ZoomMenu.java (pdfbox-2.0.23-src) | : | ZoomMenu.java (pdfbox-2.0.24-src) | ||
---|---|---|---|---|
skipping to change at line 91 | skipping to change at line 91 | |||
} | } | |||
/** | /** | |||
* Set the zoom selection. | * Set the zoom selection. | |||
* | * | |||
* @param zoomValue e.g. 1, 0.25, 4. | * @param zoomValue e.g. 1, 0.25, 4. | |||
* @throws IllegalArgumentException if the parameter doesn't belong to a zoo m menu item. | * @throws IllegalArgumentException if the parameter doesn't belong to a zoo m menu item. | |||
*/ | */ | |||
public void changeZoomSelection(float zoomValue) | public void changeZoomSelection(float zoomValue) | |||
{ | { | |||
String selection = (int)(zoomValue*100) +"%"; | int selection = (int) (zoomValue * 100); | |||
for (Component comp : menu.getMenuComponents()) | for (Component comp : menu.getMenuComponents()) | |||
{ | { | |||
JRadioButtonMenuItem menuItem = (JRadioButtonMenuItem) comp; | ZoomMenuItem menuItem = (ZoomMenuItem) comp; | |||
if (menuItem.getText().equals(selection)) | if (menuItem.zoom == selection) | |||
{ | { | |||
menuItem.setSelected(true); | menuItem.setSelected(true); | |||
return; | return; | |||
} | } | |||
} | } | |||
throw new IllegalArgumentException("no zoom menu item found for: " + sel ection); | throw new IllegalArgumentException("no zoom menu item found for: " + sel ection + "%"); | |||
} | } | |||
/** | /** | |||
* Tell whether the command belongs to the zoom menu. | * Tell whether the command belongs to the zoom menu. | |||
* | * | |||
* @param actionCommand a menu command string. | * @param actionCommand a menu command string. | |||
* @return true if the command is a zoom menu command, e.g. "100%", false if not. | * @return true if the command is a zoom menu command, e.g. "100%", false if not. | |||
*/ | */ | |||
public static boolean isZoomMenu(String actionCommand) | public static boolean isZoomMenu(String actionCommand) | |||
{ | { | |||
End of changes. 3 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added |