List of usage examples for java.awt.event KeyEvent VK_T
int VK_T
To view the source code for java.awt.event KeyEvent VK_T.
Click Source Link
From source file:org.sikuli.ide.SikuliIDE.java
private void initToolMenu() throws NoSuchMethodException { int scMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); _toolMenu.setMnemonic(java.awt.event.KeyEvent.VK_T); _toolMenu.add(createMenuItem(_I("menuToolExtensions"), null, new ToolAction(ToolAction.EXTENSIONS))); }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.label.PainelLabel.java
/** * Cria o menu editar do Frame Principal * /* ww w . ja v a 2 s . c o m*/ * @param menu */ private JMenu criaMenuEditar() { JMenu menu = new JMenu(GERAL.EDITAR); menu.setBackground(parentFrame.corDefault); menu.setMnemonic('E'); menu.setMnemonic(KeyEvent.VK_E); JMenuItem btnContraste = new JMenuItem(GERAL.ALTERAR_CONTRASTE); btnContraste.addActionListener(this); btnContraste.setActionCommand("Contraste"); // btnAumenta.setMnemonic('F'); // btnAumenta.setMnemonic(KeyEvent.VK_F); // btnAumenta.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ADD, // ActionEvent.CTRL_MASK)); btnContraste.setToolTipText(GERAL.DICA_CONTRASTE); btnContraste.getAccessibleContext().setAccessibleDescription(GERAL.DICA_CONTRASTE); menu.add(btnContraste); JMenuItem btnAumenta = new JMenuItem(GERAL.AUMENTA_FONTE); btnAumenta.addActionListener(this); btnAumenta.setActionCommand("AumentaFonte"); // btnAumenta.setMnemonic('F'); // btnAumenta.setMnemonic(KeyEvent.VK_F); btnAumenta.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ADD, ActionEvent.CTRL_MASK)); btnAumenta.setToolTipText(GERAL.DICA_AUMENTA_FONTE); btnAumenta.getAccessibleContext().setAccessibleDescription(GERAL.DICA_AUMENTA_FONTE); menu.add(btnAumenta); JMenuItem btnDiminui = new JMenuItem(GERAL.DIMINUI_FONTE); btnDiminui.addActionListener(this); btnDiminui.setActionCommand("DiminuiFonte"); // btnDiminui.setMnemonic('F'); // btnDiminui.setMnemonic(KeyEvent.VK_F); btnDiminui.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_SUBTRACT, ActionEvent.CTRL_MASK)); btnDiminui.setToolTipText(GERAL.DICA_DIMINUI_FONTE); btnDiminui.getAccessibleContext().setAccessibleDescription(GERAL.DICA_DIMINUI_FONTE); menu.add(btnDiminui); menu.add(new JSeparator()); JMenuItem btnProcurar = new JMenuItem(GERAL.PROCURAR); btnProcurar.addActionListener(this); btnProcurar.setActionCommand("Procurar"); btnProcurar.setMnemonic('P'); btnProcurar.setMnemonic(KeyEvent.VK_P); btnProcurar.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, ActionEvent.CTRL_MASK)); btnProcurar.setToolTipText(GERAL.DICA_PROCURAR); btnProcurar.getAccessibleContext().setAccessibleDescription(GERAL.DICA_PROCURAR); menu.add(btnProcurar); JMenuItem btnSelecionarTudo = new JMenuItem(GERAL.SELECIONAR_TUDO); btnSelecionarTudo.addActionListener(this); btnSelecionarTudo.setActionCommand("SelecionarTudo"); btnSelecionarTudo.setMnemonic('T'); btnSelecionarTudo.setMnemonic(KeyEvent.VK_T); btnSelecionarTudo.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, ActionEvent.CTRL_MASK)); btnSelecionarTudo.setToolTipText(GERAL.DICA_SELECIONAR_TODO_CSS); btnSelecionarTudo.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SELECIONAR_TODO_CSS); menu.add(btnSelecionarTudo); JMenuItem btnDesfazer = new JMenuItem(GERAL.DESFAZER); btnDesfazer.addActionListener(this); btnDesfazer.setActionCommand("Desfazer"); btnDesfazer.setMnemonic('z'); btnDesfazer.setMnemonic(KeyEvent.VK_Z); btnDesfazer.getAccessibleContext().setAccessibleDescription(GERAL.DICA_DESFAZER); btnDesfazer.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, ActionEvent.CTRL_MASK)); menu.add(btnDesfazer); menu.setEnabled(true); return menu; }
From source file:savant.view.swing.Savant.java
private void initMenu() { loadGenomeItem.setAccelerator(//w w w . j a v a2 s . c om javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, MiscUtils.MENU_MASK)); loadFromFileItem.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, MiscUtils.MENU_MASK)); loadFromURLItem.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, MiscUtils.MENU_MASK)); loadFromDataSourcePluginItem.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, MiscUtils.MENU_MASK)); openProjectItem.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, MiscUtils.MENU_MASK)); saveProjectItem.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, MiscUtils.MENU_MASK)); saveProjectAsItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, MiscUtils.MENU_MASK | java.awt.event.InputEvent.SHIFT_MASK)); formatItem.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, MiscUtils.MENU_MASK)); exitItem.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, MiscUtils.MENU_MASK)); undoItem.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, MiscUtils.MENU_MASK)); redoItem.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Y, MiscUtils.MENU_MASK)); bookmarkItem.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, MiscUtils.MENU_MASK)); navigationItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.SHIFT_MASK | MiscUtils.MENU_MASK)); panLeftItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_LEFT, java.awt.event.InputEvent.SHIFT_MASK)); panRightItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_RIGHT, java.awt.event.InputEvent.SHIFT_MASK)); zoomInItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_UP, java.awt.event.InputEvent.SHIFT_MASK)); zoomOutItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_DOWN, java.awt.event.InputEvent.SHIFT_MASK)); toStartItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_HOME, java.awt.event.InputEvent.SHIFT_MASK)); toEndItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_END, java.awt.event.InputEvent.SHIFT_MASK)); preferencesItem.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, MiscUtils.MENU_MASK)); crosshairItem.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_J, MiscUtils.MENU_MASK)); plumblineItem.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_K, MiscUtils.MENU_MASK)); spotlightItem.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, MiscUtils.MENU_MASK)); bookmarksItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, MiscUtils.MENU_MASK | java.awt.event.InputEvent.SHIFT_MASK)); genomeItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, MiscUtils.MENU_MASK | java.awt.event.InputEvent.SHIFT_MASK)); rulerItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, MiscUtils.MENU_MASK | java.awt.event.InputEvent.SHIFT_MASK)); statusBarItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, MiscUtils.MENU_MASK | java.awt.event.InputEvent.SHIFT_MASK)); pluginToolbarItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, MiscUtils.MENU_MASK | java.awt.event.InputEvent.SHIFT_MASK)); exportItem.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, MiscUtils.MENU_MASK)); if (!Desktop.isDesktopSupported() || !Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { tutorialsItem.setEnabled(false); userManualItem.setEnabled(false); websiteItem.setEnabled(false); } initBrowseMenu(); try { RecentTracksController.getInstance().populateMenu(recentTrackMenu); RecentProjectsController.getInstance().populateMenu(recentProjectMenu); } catch (IOException ex) { LOG.error("Unable to populate Recent Items menu.", ex); } }
From source file:org.domainmath.gui.MainFrame.java
/** This method is called from within the constructor to * initialize the form./*from w w w. j a v a 2 s . c om*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { buttonGroup1 = new javax.swing.ButtonGroup(); jToolBar1 = new javax.swing.JToolBar(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jSeparator4 = new javax.swing.JToolBar.Separator(); connectButton = new javax.swing.JButton(); disconnectButton = new javax.swing.JButton(); jSeparator9 = new javax.swing.JToolBar.Separator(); jButton4 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jSeparator15 = new javax.swing.JToolBar.Separator(); jButton6 = new javax.swing.JButton(); jButton7 = new javax.swing.JButton(); jButton8 = new javax.swing.JButton(); jSeparator13 = new javax.swing.JToolBar.Separator(); jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); dirComboBox = new javax.swing.JComboBox(); folderUpButton = new javax.swing.JButton(); browseButton = new javax.swing.JButton(); addButton = new javax.swing.JButton(); jMenuBar1 = new javax.swing.JMenuBar(); fileMenu = new javax.swing.JMenu(); newFileItem = new javax.swing.JMenuItem(); openItem = new javax.swing.JMenuItem(); jSeparator17 = new javax.swing.JPopupMenu.Separator(); saveFileItem = new javax.swing.JMenuItem(); saveAsItem = new javax.swing.JMenuItem(); savePlotItem = new javax.swing.JMenuItem(); saveAllItem = new javax.swing.JMenuItem(); jSeparator1 = new javax.swing.JPopupMenu.Separator(); printFileItem = new javax.swing.JMenuItem(); printItem = new javax.swing.JMenuItem(); jSeparator19 = new javax.swing.JPopupMenu.Separator(); preferencesItem = new javax.swing.JMenuItem(); jSeparator2 = new javax.swing.JPopupMenu.Separator(); connectItem = new javax.swing.JMenuItem(); disconnectItem = new javax.swing.JMenuItem(); jSeparator3 = new javax.swing.JPopupMenu.Separator(); exitItem = new javax.swing.JMenuItem(); editMenu = new javax.swing.JMenu(); undoItem = new javax.swing.JMenuItem(); redoItem = new javax.swing.JMenuItem(); jSeparator20 = new javax.swing.JPopupMenu.Separator(); cutItem = new javax.swing.JMenuItem(); copyItem = new javax.swing.JMenuItem(); pasteItem = new javax.swing.JMenuItem(); jSeparator21 = new javax.swing.JPopupMenu.Separator(); deleteItem = new javax.swing.JMenuItem(); selectAllItem = new javax.swing.JMenuItem(); jSeparator22 = new javax.swing.JPopupMenu.Separator(); jMenuItem2 = new javax.swing.JMenuItem(); jMenuItem3 = new javax.swing.JMenuItem(); jSeparator23 = new javax.swing.JPopupMenu.Separator(); jMenuItem4 = new javax.swing.JMenuItem(); jMenuItem5 = new javax.swing.JMenuItem(); jSeparator24 = new javax.swing.JPopupMenu.Separator(); jMenuItem6 = new javax.swing.JMenuItem(); jMenuItem1 = new javax.swing.JMenuItem(); jSeparator11 = new javax.swing.JPopupMenu.Separator(); clearOutWindowItem = new javax.swing.JMenuItem(); jMenu3 = new javax.swing.JMenu(); consoleItem = new javax.swing.JMenuItem(); historyItem = new javax.swing.JMenuItem(); filesItem = new javax.swing.JMenuItem(); workspaceItem = new javax.swing.JMenuItem(); codeEditorItem = new javax.swing.JMenuItem(); pathsItem = new javax.swing.JMenuItem(); pkgsItem = new javax.swing.JMenuItem(); arrayEditItem = new javax.swing.JMenuItem(); jMenuItem7 = new javax.swing.JMenuItem(); jMenu1 = new javax.swing.JMenu(); findItem = new javax.swing.JMenuItem(); replaceItem = new javax.swing.JMenuItem(); gotoItem = new javax.swing.JMenuItem(); jSeparator25 = new javax.swing.JPopupMenu.Separator(); googleItem = new javax.swing.JMenuItem(); wikiItem = new javax.swing.JMenuItem(); pkgMenu = new javax.swing.JMenu(); debugMenu = new javax.swing.JMenu(); runScriptItem = new javax.swing.JMenuItem(); runScriptCItem = new javax.swing.JMenuItem(); jMenuItem8 = new javax.swing.JMenuItem(); jSeparator8 = new javax.swing.JPopupMenu.Separator(); debugScriptMenuItem = new javax.swing.JMenuItem(); testScriptMenuItem = new javax.swing.JMenuItem(); toggleBreakpointItem = new javax.swing.JMenuItem(); removeToggleBreakpointItem = new javax.swing.JMenuItem(); clearAllBreakpointsItem = new javax.swing.JMenuItem(); jSeparator10 = new javax.swing.JPopupMenu.Separator(); stepItem = new javax.swing.JMenuItem(); stepInItem = new javax.swing.JMenuItem(); stepOutItem = new javax.swing.JMenuItem(); continueItem = new javax.swing.JMenuItem(); jSeparator5 = new javax.swing.JPopupMenu.Separator(); finishDebugItem = new javax.swing.JMenuItem(); toolsMenu = new javax.swing.JMenu(); fltkplotItem = new javax.swing.JMenuItem(); octaveCmdItem = new javax.swing.JMenuItem(); jMenu2 = new javax.swing.JMenu(); previousWindowItem = new javax.swing.JMenuItem(); nextWindowItem = new javax.swing.JMenuItem(); jSeparator29 = new javax.swing.JPopupMenu.Separator(); closeItem = new javax.swing.JMenuItem(); closeAllItem = new javax.swing.JMenuItem(); jSeparator18 = new javax.swing.JPopupMenu.Separator(); windowsItem = new javax.swing.JMenuItem(); helpMenu = new javax.swing.JMenu(); forumItem = new javax.swing.JMenuItem(); octaveInfoItem = new javax.swing.JMenuItem(); jSeparator12 = new javax.swing.JPopupMenu.Separator(); quickHelpItem = new javax.swing.JMenuItem(); jMenuItem9 = new javax.swing.JMenuItem(); docPkgItem = new javax.swing.JMenuItem(); referenceMenu = new javax.swing.JMenu(); referenceItem = new javax.swing.JMenuItem(); jSeparator6 = new javax.swing.JPopupMenu.Separator(); checkForUpdatesMenuItem = new javax.swing.JMenuItem(); onlineHelpItem = new javax.swing.JMenuItem(); faqItem = new javax.swing.JMenuItem(); jSeparator14 = new javax.swing.JPopupMenu.Separator(); reportBugItem = new javax.swing.JMenuItem(); feedBackItem = new javax.swing.JMenuItem(); jSeparator7 = new javax.swing.JPopupMenu.Separator(); AboutItem = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); java.util.ResourceBundle bundle = java.util.ResourceBundle .getBundle("org/domainmath/gui/resources/DomainMath_en"); // NOI18N setTitle(bundle.getString("DomainMath.title")); // NOI18N addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { formWindowClosing(evt); } public void windowOpened(java.awt.event.WindowEvent evt) { formWindowOpened(evt); } }); jToolBar1.setRollover(true); jToolBar1.setName("Standard"); // NOI18N jButton1.setIcon(new javax.swing.ImageIcon( getClass().getResource("/org/domainmath/gui/icons/size22x22/document-new.png"))); // NOI18N jButton1.setFocusable(false); jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jToolBar1.add(jButton1); jButton2.setIcon(new javax.swing.ImageIcon( getClass().getResource("/org/domainmath/gui/icons/size22x22/document-open.png"))); // NOI18N jButton2.setFocusable(false); jButton2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jButton2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jToolBar1.add(jButton2); jButton3.setIcon(new javax.swing.ImageIcon( getClass().getResource("/org/domainmath/gui/icons/size22x22/document-save-all.png"))); // NOI18N jButton3.setFocusable(false); jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jToolBar1.add(jButton3); jToolBar1.add(jSeparator4); connectButton.setIcon(new javax.swing.ImageIcon( getClass().getResource("/org/domainmath/gui/icons/size22x22/connect.png"))); // NOI18N connectButton.setMnemonic(java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en") .getString("connectItem.mnemonic").charAt(0)); connectButton.setToolTipText(bundle.getString("connectItem.tooltip")); // NOI18N connectButton.setFocusable(false); connectButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); connectButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); connectButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { connectButtonActionPerformed(evt); } }); jToolBar1.add(connectButton); disconnectButton.setIcon(new javax.swing.ImageIcon( getClass().getResource("/org/domainmath/gui/icons/size22x22/disconnect.png"))); // NOI18N disconnectButton .setMnemonic(java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en") .getString("disconnectItem.mnemonic").charAt(0)); disconnectButton.setToolTipText(bundle.getString("disconnectItem.tooltip")); // NOI18N disconnectButton.setFocusable(false); disconnectButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); disconnectButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); disconnectButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { disconnectButtonActionPerformed(evt); } }); jToolBar1.add(disconnectButton); jToolBar1.add(jSeparator9); jButton4.setIcon(new javax.swing.ImageIcon( getClass().getResource("/org/domainmath/gui/icons/size22x22/edit-undo.png"))); // NOI18N jButton4.setFocusable(false); jButton4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jButton4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); jToolBar1.add(jButton4); jButton5.setIcon(new javax.swing.ImageIcon( getClass().getResource("/org/domainmath/gui/icons/size22x22/edit-redo.png"))); // NOI18N jButton5.setFocusable(false); jButton5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jButton5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); jToolBar1.add(jButton5); jToolBar1.add(jSeparator15); jButton6.setIcon(new javax.swing.ImageIcon( getClass().getResource("/org/domainmath/gui/icons/size22x22/edit-cut.png"))); // NOI18N jButton6.setFocusable(false); jButton6.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jButton6.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton6ActionPerformed(evt); } }); jToolBar1.add(jButton6); jButton7.setIcon(new javax.swing.ImageIcon( getClass().getResource("/org/domainmath/gui/icons/size22x22/edit-copy.png"))); // NOI18N jButton7.setFocusable(false); jButton7.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jButton7.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jButton7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton7ActionPerformed(evt); } }); jToolBar1.add(jButton7); jButton8.setIcon(new javax.swing.ImageIcon( getClass().getResource("/org/domainmath/gui/icons/size22x22/edit-paste.png"))); // NOI18N jButton8.setFocusable(false); jButton8.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jButton8.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jButton8.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton8ActionPerformed(evt); } }); jToolBar1.add(jButton8); jToolBar1.add(jSeparator13); jLabel1.setText("Current Directory:"); dirComboBox.setEditable(true); dirComboBox.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { dirComboBoxItemStateChanged(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout .setHorizontalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGap(1, 1, 1).addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(dirComboBox, 0, 112, Short.MAX_VALUE).addGap(1, 1, 1))); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGap(5, 5, 5).addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel1) .addComponent(dirComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(3, 3, 3))); jToolBar1.add(jPanel1); folderUpButton.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/size22x22/go-up.png"))); // NOI18N folderUpButton.setToolTipText("Up"); folderUpButton.setFocusable(false); folderUpButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); folderUpButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); folderUpButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { folderUpButtonActionPerformed(evt); } }); jToolBar1.add(folderUpButton); browseButton.setIcon(new javax.swing.ImageIcon( getClass().getResource("/org/domainmath/gui/icons/size22x22/document-open.png"))); // NOI18N browseButton.setToolTipText(bundle.getString("browseButton.title")); // NOI18N browseButton.setFocusable(false); browseButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); browseButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); browseButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { browseButtonActionPerformed(evt); } }); jToolBar1.add(browseButton); addButton.setIcon(new javax.swing.ImageIcon( getClass().getResource("/org/domainmath/gui/icons/size22x22/edit-add.png"))); // NOI18N addButton.setToolTipText(bundle.getString("addButton.title")); // NOI18N addButton.setFocusable(false); addButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); addButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); addButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { addButtonActionPerformed(evt); } }); jToolBar1.add(addButton); getContentPane().add(jToolBar1, java.awt.BorderLayout.PAGE_START); fileMenu.setMnemonic(java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en") .getString("fileMenu.mnemonic").charAt(0)); fileMenu.setText(bundle.getString("fileMenu.name")); // NOI18N newFileItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK)); newFileItem.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/document-new.png"))); // NOI18N newFileItem.setText("New"); newFileItem.setToolTipText(bundle.getString("newMenuItem.tooltip")); // NOI18N newFileItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newFileItemActionPerformed(evt); } }); fileMenu.add(newFileItem); openItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK)); openItem.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/document-open.png"))); // NOI18N openItem.setText("Open..."); openItem.setToolTipText("Open File"); openItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { openItemActionPerformed(evt); } }); fileMenu.add(openItem); fileMenu.add(jSeparator17); saveFileItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK)); saveFileItem.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/document-save.png"))); // NOI18N saveFileItem.setText("Save "); saveFileItem.setToolTipText(bundle.getString("saveMenuItem.tooltp")); // NOI18N saveFileItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveFileItemActionPerformed(evt); } }); fileMenu.add(saveFileItem); saveAsItem.setText("Save As..."); saveAsItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveAsItemActionPerformed(evt); } }); fileMenu.add(saveAsItem); savePlotItem.setMnemonic(java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en") .getString("savePlotItem.mnemonic").charAt(0)); savePlotItem.setText(bundle.getString("savePlotItem.name")); // NOI18N savePlotItem.setToolTipText(bundle.getString("savePlotItem.tooltip")); // NOI18N savePlotItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { savePlotItemActionPerformed(evt); } }); fileMenu.add(savePlotItem); saveAllItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); saveAllItem.setIcon(new javax.swing.ImageIcon( getClass().getResource("/org/domainmath/gui/icons/document-save-all.png"))); // NOI18N saveAllItem.setText(bundle.getString("saveAllMenuItem.text")); // NOI18N saveAllItem.setToolTipText(bundle.getString("saveAllMenuItem.tooltip")); // NOI18N saveAllItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveAllItemActionPerformed(evt); } }); fileMenu.add(saveAllItem); fileMenu.add(jSeparator1); printFileItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_MASK)); printFileItem.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/document-print2.png"))); // NOI18N printFileItem.setText("Print"); printFileItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { printFileItemActionPerformed(evt); } }); fileMenu.add(printFileItem); printItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); printItem.setMnemonic(java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en") .getString("printItem.mnemonic").charAt(0)); printItem.setText(bundle.getString("printItem.name")); // NOI18N printItem.setToolTipText(bundle.getString("printItem.tooltip")); // NOI18N printItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { printItemActionPerformed(evt); } }); fileMenu.add(printItem); fileMenu.add(jSeparator19); preferencesItem.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/preferences.png"))); // NOI18N preferencesItem.setMnemonic(java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en") .getString("preferecesItem.mnemonic").charAt(0)); preferencesItem.setText(bundle.getString("preferencesItem.name")); // NOI18N preferencesItem.setToolTipText(bundle.getString("preferencesItem.tooltip")); // NOI18N preferencesItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { preferencesItemActionPerformed(evt); } }); fileMenu.add(preferencesItem); fileMenu.add(jSeparator2); connectItem.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/connect.png"))); // NOI18N connectItem.setMnemonic(java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en") .getString("connectItem.mnemonic").charAt(0)); connectItem.setText(bundle.getString("connectItem.name")); // NOI18N connectItem.setToolTipText(bundle.getString("connectItem.tooltip")); // NOI18N connectItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { connectItemActionPerformed(evt); } }); fileMenu.add(connectItem); disconnectItem.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/disconnect.png"))); // NOI18N disconnectItem.setMnemonic(java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en") .getString("disconnectItem.mnemonic").charAt(0)); disconnectItem.setText(bundle.getString("disconnectItem.name")); // NOI18N disconnectItem.setToolTipText(bundle.getString("disconnectItem.tooltip")); // NOI18N disconnectItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { disconnectItemActionPerformed(evt); } }); fileMenu.add(disconnectItem); fileMenu.add(jSeparator3); exitItem.setMnemonic(java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en") .getString("exitItem.mnemonic").charAt(0)); exitItem.setText(bundle.getString("exitItem.name")); // NOI18N exitItem.setToolTipText(bundle.getString("exitItem.tooltip")); // NOI18N exitItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exitItemActionPerformed(evt); } }); fileMenu.add(exitItem); jMenuBar1.add(fileMenu); editMenu.setMnemonic(java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en") .getString("editMenu.mnemonic").charAt(0)); editMenu.setText("Edit"); undoItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, java.awt.event.InputEvent.CTRL_MASK)); undoItem.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/edit-undo.png"))); // NOI18N undoItem.setText("Undo"); undoItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { undoItemActionPerformed(evt); } }); editMenu.add(undoItem); redoItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Y, java.awt.event.InputEvent.CTRL_MASK)); redoItem.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/edit-redo.png"))); // NOI18N redoItem.setText("Redo"); redoItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { redoItemActionPerformed(evt); } }); editMenu.add(redoItem); editMenu.add(jSeparator20); cutItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_MASK)); cutItem.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/edit-cut.png"))); // NOI18N cutItem.setText("Cut"); cutItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cutItemActionPerformed(evt); } }); editMenu.add(cutItem); copyItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK)); copyItem.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/edit-copy.png"))); // NOI18N copyItem.setText("Copy"); copyItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { copyItemActionPerformed(evt); } }); editMenu.add(copyItem); pasteItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.CTRL_MASK)); pasteItem.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/edit-paste.png"))); // NOI18N pasteItem.setText("Paste"); pasteItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { pasteItemActionPerformed(evt); } }); editMenu.add(pasteItem); editMenu.add(jSeparator21); deleteItem.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/edit-delete.png"))); // NOI18N deleteItem.setText("Delete"); deleteItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deleteItemActionPerformed(evt); } }); editMenu.add(deleteItem); selectAllItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK)); selectAllItem.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/edit-select-all.png"))); // NOI18N selectAllItem.setText("Select All"); selectAllItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { selectAllItemActionPerformed(evt); } }); editMenu.add(selectAllItem); editMenu.add(jSeparator22); jMenuItem2.setAction(new RSyntaxTextAreaEditorKit.InsertTabAction()); jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_TAB, java.awt.event.InputEvent.CTRL_MASK)); jMenuItem2.setText("Increase Indent"); editMenu.add(jMenuItem2); jMenuItem3.setAction(new RSyntaxTextAreaEditorKit.DecreaseIndentAction()); jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_TAB, java.awt.event.InputEvent.SHIFT_MASK)); jMenuItem3.setText("Decrease Indent"); editMenu.add(jMenuItem3); editMenu.add(jSeparator23); jMenuItem4.setAction(new RTextAreaEditorKit.UpperSelectionCaseAction()); jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, java.awt.event.InputEvent.CTRL_MASK)); jMenuItem4.setText("Make Uppercase"); editMenu.add(jMenuItem4); jMenuItem5.setAction(new RTextAreaEditorKit.LowerSelectionCaseAction()); jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); jMenuItem5.setText("Make Lowercase"); editMenu.add(jMenuItem5); editMenu.add(jSeparator24); jMenuItem6.setText("Clear All Marks..."); jMenuItem6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem6ActionPerformed(evt); } }); editMenu.add(jMenuItem6); jMenuItem1.setAction(new RSyntaxTextAreaEditorKit.ToggleCommentAction()); jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_SLASH, java.awt.event.InputEvent.CTRL_MASK)); jMenuItem1.setText("Toggle Comment"); jMenuItem1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem1ActionPerformed(evt); } }); editMenu.add(jMenuItem1); editMenu.add(jSeparator11); clearOutWindowItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_W, java.awt.event.InputEvent.CTRL_MASK)); clearOutWindowItem .setMnemonic(java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en") .getString("clearOutputWindowItem.mnemonic").charAt(0)); clearOutWindowItem.setText(bundle.getString("clearOutputWindowItem.name")); // NOI18N clearOutWindowItem.setToolTipText(bundle.getString("clearOutputWindowItem.tooltip")); // NOI18N clearOutWindowItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { clearOutWindowItemActionPerformed(evt); } }); editMenu.add(clearOutWindowItem); jMenuBar1.add(editMenu); jMenu3.setText(bundle.getString("viewMenu.title")); // NOI18N consoleItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_0, java.awt.event.InputEvent.CTRL_MASK)); consoleItem.setText(bundle.getString("consoleItem.title")); // NOI18N consoleItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { consoleItemActionPerformed(evt); } }); jMenu3.add(consoleItem); historyItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_1, java.awt.event.InputEvent.CTRL_MASK)); historyItem.setText(bundle.getString("historyItem.title")); // NOI18N historyItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { historyItemActionPerformed(evt); } }); jMenu3.add(historyItem); filesItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_2, java.awt.event.InputEvent.CTRL_MASK)); filesItem.setText(bundle.getString("filesItem.title")); // NOI18N filesItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { filesItemActionPerformed(evt); } }); jMenu3.add(filesItem); workspaceItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_3, java.awt.event.InputEvent.CTRL_MASK)); workspaceItem.setText(bundle.getString("worksaceItem.title")); // NOI18N workspaceItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { workspaceItemActionPerformed(evt); } }); jMenu3.add(workspaceItem); codeEditorItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_4, java.awt.event.InputEvent.CTRL_MASK)); codeEditorItem.setText(bundle.getString("codeEditorItem.title")); // NOI18N codeEditorItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { codeEditorItemActionPerformed(evt); } }); jMenu3.add(codeEditorItem); pathsItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_5, java.awt.event.InputEvent.CTRL_MASK)); pathsItem.setText(bundle.getString("setPathsItem.title")); // NOI18N pathsItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { pathsItemActionPerformed(evt); } }); jMenu3.add(pathsItem); pkgsItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_6, java.awt.event.InputEvent.CTRL_MASK)); pkgsItem.setText(bundle.getString("pkgsItem.title")); // NOI18N pkgsItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { pkgsItemActionPerformed(evt); } }); jMenu3.add(pkgsItem); arrayEditItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_7, java.awt.event.InputEvent.CTRL_MASK)); arrayEditItem.setText(bundle.getString("arrayEidtorItem.title")); // NOI18N arrayEditItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { arrayEditItemActionPerformed(evt); } }); jMenu3.add(arrayEditItem); jMenuItem7.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_8, java.awt.event.InputEvent.CTRL_MASK)); jMenuItem7.setText("Debugger Window"); jMenuItem7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem7ActionPerformed(evt); } }); jMenu3.add(jMenuItem7); jMenuBar1.add(jMenu3); jMenu1.setMnemonic('S'); jMenu1.setText("Search"); findItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.CTRL_MASK)); findItem.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/edit-find.png"))); // NOI18N findItem.setMnemonic('F'); findItem.setText("Find..."); findItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { findItemActionPerformed(evt); } }); jMenu1.add(findItem); replaceItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK)); replaceItem.setIcon(new javax.swing.ImageIcon( getClass().getResource("/org/domainmath/gui/icons/edit-find-replace.png"))); // NOI18N replaceItem.setText("Replace..."); replaceItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { replaceItemActionPerformed(evt); } }); jMenu1.add(replaceItem); gotoItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); gotoItem.setText("Go To..."); gotoItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { gotoItemActionPerformed(evt); } }); jMenu1.add(gotoItem); jMenu1.add(jSeparator25); googleItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, java.awt.event.InputEvent.CTRL_MASK)); googleItem.setText("Google Search"); googleItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { googleItemActionPerformed(evt); } }); jMenu1.add(googleItem); wikiItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_W, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); wikiItem.setText("Wikipedia Search"); wikiItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { wikiItemActionPerformed(evt); } }); jMenu1.add(wikiItem); jMenuBar1.add(jMenu1); pkgMenu.setText(bundle.getString("pkgMenu.name")); // NOI18N jMenuBar1.add(pkgMenu); debugMenu.setText("Debug"); runScriptItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F6, 0)); runScriptItem .setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/Run.png"))); // NOI18N runScriptItem.setText("Run Script"); runScriptItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { runScriptItemActionPerformed(evt); } }); debugMenu.add(runScriptItem); runScriptCItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F6, java.awt.event.InputEvent.SHIFT_MASK)); runScriptCItem.setText("Run Script from Console"); runScriptCItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { runScriptCItemActionPerformed(evt); } }); debugMenu.add(runScriptCItem); jMenuItem8.setText("Edit Run Configuration"); jMenuItem8.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem8ActionPerformed(evt); } }); debugMenu.add(jMenuItem8); debugMenu.add(jSeparator8); debugScriptMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F5, java.awt.event.InputEvent.CTRL_MASK)); debugScriptMenuItem.setText("Debug Script"); debugScriptMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { debugScriptMenuItemActionPerformed(evt); } }); debugMenu.add(debugScriptMenuItem); testScriptMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); testScriptMenuItem.setText("Test Script"); testScriptMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { testScriptMenuItemActionPerformed(evt); } }); debugMenu.add(testScriptMenuItem); toggleBreakpointItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F9, 0)); toggleBreakpointItem.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/resources/stop.png"))); // NOI18N toggleBreakpointItem.setText("Toggle Breakpoint"); toggleBreakpointItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { toggleBreakpointItemActionPerformed(evt); } }); debugMenu.add(toggleBreakpointItem); removeToggleBreakpointItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F9, java.awt.event.InputEvent.SHIFT_MASK)); removeToggleBreakpointItem.setText("Remove Toggle Breakpoint"); removeToggleBreakpointItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { removeToggleBreakpointItemActionPerformed(evt); } }); debugMenu.add(removeToggleBreakpointItem); clearAllBreakpointsItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F9, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); clearAllBreakpointsItem.setText("Clear All Breakpoints..."); clearAllBreakpointsItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { clearAllBreakpointsItemActionPerformed(evt); } }); debugMenu.add(clearAllBreakpointsItem); debugMenu.add(jSeparator10); stepItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F10, java.awt.event.InputEvent.SHIFT_MASK)); stepItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/step.png"))); // NOI18N stepItem.setText("Step"); stepItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { stepItemActionPerformed(evt); } }); debugMenu.add(stepItem); stepInItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F11, 0)); stepInItem.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/step-in.png"))); // NOI18N stepInItem.setText("Step in"); stepInItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { stepInItemActionPerformed(evt); } }); debugMenu.add(stepInItem); stepOutItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F11, java.awt.event.InputEvent.SHIFT_MASK)); stepOutItem.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/step-out.png"))); // NOI18N stepOutItem.setText("Step out"); stepOutItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { stepOutItemActionPerformed(evt); } }); debugMenu.add(stepOutItem); continueItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F8, 0)); continueItem.setText("Continue"); continueItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { continueItemActionPerformed(evt); } }); debugMenu.add(continueItem); debugMenu.add(jSeparator5); finishDebugItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F5, java.awt.event.InputEvent.SHIFT_MASK)); finishDebugItem .setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/finish.png"))); // NOI18N finishDebugItem.setText("Finish Debugger Session"); finishDebugItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { finishDebugItemActionPerformed(evt); } }); debugMenu.add(finishDebugItem); jMenuBar1.add(debugMenu); toolsMenu.setMnemonic(java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en") .getString("ToolsMenu.mnemonic").charAt(0)); toolsMenu.setText(bundle.getString("ToolsMenu.name")); // NOI18N fltkplotItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); fltkplotItem.setMnemonic(java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en") .getString("fltkPlotItem.mnemonic").charAt(0)); fltkplotItem.setText(bundle.getString("fltkPlotItem.name")); // NOI18N fltkplotItem.setToolTipText(bundle.getString("fltkPlotItem.tooltip")); // NOI18N fltkplotItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { fltkplotItemActionPerformed(evt); } }); toolsMenu.add(fltkplotItem); octaveCmdItem.setMnemonic(java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en") .getString("octaveCmdItem.mnemonic").charAt(0)); octaveCmdItem.setText(bundle.getString("octaveCmdItem.name")); // NOI18N octaveCmdItem.setToolTipText(bundle.getString("octaveCmdItem.tooltip")); // NOI18N octaveCmdItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { octaveCmdItemActionPerformed(evt); } }); toolsMenu.add(octaveCmdItem); jMenuBar1.add(toolsMenu); jMenu2.setText(bundle.getString("windowMenu.title")); // NOI18N previousWindowItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_PAGE_DOWN, java.awt.event.InputEvent.CTRL_MASK)); previousWindowItem.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/go-previous.png"))); // NOI18N previousWindowItem.setText(bundle.getString("previousWindowItem.title")); // NOI18N previousWindowItem.setToolTipText(bundle.getString("previousWindowItem.tooltip")); // NOI18N previousWindowItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { previousWindowItemActionPerformed(evt); } }); jMenu2.add(previousWindowItem); nextWindowItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_PAGE_UP, java.awt.event.InputEvent.CTRL_MASK)); nextWindowItem.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/go-next.png"))); // NOI18N nextWindowItem.setText(bundle.getString("nextWindowItem.title")); // NOI18N nextWindowItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { nextWindowItemActionPerformed(evt); } }); jMenu2.add(nextWindowItem); jMenu2.add(jSeparator29); closeItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_W, java.awt.event.InputEvent.ALT_MASK)); closeItem.setText(bundle.getString("closeMenuItem.name")); // NOI18N closeItem.setToolTipText(bundle.getString("closeItem.tooltip")); // NOI18N closeItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { closeItemActionPerformed(evt); } }); jMenu2.add(closeItem); closeAllItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_W, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK)); closeAllItem.setText(bundle.getString("closeAllItem.name")); // NOI18N closeAllItem.setToolTipText(bundle.getString("closeAllItem.tooltip")); // NOI18N closeAllItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { closeAllItemActionPerformed(evt); } }); jMenu2.add(closeAllItem); jMenu2.add(jSeparator18); windowsItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.SHIFT_MASK)); windowsItem.setText(bundle.getString("windowsItem.title")); // NOI18N windowsItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { windowsItemActionPerformed(evt); } }); jMenu2.add(windowsItem); jMenuBar1.add(jMenu2); helpMenu.setMnemonic(java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en") .getString("helpMenu.mnemonic").charAt(0)); helpMenu.setText(bundle.getString("helpMenu.name")); // NOI18N forumItem.setText("Forum"); forumItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { forumItemActionPerformed(evt); } }); helpMenu.add(forumItem); octaveInfoItem.setMnemonic(java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en") .getString("octInfoItem.mnemonic").charAt(0)); octaveInfoItem.setText(bundle.getString("octInfoItem.name")); // NOI18N octaveInfoItem.setToolTipText(bundle.getString("octInfoItem.tooltip")); // NOI18N octaveInfoItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { octaveInfoItemActionPerformed(evt); } }); helpMenu.add(octaveInfoItem); helpMenu.add(jSeparator12); quickHelpItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0)); quickHelpItem.setText(bundle.getString("quickHelpItem.name")); // NOI18N quickHelpItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { quickHelpItemActionPerformed(evt); } }); helpMenu.add(quickHelpItem); jMenuItem9.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, java.awt.event.InputEvent.SHIFT_MASK)); jMenuItem9.setText("Package Documentation"); jMenuItem9.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem9ActionPerformed(evt); } }); helpMenu.add(jMenuItem9); docPkgItem.setText("Package Online Documentation"); docPkgItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { docPkgItemActionPerformed(evt); } }); helpMenu.add(docPkgItem); referenceMenu.setText(bundle.getString("referencesMenu.name")); // NOI18N helpMenu.add(referenceMenu); referenceItem.setMnemonic(java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en") .getString("addReferencesItem.mnemonic").charAt(0)); referenceItem.setText(bundle.getString("addReferencesItem.name")); // NOI18N referenceItem.setToolTipText(bundle.getString("addReferencesItem.tooltip")); // NOI18N referenceItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { referenceItemActionPerformed(evt); } }); helpMenu.add(referenceItem); helpMenu.add(jSeparator6); checkForUpdatesMenuItem.setText(bundle.getString("checkForUpdatesMenuItem.text")); // NOI18N checkForUpdatesMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { checkForUpdatesMenuItemActionPerformed(evt); } }); helpMenu.add(checkForUpdatesMenuItem); onlineHelpItem.setText("Help and Support"); onlineHelpItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { onlineHelpItemActionPerformed(evt); } }); helpMenu.add(onlineHelpItem); faqItem.setText("Online FAQ"); faqItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { faqItemActionPerformed(evt); } }); helpMenu.add(faqItem); helpMenu.add(jSeparator14); reportBugItem.setMnemonic(java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en") .getString("reportBugItem.mnemonic").charAt(0)); reportBugItem.setText(bundle.getString("reportBugItem.name")); // NOI18N reportBugItem.setToolTipText(bundle.getString("reportBugItem.tooltip")); // NOI18N reportBugItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { reportBugItemActionPerformed(evt); } }); helpMenu.add(reportBugItem); feedBackItem.setMnemonic(java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en") .getString("yourFeedbackItem.mnemonic").charAt(0)); feedBackItem.setText(bundle.getString("yourFeedbackItem.name")); // NOI18N feedBackItem.setToolTipText(bundle.getString("yourFeedbackItem.tooltip")); // NOI18N feedBackItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { feedBackItemActionPerformed(evt); } }); helpMenu.add(feedBackItem); helpMenu.add(jSeparator7); AboutItem.setMnemonic(java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en") .getString("aboutItem.mnemonic").charAt(0)); AboutItem.setText(bundle.getString("aboutItem.name")); // NOI18N AboutItem.setToolTipText(bundle.getString("aboutItem.tooltip")); // NOI18N AboutItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { AboutItemActionPerformed(evt); } }); helpMenu.add(AboutItem); jMenuBar1.add(helpMenu); setJMenuBar(jMenuBar1); pack(); }
From source file:com.maxl.java.amikodesk.AMiKoDesk.java
private static void createAndShowFullGUI() { // Create and setup window final JFrame jframe = new JFrame(Constants.APP_NAME); jframe.setName(Constants.APP_NAME + ".main"); int min_width = CML_OPT_WIDTH; int min_height = CML_OPT_HEIGHT; jframe.setPreferredSize(new Dimension(min_width, min_height)); jframe.setMinimumSize(new Dimension(min_width, min_height)); Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); int x = (screen.width - min_width) / 2; int y = (screen.height - min_height) / 2; jframe.setBounds(x, y, min_width, min_height); // Set application icon if (Utilities.appCustomization().equals("ywesee")) { ImageIcon img = new ImageIcon(Constants.AMIKO_ICON); jframe.setIconImage(img.getImage()); } else if (Utilities.appCustomization().equals("desitin")) { ImageIcon img = new ImageIcon(Constants.DESITIN_ICON); jframe.setIconImage(img.getImage()); } else if (Utilities.appCustomization().equals("meddrugs")) { ImageIcon img = new ImageIcon(Constants.MEDDRUGS_ICON); jframe.setIconImage(img.getImage()); } else if (Utilities.appCustomization().equals("zurrose")) { ImageIcon img = new ImageIcon(Constants.AMIKO_ICON); jframe.setIconImage(img.getImage()); }/*from w ww. j a v a2s .com*/ // ------ Setup menubar ------ JMenuBar menu_bar = new JMenuBar(); // menu_bar.add(Box.createHorizontalGlue()); // --> aligns menu items to the right! // -- Menu "Datei" -- JMenu datei_menu = new JMenu("Datei"); if (Utilities.appLanguage().equals("fr")) datei_menu.setText("Fichier"); menu_bar.add(datei_menu); JMenuItem print_item = new JMenuItem("Drucken..."); JMenuItem settings_item = new JMenuItem(m_rb.getString("settings") + "..."); JMenuItem quit_item = new JMenuItem("Beenden"); if (Utilities.appLanguage().equals("fr")) { print_item.setText("Imprimer"); quit_item.setText("Terminer"); } datei_menu.add(print_item); datei_menu.addSeparator(); datei_menu.add(settings_item); datei_menu.addSeparator(); datei_menu.add(quit_item); // -- Menu "Aktualisieren" -- JMenu update_menu = new JMenu("Aktualisieren"); if (Utilities.appLanguage().equals("fr")) update_menu.setText("Mise jour"); menu_bar.add(update_menu); final JMenuItem updatedb_item = new JMenuItem("Aktualisieren via Internet..."); updatedb_item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK)); JMenuItem choosedb_item = new JMenuItem("Aktualisieren via Datei..."); update_menu.add(updatedb_item); update_menu.add(choosedb_item); if (Utilities.appLanguage().equals("fr")) { updatedb_item.setText("Tlcharger la banque de donnes..."); updatedb_item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, ActionEvent.CTRL_MASK)); choosedb_item.setText("Ajourner la banque de donnes..."); } // -- Menu "Hilfe" -- JMenu hilfe_menu = new JMenu("Hilfe"); if (Utilities.appLanguage().equals("fr")) hilfe_menu.setText("Aide"); menu_bar.add(hilfe_menu); JMenuItem about_item = new JMenuItem("ber " + Constants.APP_NAME + "..."); JMenuItem ywesee_item = new JMenuItem(Constants.APP_NAME + " im Internet"); if (Utilities.appCustomization().equals("meddrugs")) ywesee_item.setText("med-drugs im Internet"); JMenuItem report_item = new JMenuItem("Error Report..."); JMenuItem contact_item = new JMenuItem("Kontakt..."); if (Utilities.appLanguage().equals("fr")) { // Extrawunsch med-drugs if (Utilities.appCustomization().equals("meddrugs")) about_item.setText(Constants.APP_NAME); else about_item.setText("A propos de " + Constants.APP_NAME + "..."); contact_item.setText("Contact..."); if (Utilities.appCustomization().equals("meddrugs")) ywesee_item.setText("med-drugs sur Internet"); else ywesee_item.setText(Constants.APP_NAME + " sur Internet"); report_item.setText("Rapport d'erreur..."); } hilfe_menu.add(about_item); hilfe_menu.add(ywesee_item); hilfe_menu.addSeparator(); hilfe_menu.add(report_item); hilfe_menu.addSeparator(); hilfe_menu.add(contact_item); // Menu "Abonnieren" (only for ywesee) JMenu subscribe_menu = new JMenu("Abonnieren"); if (Utilities.appLanguage().equals("fr")) subscribe_menu.setText("Abonnement"); if (Utilities.appCustomization().equals("ywesee")) { menu_bar.add(subscribe_menu); } jframe.setJMenuBar(menu_bar); // ------ Setup toolbar ------ JToolBar toolBar = new JToolBar("Database"); toolBar.setPreferredSize(new Dimension(jframe.getWidth(), 64)); final JToggleButton selectAipsButton = new JToggleButton( new ImageIcon(Constants.IMG_FOLDER + "aips32x32_bright.png")); final JToggleButton selectFavoritesButton = new JToggleButton( new ImageIcon(Constants.IMG_FOLDER + "favorites32x32_bright.png")); final JToggleButton selectInteractionsButton = new JToggleButton( new ImageIcon(Constants.IMG_FOLDER + "interactions32x32_bright.png")); final JToggleButton selectShoppingCartButton = new JToggleButton( new ImageIcon(Constants.IMG_FOLDER + "shoppingcart32x32_bright.png")); final JToggleButton selectComparisonCartButton = new JToggleButton( new ImageIcon(Constants.IMG_FOLDER + "comparisoncart32x32_bright.png")); final JToggleButton list_of_buttons[] = { selectAipsButton, selectFavoritesButton, selectInteractionsButton, selectShoppingCartButton, selectComparisonCartButton }; if (Utilities.appLanguage().equals("de")) { setupButton(selectAipsButton, "Kompendium", "aips32x32_gray.png", "aips32x32_dark.png"); setupButton(selectFavoritesButton, "Favoriten", "favorites32x32_gray.png", "favorites32x32_dark.png"); setupButton(selectInteractionsButton, "Interaktionen", "interactions32x32_gray.png", "interactions32x32_dark.png"); setupButton(selectShoppingCartButton, "Warenkorb", "shoppingcart32x32_gray.png", "shoppingcart32x32_dark.png"); setupButton(selectComparisonCartButton, "Preisvergleich", "comparisoncart32x32_gray.png", "comparisoncart32x32_dark.png"); } else if (Utilities.appLanguage().equals("fr")) { setupButton(selectAipsButton, "Compendium", "aips32x32_gray.png", "aips32x32_dark.png"); setupButton(selectFavoritesButton, "Favorites", "favorites32x32_gray.png", "favorites32x32_dark.png"); setupButton(selectInteractionsButton, "Interactions", "interactions32x32_gray.png", "interactions32x32_dark.png"); setupButton(selectShoppingCartButton, "Panier", "shoppingcart32x32_gray.png", "shoppingcart32x32_dark.png"); setupButton(selectComparisonCartButton, "Preisvergleich", "comparisoncart32x32_gray.png", "comparisoncart32x32_dark.png"); } // Add to toolbar and set up toolBar.setBackground(m_toolbar_bg); toolBar.add(selectAipsButton); toolBar.addSeparator(); toolBar.add(selectFavoritesButton); toolBar.addSeparator(); toolBar.add(selectInteractionsButton); if (!Utilities.appCustomization().equals("zurrose")) { toolBar.addSeparator(); toolBar.add(selectShoppingCartButton); } if (Utilities.appCustomization().equals("zurrorse")) { toolBar.addSeparator(); toolBar.add(selectComparisonCartButton); } toolBar.setRollover(true); toolBar.setFloatable(false); // Progress indicator (not working...) toolBar.addSeparator(new Dimension(32, 32)); toolBar.add(m_progress_indicator); // ------ Setup settingspage ------ final SettingsPage settingsPage = new SettingsPage(jframe, m_rb); // Attach observer to it settingsPage.addObserver(new Observer() { public void update(Observable o, Object arg) { System.out.println(arg); if (m_shopping_cart != null) { // Refresh some stuff m_shopping_basket.clear(); int index = m_shopping_cart.getCartIndex(); if (index > 0) m_web_panel.saveShoppingCartWithIndex(index); m_web_panel.updateShoppingHtml(); } } }); jframe.addWindowListener(new WindowListener() { // Use WindowAdapter! @Override public void windowOpened(WindowEvent e) { } @Override public void windowClosed(WindowEvent e) { m_web_panel.dispose(); Runtime.getRuntime().exit(0); } @Override public void windowClosing(WindowEvent e) { // Save shopping cart int index = m_shopping_cart.getCartIndex(); if (index > 0 && m_web_panel != null) m_web_panel.saveShoppingCartWithIndex(index); } @Override public void windowIconified(WindowEvent e) { } @Override public void windowDeiconified(WindowEvent e) { } @Override public void windowActivated(WindowEvent e) { } @Override public void windowDeactivated(WindowEvent e) { } }); print_item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { m_web_panel.print(); } }); settings_item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { settingsPage.display(); } }); quit_item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { try { // Save shopping cart int index = m_shopping_cart.getCartIndex(); if (index > 0 && m_web_panel != null) m_web_panel.saveShoppingCartWithIndex(index); // Save settings WindowSaver.saveSettings(); m_web_panel.dispose(); Runtime.getRuntime().exit(0); } catch (Exception e) { System.out.println(e); } } }); subscribe_menu.addMenuListener(new MenuListener() { @Override public void menuSelected(MenuEvent event) { if (Utilities.appCustomization().equals("ywesee")) { if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().browse(new URI( "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3UM84Z6WLFKZE")); } catch (IOException e) { // TODO: } catch (URISyntaxException r) { // TODO: } } } } @Override public void menuDeselected(MenuEvent event) { // do nothing } @Override public void menuCanceled(MenuEvent event) { // do nothing } }); contact_item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (Utilities.appCustomization().equals("ywesee")) { if (Desktop.isDesktopSupported()) { try { URI mail_to_uri = URI .create("mailto:zdavatz@ywesee.com?subject=AmiKo%20Desktop%20Feedback"); Desktop.getDesktop().mail(mail_to_uri); } catch (IOException e) { // TODO: } } else { AmiKoDialogs cd = new AmiKoDialogs(Utilities.appLanguage(), Utilities.appCustomization()); cd.ContactDialog(); } } else if (Utilities.appCustomization().equals("desitin")) { if (Desktop.isDesktopSupported()) { try { URI mail_to_uri = URI .create("mailto:info@desitin.ch?subject=AmiKo%20Desktop%20Desitin%20Feedback"); Desktop.getDesktop().mail(mail_to_uri); } catch (IOException e) { // TODO: } } else { AmiKoDialogs cd = new AmiKoDialogs(Utilities.appLanguage(), Utilities.appCustomization()); cd.ContactDialog(); } } else if (Utilities.appCustomization().equals("meddrugs")) { if (Desktop.isDesktopSupported()) { try { URI mail_to_uri = URI.create( "mailto:med-drugs@just-medical.com?subject=med-drugs%20desktop%20Feedback"); Desktop.getDesktop().mail(mail_to_uri); } catch (IOException e) { // TODO: } } else { AmiKoDialogs cd = new AmiKoDialogs(Utilities.appLanguage(), Utilities.appCustomization()); cd.ContactDialog(); } } else if (Utilities.appCustomization().equals("zurrose")) { if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().browse(new URI("www.zurrose.ch/amiko")); } catch (IOException e) { // TODO: } catch (URISyntaxException r) { // TODO: } } } } }); report_item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { // Check first m_application_folder otherwise resort to // pre-installed report String report_file = m_application_data_folder + "\\" + Constants.DEFAULT_AMIKO_REPORT_BASE + Utilities.appLanguage() + ".html"; if (!(new File(report_file)).exists()) report_file = System.getProperty("user.dir") + "/dbs/" + Constants.DEFAULT_AMIKO_REPORT_BASE + Utilities.appLanguage() + ".html"; // Open report file in browser if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().browse(new File(report_file).toURI()); } catch (IOException e) { // TODO: } } } }); ywesee_item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (Utilities.appCustomization().equals("ywesee")) { if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().browse(new URI("http://www.ywesee.com/AmiKo/Desktop")); } catch (IOException e) { // TODO: } catch (URISyntaxException r) { // TODO: } } } else if (Utilities.appCustomization().equals("desitin")) { if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().browse( new URI("http://www.desitin.ch/produkte/arzneimittel-kompendium-apps/")); } catch (IOException e) { // TODO: } catch (URISyntaxException r) { // TODO: } } } else if (Utilities.appCustomization().equals("meddrugs")) { if (Desktop.isDesktopSupported()) { try { if (Utilities.appLanguage().equals("de")) Desktop.getDesktop().browse(new URI("http://www.med-drugs.ch")); else if (Utilities.appLanguage().equals("fr")) Desktop.getDesktop() .browse(new URI("http://www.med-drugs.ch/index.cfm?&newlang=fr")); } catch (IOException e) { // TODO: } catch (URISyntaxException r) { // TODO: } } } else if (Utilities.appCustomization().equals("zurrose")) { if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().browse(new URI("www.zurrose.ch/amiko")); } catch (IOException e) { // TODO: } catch (URISyntaxException r) { // TODO: } } } } }); about_item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { AmiKoDialogs ad = new AmiKoDialogs(Utilities.appLanguage(), Utilities.appCustomization()); ad.AboutDialog(); } }); // Container final Container container = jframe.getContentPane(); container.setBackground(Color.WHITE); container.setLayout(new BorderLayout()); // ==== Toolbar ===== container.add(toolBar, BorderLayout.NORTH); // ==== Left panel ==== JPanel left_panel = new JPanel(); left_panel.setBackground(Color.WHITE); left_panel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(2, 2, 2, 2); // ---- Search field ---- final SearchField searchField = new SearchField("Suche Prparat"); if (Utilities.appLanguage().equals("fr")) searchField.setText("Recherche Specialit"); gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = gbc.gridheight = 1; gbc.weightx = gbc.weighty = 0.0; // --> container.add(searchField, gbc); left_panel.add(searchField, gbc); // ---- Buttons ---- // Names String l_title = "Prparat"; String l_author = "Inhaberin"; String l_atccode = "Wirkstoff / ATC Code"; String l_regnr = "Zulassungsnummer"; String l_ingredient = "Wirkstoff"; String l_therapy = "Therapie"; String l_search = "Suche"; if (Utilities.appLanguage().equals("fr")) { l_title = "Spcialit"; l_author = "Titulaire"; l_atccode = "Principe Active / Code ATC"; l_regnr = "Nombre Enregistration"; l_ingredient = "Principe Active"; l_therapy = "Thrapie"; l_search = "Recherche"; } ButtonGroup bg = new ButtonGroup(); JToggleButton but_title = new JToggleButton(l_title); setupToggleButton(but_title); bg.add(but_title); gbc.gridx = 0; gbc.gridy = 1; gbc.gridwidth = gbc.gridheight = 1; gbc.weightx = gbc.weighty = 0.0; // --> container.add(but_title, gbc); left_panel.add(but_title, gbc); JToggleButton but_auth = new JToggleButton(l_author); setupToggleButton(but_auth); bg.add(but_auth); gbc.gridx = 0; gbc.gridy += 1; gbc.gridwidth = gbc.gridheight = 1; gbc.weightx = gbc.weighty = 0.0; // --> container.add(but_auth, gbc); left_panel.add(but_auth, gbc); JToggleButton but_atccode = new JToggleButton(l_atccode); setupToggleButton(but_atccode); bg.add(but_atccode); gbc.gridx = 0; gbc.gridy += 1; gbc.gridwidth = gbc.gridheight = 1; gbc.weightx = gbc.weighty = 0.0; // --> container.add(but_atccode, gbc); left_panel.add(but_atccode, gbc); JToggleButton but_regnr = new JToggleButton(l_regnr); setupToggleButton(but_regnr); bg.add(but_regnr); gbc.gridx = 0; gbc.gridy += 1; gbc.gridwidth = gbc.gridheight = 1; gbc.weightx = gbc.weighty = 0.0; // --> container.add(but_regnr, gbc); left_panel.add(but_regnr, gbc); JToggleButton but_therapy = new JToggleButton(l_therapy); setupToggleButton(but_therapy); bg.add(but_therapy); gbc.gridx = 0; gbc.gridy += 1; gbc.gridwidth = gbc.gridheight = 1; gbc.weightx = gbc.weighty = 0.0; // --> container.add(but_therapy, gbc); left_panel.add(but_therapy, gbc); // ---- Card layout ---- final CardLayout cardl = new CardLayout(); cardl.setHgap(-4); // HACK to make things look better!! final JPanel p_results = new JPanel(cardl); m_list_titles = new ListPanel(); m_list_auths = new ListPanel(); m_list_regnrs = new ListPanel(); m_list_atccodes = new ListPanel(); m_list_ingredients = new ListPanel(); m_list_therapies = new ListPanel(); // Contraints gbc.fill = GridBagConstraints.BOTH; gbc.gridx = 0; gbc.gridy += 1; gbc.gridwidth = 1; gbc.gridheight = 10; gbc.weightx = 1.0; gbc.weighty = 1.0; // p_results.add(m_list_titles, l_title); p_results.add(m_list_auths, l_author); p_results.add(m_list_regnrs, l_regnr); p_results.add(m_list_atccodes, l_atccode); p_results.add(m_list_ingredients, l_ingredient); p_results.add(m_list_therapies, l_therapy); // --> container.add(p_results, gbc); left_panel.add(p_results, gbc); left_panel.setBorder(null); // First card to show cardl.show(p_results, l_title); // ==== Right panel ==== JPanel right_panel = new JPanel(); right_panel.setBackground(Color.WHITE); right_panel.setLayout(new GridBagLayout()); // ---- Section titles ---- m_section_titles = null; if (Utilities.appLanguage().equals("de")) { m_section_titles = new IndexPanel(SectionTitle_DE); } else if (Utilities.appLanguage().equals("fr")) { m_section_titles = new IndexPanel(SectionTitle_FR); } m_section_titles.setMinimumSize(new Dimension(150, 150)); m_section_titles.setMaximumSize(new Dimension(320, 1000)); // ---- Fachinformation ---- m_web_panel = new WebPanel2(); m_web_panel.setMinimumSize(new Dimension(320, 150)); // Add JSplitPane on the RIGHT final int Divider_location = 150; final int Divider_size = 10; final JSplitPane split_pane_right = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, m_section_titles, m_web_panel); split_pane_right.setOneTouchExpandable(true); split_pane_right.setDividerLocation(Divider_location); split_pane_right.setDividerSize(Divider_size); // Add JSplitPane on the LEFT JSplitPane split_pane_left = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left_panel, split_pane_right /* right_panel */); split_pane_left.setOneTouchExpandable(true); split_pane_left.setDividerLocation(320); // Sets the pane divider location split_pane_left.setDividerSize(Divider_size); container.add(split_pane_left, BorderLayout.CENTER); // Add status bar on the bottom JPanel statusPanel = new JPanel(); statusPanel.setPreferredSize(new Dimension(jframe.getWidth(), 16)); statusPanel.setLayout(new BoxLayout(statusPanel, BoxLayout.X_AXIS)); container.add(statusPanel, BorderLayout.SOUTH); final JLabel m_status_label = new JLabel(""); m_status_label.setHorizontalAlignment(SwingConstants.LEFT); statusPanel.add(m_status_label); // Add mouse listener searchField.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { searchField.setText(""); } }); final String final_title = l_title; final String final_author = l_author; final String final_atccode = l_atccode; final String final_regnr = l_regnr; final String final_therapy = l_therapy; final String final_search = l_search; // Internal class that implements switching between buttons final class Toggle { public void toggleButton(JToggleButton jbn) { for (int i = 0; i < list_of_buttons.length; ++i) { if (jbn == list_of_buttons[i]) list_of_buttons[i].setSelected(true); else list_of_buttons[i].setSelected(false); } } } ; // ------ Add toolbar action listeners ------ selectAipsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { new Toggle().toggleButton(selectAipsButton); // Set state 'aips' if (!m_curr_uistate.getUseMode().equals("aips")) { m_curr_uistate.setUseMode("aips"); // Show middle pane split_pane_right.setDividerSize(Divider_size); split_pane_right.setDividerLocation(Divider_location); m_section_titles.setVisible(true); // SwingUtilities.invokeLater(new Runnable() { @Override public void run() { m_start_time = System.currentTimeMillis(); m_query_str = searchField.getText(); int num_hits = retrieveAipsSearchResults(false); m_status_label.setText(med_search.size() + " Suchresultate in " + (System.currentTimeMillis() - m_start_time) / 1000.0f + " Sek."); // if (med_index < 0 && prev_med_index >= 0) med_index = prev_med_index; m_web_panel.updateText(); if (num_hits == 0) { m_web_panel.emptyPage(); } } }); } } }); selectFavoritesButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { new Toggle().toggleButton(selectFavoritesButton); // Set state 'favorites' if (!m_curr_uistate.getUseMode().equals("favorites")) { m_curr_uistate.setUseMode("favorites"); // Show middle pane split_pane_right.setDividerSize(Divider_size); split_pane_right.setDividerLocation(Divider_location); m_section_titles.setVisible(true); // SwingUtilities.invokeLater(new Runnable() { @Override public void run() { m_start_time = System.currentTimeMillis(); // m_query_str = searchField.getText(); // Clear the search container med_search.clear(); for (String regnr : favorite_meds_set) { List<Medication> meds = m_sqldb.searchRegNr(regnr); if (!meds.isEmpty()) { // Add med database ID med_search.add(meds.get(0)); } } // Sort list of meds Collections.sort(med_search, new Comparator<Medication>() { @Override public int compare(final Medication m1, final Medication m2) { return m1.getTitle().compareTo(m2.getTitle()); } }); sTitle(); cardl.show(p_results, final_title); m_status_label.setText(med_search.size() + " Suchresultate in " + (System.currentTimeMillis() - m_start_time) / 1000.0f + " Sek."); } }); } } }); selectInteractionsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { new Toggle().toggleButton(selectInteractionsButton); // Set state 'interactions' if (!m_curr_uistate.getUseMode().equals("interactions")) { m_curr_uistate.setUseMode("interactions"); // Show middle pane split_pane_right.setDividerSize(Divider_size); split_pane_right.setDividerLocation(Divider_location); m_section_titles.setVisible(true); // SwingUtilities.invokeLater(new Runnable() { @Override public void run() { m_query_str = searchField.getText(); retrieveAipsSearchResults(false); // Switch to interaction mode m_web_panel.updateInteractionsCart(); m_web_panel.repaint(); m_web_panel.validate(); } }); } } }); selectShoppingCartButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { String email_adr = m_prefs.get("emailadresse", ""); if (email_adr != null && email_adr.length() > 2) // Two chars is the minimum lenght for an email address m_preferences_ok = true; if (m_preferences_ok) { m_preferences_ok = false; // Check always new Toggle().toggleButton(selectShoppingCartButton); // Set state 'shopping' if (!m_curr_uistate.getUseMode().equals("shopping")) { m_curr_uistate.setUseMode("shopping"); // Show middle pane split_pane_right.setDividerSize(Divider_size); split_pane_right.setDividerLocation(Divider_location); m_section_titles.setVisible(true); // Set right panel title m_web_panel.setTitle(m_rb.getString("shoppingCart")); // Switch to shopping cart int index = 1; if (m_shopping_cart != null) { index = m_shopping_cart.getCartIndex(); m_web_panel.loadShoppingCartWithIndex(index); // m_shopping_cart.printShoppingBasket(); } // m_web_panel.updateShoppingHtml(); m_web_panel.updateListOfPackages(); if (m_first_pass == true) { m_first_pass = false; if (Utilities.appCustomization().equals("ywesee")) med_search = m_sqldb.searchAuth("ibsa"); else if (Utilities.appCustomization().equals("desitin")) med_search = m_sqldb.searchAuth("desitin"); sAuth(); cardl.show(p_results, final_author); } } } else { selectShoppingCartButton.setSelected(false); settingsPage.display(); } } }); selectComparisonCartButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { new Toggle().toggleButton(selectComparisonCartButton); // Set state 'comparison' if (!m_curr_uistate.getUseMode().equals("comparison")) { m_curr_uistate.setUseMode("comparison"); // Hide middle pane m_section_titles.setVisible(false); split_pane_right.setDividerLocation(0); split_pane_right.setDividerSize(0); // SwingUtilities.invokeLater(new Runnable() { @Override public void run() { m_start_time = System.currentTimeMillis(); // Set right panel title m_web_panel.setTitle(getTitle("priceComp")); if (med_index >= 0) { if (med_id != null && med_index < med_id.size()) { Medication m = m_sqldb.getMediWithId(med_id.get(med_index)); String atc_code = m.getAtcCode(); if (atc_code != null) { String atc = atc_code.split(";")[0]; m_web_panel.fillComparisonBasket(atc); m_web_panel.updateComparisonCartHtml(); // Update pane on the left retrieveAipsSearchResults(false); } } } m_status_label.setText(rose_search.size() + " Suchresultate in " + (System.currentTimeMillis() - m_start_time) / 1000.0f + " Sek."); } }); } } }); // ------ Add keylistener to text field (type as you go feature) ------ searchField.addKeyListener(new KeyAdapter() { @Override public void keyTyped(KeyEvent e) { // keyReleased(KeyEvent e) // invokeLater potentially in the wrong place... more testing // required SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (m_curr_uistate.isLoadCart()) m_curr_uistate.restoreUseMode(); m_start_time = System.currentTimeMillis(); m_query_str = searchField.getText(); // Queries for SQLite DB if (!m_query_str.isEmpty()) { if (m_query_type == 0) { if (m_curr_uistate.isComparisonMode()) { rose_search = m_rosedb.searchTitle(m_query_str); } else { med_search = m_sqldb.searchTitle(m_query_str); if (m_curr_uistate.databaseUsed().equals("favorites")) retrieveFavorites(); } sTitle(); cardl.show(p_results, final_title); } else if (m_query_type == 1) { if (m_curr_uistate.isComparisonMode()) { rose_search = m_rosedb.searchSupplier(m_query_str); } else { med_search = m_sqldb.searchAuth(m_query_str); if (m_curr_uistate.databaseUsed().equals("favorites")) retrieveFavorites(); } sAuth(); cardl.show(p_results, final_author); } else if (m_query_type == 2) { if (m_curr_uistate.isComparisonMode()) { rose_search = m_rosedb.searchATC(m_query_str); } else { med_search = m_sqldb.searchATC(m_query_str); if (m_curr_uistate.databaseUsed().equals("favorites")) retrieveFavorites(); } sATC(); cardl.show(p_results, final_atccode); } else if (m_query_type == 3) { if (m_curr_uistate.isComparisonMode()) { rose_search = m_rosedb.searchEan(m_query_str); } else { med_search = m_sqldb.searchRegNr(m_query_str); if (m_curr_uistate.databaseUsed().equals("favorites")) retrieveFavorites(); } sRegNr(); cardl.show(p_results, final_regnr); } else if (m_query_type == 4) { if (m_curr_uistate.isComparisonMode()) { rose_search = m_rosedb.searchTherapy(m_query_str); } else { med_search = m_sqldb.searchApplication(m_query_str); if (m_curr_uistate.databaseUsed().equals("favorites")) retrieveFavorites(); } sTherapy(); cardl.show(p_results, final_therapy); } else { // do nothing } int num_hits = 0; if (m_curr_uistate.isComparisonMode()) num_hits = rose_search.size(); else num_hits = med_search.size(); m_status_label.setText(num_hits + " Suchresultate in " + (System.currentTimeMillis() - m_start_time) / 1000.0f + " Sek."); } } }); } }); // Add actionlisteners but_title.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { if (m_curr_uistate.isLoadCart()) m_curr_uistate.restoreUseMode(); searchField.setText(final_search + " " + final_title); m_curr_uistate.setQueryType(m_query_type = 0); sTitle(); cardl.show(p_results, final_title); } }); but_auth.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { if (m_curr_uistate.isLoadCart()) m_curr_uistate.restoreUseMode(); searchField.setText(final_search + " " + final_author); m_curr_uistate.setQueryType(m_query_type = 1); sAuth(); cardl.show(p_results, final_author); } }); but_atccode.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { if (m_curr_uistate.isLoadCart()) m_curr_uistate.restoreUseMode(); searchField.setText(final_search + " " + final_atccode); m_curr_uistate.setQueryType(m_query_type = 2); sATC(); cardl.show(p_results, final_atccode); } }); but_regnr.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { if (m_curr_uistate.isLoadCart()) m_curr_uistate.restoreUseMode(); searchField.setText(final_search + " " + final_regnr); m_curr_uistate.setQueryType(m_query_type = 3); sRegNr(); cardl.show(p_results, final_regnr); } }); but_therapy.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { if (m_curr_uistate.isLoadCart()) m_curr_uistate.restoreUseMode(); searchField.setText(final_search + " " + final_therapy); m_curr_uistate.setQueryType(m_query_type = 4); sTherapy(); cardl.show(p_results, final_therapy); } }); // Display window jframe.pack(); // jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // jframe.setAlwaysOnTop(true); jframe.setVisible(true); // Check if user has selected an alternative database /* * NOTE: 21/11/2013: This solution is put on ice. Favored is a solution * where the database selected by the user is saved in a default folder * (see variable "m_application_data_folder") */ /* * try { WindowSaver.loadSettings(jframe); String database_path = * WindowSaver.getDbPath(); if (database_path!=null) * m_sqldb.loadDBFromPath(database_path); } catch(IOException e) { * e.printStackTrace(); } */ // Load AIPS database selectAipsButton.setSelected(true); selectFavoritesButton.setSelected(false); m_curr_uistate.setUseMode("aips"); med_search = m_sqldb.searchTitle(""); sTitle(); // Used instead of sTitle (which is slow) cardl.show(p_results, final_title); // Add menu item listeners updatedb_item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (m_mutex_update == false) { m_mutex_update = true; String db_file = m_maindb_update.doIt(jframe, Utilities.appLanguage(), Utilities.appCustomization(), m_application_data_folder, m_full_db_update); // ... and update time if (m_full_db_update == true) { DateTime dT = new DateTime(); m_prefs.put("updateTime", dT.now().toString()); } // if (!db_file.isEmpty()) { // Save db path (can't hurt) WindowSaver.setDbPath(db_file); } } } }); choosedb_item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { String db_file = m_maindb_update.chooseFromFile(jframe, Utilities.appLanguage(), Utilities.appCustomization(), m_application_data_folder); // ... and update time DateTime dT = new DateTime(); m_prefs.put("updateTime", dT.now().toString()); // if (!db_file.isEmpty()) { // Save db path (can't hurt) WindowSaver.setDbPath(db_file); } } }); /** * Observers */ // Attach observer to 'm_update' m_maindb_update.addObserver(new Observer() { @Override public void update(Observable o, Object arg) { System.out.println(arg); // Reset flag m_full_db_update = true; m_mutex_update = false; // Refresh some stuff after update loadAuthors(); m_emailer.loadMap(); settingsPage.load_gln_codes(); if (m_shopping_cart != null) { m_shopping_cart.load_conditions(); m_shopping_cart.load_glns(); } // Empty shopping basket if (m_curr_uistate.isShoppingMode()) { m_shopping_basket.clear(); int index = m_shopping_cart.getCartIndex(); if (index > 0) m_web_panel.saveShoppingCartWithIndex(index); m_web_panel.updateShoppingHtml(); } if (m_curr_uistate.isComparisonMode()) m_web_panel.setTitle(getTitle("priceComp")); } }); // Attach observer to 'm_emailer' m_emailer.addObserver(new Observer() { @Override public void update(Observable o, Object arg) { System.out.println(arg); // Empty shopping basket m_shopping_basket.clear(); int index = m_shopping_cart.getCartIndex(); if (index > 0) m_web_panel.saveShoppingCartWithIndex(index); m_web_panel.updateShoppingHtml(); } }); // Attach observer to "m_comparison_cart" m_comparison_cart.addObserver(new Observer() { @Override public void update(Observable o, Object arg) { System.out.println(arg); m_web_panel.setTitle(getTitle("priceComp")); m_comparison_cart.clearUploadList(); m_web_panel.updateComparisonCartHtml(); new AmiKoDialogs(Utilities.appLanguage(), Utilities.appCustomization()).UploadDialog((String) arg); } }); // If command line options are provided start app with a particular title or eancode if (commandLineOptionsProvided()) { if (!CML_OPT_TITLE.isEmpty()) startAppWithTitle(but_title); else if (!CML_OPT_EANCODE.isEmpty()) startAppWithEancode(but_regnr); else if (!CML_OPT_REGNR.isEmpty()) startAppWithRegnr(but_regnr); } // Start timer Timer global_timer = new Timer(); // Time checks all 2 minutes (120'000 milliseconds) global_timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { checkIfUpdateRequired(updatedb_item); } }, 2 * 60 * 1000, 2 * 60 * 1000); }
From source file:com.monead.semantic.workbench.SemanticWorkbench.java
/** * Create the edit menu//from w w w . ja va 2s .c o m * * @return The edit menu */ private JMenu setupEditMenu() { final JMenu menu = new JMenu("Edit"); menu.setMnemonic(KeyEvent.VK_E); menu.setToolTipText("Menu items related to editing the ontology"); editFind = new JMenuItem("Find (in assertions)"); editFind.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, KeyEvent.CTRL_MASK)); editFind.setMnemonic(KeyEvent.VK_F); editFind.setToolTipText("Find text in the assertions editor"); editFind.addActionListener(new FindAssertionsTextListener()); menu.add(editFind); editFindNextMatch = new JMenuItem("Next (matching assertion text)"); editFindNextMatch.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_MASK)); editFindNextMatch.setMnemonic(KeyEvent.VK_N); editFindNextMatch.setToolTipText("Find next text match in the assertions editor"); editFindNextMatch.addActionListener(new FindNextAssertionsTextListener()); menu.add(editFindNextMatch); menu.addSeparator(); editCommentToggle = new JMenuItem("Toggle Comment"); editCommentToggle.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, KeyEvent.CTRL_MASK)); editCommentToggle.setMnemonic(KeyEvent.VK_T); editCommentToggle .setToolTipText("Switch the chosen assertion or query lines between commented and not commented"); editCommentToggle.addActionListener(new CommentToggleListener()); editCommentToggle.setEnabled(false); menu.add(editCommentToggle); editInsertPrefixes = new JMenuItem("Insert Prefixes"); editInsertPrefixes.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, ActionEvent.CTRL_MASK)); editInsertPrefixes.setMnemonic(KeyEvent.VK_I); editInsertPrefixes.setToolTipText("Insert standard prefixes (namespaces)"); editInsertPrefixes.addActionListener(new InsertPrefixesListener()); menu.add(editInsertPrefixes); menu.addSeparator(); editExpandAllTreeNodes = new JMenuItem("Expand Entire Tree"); editExpandAllTreeNodes.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, ActionEvent.ALT_MASK)); editExpandAllTreeNodes.setMnemonic(KeyEvent.VK_E); editExpandAllTreeNodes.setToolTipText("Expand all tree nodes"); editExpandAllTreeNodes.addActionListener(new ExpandTreeListener()); menu.add(editExpandAllTreeNodes); editCollapseAllTreeNodes = new JMenuItem("Collapse Entire Tree"); editCollapseAllTreeNodes.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, ActionEvent.ALT_MASK)); editCollapseAllTreeNodes.setMnemonic(KeyEvent.VK_C); editCollapseAllTreeNodes.setToolTipText("Expand all tree nodes"); editCollapseAllTreeNodes.addActionListener(new CollapseTreeListener()); menu.add(editCollapseAllTreeNodes); menu.addSeparator(); editEditListOfSparqlServiceUrls = new JMenuItem("Edit SPARQL Service URLs List"); editEditListOfSparqlServiceUrls.setMnemonic(KeyEvent.VK_S); editEditListOfSparqlServiceUrls.setToolTipText("Remove unwanted URLs from the dropdown list"); editEditListOfSparqlServiceUrls.addActionListener(new EditListOfSparqlServiceUrls()); menu.add(editEditListOfSparqlServiceUrls); return menu; }
From source file:com.monead.semantic.workbench.SemanticWorkbench.java
/** * Create the model menu/*from www . java 2 s . co m*/ * * @return The model menu */ private JMenu setupModelMenu() { final JMenu menu = new JMenu("Model"); menu.setMnemonic(KeyEvent.VK_M); menu.setToolTipText("Menu items related to viewing the model"); modelCreateTreeView = new JMenuItem("Create Tree"); modelCreateTreeView.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, ActionEvent.ALT_MASK)); modelCreateTreeView.setMnemonic(KeyEvent.VK_T); modelCreateTreeView.setToolTipText("Create tree representation of current model"); modelCreateTreeView.addActionListener(new GenerateTreeListener()); menu.add(modelCreateTreeView); modelListInferredTriples = new JMenuItem("Identify Inferred Triples"); modelListInferredTriples.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, ActionEvent.ALT_MASK)); modelListInferredTriples.setMnemonic(KeyEvent.VK_I); modelListInferredTriples.setToolTipText("Create a list of inferred triples from the current model"); modelListInferredTriples.addActionListener(new GenerateInferredTriplesListener()); menu.add(modelListInferredTriples); menu.addSeparator(); filterResetTree = new JMenuItem("Clear Tree"); filterResetTree .setToolTipText("Remove the tree view of the ontology. This may help if memory is running low"); filterResetTree.addActionListener(new ClearTreeModelListener()); menu.add(filterResetTree); return menu; }