zoomCombo.setMaximumSize(new Dimension(75, 100));
zoomCombo.setMaximumRowCount(9);
add(zoomCombo);
// Sets the zoom in the zoom combo the current value
mxIEventListener scaleTracker = new mxIEventListener()
{
/**
*
*/
public void invoke(Object sender, mxEventObject evt)
{
ignoreZoomChange = true;
try
{
zoomCombo.setSelectedItem((int) Math.round(100 * view
.getScale())
+ "%");
}
finally
{
ignoreZoomChange = false;
}
}
};
// Installs the scale tracker to update the value in the combo box
// if the zoom is changed from outside the combo box
view.getGraph().getView().addListener(mxEvent.SCALE, scaleTracker);
view.getGraph().getView().addListener(mxEvent.SCALE_AND_TRANSLATE,
scaleTracker);
// Invokes once to sync with the actual zoom value
scaleTracker.invoke(null, null);
zoomCombo.addActionListener(new ActionListener()
{
/**
*