public DescPropPopup() { super("Descriptor Properties"); v = new JCheckBoxMenuItem("Valid"); v.addActionListener(new ValidAction()); p = new JCheckBoxMenuItem("Propagating"); p.addActionListener(new PropAction()); delete = new JMenuItem("Delete"); delete.addActionListener(new DeleteAction()); duplicate = new JMenuItem("Duplicate"); duplicate.addActionListener(new DuplicateAction()); interp = new JMenuItem("Interpolate..."); interp.addActionListener(new InterpAction()); interpToMark = new JMenu("Interpolate to Mark"); interpToMark.setEnabled(false); itmAction = new InterpToMarkAction(); shift = new JMenuItem("Shift..."); shift.addActionListener(new ShiftAction()); shiftToMark = new JMenu("Shift to Mark"); shiftToMark.setEnabled(false); stmAction = new ShiftToMarkAction(); occlusions = new JMenuItem("Occlusions..."); occAction = new OccAction(); occlusions.addActionListener(occAction); occSeparator = new JSeparator(); wrt = new JCheckBoxMenuItem("Display with Respect To", false); wrt.addActionListener(new WithRespectToAction()); add(occlusions); add(occSeparator); add(v); add(p); add(occSeparator); add(delete); add(duplicate); add(occSeparator); add(interp); add(interpToMark); add(occSeparator); add(shift); add(shiftToMark); add(occSeparator); add(wrt); }
private void buildMenu() { jMenuBar = new javax.swing.JMenuBar(); mainMenu = new javax.swing.JMenu(); mainMenu.setText("Main"); loginMenuItem = new JMenuItem("Login..."); loginMenuItem.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { headerPanel.handleLoginLogout(); } }); mainMenu.add(loginMenuItem); exitMenuItem = new JMenuItem("Exit"); exitMenuItem.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { if (qsadminMain.isConnected() == true) { headerPanel.handleLoginLogout(); } System.exit(0); } }); mainMenu.add(exitMenuItem); helpMenu = new javax.swing.JMenu(); helpMenu.setText("Help"); aboutMenuItem = new JMenuItem("About..."); aboutMenuItem.setEnabled(true); aboutMenuItem.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { about(); } }); helpMenu.add(aboutMenuItem); jMenuBar.add(mainMenu); jMenuBar.add(helpMenu); parentFrame.setJMenuBar(jMenuBar); }
private void resetMarks() { interpToMark.removeAll(); shiftToMark.removeAll(); Iterator marks = mediator.getMarkerModel().getLabels().iterator(); boolean hasMark = false; while (marks.hasNext()) { String mark = (String) marks.next(); if (!ChronicleViewer.CURR_FRAME_LABEL.equals(mark)) { JMenuItem mi = new JMenuItem(mark); mi.addActionListener(itmAction); interpToMark.add(mi); mi = new JMenuItem(mark); mi.addActionListener(stmAction); shiftToMark.add(mi); hasMark = true; } } shiftToMark.setEnabled(hasMark); interpToMark.setEnabled(hasMark); }
public ConfigEditPopup() { super("Config Properties"); newDescriptor = new JMenuItem("New Descriptor Type"); newDescriptor.addActionListener(newConfigListener); newAttribute = new JMenuItem("New Attribute Type"); newAttribute.addActionListener(new NewAttributeAction()); delete = new JMenuItem("Delete"); delete.addActionListener(new DeleteAction()); duplicate = new JMenuItem("Duplicate"); duplicate.addActionListener(new DuplicateAction()); add(newDescriptor); add(newAttribute); // add(duplicate); add(new JSeparator()); add(delete); }
/** This is the hook through which all menu items are created. */ protected JMenuItem createMenuItem(String cmd) { JMenuItem mi = new JMenuItem(getResourceString(cmd + labelSuffix)); URL url = getResource(cmd + imageSuffix); if (url != null) { mi.setHorizontalTextPosition(JButton.RIGHT); mi.setIcon(new ImageIcon(url)); } String astr = getProperty(cmd + actionSuffix); if (astr == null) { astr = cmd; } mi.setActionCommand(astr); Action a = getAction(astr); if (a != null) { mi.addActionListener(a); a.addPropertyChangeListener(createActionChangeListener(mi)); mi.setEnabled(a.isEnabled()); } else { mi.setEnabled(false); } return mi; }
/** Aware-P Epanet frontend constructor. */ public EpanetUI() { initLogger(); frame = new JFrame(); frame.setTitle(APP_TITTLE); frame.add(root); if (!Utilities.isMac()) { JMenuBar menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); menuBar.add(fileMenu); openAction = new JMenuItem("Open"); saveAction = new JMenuItem("Save"); runAction = new JMenuItem("Run"); fileMenu.add(openAction); fileMenu.add(openAction); fileMenu.add(runAction); frame.setJMenuBar(menuBar); } openAction.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { openEvent(); network.repaint(); } }); saveAction.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { saveEvent(); } }); runAction.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { runSimulation(); } }); frame.pack(); frame.setMinimumSize(new Dimension(848, 500)); frame.setLocationRelativeTo(null); clearInterface(); frame.setVisible(true); openINPButton.addActionListener(this); runSimulationButton.addActionListener(this); logoB.addActionListener(this); checkTanks.addActionListener(this); checkNodes.addActionListener(this); checkPipes.addActionListener(this); saveButton.addActionListener(this); // runMSXButton.addActionListener(this); // saveReport.addActionListener(this); frame.addWindowListener( new WindowListener() { public void windowOpened(WindowEvent e) {} public void windowClosing(WindowEvent e) { for (Handler handler : log.getHandlers()) { handler.flush(); } System.exit(0); } public void windowClosed(WindowEvent e) {} public void windowIconified(WindowEvent e) {} public void windowDeiconified(WindowEvent e) {} public void windowActivated(WindowEvent e) {} public void windowDeactivated(WindowEvent e) {} }); }