List of usage examples for javax.swing JMenuItem addMouseListener
public synchronized void addMouseListener(MouseListener l)
From source file:org.accada.hal.impl.sim.multi.GraphicSimulatorServer.java
/** * creates the help menu item/* w w w . j a v a 2 s .c o m*/ * * @return help menu */ private JMenu getHelpMenu() { JMenu helpMenu = new JMenu(guiTextConfig.getString("HelpMenuItem")); // about JMenuItem aboutMenuItem = new JMenuItem(); aboutMenuItem.setText(guiTextConfig.getString("AboutMenuItem")); aboutMenuItem.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { JDialog aboutDialog = new JDialog(GraphicSimulatorServer.this, guiTextConfig.getString("AboutDialogTitle"), true); Point pos = new Point(); pos.x = jLayeredPane.getLocationOnScreen().x + (jLayeredPane.getWidth() - getProperty("DialogWindowWidth")) / 2; pos.y = jLayeredPane.getLocationOnScreen().y + (jLayeredPane.getHeight() - getProperty("DialogWindowHeight")) / 2; aboutDialog.setLocation(pos); aboutDialog.setSize(getProperty("DialogWindowWidth"), getProperty("DialogWindowHeight")); aboutDialog.setTitle(guiTextConfig.getString("AboutDialogTitle")); JLabel text = new JLabel(guiTextConfig.getString("AboutDialogContent")); text.setHorizontalAlignment(JLabel.CENTER); aboutDialog.add(text); aboutDialog.setVisible(true); } }); helpMenu.add(aboutMenuItem); return helpMenu; }
From source file:org.accada.hal.impl.sim.multi.GraphicSimulatorServer.java
/** * creates the context menu if it does not already exists * //from ww w . j a v a 2 s. c om * @return context menu */ private JPopupMenu getContextMenu() { if (contextMenu == null) { contextMenu = new JPopupMenu(); // add new tag item JMenuItem newTagContextMenuItem = new JMenuItem(guiTextConfig.getString("AddNewTagMenuItem")); newTagContextMenuItem.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { showAddTagDialog(); contextMenu.setVisible(false); } }); contextMenu.add(newTagContextMenuItem); } return contextMenu; }
From source file:org.accada.reader.hal.impl.sim.GraphicSimulator.java
/** * creates the file menu item if it does not already exists * /* ww w. j ava 2 s . c o m*/ * @return file menu */ private JMenu getFileMenu() { JMenu fileMenu = new JMenu(guiText.getString("FileMenuItem")); // exit JMenuItem exitMenuItem = new JMenuItem(); exitMenuItem.setText(guiText.getString("QuitMenuItem")); exitMenuItem.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { System.exit(0); } }); fileMenu.add(exitMenuItem); return fileMenu; }
From source file:org.accada.reader.hal.impl.sim.GraphicSimulator.java
/** * creates the antenna menu item if it does not already exists * /*from w w w .j a va 2 s . c o m*/ * @return antenna menu */ private JMenu getAntennaMenu() { JMenu antennaMenu = new JMenu(guiText.getString("AntennaMenuItem")); // new antenna JMenuItem newAntennaMenuItem = new JMenuItem(); newAntennaMenuItem.setText(guiText.getString("AddNewAntennaMenuItem")); newAntennaMenuItem.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { showAddAntennaDialog(); } }); antennaMenu.add(newAntennaMenuItem); return antennaMenu; }
From source file:org.accada.reader.hal.impl.sim.GraphicSimulator.java
/** * creates the tag menu item if it does not already exists * //from w ww. j av a2 s.c o m * @return tag menu */ private JMenu getTagMenu() { JMenu tagMenu = new JMenu(guiText.getString("TagMenuItem")); // new tag JMenuItem newTagMenuItem = new JMenuItem(); newTagMenuItem.setText(guiText.getString("AddNewTagMenuItem")); newTagMenuItem.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { showAddTagDialog(); } }); tagMenu.add(newTagMenuItem); return tagMenu; }
From source file:org.accada.reader.hal.impl.sim.GraphicSimulator.java
/** * creates the help menu item if it does not already exists * /*w w w . jav a 2s .c o m*/ * @return help menu */ private JMenu getHelpMenu() { JMenu helpMenu = new JMenu(guiText.getString("HelpMenuItem")); // about JMenuItem aboutMenuItem = new JMenuItem(); aboutMenuItem.setText(guiText.getString("AboutMenuItem")); aboutMenuItem.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { JDialog aboutDialog = new JDialog(GraphicSimulator.this, guiText.getString("AboutDialogTitle"), true); Point pos = new Point(); pos.x = jLayeredPane.getLocationOnScreen().x + (jLayeredPane.getWidth() - getProperty("DialogWindowWidth")) / 2; pos.y = jLayeredPane.getLocationOnScreen().y + (jLayeredPane.getHeight() - getProperty("DialogWindowHeight")) / 2; aboutDialog.setLocation(pos); aboutDialog.setSize(getProperty("DialogWindowWidth"), getProperty("DialogWindowHeight")); aboutDialog.setTitle(guiText.getString("AboutDialogTitle")); JLabel text = new JLabel(guiText.getString("AboutDialogContent")); text.setHorizontalAlignment(JLabel.CENTER); aboutDialog.add(text); aboutDialog.setVisible(true); } }); helpMenu.add(aboutMenuItem); return helpMenu; }
From source file:org.accada.reader.hal.impl.sim.GraphicSimulator.java
/** * creates the context menu if it does not already exists * /*from www. j av a2 s .co m*/ * @return context menu */ private JPopupMenu getContextMenu() { if (contextMenu == null) { contextMenu = new JPopupMenu(); // add new antenna item JMenuItem newAntennaContextMenuItem = new JMenuItem(guiText.getString("AddNewAntennaMenuItem")); newAntennaContextMenuItem.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { showAddAntennaDialog(); contextMenu.setVisible(false); } }); //contextMenu.add(newAntennaContextMenuItem); // add new tag item JMenuItem newTagContextMenuItem = new JMenuItem(guiText.getString("AddNewTagMenuItem")); newTagContextMenuItem.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { showAddTagDialog(); contextMenu.setVisible(false); } }); contextMenu.add(newTagContextMenuItem); } return contextMenu; }
From source file:org.accada.reader.hal.impl.sim.GraphicSimulator.java
/** * Returns the management simulator menu. * /*from www . jav a2s.c o m*/ * @return The management simulator menu */ private JPopupMenu getMgmtSimMenu() { if (mgmtSimMenu == null) { mgmtSimMenu = new JPopupMenu(); JMenuItem newMgmtContextMenuItem = new JMenuItem("Simulate an error"); newMgmtContextMenuItem.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { mgmtSimMenu.setVisible(false); showMgmtSimDialog(); } }); mgmtSimMenu.add(newMgmtContextMenuItem); // add new tag item JMenuItem newTagContextMenuItem = new JMenuItem(guiText.getString("AddNewTagMenuItem")); newTagContextMenuItem.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { showAddTagDialog(); mgmtSimMenu.setVisible(false); } }); mgmtSimMenu.add(newTagContextMenuItem); // MenuElement[] elements = contextMenu.getSubElements(); // for (int i = 0; i < elements.length; i++) { // mgmtSimMenu.add((JMenuItem) elements[i]); // } } return mgmtSimMenu; }
From source file:org.accada.reader.hal.impl.sim.multi.GraphicSimulatorServer.java
/** * creates the view menu item// w w w. j a v a2 s. c om * * @return view menu */ private JMenu getViewMenu() { JMenu viewMenu = new JMenu(guiText.getString("ViewMenuItem")); // exit JMenuItem refreshMenuItem = new JMenuItem(); refreshMenuItem.setText(guiText.getString("RefreshMenuItem")); refreshMenuItem.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { updateGUI(); } }); viewMenu.add(refreshMenuItem); return viewMenu; }
From source file:org.accada.reader.hal.impl.sim.multi.GraphicSimulatorServer.java
/** * creates the help menu item/*from w w w . java 2s . c o m*/ * * @return help menu */ private JMenu getHelpMenu() { JMenu helpMenu = new JMenu(guiText.getString("HelpMenuItem")); // about JMenuItem aboutMenuItem = new JMenuItem(); aboutMenuItem.setText(guiText.getString("AboutMenuItem")); aboutMenuItem.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { JDialog aboutDialog = new JDialog(GraphicSimulatorServer.this, guiText.getString("AboutDialogTitle"), true); Point pos = new Point(); pos.x = jLayeredPane.getLocationOnScreen().x + (jLayeredPane.getWidth() - getProperty("DialogWindowWidth")) / 2; pos.y = jLayeredPane.getLocationOnScreen().y + (jLayeredPane.getHeight() - getProperty("DialogWindowHeight")) / 2; aboutDialog.setLocation(pos); aboutDialog.setSize(getProperty("DialogWindowWidth"), getProperty("DialogWindowHeight")); aboutDialog.setTitle(guiText.getString("AboutDialogTitle")); JLabel text = new JLabel(guiText.getString("AboutDialogContent")); text.setHorizontalAlignment(JLabel.CENTER); aboutDialog.add(text); aboutDialog.setVisible(true); } }); helpMenu.add(aboutMenuItem); return helpMenu; }