protected final MenuItem createMenuItem(String _key, String _header, ActionListener _al) { MenuItem mi = new MenuItem(res.getString("TabbedEditor." + _key)); mi.setActionCommand(_key); mi.addActionListener(_al); popupMenu.add(mi); return mi; }
public TabbedEditor(org.colos.ejs.osejs.Osejs _ejs, String _type, String _header) { ejs = _ejs; defaultType = _type; defaultHeader = _header; defaultString = new String(res.getString(defaultHeader + ".Page")); MyActionListener al = new MyActionListener(); popupMenu = new PopupMenu(); customMenuItems(al); // Creates the top menu items // common menu items copyPage = createMenuItem("copyPage", defaultHeader, al); upPage = createMenuItem("upPage", defaultHeader, al); dnPage = createMenuItem("dnPage", defaultHeader, al); renamePage = createMenuItem("renamePage", defaultHeader, al); popupMenu.addSeparator(); togglePage = createMenuItem("togglePage", defaultHeader, al); removePage = createMenuItem("removePage", defaultHeader, al); JPanel firstPanel = createFirstPanel(); tabbedPanel = new JTabbedPane(); tabbedPanel.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); tabbedPanel.add(popupMenu); // tabbedPanel.setPreferredSize (res.getDimension("TabbedEditor.PreferredSize")); tabbedPanel.addMouseListener( new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { if (OSPRuntime.isPopupTrigger(evt)) // SwingUtilities.isRightMouseButton(evt)) showMenu(evt.getComponent(), evt.getX(), evt.getY()); } }); cardLayout = new CardLayout(); finalPanel = new JPanel(cardLayout); finalPanel.add(tabbedPanel, "TabbedPanel"); finalPanel.add(firstPanel, "FirstPanel"); setFont(finalPanel.getFont()); Font font = InterfaceUtils.font(null, res.getString("Editor.TitleFont")); addPageMI.setFont(font); copyPage.setFont(font); upPage.setFont(font); dnPage.setFont(font); togglePage.setFont(font); removePage.setFont(font); renamePage.setFont(font); myFont = font.deriveFont(Font.PLAIN); showFirstPage(); }