/** Create buttons enumerated in <code>ZoomType</code> * @param flags Bitwise 'or' of flags * @see XYGraphFlags#COMBINED_ZOOM * @see XYGraphFlags#SEPARATE_ZOOM */ private void createZoomButtons(final int flags) { for(final ZoomType zoomType : ZoomType.values()){ if (! zoomType.useWithFlags(flags)) continue; final ImageFigure imageFigure = new ImageFigure(zoomType.getIconImage()); final Label tip = new Label(zoomType.getDescription()); final ToggleButton button = new ToggleButton(imageFigure); button.setBackgroundColor(ColorConstants.button); button.setOpaque(true); final ToggleModel model = new ToggleModel(); model.addChangeListener(new ChangeListener(){ public void handleStateChanged(ChangeEvent event) { if(event.getPropertyName().equals("selected") && button.isSelected()){ xyGraph.setZoomType(zoomType); } } }); button.setModel(model); button.setToolTip(tip); addButton(button); zoomGroup.add(model); if(zoomType == ZoomType.NONE) zoomGroup.setDefault(model); } }