MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / itemStateChanged

Method itemStateChanged

ij/src/main/java/ij/gui/Toolbar.java:1479–1601  ·  view source on GitHub ↗
(ItemEvent e)

Source from the content-addressed store, hash-verified

1477 public void mouseDragged(MouseEvent e) {}
1478
1479 public void itemStateChanged(ItemEvent e) {
1480 CheckboxMenuItem item = (CheckboxMenuItem)e.getSource();
1481 String previousName = getToolName();
1482 if (item==rectItem || item==roundRectItem || item==rotatedRectItem) {
1483 if (item==roundRectItem)
1484 rectType = ROUNDED_RECT_ROI;
1485 else if (item==rotatedRectItem)
1486 rectType = ROTATED_RECT_ROI;
1487 else
1488 rectType = RECT_ROI;
1489 repaintTool(RECTANGLE);
1490 showMessage(RECTANGLE);
1491 ImagePlus imp = WindowManager.getCurrentImage();
1492 Roi roi = imp!=null?imp.getRoi():null;
1493 if (roi!=null && roi.getType()==Roi.RECTANGLE)
1494 roi.setCornerDiameter(rectType==ROUNDED_RECT_ROI?arcSize:0);
1495 if (!previousName.equals(getToolName()))
1496 IJ.notifyEventListeners(IJEventListener.TOOL_CHANGED);
1497 } else if (item==ovalItem || item==ellipseItem || item==brushItem) {
1498 if (item==brushItem)
1499 ovalType = BRUSH_ROI;
1500 else if (item==ellipseItem)
1501 ovalType = ELLIPSE_ROI;
1502 else
1503 ovalType = OVAL_ROI;
1504 repaintTool(OVAL);
1505 showMessage(OVAL);
1506 if (!previousName.equals(getToolName()))
1507 IJ.notifyEventListeners(IJEventListener.TOOL_CHANGED);
1508 } else if (item==pointItem || item==multiPointItem) {
1509 multiPointMode = item==multiPointItem;
1510 Prefs.multiPointMode = multiPointMode;
1511 repaintTool(POINT);
1512 showMessage(POINT);
1513 if (!previousName.equals(getToolName()))
1514 IJ.notifyEventListeners(IJEventListener.TOOL_CHANGED);
1515 } else if (item==straightLineItem) {
1516 lineType = LINE;
1517 arrowMode = false;
1518 setTool2(LINE);
1519 showMessage(LINE);
1520 } else if (item==polyLineItem) {
1521 lineType = POLYLINE;
1522 setTool2(POLYLINE);
1523 showMessage(POLYLINE);
1524 } else if (item==freeLineItem) {
1525 lineType = FREELINE;
1526 setTool2(FREELINE);
1527 showMessage(FREELINE);
1528 } else if (item==arrowItem) {
1529 lineType = LINE;
1530 arrowMode = true;
1531 setTool2(LINE);
1532 showMessage(LINE);
1533 } else {
1534 String label = item.getLabel();
1535 String cmd = item.getActionCommand();
1536 boolean isTool = cmd.equals("Tool") || cmd.equals("Plugin Tool");

Callers

nothing calls this directly

Calls 15

getToolNameMethod · 0.95
repaintToolMethod · 0.95
showMessageMethod · 0.95
getCurrentImageMethod · 0.95
getRoiMethod · 0.95
getTypeMethod · 0.95
setCornerDiameterMethod · 0.95
notifyEventListenersMethod · 0.95
setTool2Method · 0.95
installBuiltinToolMethod · 0.95
runMethod · 0.95
removeToolsMethod · 0.95

Tested by

no test coverage detected