JGrid Tutorial #4
#Swing
In this tutorial we want to add zoom functionality to the JGrid. You can set the dimension of the grid cells be the property fixedCellDimension. Here is a example for two different dimensions:


To add a zoom functionality to the grid you can set the dimension by using a JSlider. Here is the code:
slider.setValue(grid.getFixedCellDimension());
slider.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent arg0) {
grid.setFixedCellDimension(slider.getValue());
}
});
Now you can edit the dimension dynamically. Here is the result:
You can download the source file here.