JGrid Tutorial #4


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:

final JSlider slider = new JSlider(32, 256);

slider.addChangeListener(new ChangeListener() {
  public void stateChanged(ChangeEvent arg0) {

Now you can edit the dimension dynamically. Here is the result:

You can download the source file here.

Hendrik Ebbers

Hendrik Ebbers is the founder of Open Elements. He is a Java champion, a member of JSR expert groups and a JavaOne rockstar. Hendrik is a member of the Eclipse JakartaEE working group (WG) and the Eclipse Adoptium WG. In addition, Hendrik Ebbers is a member of the Board of Directors of the Eclipse Foundation.

Circle Circle

Open Source made right


Privacy Policy Cookie Policy Privacy Config Impressum