public void actionPerformed(java.awt.event.ActionEvent e) { if ((dlg.panelMain.mark.getObject() != Obj.MORFAC) || (dlg.panelMain.mark.getCategory() == Cat.MOR_BUOY)) { for (Shp shp : shapes.keySet()) { JRadioButton button = shapes.get(shp); if (button.isSelected()) { dlg.panelMain.mark.setShape(shp); if (SeaMark.EntMAP.get(dlg.panelMain.mark.getObject()) != Ent.MOORING) { dlg.panelMain.mark.setObject(objects.get(shp)); if (dlg.panelMain.mark.getObjColour(0) == Col.UNKCOL) { dlg.panelMain.mark.setObjPattern(Pat.NOPAT); dlg.panelMain.mark.setObjColour(Col.YELLOW); } if (button == cairnButton) { dlg.panelMain.mark.setObjPattern(Pat.NOPAT); dlg.panelMain.mark.setObjColour(Col.UNKCOL); } topmarkButton.setVisible(dlg.panelMain.mark.testValid()); } button.setBorderPainted(true); } else button.setBorderPainted(false); } dlg.panelMain.panelMore.syncPanel(); } }
public void syncPanel() { if (SeaMark.EntMAP.get(dlg.panelMain.mark.getObject()) == Ent.MOORING) { mooringButton.setBorderPainted(true); categoryBox.setVisible(false); mooringBox.setVisible(true); pillarButton.setEnabled(false); sparButton.setEnabled(false); beaconButton.setEnabled(false); towerButton.setEnabled(false); stakeButton.setEnabled(false); cairnButton.setEnabled(false); noticeButton.setEnabled(false); topmarkButton.setVisible(false); for (Cat cat : moorings.keySet()) { int item = moorings.get(cat); if (dlg.panelMain.mark.getCategory() == cat) mooringBox.setSelectedIndex(item); } } else { mooringButton.setBorderPainted(false); mooringBox.setVisible(false); categoryBox.setVisible(true); pillarButton.setEnabled(true); sparButton.setEnabled(true); beaconButton.setEnabled(true); towerButton.setEnabled(true); stakeButton.setEnabled(true); cairnButton.setEnabled(true); noticeButton.setEnabled(true); topmarkButton.setBorderPainted(dlg.panelMain.mark.getTopmark() != Top.NOTOP); topmarkButton.setSelected(dlg.panelMain.mark.getTopmark() != Top.NOTOP); topmarkButton.setVisible(dlg.panelMain.mark.testValid()); for (Cat cat : categories.keySet()) { int item = categories.get(cat); if (dlg.panelMain.mark.getCategory() == cat) categoryBox.setSelectedIndex(item); } } for (Shp shp : shapes.keySet()) { JRadioButton button = shapes.get(shp); if (dlg.panelMain.mark.getShape() == shp) { button.setBorderPainted(true); } else button.setBorderPainted(false); } noticeButton.setBorderPainted(false); dlg.panelMain.mark.testValid(); }