List of usage examples for javax.swing JMenuItem setIcon
@BeanProperty(visualUpdate = true, description = "The button's default icon") public void setIcon(Icon defaultIcon)
From source file:jeplus.JEPlusFrameMain.java
private void addMenuItemResultFile(String fn) { final File file = new File(BatchManager.getResolvedEnv().getParentDir() + fn); JMenuItem item = new JMenuItem(file.getName()); item.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jeplus/images/page_white_magnify.png"))); item.setToolTipText(file.getPath()); item.addActionListener(new ActionListener() { @Override//from w w w .ja va2 s. c o m public void actionPerformed(ActionEvent e) { //openViewTabForFile(file.getPath()); // Open it in associated application try { Desktop.getDesktop().open(file); } catch (Exception ex) { logger.error("Error open result file " + file.getAbsolutePath(), ex); JOptionPane.showMessageDialog(jMenuViewResult, "Cannot open " + file.getName() + " with the associated application.", "Operation failed", JOptionPane.INFORMATION_MESSAGE); } } }); this.jMenuViewResult.add(item); }
From source file:com.mirth.connect.client.ui.browsers.message.MessageBrowser.java
public void initComponentsManual() { attachmentPopupMenu = new JPopupMenu(); JMenuItem viewAttach = new JMenuItem("View Attachment"); viewAttach.setIcon(new ImageIcon(Frame.class.getResource("images/attach.png"))); viewAttach.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { viewAttachment();//from w w w. jav a 2 s . c om } }); attachmentPopupMenu.add(viewAttach); JMenuItem exportAttach = new JMenuItem("Export Attachment"); exportAttach.setIcon(new ImageIcon(Frame.class.getResource("images/report_disk.png"))); exportAttach.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { exportAttachment(); } }); attachmentPopupMenu.add(exportAttach); pageSizeField.setDocument(new MirthFieldConstraints(3, false, false, true)); pageNumberField.setDocument(new MirthFieldConstraints(7, false, false, true)); advancedSearchPopup = new MessageBrowserAdvancedFilter(parent, this, "Advanced Search Filter", true, true); advancedSearchPopup.setVisible(false); LineBorder lineBorder = new LineBorder(new Color(0, 0, 0)); TitledBorder titledBorder = new TitledBorder("Current Search"); titledBorder.setBorder(lineBorder); lastSearchCriteriaPane.setBorder(titledBorder); lastSearchCriteriaPane.setBackground(Color.white); lastSearchCriteria.setBackground(Color.white); mirthDatePicker1.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent arg0) { allDayCheckBox.setEnabled(mirthDatePicker1.getDate() != null || mirthDatePicker2.getDate() != null); mirthTimePicker1.setEnabled(mirthDatePicker1.getDate() != null && !allDayCheckBox.isSelected()); } }); mirthDatePicker2.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent arg0) { allDayCheckBox.setEnabled(mirthDatePicker1.getDate() != null || mirthDatePicker2.getDate() != null); mirthTimePicker2.setEnabled(mirthDatePicker2.getDate() != null && !allDayCheckBox.isSelected()); } }); pageNumberField.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent arg0) { if (arg0.getKeyCode() == KeyEvent.VK_ENTER && pageGoButton.isEnabled()) { jumpToPageNumber(); } } }); if (!Arrays.asList("postgres", "oracle", "mysql").contains(PlatformUI.SERVER_DATABASE)) { regexTextSearchCheckBox.setEnabled(false); } this.addAncestorListener(new AncestorListener() { @Override public void ancestorAdded(AncestorEvent event) { } @Override public void ancestorMoved(AncestorEvent event) { } @Override public void ancestorRemoved(AncestorEvent event) { // Stop waiting for message browser requests when the message browser // is no longer being displayed parent.mirthClient.getServerConnection().abort(getAbortOperations()); // Clear the message cache when leaving the message browser. parent.messageBrowser.clearCache(); // Clear the table selection to prevent the selection listener from triggering multiple times while the model is being cleared deselectRows(); // Clear the records in the table tableModel.clear(); // Remove all columns for (TableColumn tableColumn : messageTreeTable.getColumns(true)) { messageTreeTable.removeColumn(tableColumn); } } }); }
From source file:com.hexidec.ekit.EkitCore.java
/** * Master Constructor/*from w ww . jav a2 s .c om*/ * * @param sDocument * [String] A text or HTML document to load in the editor upon * startup. * @param sStyleSheet * [String] A CSS stylesheet to load in the editor upon startup. * @param sRawDocument * [String] A document encoded as a String to load in the editor * upon startup. * @param sdocSource * [StyledDocument] Optional document specification, using * javax.swing.text.StyledDocument. * @param urlStyleSheet * [URL] A URL reference to the CSS style sheet. * @param includeToolBar * [boolean] Specifies whether the app should include the * toolbar(s). * @param showViewSource * [boolean] Specifies whether or not to show the View Source * window on startup. * @param showMenuIcons * [boolean] Specifies whether or not to show icon pictures in * menus. * @param sLanguage * [String] The language portion of the Internationalization * Locale to run Ekit in. * @param sCountry * [String] The country portion of the Internationalization * Locale to run Ekit in. * @param base64 * [boolean] Specifies whether the raw document is Base64 encoded * or not. * @param debugMode * [boolean] Specifies whether to show the Debug menu or not. * @param hasSpellChecker * [boolean] Specifies whether or not this uses the SpellChecker * module * @param multiBar * [boolean] Specifies whether to use multiple toolbars or one * big toolbar. * @param toolbarSeq * [String] Code string specifying the toolbar buttons to show. * @param keepUnknownTags * [boolean] Specifies whether or not the parser should retain * unknown tags. * @param enterBreak * [boolean] Specifies whether the ENTER key should insert breaks * instead of paragraph tags. * @param inlineEdit * [boolean] Should edit inline content only (no line breaks) */ public EkitCore(boolean isParentApplet, String sDocument, String sStyleSheet, String sRawDocument, StyledDocument sdocSource, URL urlStyleSheet, boolean includeToolBar, boolean showViewSource, boolean showMenuIcons, String sLanguage, String sCountry, boolean base64, boolean debugMode, boolean hasSpellChecker, boolean multiBar, String toolbarSeq, boolean keepUnknownTags, boolean enterBreak, boolean inlineEdit, List<HTMLDocumentBehavior> behaviors) { super(); if (behaviors != null) { this.behaviors.addAll(behaviors); } preserveUnknownTags = keepUnknownTags; enterIsBreak = enterBreak; this.inlineEdit = inlineEdit; frameHandler = new Frame(); // Determine if system clipboard is available (SecurityManager version) /* * SecurityManager secManager = System.getSecurityManager(); * if(secManager != null) { try { * secManager.checkSystemClipboardAccess(); sysClipboard = * Toolkit.getDefaultToolkit().getSystemClipboard(); } * catch(SecurityException se) { sysClipboard = null; } } */ // Obtain system clipboard if available try { sysClipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); } catch (Exception ex) { sysClipboard = null; } // Plain text DataFlavor for unformatted paste try { dfPlainText = new DataFlavor("text/plain; class=java.lang.String; charset=Unicode"); // Charsets // usually // available // include // Unicode, // UTF-16, // UTF-8, // & // US-ASCII } catch (ClassNotFoundException cnfe) { // it would be nice to use DataFlavor.plainTextFlavor, but that is // deprecated // this will not work as desired, but it will prevent errors from // being thrown later // alternately, we could flag up here that Unformatted Paste is not // available and adjust the UI accordingly // however, the odds of java.lang.String not being found are pretty // slim one imagines dfPlainText = DataFlavor.stringFlavor; } /* Localize for language */ Locale baseLocale = Locale.getDefault(); if (sLanguage != null && sCountry != null) { baseLocale = new Locale(sLanguage, sCountry); } Translatrix.init("EkitLanguageResources", baseLocale); /* Initialise system-specific control key value */ if (!(GraphicsEnvironment.isHeadless())) { CTRLKEY = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); } /* Create the editor kit, document, and stylesheet */ jtpMain = new EkitTextPane(); htmlKit = new ExtendedHTMLEditorKit(); htmlDoc = (ExtendedHTMLDocument) (htmlKit.createDefaultDocument()); htmlDoc.putProperty("IgnoreCharsetDirective", Boolean.TRUE); htmlDoc.setPreservesUnknownTags(preserveUnknownTags); styleSheet = htmlDoc.getStyleSheet(); htmlKit.setDefaultCursor(new Cursor(Cursor.TEXT_CURSOR)); jtpMain.setCursor(new Cursor(Cursor.TEXT_CURSOR)); /* Set up the text pane */ jtpMain.setEditorKit(htmlKit); jtpMain.setDocument(htmlDoc); // jtpMain.addMouseMotionListener(new EkitMouseMotionListener()); jtpMain.addFocusListener(this); jtpMain.setMargin(new Insets(4, 4, 4, 4)); jtpMain.addKeyListener(this); // jtpMain.setDragEnabled(true); // this causes an error in older Java // versions /* Create the source text area */ if (sdocSource == null) { jtpSource = new JTextArea(); jtpSource.setText(jtpMain.getText()); } else { jtpSource = new JTextArea(sdocSource); jtpMain.setText(jtpSource.getText()); } jtpSource.setBackground(new Color(212, 212, 212)); jtpSource.setSelectionColor(new Color(255, 192, 192)); jtpSource.setMargin(new Insets(4, 4, 4, 4)); jtpSource.getDocument().addDocumentListener(this); jtpSource.addFocusListener(this); jtpSource.setCursor(new Cursor(Cursor.TEXT_CURSOR)); jtpSource.setColumns(1024); jtpSource.setEditable(false); /* Add CaretListener for tracking caret location events */ jtpMain.addCaretListener(new CaretListener() { public void caretUpdate(CaretEvent ce) { handleCaretPositionChange(ce); } }); // Default text if (!inlineEdit) { setDocumentText("<p></p>"); } /* Set up the undo features */ undoMngr = new UndoManager(); undoAction = new UndoAction(); redoAction = new RedoAction(); jtpMain.getDocument().addUndoableEditListener(new CustomUndoableEditListener()); /* Insert raw document, if exists */ if (sRawDocument != null && sRawDocument.length() > 0) { if (base64) { jtpMain.setText(Base64Codec.decode(sRawDocument)); } else { jtpMain.setText(sRawDocument); } } jtpMain.setCaretPosition(0); jtpMain.getDocument().addDocumentListener(this); /* Import CSS from reference, if exists */ if (urlStyleSheet != null) { try { String currDocText = jtpMain.getText(); htmlDoc = (ExtendedHTMLDocument) (htmlKit.createDefaultDocument()); htmlDoc.putProperty("IgnoreCharsetDirective", Boolean.TRUE); htmlDoc.setPreservesUnknownTags(preserveUnknownTags); styleSheet = htmlDoc.getStyleSheet(); BufferedReader br = new BufferedReader(new InputStreamReader(urlStyleSheet.openStream())); styleSheet.loadRules(br, urlStyleSheet); br.close(); htmlDoc = new ExtendedHTMLDocument(styleSheet); registerDocument(htmlDoc); jtpMain.setText(currDocText); jtpSource.setText(jtpMain.getText()); } catch (Exception e) { log.error(e.getMessage(), e); } } /* Preload the specified HTML document, if exists */ if (sDocument != null) { File defHTML = new File(sDocument); if (defHTML.exists()) { try { openDocument(defHTML); } catch (Exception e) { logException("Exception in preloading HTML document", e); } } } /* Preload the specified CSS document, if exists */ if (sStyleSheet != null) { File defCSS = new File(sStyleSheet); if (defCSS.exists()) { try { openStyleSheet(defCSS); } catch (Exception e) { logException("Exception in preloading CSS stylesheet", e); } } } /* Collect the actions that the JTextPane is naturally aware of */ Hashtable<Object, Action> actions = new Hashtable<Object, Action>(); Action[] actionsArray = jtpMain.getActions(); for (Action a : actionsArray) { actions.put(a.getValue(Action.NAME), a); } /* Create shared actions */ actionFontBold = new StyledEditorKit.BoldAction(); actionFontItalic = new StyledEditorKit.ItalicAction(); actionFontUnderline = new StyledEditorKit.UnderlineAction(); actionFontStrike = new FormatAction(this, Translatrix.getTranslationString("FontStrike"), HTML.Tag.STRIKE); actionFontSuperscript = new FormatAction(this, Translatrix.getTranslationString("FontSuperscript"), HTML.Tag.SUP); actionFontSubscript = new FormatAction(this, Translatrix.getTranslationString("FontSubscript"), HTML.Tag.SUB); actionListUnordered = new ListAutomationAction(this, Translatrix.getTranslationString("ListUnordered"), HTML.Tag.UL); actionListOrdered = new ListAutomationAction(this, Translatrix.getTranslationString("ListOrdered"), HTML.Tag.OL); actionSelectFont = new SetFontFamilyAction(this, "[MENUFONTSELECTOR]"); actionAlignLeft = new AlignmentAction(Translatrix.getTranslationString("AlignLeft"), StyleConstants.ALIGN_LEFT); actionAlignCenter = new AlignmentAction(Translatrix.getTranslationString("AlignCenter"), StyleConstants.ALIGN_CENTER); actionAlignRight = new AlignmentAction(Translatrix.getTranslationString("AlignRight"), StyleConstants.ALIGN_RIGHT); actionAlignJustified = new AlignmentAction(Translatrix.getTranslationString("AlignJustified"), StyleConstants.ALIGN_JUSTIFIED); actionInsertAnchor = new CustomAction(this, Translatrix.getTranslationString("InsertAnchor") + menuDialog, HTML.Tag.A); actionClearFormat = new ClearFormatAction(this); actionSpecialChar = new SpecialCharAction(this); // actionTableButtonMenu Action actionTableInsert = new CommandAction(Translatrix.getTranslationString("InsertTable") + menuDialog, getEkitIcon("TableCreate"), CMD_TABLE_INSERT, this); Action actionTableDelete = new CommandAction(Translatrix.getTranslationString("DeleteTable"), getEkitIcon("TableDelete"), CMD_TABLE_DELETE, this); Action actionTableRow = new CommandAction(Translatrix.getTranslationString("InsertTableRow"), getEkitIcon("InsertRow"), CMD_TABLE_ROW_INSERT, this); Action actionTableRowAfter = new CommandAction(Translatrix.getTranslationString("InsertTableRowAfter"), getEkitIcon("InsertRowAfter"), CMD_TABLE_ROW_INSERT_AFTER, this); Action actionTableCol = new CommandAction(Translatrix.getTranslationString("InsertTableColumn"), getEkitIcon("InsertColumn"), CMD_TABLE_COLUMN_INSERT, this); Action actionTableColAfter = new CommandAction(Translatrix.getTranslationString("InsertTableColumnAfter"), getEkitIcon("InsertColumnAfter"), CMD_TABLE_COLUMN_INSERT_AFTER, this); Action actionTableRowDel = new CommandAction(Translatrix.getTranslationString("DeleteTableRow"), getEkitIcon("DeleteRow"), CMD_TABLE_ROW_DELETE, this); Action actionTableColDel = new CommandAction(Translatrix.getTranslationString("DeleteTableColumn"), getEkitIcon("DeleteColumn"), CMD_TABLE_COLUMN_DELETE, this); Action actionTableColFmt = new CommandAction(Translatrix.getTranslationString("FormatTableColumn"), getEkitIcon("FormatColumn"), CMD_TABLE_COLUMN_FORMAT, this); actionTableButtonMenu = new ButtonMenuAction(Translatrix.getTranslationString("TableMenu"), getEkitIcon("TableMenu"), actionTableInsert, actionTableDelete, null, actionTableRow, actionTableRowAfter, actionTableCol, actionTableColAfter, null, actionTableRowDel, actionTableColDel, null, actionTableColFmt); /* Build the menus */ /* FILE Menu */ jMenuFile = new JMenu(Translatrix.getTranslationString("File")); htMenus.put(KEY_MENU_FILE, jMenuFile); JMenuItem jmiNew = new JMenuItem(Translatrix.getTranslationString("NewDocument")); jmiNew.setActionCommand(CMD_DOC_NEW); jmiNew.addActionListener(this); jmiNew.setAccelerator(KeyStroke.getKeyStroke('N', CTRLKEY, false)); if (showMenuIcons) { jmiNew.setIcon(getEkitIcon("New")); } ; jMenuFile.add(jmiNew); JMenuItem jmiNewStyled = new JMenuItem(Translatrix.getTranslationString("NewStyledDocument")); jmiNewStyled.setActionCommand(CMD_DOC_NEW_STYLED); jmiNewStyled.addActionListener(this); if (showMenuIcons) { jmiNewStyled.setIcon(getEkitIcon("NewStyled")); } ; jMenuFile.add(jmiNewStyled); JMenuItem jmiOpenHTML = new JMenuItem(Translatrix.getTranslationString("OpenDocument") + menuDialog); jmiOpenHTML.setActionCommand(CMD_DOC_OPEN_HTML); jmiOpenHTML.addActionListener(this); jmiOpenHTML.setAccelerator(KeyStroke.getKeyStroke('O', CTRLKEY, false)); if (showMenuIcons) { jmiOpenHTML.setIcon(getEkitIcon("Open")); } ; jMenuFile.add(jmiOpenHTML); JMenuItem jmiOpenCSS = new JMenuItem(Translatrix.getTranslationString("OpenStyle") + menuDialog); jmiOpenCSS.setActionCommand(CMD_DOC_OPEN_CSS); jmiOpenCSS.addActionListener(this); jMenuFile.add(jmiOpenCSS); jMenuFile.addSeparator(); JMenuItem jmiSave = new JMenuItem(Translatrix.getTranslationString("Save")); jmiSave.setActionCommand(CMD_DOC_SAVE); jmiSave.addActionListener(this); jmiSave.setAccelerator(KeyStroke.getKeyStroke('S', CTRLKEY, false)); if (showMenuIcons) { jmiSave.setIcon(getEkitIcon("Save")); } ; jMenuFile.add(jmiSave); JMenuItem jmiSaveAs = new JMenuItem(Translatrix.getTranslationString("SaveAs") + menuDialog); jmiSaveAs.setActionCommand(CMD_DOC_SAVE_AS); jmiSaveAs.addActionListener(this); jMenuFile.add(jmiSaveAs); JMenuItem jmiSaveBody = new JMenuItem(Translatrix.getTranslationString("SaveBody") + menuDialog); jmiSaveBody.setActionCommand(CMD_DOC_SAVE_BODY); jmiSaveBody.addActionListener(this); jMenuFile.add(jmiSaveBody); JMenuItem jmiSaveRTF = new JMenuItem(Translatrix.getTranslationString("SaveRTF") + menuDialog); jmiSaveRTF.setActionCommand(CMD_DOC_SAVE_RTF); jmiSaveRTF.addActionListener(this); jMenuFile.add(jmiSaveRTF); jMenuFile.addSeparator(); JMenuItem jmiPrint = new JMenuItem(Translatrix.getTranslationString("Print")); jmiPrint.setActionCommand(CMD_DOC_PRINT); jmiPrint.addActionListener(this); jMenuFile.add(jmiPrint); jMenuFile.addSeparator(); JMenuItem jmiSerialOut = new JMenuItem(Translatrix.getTranslationString("Serialize") + menuDialog); jmiSerialOut.setActionCommand(CMD_DOC_SERIALIZE_OUT); jmiSerialOut.addActionListener(this); jMenuFile.add(jmiSerialOut); JMenuItem jmiSerialIn = new JMenuItem(Translatrix.getTranslationString("ReadFromSer") + menuDialog); jmiSerialIn.setActionCommand(CMD_DOC_SERIALIZE_IN); jmiSerialIn.addActionListener(this); jMenuFile.add(jmiSerialIn); jMenuFile.addSeparator(); JMenuItem jmiExit = new JMenuItem(Translatrix.getTranslationString("Exit")); jmiExit.setActionCommand(CMD_EXIT); jmiExit.addActionListener(this); jMenuFile.add(jmiExit); /* EDIT Menu */ jMenuEdit = new JMenu(Translatrix.getTranslationString("Edit")); htMenus.put(KEY_MENU_EDIT, jMenuEdit); if (sysClipboard != null) { // System Clipboard versions of menu commands JMenuItem jmiCut = new JMenuItem(Translatrix.getTranslationString("Cut")); jmiCut.setActionCommand(CMD_CLIP_CUT); jmiCut.addActionListener(this); jmiCut.setAccelerator(KeyStroke.getKeyStroke('X', CTRLKEY, false)); if (showMenuIcons) { jmiCut.setIcon(getEkitIcon("Cut")); } jMenuEdit.add(jmiCut); JMenuItem jmiCopy = new JMenuItem(Translatrix.getTranslationString("Copy")); jmiCopy.setActionCommand(CMD_CLIP_COPY); jmiCopy.addActionListener(this); jmiCopy.setAccelerator(KeyStroke.getKeyStroke('C', CTRLKEY, false)); if (showMenuIcons) { jmiCopy.setIcon(getEkitIcon("Copy")); } jMenuEdit.add(jmiCopy); JMenuItem jmiPaste = new JMenuItem(Translatrix.getTranslationString("Paste")); jmiPaste.setActionCommand(CMD_CLIP_PASTE); jmiPaste.addActionListener(this); jmiPaste.setAccelerator(KeyStroke.getKeyStroke('V', CTRLKEY, false)); if (showMenuIcons) { jmiPaste.setIcon(getEkitIcon("Paste")); } jMenuEdit.add(jmiPaste); JMenuItem jmiPasteX = new JMenuItem(Translatrix.getTranslationString("PasteUnformatted")); jmiPasteX.setActionCommand(CMD_CLIP_PASTE_PLAIN); jmiPasteX.addActionListener(this); jmiPasteX.setAccelerator(KeyStroke.getKeyStroke('V', CTRLKEY + KeyEvent.SHIFT_MASK, false)); if (showMenuIcons) { jmiPasteX.setIcon(getEkitIcon("PasteUnformatted")); } jMenuEdit.add(jmiPasteX); } else { // DefaultEditorKit versions of menu commands JMenuItem jmiCut = new JMenuItem(new DefaultEditorKit.CutAction()); jmiCut.setText(Translatrix.getTranslationString("Cut")); jmiCut.setAccelerator(KeyStroke.getKeyStroke('X', CTRLKEY, false)); if (showMenuIcons) { jmiCut.setIcon(getEkitIcon("Cut")); } jMenuEdit.add(jmiCut); JMenuItem jmiCopy = new JMenuItem(new DefaultEditorKit.CopyAction()); jmiCopy.setText(Translatrix.getTranslationString("Copy")); jmiCopy.setAccelerator(KeyStroke.getKeyStroke('C', CTRLKEY, false)); if (showMenuIcons) { jmiCopy.setIcon(getEkitIcon("Copy")); } jMenuEdit.add(jmiCopy); JMenuItem jmiPaste = new JMenuItem(new DefaultEditorKit.PasteAction()); jmiPaste.setText(Translatrix.getTranslationString("Paste")); jmiPaste.setAccelerator(KeyStroke.getKeyStroke('V', CTRLKEY, false)); if (showMenuIcons) { jmiPaste.setIcon(getEkitIcon("Paste")); } jMenuEdit.add(jmiPaste); JMenuItem jmiPasteX = new JMenuItem(Translatrix.getTranslationString("PasteUnformatted")); jmiPasteX.setActionCommand(CMD_CLIP_PASTE_PLAIN); jmiPasteX.addActionListener(this); jmiPasteX.setAccelerator(KeyStroke.getKeyStroke('V', CTRLKEY + KeyEvent.SHIFT_MASK, false)); if (showMenuIcons) { jmiPasteX.setIcon(getEkitIcon("PasteUnformatted")); } jMenuEdit.add(jmiPasteX); } jMenuEdit.addSeparator(); JMenuItem jmiUndo = new JMenuItem(undoAction); jmiUndo.setAccelerator(KeyStroke.getKeyStroke('Z', CTRLKEY, false)); if (showMenuIcons) { jmiUndo.setIcon(getEkitIcon("Undo")); } jMenuEdit.add(jmiUndo); JMenuItem jmiRedo = new JMenuItem(redoAction); jmiRedo.setAccelerator(KeyStroke.getKeyStroke('Y', CTRLKEY, false)); if (showMenuIcons) { jmiRedo.setIcon(getEkitIcon("Redo")); } jMenuEdit.add(jmiRedo); jMenuEdit.addSeparator(); JMenuItem jmiSelAll = new JMenuItem((Action) actions.get(DefaultEditorKit.selectAllAction)); jmiSelAll.setText(Translatrix.getTranslationString("SelectAll")); jmiSelAll.setAccelerator(KeyStroke.getKeyStroke('A', CTRLKEY, false)); jMenuEdit.add(jmiSelAll); JMenuItem jmiSelPara = new JMenuItem((Action) actions.get(DefaultEditorKit.selectParagraphAction)); jmiSelPara.setText(Translatrix.getTranslationString("SelectParagraph")); jMenuEdit.add(jmiSelPara); JMenuItem jmiSelLine = new JMenuItem((Action) actions.get(DefaultEditorKit.selectLineAction)); jmiSelLine.setText(Translatrix.getTranslationString("SelectLine")); jMenuEdit.add(jmiSelLine); JMenuItem jmiSelWord = new JMenuItem((Action) actions.get(DefaultEditorKit.selectWordAction)); jmiSelWord.setText(Translatrix.getTranslationString("SelectWord")); jMenuEdit.add(jmiSelWord); jMenuEdit.addSeparator(); JMenu jMenuEnterKey = new JMenu(Translatrix.getTranslationString("EnterKeyMenu")); jcbmiEnterKeyParag = new JCheckBoxMenuItem(Translatrix.getTranslationString("EnterKeyParag"), !enterIsBreak); jcbmiEnterKeyParag.setActionCommand(CMD_ENTER_PARAGRAPH); jcbmiEnterKeyParag.addActionListener(this); jMenuEnterKey.add(jcbmiEnterKeyParag); jcbmiEnterKeyBreak = new JCheckBoxMenuItem(Translatrix.getTranslationString("EnterKeyBreak"), enterIsBreak); jcbmiEnterKeyBreak.setActionCommand(CMD_ENTER_BREAK); jcbmiEnterKeyBreak.addActionListener(this); jMenuEnterKey.add(jcbmiEnterKeyBreak); jMenuEdit.add(jMenuEnterKey); /* VIEW Menu */ jMenuView = new JMenu(Translatrix.getTranslationString("View")); htMenus.put(KEY_MENU_VIEW, jMenuView); if (includeToolBar) { if (multiBar) { jMenuToolbars = new JMenu(Translatrix.getTranslationString("ViewToolbars")); jcbmiViewToolbarMain = new JCheckBoxMenuItem(Translatrix.getTranslationString("ViewToolbarMain"), false); jcbmiViewToolbarMain.setActionCommand(CMD_TOGGLE_TOOLBAR_MAIN); jcbmiViewToolbarMain.addActionListener(this); jMenuToolbars.add(jcbmiViewToolbarMain); jcbmiViewToolbarFormat = new JCheckBoxMenuItem( Translatrix.getTranslationString("ViewToolbarFormat"), false); jcbmiViewToolbarFormat.setActionCommand(CMD_TOGGLE_TOOLBAR_FORMAT); jcbmiViewToolbarFormat.addActionListener(this); jMenuToolbars.add(jcbmiViewToolbarFormat); jcbmiViewToolbarStyles = new JCheckBoxMenuItem( Translatrix.getTranslationString("ViewToolbarStyles"), false); jcbmiViewToolbarStyles.setActionCommand(CMD_TOGGLE_TOOLBAR_STYLES); jcbmiViewToolbarStyles.addActionListener(this); jMenuToolbars.add(jcbmiViewToolbarStyles); jMenuView.add(jMenuToolbars); } else { jcbmiViewToolbar = new JCheckBoxMenuItem(Translatrix.getTranslationString("ViewToolbar"), false); jcbmiViewToolbar.setActionCommand(CMD_TOGGLE_TOOLBAR_SINGLE); jcbmiViewToolbar.addActionListener(this); jMenuView.add(jcbmiViewToolbar); } } jcbmiViewSource = new JCheckBoxMenuItem(Translatrix.getTranslationString("ViewSource"), false); jcbmiViewSource.setActionCommand(CMD_TOGGLE_SOURCE_VIEW); jcbmiViewSource.addActionListener(this); jMenuView.add(jcbmiViewSource); /* FONT Menu */ jMenuFont = new JMenu(Translatrix.getTranslationString("Font")); htMenus.put(KEY_MENU_FONT, jMenuFont); JMenuItem jmiBold = new JMenuItem(actionFontBold); jmiBold.setText(Translatrix.getTranslationString("FontBold")); jmiBold.setAccelerator(KeyStroke.getKeyStroke('B', CTRLKEY, false)); if (showMenuIcons) { jmiBold.setIcon(getEkitIcon("Bold")); } jMenuFont.add(jmiBold); JMenuItem jmiItalic = new JMenuItem(actionFontItalic); jmiItalic.setText(Translatrix.getTranslationString("FontItalic")); jmiItalic.setAccelerator(KeyStroke.getKeyStroke('I', CTRLKEY, false)); if (showMenuIcons) { jmiItalic.setIcon(getEkitIcon("Italic")); } jMenuFont.add(jmiItalic); JMenuItem jmiUnderline = new JMenuItem(actionFontUnderline); jmiUnderline.setText(Translatrix.getTranslationString("FontUnderline")); jmiUnderline.setAccelerator(KeyStroke.getKeyStroke('U', CTRLKEY, false)); if (showMenuIcons) { jmiUnderline.setIcon(getEkitIcon("Underline")); } jMenuFont.add(jmiUnderline); JMenuItem jmiStrike = new JMenuItem(actionFontStrike); jmiStrike.setText(Translatrix.getTranslationString("FontStrike")); if (showMenuIcons) { jmiStrike.setIcon(getEkitIcon("Strike")); } jMenuFont.add(jmiStrike); JMenuItem jmiSupscript = new JMenuItem(actionFontSuperscript); if (showMenuIcons) { jmiSupscript.setIcon(getEkitIcon("Super")); } jMenuFont.add(jmiSupscript); JMenuItem jmiSubscript = new JMenuItem(actionFontSubscript); if (showMenuIcons) { jmiSubscript.setIcon(getEkitIcon("Sub")); } jMenuFont.add(jmiSubscript); jMenuFont.addSeparator(); jMenuFont.add( new JMenuItem(new FormatAction(this, Translatrix.getTranslationString("FormatBig"), HTML.Tag.BIG))); jMenuFont.add(new JMenuItem( new FormatAction(this, Translatrix.getTranslationString("FormatSmall"), HTML.Tag.SMALL))); JMenu jMenuFontSize = new JMenu(Translatrix.getTranslationString("FontSize")); jMenuFontSize.add(new JMenuItem( new StyledEditorKit.FontSizeAction(Translatrix.getTranslationString("FontSize1"), 8))); jMenuFontSize.add(new JMenuItem( new StyledEditorKit.FontSizeAction(Translatrix.getTranslationString("FontSize2"), 10))); jMenuFontSize.add(new JMenuItem( new StyledEditorKit.FontSizeAction(Translatrix.getTranslationString("FontSize3"), 12))); jMenuFontSize.add(new JMenuItem( new StyledEditorKit.FontSizeAction(Translatrix.getTranslationString("FontSize4"), 14))); jMenuFontSize.add(new JMenuItem( new StyledEditorKit.FontSizeAction(Translatrix.getTranslationString("FontSize5"), 18))); jMenuFontSize.add(new JMenuItem( new StyledEditorKit.FontSizeAction(Translatrix.getTranslationString("FontSize6"), 24))); jMenuFontSize.add(new JMenuItem( new StyledEditorKit.FontSizeAction(Translatrix.getTranslationString("FontSize7"), 32))); jMenuFont.add(jMenuFontSize); jMenuFont.addSeparator(); JMenu jMenuFontSub = new JMenu(Translatrix.getTranslationString("Font")); JMenuItem jmiSelectFont = new JMenuItem(actionSelectFont); jmiSelectFont.setText(Translatrix.getTranslationString("FontSelect") + menuDialog); if (showMenuIcons) { jmiSelectFont.setIcon(getEkitIcon("FontFaces")); } jMenuFontSub.add(jmiSelectFont); JMenuItem jmiSerif = new JMenuItem((Action) actions.get("font-family-Serif")); jmiSerif.setText(Translatrix.getTranslationString("FontSerif")); jMenuFontSub.add(jmiSerif); JMenuItem jmiSansSerif = new JMenuItem((Action) actions.get("font-family-SansSerif")); jmiSansSerif.setText(Translatrix.getTranslationString("FontSansserif")); jMenuFontSub.add(jmiSansSerif); JMenuItem jmiMonospaced = new JMenuItem((Action) actions.get("font-family-Monospaced")); jmiMonospaced.setText(Translatrix.getTranslationString("FontMonospaced")); jMenuFontSub.add(jmiMonospaced); jMenuFont.add(jMenuFontSub); jMenuFont.addSeparator(); JMenu jMenuFontColor = new JMenu(Translatrix.getTranslationString("Color")); Hashtable<String, String> customAttr = new Hashtable<String, String>(); customAttr.put("color", "black"); jMenuFontColor.add(new JMenuItem(new CustomAction(this, Translatrix.getTranslationString("CustomColor") + menuDialog, HTML.Tag.FONT, customAttr))); jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction( Translatrix.getTranslationString("ColorAqua"), new Color(0, 255, 255)))); jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction( Translatrix.getTranslationString("ColorBlack"), new Color(0, 0, 0)))); jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction( Translatrix.getTranslationString("ColorBlue"), new Color(0, 0, 255)))); jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction( Translatrix.getTranslationString("ColorFuschia"), new Color(255, 0, 255)))); jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction( Translatrix.getTranslationString("ColorGray"), new Color(128, 128, 128)))); jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction( Translatrix.getTranslationString("ColorGreen"), new Color(0, 128, 0)))); jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction( Translatrix.getTranslationString("ColorLime"), new Color(0, 255, 0)))); jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction( Translatrix.getTranslationString("ColorMaroon"), new Color(128, 0, 0)))); jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction( Translatrix.getTranslationString("ColorNavy"), new Color(0, 0, 128)))); jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction( Translatrix.getTranslationString("ColorOlive"), new Color(128, 128, 0)))); jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction( Translatrix.getTranslationString("ColorPurple"), new Color(128, 0, 128)))); jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction( Translatrix.getTranslationString("ColorRed"), new Color(255, 0, 0)))); jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction( Translatrix.getTranslationString("ColorSilver"), new Color(192, 192, 192)))); jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction( Translatrix.getTranslationString("ColorTeal"), new Color(0, 128, 128)))); jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction( Translatrix.getTranslationString("ColorWhite"), new Color(255, 255, 255)))); jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction( Translatrix.getTranslationString("ColorYellow"), new Color(255, 255, 0)))); jMenuFont.add(jMenuFontColor); /* FORMAT Menu */ jMenuFormat = new JMenu(Translatrix.getTranslationString("Format")); htMenus.put(KEY_MENU_FORMAT, jMenuFormat); JMenuItem jmiClearFormat = new JMenuItem(actionClearFormat); jMenuFormat.add(jmiClearFormat); jMenuFormat.addSeparator(); JMenu jMenuFormatAlign = new JMenu(Translatrix.getTranslationString("Align")); JMenuItem jmiAlignLeft = new JMenuItem(actionAlignLeft); if (showMenuIcons) { jmiAlignLeft.setIcon(getEkitIcon("AlignLeft")); } ; jMenuFormatAlign.add(jmiAlignLeft); JMenuItem jmiAlignCenter = new JMenuItem(actionAlignCenter); if (showMenuIcons) { jmiAlignCenter.setIcon(getEkitIcon("AlignCenter")); } ; jMenuFormatAlign.add(jmiAlignCenter); JMenuItem jmiAlignRight = new JMenuItem(actionAlignRight); if (showMenuIcons) { jmiAlignRight.setIcon(getEkitIcon("AlignRight")); } ; jMenuFormatAlign.add(jmiAlignRight); JMenuItem jmiAlignJustified = new JMenuItem(actionAlignJustified); if (showMenuIcons) { jmiAlignJustified.setIcon(getEkitIcon("AlignJustified")); } ; jMenuFormatAlign.add(jmiAlignJustified); jMenuFormat.add(jMenuFormatAlign); jMenuFormat.addSeparator(); JMenu jMenuFormatHeading = new JMenu(Translatrix.getTranslationString("Heading")); jMenuFormatHeading.add( new JMenuItem(new FormatAction(this, Translatrix.getTranslationString("Heading1"), HTML.Tag.H1))); jMenuFormatHeading.add( new JMenuItem(new FormatAction(this, Translatrix.getTranslationString("Heading2"), HTML.Tag.H2))); jMenuFormatHeading.add( new JMenuItem(new FormatAction(this, Translatrix.getTranslationString("Heading3"), HTML.Tag.H3))); jMenuFormatHeading.add( new JMenuItem(new FormatAction(this, Translatrix.getTranslationString("Heading4"), HTML.Tag.H4))); jMenuFormatHeading.add( new JMenuItem(new FormatAction(this, Translatrix.getTranslationString("Heading5"), HTML.Tag.H5))); jMenuFormatHeading.add( new JMenuItem(new FormatAction(this, Translatrix.getTranslationString("Heading6"), HTML.Tag.H6))); jMenuFormat.add(jMenuFormatHeading); jMenuFormat.addSeparator(); JMenuItem jmiUList = new JMenuItem(actionListUnordered); if (showMenuIcons) { jmiUList.setIcon(getEkitIcon("UList")); } jMenuFormat.add(jmiUList); JMenuItem jmiOList = new JMenuItem(actionListOrdered); if (showMenuIcons) { jmiOList.setIcon(getEkitIcon("OList")); } jMenuFormat.add(jmiOList); jMenuFormat.add( new JMenuItem(new FormatAction(this, Translatrix.getTranslationString("ListItem"), HTML.Tag.LI))); jMenuFormat.addSeparator(); jMenuFormat.add(new JMenuItem( new FormatAction(this, Translatrix.getTranslationString("FormatBlockquote"), HTML.Tag.BLOCKQUOTE))); jMenuFormat.add( new JMenuItem(new FormatAction(this, Translatrix.getTranslationString("FormatPre"), HTML.Tag.PRE))); jMenuFormat.add(new JMenuItem( new FormatAction(this, Translatrix.getTranslationString("FormatStrong"), HTML.Tag.STRONG))); jMenuFormat.add(new JMenuItem( new FormatAction(this, Translatrix.getTranslationString("FormatEmphasis"), HTML.Tag.EM))); jMenuFormat.add( new JMenuItem(new FormatAction(this, Translatrix.getTranslationString("FormatTT"), HTML.Tag.TT))); jMenuFormat.add(new JMenuItem( new FormatAction(this, Translatrix.getTranslationString("FormatSpan"), HTML.Tag.SPAN))); /* INSERT Menu */ jMenuInsert = new JMenu(Translatrix.getTranslationString("Insert")); htMenus.put(KEY_MENU_INSERT, jMenuInsert); JMenuItem jmiInsertAnchor = new JMenuItem(actionInsertAnchor); if (showMenuIcons) { jmiInsertAnchor.setIcon(getEkitIcon("Anchor")); } ; jMenuInsert.add(jmiInsertAnchor); JMenuItem jmiBreak = new JMenuItem(Translatrix.getTranslationString("InsertBreak")); jmiBreak.setActionCommand(CMD_INSERT_BREAK); jmiBreak.addActionListener(this); jmiBreak.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, KeyEvent.SHIFT_MASK, false)); jMenuInsert.add(jmiBreak); JMenuItem jmiNBSP = new JMenuItem(Translatrix.getTranslationString("InsertNBSP")); jmiNBSP.setActionCommand(CMD_INSERT_NBSP); jmiNBSP.addActionListener(this); jmiNBSP.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, KeyEvent.SHIFT_MASK, false)); jMenuInsert.add(jmiNBSP); JMenu jMenuUnicode = new JMenu(Translatrix.getTranslationString("InsertUnicodeCharacter")); if (showMenuIcons) { jMenuUnicode.setIcon(getEkitIcon("Unicode")); } ; JMenuItem jmiUnicodeAll = new JMenuItem( Translatrix.getTranslationString("InsertUnicodeCharacterAll") + menuDialog); if (showMenuIcons) { jmiUnicodeAll.setIcon(getEkitIcon("Unicode")); } ; jmiUnicodeAll.setActionCommand(CMD_INSERT_UNICODE_CHAR); jmiUnicodeAll.addActionListener(this); jMenuUnicode.add(jmiUnicodeAll); JMenuItem jmiUnicodeMath = new JMenuItem( Translatrix.getTranslationString("InsertUnicodeCharacterMath") + menuDialog); if (showMenuIcons) { jmiUnicodeMath.setIcon(getEkitIcon("Math")); } ; jmiUnicodeMath.setActionCommand(CMD_INSERT_UNICODE_MATH); jmiUnicodeMath.addActionListener(this); jMenuUnicode.add(jmiUnicodeMath); JMenuItem jmiUnicodeDraw = new JMenuItem( Translatrix.getTranslationString("InsertUnicodeCharacterDraw") + menuDialog); if (showMenuIcons) { jmiUnicodeDraw.setIcon(getEkitIcon("Draw")); } ; jmiUnicodeDraw.setActionCommand(CMD_INSERT_UNICODE_DRAW); jmiUnicodeDraw.addActionListener(this); jMenuUnicode.add(jmiUnicodeDraw); JMenuItem jmiUnicodeDing = new JMenuItem( Translatrix.getTranslationString("InsertUnicodeCharacterDing") + menuDialog); jmiUnicodeDing.setActionCommand(CMD_INSERT_UNICODE_DING); jmiUnicodeDing.addActionListener(this); jMenuUnicode.add(jmiUnicodeDing); JMenuItem jmiUnicodeSigs = new JMenuItem( Translatrix.getTranslationString("InsertUnicodeCharacterSigs") + menuDialog); jmiUnicodeSigs.setActionCommand(CMD_INSERT_UNICODE_SIGS); jmiUnicodeSigs.addActionListener(this); jMenuUnicode.add(jmiUnicodeSigs); JMenuItem jmiUnicodeSpec = new JMenuItem( Translatrix.getTranslationString("InsertUnicodeCharacterSpec") + menuDialog); jmiUnicodeSpec.setActionCommand(CMD_INSERT_UNICODE_SPEC); jmiUnicodeSpec.addActionListener(this); jMenuUnicode.add(jmiUnicodeSpec); jMenuInsert.add(jMenuUnicode); JMenuItem jmiHRule = new JMenuItem(Translatrix.getTranslationString("InsertHorizontalRule")); jmiHRule.setActionCommand(CMD_INSERT_HR); jmiHRule.addActionListener(this); jMenuInsert.add(jmiHRule); jMenuInsert.addSeparator(); if (!isParentApplet) { JMenuItem jmiImageLocal = new JMenuItem( Translatrix.getTranslationString("InsertLocalImage") + menuDialog); jmiImageLocal.setActionCommand(CMD_INSERT_IMAGE_LOCAL); jmiImageLocal.addActionListener(this); jMenuInsert.add(jmiImageLocal); } JMenuItem jmiImageURL = new JMenuItem(Translatrix.getTranslationString("InsertURLImage") + menuDialog); jmiImageURL.setActionCommand(CMD_INSERT_IMAGE_URL); jmiImageURL.addActionListener(this); jMenuInsert.add(jmiImageURL); /* TABLE Menu */ jMenuTable = new JMenu(Translatrix.getTranslationString("Table")); htMenus.put(KEY_MENU_TABLE, jMenuTable); JMenuItem jmiTable = new JMenuItem(actionTableInsert); if (!showMenuIcons) { jmiTable.setIcon(null); } jMenuTable.add(jmiTable); jMenuTable.addSeparator(); Action actionTableEdit = new CommandAction(Translatrix.getTranslationString("TableEdit") + menuDialog, getEkitIcon("TableEdit"), CMD_TABLE_EDIT, this); JMenuItem jmiEditTable = new JMenuItem(actionTableEdit); if (!showMenuIcons) { jmiEditTable.setIcon(null); } jMenuTable.add(jmiEditTable); Action actionCellEdit = new CommandAction(Translatrix.getTranslationString("TableCellEdit") + menuDialog, getEkitIcon("CellEdit"), CMD_TABLE_CELL_EDIT, this); JMenuItem jmiEditCell = new JMenuItem(actionCellEdit); if (!showMenuIcons) { jmiEditCell.setIcon(null); } jmiEditCell.setActionCommand(CMD_TABLE_CELL_EDIT); jmiEditCell.addActionListener(this); jMenuTable.add(jmiEditCell); jMenuTable.addSeparator(); JMenuItem jmiTableRow = new JMenuItem(actionTableRow); if (!showMenuIcons) { jmiTableRow.setIcon(null); } jMenuTable.add(jmiTableRow); JMenuItem jmiTableCol = new JMenuItem(actionTableCol); if (!showMenuIcons) { jmiTableCol.setIcon(null); } jMenuTable.add(jmiTableCol); jMenuTable.addSeparator(); JMenuItem jmiTableRowDel = new JMenuItem(actionTableRowDel); if (!showMenuIcons) { jmiTableRowDel.setIcon(null); } jMenuTable.add(jmiTableRowDel); JMenuItem jmiTableColDel = new JMenuItem(actionTableColDel); if (!showMenuIcons) { jmiTableColDel.setIcon(null); } jMenuTable.add(jmiTableColDel); /* FORMS Menu */ jMenuForms = new JMenu(Translatrix.getTranslationString("Forms")); htMenus.put(KEY_MENU_FORMS, jMenuForms); JMenuItem jmiFormInsertForm = new JMenuItem(Translatrix.getTranslationString("FormInsertForm")); jmiFormInsertForm.setActionCommand(CMD_FORM_INSERT); jmiFormInsertForm.addActionListener(this); jMenuForms.add(jmiFormInsertForm); jMenuForms.addSeparator(); JMenuItem jmiFormTextfield = new JMenuItem(Translatrix.getTranslationString("FormTextfield")); jmiFormTextfield.setActionCommand(CMD_FORM_TEXTFIELD); jmiFormTextfield.addActionListener(this); jMenuForms.add(jmiFormTextfield); JMenuItem jmiFormTextarea = new JMenuItem(Translatrix.getTranslationString("FormTextarea")); jmiFormTextarea.setActionCommand(CMD_FORM_TEXTAREA); jmiFormTextarea.addActionListener(this); jMenuForms.add(jmiFormTextarea); JMenuItem jmiFormCheckbox = new JMenuItem(Translatrix.getTranslationString("FormCheckbox")); jmiFormCheckbox.setActionCommand(CMD_FORM_CHECKBOX); jmiFormCheckbox.addActionListener(this); jMenuForms.add(jmiFormCheckbox); JMenuItem jmiFormRadio = new JMenuItem(Translatrix.getTranslationString("FormRadio")); jmiFormRadio.setActionCommand(CMD_FORM_RADIO); jmiFormRadio.addActionListener(this); jMenuForms.add(jmiFormRadio); JMenuItem jmiFormPassword = new JMenuItem(Translatrix.getTranslationString("FormPassword")); jmiFormPassword.setActionCommand(CMD_FORM_PASSWORD); jmiFormPassword.addActionListener(this); jMenuForms.add(jmiFormPassword); jMenuForms.addSeparator(); JMenuItem jmiFormButton = new JMenuItem(Translatrix.getTranslationString("FormButton")); jmiFormButton.setActionCommand(CMD_FORM_BUTTON); jmiFormButton.addActionListener(this); jMenuForms.add(jmiFormButton); JMenuItem jmiFormButtonSubmit = new JMenuItem(Translatrix.getTranslationString("FormButtonSubmit")); jmiFormButtonSubmit.setActionCommand(CMD_FORM_SUBMIT); jmiFormButtonSubmit.addActionListener(this); jMenuForms.add(jmiFormButtonSubmit); JMenuItem jmiFormButtonReset = new JMenuItem(Translatrix.getTranslationString("FormButtonReset")); jmiFormButtonReset.setActionCommand(CMD_FORM_RESET); jmiFormButtonReset.addActionListener(this); jMenuForms.add(jmiFormButtonReset); /* TOOLS Menu */ if (hasSpellChecker) { jMenuTools = new JMenu(Translatrix.getTranslationString("Tools")); htMenus.put(KEY_MENU_TOOLS, jMenuTools); JMenuItem jmiSpellcheck = new JMenuItem(Translatrix.getTranslationString("ToolSpellcheck")); jmiSpellcheck.setActionCommand(CMD_SPELLCHECK); jmiSpellcheck.addActionListener(this); jMenuTools.add(jmiSpellcheck); } /* SEARCH Menu */ jMenuSearch = new JMenu(Translatrix.getTranslationString("Search")); htMenus.put(KEY_MENU_SEARCH, jMenuSearch); JMenuItem jmiFind = new JMenuItem(Translatrix.getTranslationString("SearchFind")); if (showMenuIcons) { jmiFind.setIcon(getEkitIcon("Find")); } ; jmiFind.setActionCommand(CMD_SEARCH_FIND); jmiFind.addActionListener(this); jmiFind.setAccelerator(KeyStroke.getKeyStroke('F', CTRLKEY, false)); jMenuSearch.add(jmiFind); JMenuItem jmiFindAgain = new JMenuItem(Translatrix.getTranslationString("SearchFindAgain")); if (showMenuIcons) { jmiFindAgain.setIcon(getEkitIcon("FindAgain")); } ; jmiFindAgain.setActionCommand(CMD_SEARCH_FIND_AGAIN); jmiFindAgain.addActionListener(this); jmiFindAgain.setAccelerator(KeyStroke.getKeyStroke('G', CTRLKEY, false)); jMenuSearch.add(jmiFindAgain); JMenuItem jmiReplace = new JMenuItem(Translatrix.getTranslationString("SearchReplace")); if (showMenuIcons) { jmiReplace.setIcon(getEkitIcon("Replace")); } ; jmiReplace.setActionCommand(CMD_SEARCH_REPLACE); jmiReplace.addActionListener(this); jmiReplace.setAccelerator(KeyStroke.getKeyStroke('R', CTRLKEY, false)); jMenuSearch.add(jmiReplace); /* HELP Menu */ jMenuHelp = new JMenu(Translatrix.getTranslationString("Help")); htMenus.put(KEY_MENU_HELP, jMenuHelp); JMenuItem jmiAbout = new JMenuItem(Translatrix.getTranslationString("About")); jmiAbout.setActionCommand(CMD_HELP_ABOUT); jmiAbout.addActionListener(this); jMenuHelp.add(jmiAbout); /* DEBUG Menu */ jMenuDebug = new JMenu(Translatrix.getTranslationString("Debug")); htMenus.put(KEY_MENU_DEBUG, jMenuDebug); JMenuItem jmiDesc = new JMenuItem(Translatrix.getTranslationString("DescribeDoc")); jmiDesc.setActionCommand(CMD_DEBUG_DESCRIBE_DOC); jmiDesc.addActionListener(this); jMenuDebug.add(jmiDesc); JMenuItem jmiDescCSS = new JMenuItem(Translatrix.getTranslationString("DescribeCSS")); jmiDescCSS.setActionCommand(CMD_DEBUG_DESCRIBE_CSS); jmiDescCSS.addActionListener(this); jMenuDebug.add(jmiDescCSS); JMenuItem jmiTag = new JMenuItem(Translatrix.getTranslationString("WhatTags")); jmiTag.setActionCommand(CMD_DEBUG_CURRENT_TAGS); jmiTag.addActionListener(this); jMenuDebug.add(jmiTag); /* Create menubar and add menus */ jMenuBar = new JMenuBar(); jMenuBar.add(jMenuFile); jMenuBar.add(jMenuEdit); jMenuBar.add(jMenuView); jMenuBar.add(jMenuFont); jMenuBar.add(jMenuFormat); jMenuBar.add(jMenuSearch); jMenuBar.add(jMenuInsert); jMenuBar.add(jMenuTable); jMenuBar.add(jMenuForms); if (jMenuTools != null) { jMenuBar.add(jMenuTools); } jMenuBar.add(jMenuHelp); if (debugMode) { jMenuBar.add(jMenuDebug); } /* Create toolbar tool objects */ jbtnNewHTML = new JButtonNoFocus(getEkitIcon("New")); jbtnNewHTML.setToolTipText(Translatrix.getTranslationString("NewDocument")); jbtnNewHTML.setActionCommand(CMD_DOC_NEW); jbtnNewHTML.addActionListener(this); htTools.put(KEY_TOOL_NEW, jbtnNewHTML); jbtnNewStyledHTML = new JButtonNoFocus(getEkitIcon("NewStyled")); jbtnNewStyledHTML.setToolTipText(Translatrix.getTranslationString("NewStyledDocument")); jbtnNewStyledHTML.setActionCommand(CMD_DOC_NEW_STYLED); jbtnNewStyledHTML.addActionListener(this); htTools.put(KEY_TOOL_NEWSTYLED, jbtnNewStyledHTML); jbtnOpenHTML = new JButtonNoFocus(getEkitIcon("Open")); jbtnOpenHTML.setToolTipText(Translatrix.getTranslationString("OpenDocument")); jbtnOpenHTML.setActionCommand(CMD_DOC_OPEN_HTML); jbtnOpenHTML.addActionListener(this); htTools.put(KEY_TOOL_OPEN, jbtnOpenHTML); jbtnSaveHTML = new JButtonNoFocus(getEkitIcon("Save")); jbtnSaveHTML.setToolTipText(Translatrix.getTranslationString("SaveDocument")); jbtnSaveHTML.setActionCommand(CMD_DOC_SAVE_AS); jbtnSaveHTML.addActionListener(this); htTools.put(KEY_TOOL_SAVE, jbtnSaveHTML); jbtnPrint = new JButtonNoFocus(getEkitIcon("Print")); jbtnPrint.setToolTipText(Translatrix.getTranslationString("PrintDocument")); jbtnPrint.setActionCommand(CMD_DOC_PRINT); jbtnPrint.addActionListener(this); htTools.put(KEY_TOOL_PRINT, jbtnPrint); // jbtnCut = new JButtonNoFocus(new DefaultEditorKit.CutAction()); jbtnCut = new JButtonNoFocus(); jbtnCut.setActionCommand(CMD_CLIP_CUT); jbtnCut.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { EkitCore.this.actionPerformed(evt); } }); jbtnCut.setIcon(getEkitIcon("Cut")); jbtnCut.setText(null); jbtnCut.setToolTipText(Translatrix.getTranslationString("Cut")); htTools.put(KEY_TOOL_CUT, jbtnCut); // jbtnCopy = new JButtonNoFocus(new DefaultEditorKit.CopyAction()); jbtnCopy = new JButtonNoFocus(); jbtnCopy.setActionCommand(CMD_CLIP_COPY); jbtnCopy.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { EkitCore.this.actionPerformed(evt); } }); jbtnCopy.setIcon(getEkitIcon("Copy")); jbtnCopy.setText(null); jbtnCopy.setToolTipText(Translatrix.getTranslationString("Copy")); htTools.put(KEY_TOOL_COPY, jbtnCopy); // jbtnPaste = new JButtonNoFocus(new DefaultEditorKit.PasteAction()); jbtnPaste = new JButtonNoFocus(); jbtnPaste.setActionCommand(CMD_CLIP_PASTE); jbtnPaste.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { EkitCore.this.actionPerformed(evt); } }); jbtnPaste.setIcon(getEkitIcon("Paste")); jbtnPaste.setText(null); jbtnPaste.setToolTipText(Translatrix.getTranslationString("Paste")); htTools.put(KEY_TOOL_PASTE, jbtnPaste); jbtnPasteX = new JButtonNoFocus(); jbtnPasteX.setActionCommand(CMD_CLIP_PASTE_PLAIN); jbtnPasteX.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { EkitCore.this.actionPerformed(evt); } }); jbtnPasteX.setIcon(getEkitIcon("PasteUnformatted")); jbtnPasteX.setText(null); jbtnPasteX.setToolTipText(Translatrix.getTranslationString("PasteUnformatted")); htTools.put(KEY_TOOL_PASTEX, jbtnPasteX); jbtnUndo = new JButtonNoFocus(undoAction); jbtnUndo.setIcon(getEkitIcon("Undo")); jbtnUndo.setText(null); jbtnUndo.setToolTipText(Translatrix.getTranslationString("Undo")); htTools.put(KEY_TOOL_UNDO, jbtnUndo); jbtnRedo = new JButtonNoFocus(redoAction); jbtnRedo.setIcon(getEkitIcon("Redo")); jbtnRedo.setText(null); jbtnRedo.setToolTipText(Translatrix.getTranslationString("Redo")); htTools.put(KEY_TOOL_REDO, jbtnRedo); jbtnBold = new JButtonNoFocus(actionFontBold); jbtnBold.setIcon(getEkitIcon("Bold")); jbtnBold.setText(null); jbtnBold.setToolTipText(Translatrix.getTranslationString("FontBold")); htTools.put(KEY_TOOL_BOLD, jbtnBold); jbtnItalic = new JButtonNoFocus(actionFontItalic); jbtnItalic.setIcon(getEkitIcon("Italic")); jbtnItalic.setText(null); jbtnItalic.setToolTipText(Translatrix.getTranslationString("FontItalic")); htTools.put(KEY_TOOL_ITALIC, jbtnItalic); jbtnUnderline = new JButtonNoFocus(actionFontUnderline); jbtnUnderline.setIcon(getEkitIcon("Underline")); jbtnUnderline.setText(null); jbtnUnderline.setToolTipText(Translatrix.getTranslationString("FontUnderline")); htTools.put(KEY_TOOL_UNDERLINE, jbtnUnderline); jbtnStrike = new JButtonNoFocus(actionFontStrike); jbtnStrike.setIcon(getEkitIcon("Strike")); jbtnStrike.setText(null); jbtnStrike.setToolTipText(Translatrix.getTranslationString("FontStrike")); htTools.put(KEY_TOOL_STRIKE, jbtnStrike); jbtnSuperscript = new JButtonNoFocus(actionFontSuperscript); jbtnSuperscript.setIcon(getEkitIcon("Super")); jbtnSuperscript.setText(null); jbtnSuperscript.setToolTipText(Translatrix.getTranslationString("FontSuperscript")); htTools.put(KEY_TOOL_SUPER, jbtnSuperscript); jbtnSubscript = new JButtonNoFocus(actionFontSubscript); jbtnSubscript.setIcon(getEkitIcon("Sub")); jbtnSubscript.setText(null); jbtnSubscript.setToolTipText(Translatrix.getTranslationString("FontSubscript")); htTools.put(KEY_TOOL_SUB, jbtnSubscript); jbtnUList = new JButtonNoFocus(actionListUnordered); jbtnUList.setIcon(getEkitIcon("UList")); jbtnUList.setText(null); jbtnUList.setToolTipText(Translatrix.getTranslationString("ListUnordered")); htTools.put(KEY_TOOL_ULIST, jbtnUList); jbtnOList = new JButtonNoFocus(actionListOrdered); jbtnOList.setIcon(getEkitIcon("OList")); jbtnOList.setText(null); jbtnOList.setToolTipText(Translatrix.getTranslationString("ListOrdered")); htTools.put(KEY_TOOL_OLIST, jbtnOList); jbtnAlignLeft = new JButtonNoFocus(actionAlignLeft); jbtnAlignLeft.setIcon(getEkitIcon("AlignLeft")); jbtnAlignLeft.setText(null); jbtnAlignLeft.setToolTipText(Translatrix.getTranslationString("AlignLeft")); htTools.put(KEY_TOOL_ALIGNL, jbtnAlignLeft); jbtnAlignCenter = new JButtonNoFocus(actionAlignCenter); jbtnAlignCenter.setIcon(getEkitIcon("AlignCenter")); jbtnAlignCenter.setText(null); jbtnAlignCenter.setToolTipText(Translatrix.getTranslationString("AlignCenter")); htTools.put(KEY_TOOL_ALIGNC, jbtnAlignCenter); jbtnAlignRight = new JButtonNoFocus(actionAlignRight); jbtnAlignRight.setIcon(getEkitIcon("AlignRight")); jbtnAlignRight.setText(null); jbtnAlignRight.setToolTipText(Translatrix.getTranslationString("AlignRight")); htTools.put(KEY_TOOL_ALIGNR, jbtnAlignRight); jbtnAlignJustified = new JButtonNoFocus(actionAlignJustified); jbtnAlignJustified.setIcon(getEkitIcon("AlignJustified")); jbtnAlignJustified.setText(null); jbtnAlignJustified.setToolTipText(Translatrix.getTranslationString("AlignJustified")); htTools.put(KEY_TOOL_ALIGNJ, jbtnAlignJustified); jbtnUnicode = new JButtonNoFocus(); jbtnUnicode.setActionCommand(CMD_INSERT_UNICODE_CHAR); jbtnUnicode.addActionListener(this); jbtnUnicode.setIcon(getEkitIcon("Unicode")); jbtnUnicode.setText(null); jbtnUnicode.setToolTipText(Translatrix.getTranslationString("ToolUnicode")); htTools.put(KEY_TOOL_UNICODE, jbtnUnicode); jbtnUnicodeMath = new JButtonNoFocus(); jbtnUnicodeMath.setActionCommand(CMD_INSERT_UNICODE_MATH); jbtnUnicodeMath.addActionListener(this); jbtnUnicodeMath.setIcon(getEkitIcon("Math")); jbtnUnicodeMath.setText(null); jbtnUnicodeMath.setToolTipText(Translatrix.getTranslationString("ToolUnicodeMath")); htTools.put(KEY_TOOL_UNIMATH, jbtnUnicodeMath); jbtnFind = new JButtonNoFocus(); jbtnFind.setActionCommand(CMD_SEARCH_FIND); jbtnFind.addActionListener(this); jbtnFind.setIcon(getEkitIcon("Find")); jbtnFind.setText(null); jbtnFind.setToolTipText(Translatrix.getTranslationString("SearchFind")); htTools.put(KEY_TOOL_FIND, jbtnFind); jbtnAnchor = new JButtonNoFocus(actionInsertAnchor); jbtnAnchor.setIcon(getEkitIcon("Anchor")); jbtnAnchor.setText(null); jbtnAnchor.setToolTipText(Translatrix.getTranslationString("ToolAnchor")); htTools.put(KEY_TOOL_ANCHOR, jbtnAnchor); jtbtnViewSource = new JToggleButtonNoFocus(getEkitIcon("Source")); jtbtnViewSource.setText(null); jtbtnViewSource.setToolTipText(Translatrix.getTranslationString("ViewSource")); jtbtnViewSource.setActionCommand(CMD_TOGGLE_SOURCE_VIEW); jtbtnViewSource.addActionListener(this); jtbtnViewSource.setPreferredSize(jbtnAnchor.getPreferredSize()); jtbtnViewSource.setMinimumSize(jbtnAnchor.getMinimumSize()); jtbtnViewSource.setMaximumSize(jbtnAnchor.getMaximumSize()); htTools.put(KEY_TOOL_SOURCE, jtbtnViewSource); jcmbStyleSelector = new JComboBoxNoFocus(); jcmbStyleSelector.setToolTipText(Translatrix.getTranslationString("PickCSSStyle")); jcmbStyleSelector.setAction(new StylesAction(jcmbStyleSelector)); htTools.put(KEY_TOOL_STYLES, jcmbStyleSelector); String[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); Vector<String> vcFontnames = new Vector<String>(fonts.length + 1); vcFontnames.add(Translatrix.getTranslationString("SelectorToolFontsDefaultFont")); for (String fontname : fonts) { vcFontnames.add(fontname); } Collections.sort(vcFontnames); jcmbFontSelector = new JComboBoxNoFocus(vcFontnames); jcmbFontSelector.setAction(new SetFontFamilyAction(this, "[EKITFONTSELECTOR]")); htTools.put(KEY_TOOL_FONTS, jcmbFontSelector); jbtnInsertTable = new JButtonNoFocus(); jbtnInsertTable.setActionCommand(CMD_TABLE_INSERT); jbtnInsertTable.addActionListener(this); jbtnInsertTable.setIcon(getEkitIcon("TableCreate")); jbtnInsertTable.setText(null); jbtnInsertTable.setToolTipText(Translatrix.getTranslationString("InsertTable")); htTools.put(KEY_TOOL_INSTABLE, jbtnInsertTable); jbtnEditTable = new JButtonNoFocus(); jbtnEditTable.setActionCommand(CMD_TABLE_EDIT); jbtnEditTable.addActionListener(this); jbtnEditTable.setIcon(getEkitIcon("TableEdit")); jbtnEditTable.setText(null); jbtnEditTable.setToolTipText(Translatrix.getTranslationString("TableEdit")); htTools.put(KEY_TOOL_EDITTABLE, jbtnEditTable); jbtnEditCell = new JButtonNoFocus(); jbtnEditCell.setActionCommand(CMD_TABLE_CELL_EDIT); jbtnEditCell.addActionListener(this); jbtnEditCell.setIcon(getEkitIcon("CellEdit")); jbtnEditCell.setText(null); jbtnEditCell.setToolTipText(Translatrix.getTranslationString("TableCellEdit")); htTools.put(KEY_TOOL_EDITCELL, jbtnEditCell); jbtnInsertRow = new JButtonNoFocus(); jbtnInsertRow.setActionCommand(CMD_TABLE_ROW_INSERT); jbtnInsertRow.addActionListener(this); jbtnInsertRow.setIcon(getEkitIcon("InsertRow")); jbtnInsertRow.setText(null); jbtnInsertRow.setToolTipText(Translatrix.getTranslationString("InsertTableRow")); htTools.put(KEY_TOOL_INSERTROW, jbtnInsertRow); jbtnInsertColumn = new JButtonNoFocus(); jbtnInsertColumn.setActionCommand(CMD_TABLE_COLUMN_INSERT); jbtnInsertColumn.addActionListener(this); jbtnInsertColumn.setIcon(getEkitIcon("InsertColumn")); jbtnInsertColumn.setText(null); jbtnInsertColumn.setToolTipText(Translatrix.getTranslationString("InsertTableColumn")); htTools.put(KEY_TOOL_INSERTCOL, jbtnInsertColumn); jbtnDeleteRow = new JButtonNoFocus(); jbtnDeleteRow.setActionCommand(CMD_TABLE_ROW_DELETE); jbtnDeleteRow.addActionListener(this); jbtnDeleteRow.setIcon(getEkitIcon("DeleteRow")); jbtnDeleteRow.setText(null); jbtnDeleteRow.setToolTipText(Translatrix.getTranslationString("DeleteTableRow")); htTools.put(KEY_TOOL_DELETEROW, jbtnDeleteRow); jbtnDeleteColumn = new JButtonNoFocus(); jbtnDeleteColumn.setActionCommand(CMD_TABLE_COLUMN_DELETE); jbtnDeleteColumn.addActionListener(this); jbtnDeleteColumn.setIcon(getEkitIcon("DeleteColumn")); jbtnDeleteColumn.setText(null); jbtnDeleteColumn.setToolTipText(Translatrix.getTranslationString("DeleteTableColumn")); htTools.put(KEY_TOOL_DELETECOL, jbtnDeleteColumn); jbtnMaximize = new JButtonNoFocus(); jbtnMaximize.setActionCommand(CMD_MAXIMIZE); jbtnMaximize.addActionListener(this); jbtnMaximize.setIcon(getEkitIcon("Maximize")); jbtnMaximize.setText(null); jbtnMaximize.setToolTipText(Translatrix.getTranslationString("Maximize")); htTools.put(KEY_TOOL_MAXIMIZE, jbtnMaximize); jbtnClearFormat = new JButtonNoFocus(actionClearFormat); jbtnClearFormat.setIcon(getEkitIcon("ClearFormat")); jbtnClearFormat.setText(null); jbtnClearFormat.setToolTipText(Translatrix.getTranslationString("ClearFormat")); htTools.put(KEY_TOOL_CLEAR_FORMAT, jbtnClearFormat); jbtnSpecialChar = new JButtonNoFocus(actionSpecialChar); jbtnSpecialChar.setIcon(getEkitIcon("SpecialChar")); jbtnSpecialChar.setText(null); jbtnSpecialChar.setToolTipText(Translatrix.getTranslationString("SpecialChar")); htTools.put(KEY_TOOL_SPECIAL_CHAR, jbtnSpecialChar); jbtnTableButtonMenu = new JButtonNoFocus(actionTableButtonMenu); jbtnTableButtonMenu.setText(null); htTools.put(KEY_TOOL_TABLE_MENU, jbtnTableButtonMenu); /* Create the toolbar */ if (multiBar) { jToolBarMain = new JToolBar(JToolBar.HORIZONTAL); jToolBarMain.setFloatable(false); jToolBarFormat = new JToolBar(JToolBar.HORIZONTAL); jToolBarFormat.setFloatable(false); jToolBarStyles = new JToolBar(JToolBar.HORIZONTAL); jToolBarStyles.setFloatable(false); initializeMultiToolbars(toolbarSeq); // fix the weird size preference of toggle buttons jtbtnViewSource.setPreferredSize(jbtnAnchor.getPreferredSize()); jtbtnViewSource.setMinimumSize(jbtnAnchor.getMinimumSize()); jtbtnViewSource.setMaximumSize(jbtnAnchor.getMaximumSize()); } else if (includeToolBar) { jToolBar = new JToolBar(JToolBar.HORIZONTAL); jToolBar.setFloatable(false); initializeSingleToolbar(toolbarSeq); // fix the weird size preference of toggle buttons jtbtnViewSource.setPreferredSize(jbtnAnchor.getPreferredSize()); jtbtnViewSource.setMinimumSize(jbtnAnchor.getMinimumSize()); jtbtnViewSource.setMaximumSize(jbtnAnchor.getMaximumSize()); } /* Create the scroll area for the text pane */ jspViewport = new JScrollPane(jtpMain); jspViewport.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); jspViewport.setPreferredSize(new Dimension(400, 400)); jspViewport.setMinimumSize(new Dimension(32, 32)); /* Create the scroll area for the source viewer */ jspSource = new JScrollPane(jtpSource); jspSource.setPreferredSize(new Dimension(400, 100)); jspSource.setMinimumSize(new Dimension(32, 32)); displayPanel = new JPanel(); displayPanel.setLayout(new CardLayout()); displayPanel.add(jspViewport, PANEL_NAME_MAIN); displayPanel.add(jspSource, PANEL_NAME_SOURCE); if (showViewSource) { toggleSourceWindow(); } registerDocumentStyles(); tableCtl = new TableController(this); htmlDoc.setInlineEdit(inlineEdit); htmlDoc.addFilter(new HTMLTableDocumentFilter()); // Inicializa documento pelos behaviors for (HTMLDocumentBehavior b : this.behaviors) { b.initializeDocument(jtpMain); } htmlDoc.getBehaviors().addAll(this.behaviors); /* Add the components to the app */ this.setLayout(new BorderLayout()); this.add(displayPanel, BorderLayout.CENTER); }
From source file:com.itemanalysis.jmetrik.gui.Jmetrik.java
private JMenuBar createMenuBar() { final JMenuBar menuBar = new JMenuBar(); JMenuItem mItem = null; String urlString;/*from w w w . j a v a2 s . c o m*/ URL url; //============================================================================================ // File Menu //============================================================================================ JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('f'); menuBar.add(fileMenu); urlString = "/org/tango-project/tango-icon-theme/16x16/actions/document-new.png"; url = this.getClass().getResource(urlString); ImageIcon iconNew = new ImageIcon(url, "New"); mItem = new JMenuItem(new NewTextFileAction("New", iconNew)); fileMenu.add(mItem); urlString = "/org/tango-project/tango-icon-theme/16x16/actions/document-open.png"; url = this.getClass().getResource(urlString); ImageIcon iconOpen = new ImageIcon(url, "Open"); mItem = new JMenuItem(new OpenFileAction("Open...", iconOpen, new Integer(KeyEvent.VK_A))); fileMenu.add(mItem); urlString = "/org/tango-project/tango-icon-theme/16x16/actions/document-save.png"; url = this.getClass().getResource(urlString); ImageIcon iconSave = new ImageIcon(url, "Save"); mItem = new JMenuItem(new SaveAction("Save", iconSave, new Integer(KeyEvent.VK_S))); fileMenu.add(mItem); urlString = "/org/tango-project/tango-icon-theme/16x16/actions/document-save-as.png"; url = this.getClass().getResource(urlString); ImageIcon iconSaveAs = new ImageIcon(url, "Save As"); mItem = new JMenuItem(new SaveAsAction("Save As...", iconSaveAs)); fileMenu.add(mItem); urlString = "/org/tango-project/tango-icon-theme/16x16/status/folder-visiting.png"; url = this.getClass().getResource(urlString); ImageIcon iconClose = new ImageIcon(url, "Close All Tabs"); mItem = new JMenuItem(new CloseAllTabsAction("Close All Tabs...", iconClose, new Integer(KeyEvent.VK_C))); fileMenu.add(mItem); fileMenu.addSeparator(); urlString = "/org/tango-project/tango-icon-theme/16x16/actions/document-print.png"; url = this.getClass().getResource(urlString); ImageIcon iconPrint = new ImageIcon(url, "Print"); mItem = new JMenuItem(new PrintAction("Print...", iconPrint)); fileMenu.add(mItem); fileMenu.addSeparator(); // exit menu item urlString = "/org/tango-project/tango-icon-theme/16x16/actions/system-log-out.png"; url = this.getClass().getResource(urlString); ImageIcon iconExit = new ImageIcon(url, "Exit"); mItem = new JMenuItem(new ExitAction("Exit", iconExit)); fileMenu.add(mItem); //============================================================================================ // Edit Menu //============================================================================================ JMenu editMenu = new JMenu("Edit"); editMenu.setMnemonic(KeyEvent.VK_E); urlString = "/org/tango-project/tango-icon-theme/16x16/actions/edit-cut.png"; url = this.getClass().getResource(urlString); ImageIcon iconCut = new ImageIcon(url, "Cut"); mItem = new JMenuItem(new DefaultEditorKit.CutAction()); mItem.setText("Cut"); mItem.setIcon(iconCut); mItem.setMnemonic(KeyEvent.VK_X); editMenu.add(mItem); urlString = "/org/tango-project/tango-icon-theme/16x16/actions/edit-copy.png"; url = this.getClass().getResource(urlString); ImageIcon iconCopy = new ImageIcon(url, "Copy"); mItem = new JMenuItem(new DefaultEditorKit.CopyAction()); mItem.setText("Copy"); mItem.setIcon(iconCopy); mItem.setMnemonic(KeyEvent.VK_C); editMenu.add(mItem); urlString = "/org/tango-project/tango-icon-theme/16x16/actions/edit-paste.png"; url = this.getClass().getResource(urlString); ImageIcon iconPaste = new ImageIcon(url, "Paste"); mItem = new JMenuItem(new DefaultEditorKit.PasteAction()); mItem.setText("Paste"); mItem.setIcon(iconPaste); mItem.setMnemonic(KeyEvent.VK_V); editMenu.add(mItem); editMenu.addSeparator(); urlString = "/org/tango-project/tango-icon-theme/16x16/actions/edit-undo.png"; url = this.getClass().getResource(urlString); ImageIcon iconUndo = new ImageIcon(url, "Undo"); mItem = new JMenuItem(new UndoAction("Undo", iconUndo, new Integer(KeyEvent.VK_Z))); editMenu.add(mItem); urlString = "/org/tango-project/tango-icon-theme/16x16/actions/edit-redo.png"; url = this.getClass().getResource(urlString); ImageIcon iconRedo = new ImageIcon(url, "Redo"); mItem = new JMenuItem(new RedoAction("Redo", iconRedo, new Integer(KeyEvent.VK_Y))); editMenu.add(mItem); editMenu.addSeparator(); urlString = "/org/tango-project/tango-icon-theme/16x16/categories/preferences-system.png"; url = this.getClass().getResource(urlString); ImageIcon iconView = new ImageIcon(url, "Preferences"); mItem = new JMenuItem("Preferences"); mItem.setIcon(iconView); mItem.setToolTipText("Edit jMetrik preferences"); mItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JmetrikPreferencesManager prefs = new JmetrikPreferencesManager(); prefs.addPropertyChangeListener(new ErrorOccurredPropertyChangeListener()); prefs.addPropertyChangeListener(statusBar.getStatusListener()); JmetrikPreferencesDialog propDialog = new JmetrikPreferencesDialog(Jmetrik.this, prefs); // propDialog.loadPreferences(); propDialog.setVisible(true); } }); editMenu.setMnemonic('e'); editMenu.add(mItem); menuBar.add(editMenu); //============================================================================================ // Log Menu //============================================================================================ JMenu logMenu = new JMenu("Log"); urlString = "/org/tango-project/tango-icon-theme/16x16/actions/document-properties.png"; url = this.getClass().getResource(urlString); ImageIcon iconLog = new ImageIcon(url, "View Log"); mItem = new JMenuItem(new ViewLogAction("View Log", iconLog)); logMenu.setMnemonic('l'); logMenu.add(mItem); urlString = "/org/tango-project/tango-icon-theme/16x16/mimetypes/text-x-generic.png"; url = this.getClass().getResource(urlString); ImageIcon iconCommand = new ImageIcon(url, "Script Log"); mItem = new JMenuItem(new ViewScriptLogAction("Script Log", iconCommand)); logMenu.setMnemonic('c'); logMenu.add(mItem); menuBar.add(logMenu); //============================================================================================ // Manage Menu //============================================================================================ JMenu manageMenu = new JMenu("Manage"); manageMenu.setMnemonic('m'); mItem = new JMenuItem("New Database...");//create db mItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { NewDatabaseDialog newDatabaseDialog = new NewDatabaseDialog(Jmetrik.this); newDatabaseDialog.setVisible(true); if (newDatabaseDialog.canRun()) { if (workspace == null) { // workspace = new Workspace(workspaceTree, tabbedPane, dataTable, variableTable); workspace = new Workspace(workspaceList, tabbedPane, dataTable, variableTable); workspace.addPropertyChangeListener(statusBar.getStatusListener()); workspace.addPropertyChangeListener(new ErrorOccurredPropertyChangeListener()); } workspace.runProcess(newDatabaseDialog.getCommand()); // workspace.createDatabase(newDatabaseDialog.getCommand()); } } }); manageMenu.add(mItem); mItem = new JMenuItem("Open Database..."); mItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { OpenDatabaseDialog openDbDialog = new OpenDatabaseDialog(Jmetrik.this, "Open"); JList l = openDbDialog.getDatabaseList(); workspace.setDatabaseListModel(l); openDbDialog.setVisible(true); if (openDbDialog.canRun()) { openWorkspace(openDbDialog.getDatabaseName()); } } }); manageMenu.add(mItem); urlString = "/org/tango-project/tango-icon-theme/16x16/actions/edit-delete.png"; url = this.getClass().getResource(urlString); ImageIcon iconDelete = new ImageIcon(url, "Delete"); mItem = new JMenuItem("Delete Database..."); mItem.setIcon(iconDelete); mItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { OpenDatabaseDialog selectDialog = new OpenDatabaseDialog(Jmetrik.this, "Delete"); JList l = selectDialog.getDatabaseList(); workspace.setDatabaseListModel(l); selectDialog.setVisible(true); if (selectDialog.canRun()) { int answer = JOptionPane.showConfirmDialog(Jmetrik.this, "Do you want to delete " + selectDialog.getDatabaseName() + " and all of its contents? \n" + "All data will be permanently deleted. You cannot undo this action.", "Delete Database", JOptionPane.WARNING_MESSAGE, JOptionPane.YES_NO_OPTION); if (answer == JOptionPane.YES_OPTION) { DatabaseCommand command = new DatabaseCommand(); DatabaseName dbName = new DatabaseName(selectDialog.getDatabaseName()); command.getFreeOption("name").add(dbName.getName()); command.getSelectOneOption("action").setSelected("delete-db"); DatabaseName currentDb = workspace.getDatabaseName(); if (currentDb.getName().equals(dbName.getName())) { JOptionPane.showMessageDialog(Jmetrik.this, "You cannot delete the current database.\n" + "Close the database before attempting to delete it.", "Database Delete Error", JOptionPane.WARNING_MESSAGE); } else { workspace.runProcess(command); } } } } }); manageMenu.add(mItem); manageMenu.addSeparator(); urlString = "/org/tango-project/tango-icon-theme/16x16/apps/accessories-text-editor.png"; url = this.getClass().getResource(urlString); ImageIcon iconDesc = new ImageIcon(url, "Descriptions"); mItem = new JMenuItem("Table Descriptions..."); mItem.setIcon(iconDesc); mItem.addActionListener(new TableDescriptionActionListener()); manageMenu.add(mItem); urlString = "/org/tango-project/tango-icon-theme/16x16/actions/list-add.png"; url = this.getClass().getResource(urlString); ImageIcon iconImport = new ImageIcon(url, "Import"); mItem = new JMenuItem("Import Data..."); mItem.setIcon(iconImport); mItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (workspace.databaseOpened()) { ImportDialog importDialog = new ImportDialog(Jmetrik.this, workspace.getDatabaseName(), importExportPath); importDialog.setVisible(true); if (importDialog.canRun()) { importExportPath = importDialog.getCurrentDirectory(); workspace.runProcess(importDialog.getCommand()); } } else { JOptionPane.showMessageDialog(Jmetrik.this, "You must open a database before importing data.", "No Open Database", JOptionPane.ERROR_MESSAGE); } } }); manageMenu.add(mItem); urlString = "/org/tango-project/tango-icon-theme/16x16/actions/format-indent-less.png"; url = this.getClass().getResource(urlString); ImageIcon iconExport = new ImageIcon(url, "Export"); mItem = new JMenuItem("Export Data..."); mItem.setIcon(iconExport); mItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { DataTableName tableName = (DataTableName) workspaceList.getSelectedValue(); if (!workspace.databaseOpened()) { JOptionPane.showMessageDialog(Jmetrik.this, "You must open a database before exporting data.", "No Open Database", JOptionPane.ERROR_MESSAGE); } else if (tableName == null) { JOptionPane.showMessageDialog(Jmetrik.this, "You must select a table in the workspace list. \n " + "Select a table to continue the export.", "No Table Selected", JOptionPane.ERROR_MESSAGE); } else { ExportDataDialog exportDialog = new ExportDataDialog(Jmetrik.this, workspace.getDatabaseName(), tableName, importExportPath); if (exportDialog.canRun()) { importExportPath = exportDialog.getCurrentDirectory(); workspace.runProcess(exportDialog.getCommand()); } } } }); manageMenu.add(mItem); urlString = "/org/tango-project/tango-icon-theme/16x16/actions/edit-delete.png"; url = this.getClass().getResource(urlString); ImageIcon iconDeleteTable = new ImageIcon(url, "Delete"); mItem = new JMenuItem("Delete Table..."); mItem.setIcon(iconDeleteTable); mItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (workspace.databaseOpened()) { DeleteTableDialog deleteDialog = new DeleteTableDialog(Jmetrik.this, workspace.getDatabaseName(), (SortedListModel<DataTableName>) workspaceList.getModel()); deleteDialog.setVisible(true); if (deleteDialog.canRun()) { int nSelected = deleteDialog.getNumberOfSelectedTables(); int answer = JOptionPane.NO_OPTION; if (nSelected > 1) { answer = JOptionPane.showConfirmDialog(Jmetrik.this, "Do you want to delete these " + nSelected + " tables? \n" + "All data will be permanently deleted. You cannot undo this action.", "Delete Database", JOptionPane.WARNING_MESSAGE, JOptionPane.YES_NO_OPTION); } else { ArrayList<DataTableName> dList = deleteDialog.getSelectedTables(); answer = JOptionPane.showConfirmDialog(Jmetrik.this, "Do you want to delete the table " + dList.get(0).getTableName() + "? \n" + "All data will be permanently deleted. You cannot undo this action.", "Delete Database", JOptionPane.WARNING_MESSAGE, JOptionPane.YES_NO_OPTION); } if (answer == JOptionPane.YES_OPTION) { workspace.runProcess(deleteDialog.getCommand()); } } } else { JOptionPane.showMessageDialog(Jmetrik.this, "You must open a database before deleting a table.", "No Open Database", JOptionPane.ERROR_MESSAGE); } } }); manageMenu.add(mItem); manageMenu.addSeparator(); SubsetCasesProcess subsetCasesProcess = new SubsetCasesProcess(); subsetCasesProcess.addMenuItem(Jmetrik.this, manageMenu, dialogs, workspace, workspaceList); SubsetVariablesProcess subsetVariablesProcess = new SubsetVariablesProcess(); subsetVariablesProcess.addMenuItem(Jmetrik.this, manageMenu, dialogs, workspace, workspaceList); urlString = "/org/tango-project/tango-icon-theme/16x16/actions/edit-delete.png"; url = this.getClass().getResource(urlString); ImageIcon iconDeleteVariables = new ImageIcon(url, "Delete Variables"); mItem = new JMenuItem("Delete Variables..."); mItem.setIcon(iconDeleteVariables); mItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { DataTableName tableName = (DataTableName) workspaceList.getSelectedValue(); if (!workspace.databaseOpened()) { JOptionPane.showMessageDialog(Jmetrik.this, "You must open a database before subsetting data.", "No Open Database", JOptionPane.ERROR_MESSAGE); } else if (tableName == null) { JOptionPane.showMessageDialog(Jmetrik.this, "You must select a table in the workspace list. \n " + "Select a table to continue.", "No Table Selected", JOptionPane.ERROR_MESSAGE); } else if (workspace.tableOpen()) { DeleteVariableDialog deleteVariableDialog = new DeleteVariableDialog(Jmetrik.this, workspace.getDatabaseName(), workspace.getCurrentDataTable(), workspace.getVariables()); deleteVariableDialog.setVisible(true); if (deleteVariableDialog.canRun()) { int nSelected = deleteVariableDialog.getNumberOfSelectedVariables(); int answer = JOptionPane.NO_OPTION; if (nSelected > 1) { answer = JOptionPane.showConfirmDialog(Jmetrik.this, "Do you want to delete these " + nSelected + " variables? \n" + "All data will be permanently deleted. You cannot undo this action.", "Delete Variables", JOptionPane.WARNING_MESSAGE, JOptionPane.YES_NO_OPTION); } else { VariableAttributes v = deleteVariableDialog.getSelectedVariable(); answer = JOptionPane.showConfirmDialog(Jmetrik.this, "Do you want to delete the variable " + v.getName().toString() + "? \n" + "All data will be permanently deleted. You cannot undo this action.", "Delete Database", JOptionPane.WARNING_MESSAGE, JOptionPane.YES_NO_OPTION); } if (answer == JOptionPane.YES_OPTION) { workspace.runProcess(deleteVariableDialog.getCommand()); } } } } }); manageMenu.add(mItem); menuBar.add(manageMenu); //============================================================================================ // Transform Menu //============================================================================================ JMenu transformMenu = new JMenu("Transform"); transformMenu.setMnemonic('t'); BasicScoringProcess basicScoringProcess = new BasicScoringProcess(); basicScoringProcess.addMenuItem(Jmetrik.this, transformMenu, dialogs, workspace, workspaceList); ScoringProcess scoringProcess = new ScoringProcess(); scoringProcess.addMenuItem(Jmetrik.this, transformMenu, dialogs, workspace, workspaceList); transformMenu.addSeparator(); RankingProcess rankingProcess = new RankingProcess(); rankingProcess.addMenuItem(Jmetrik.this, transformMenu, dialogs, workspace, workspaceList); TestScalingProcess testScalingProcess = new TestScalingProcess(); testScalingProcess.addMenuItem(Jmetrik.this, transformMenu, dialogs, workspace, workspaceList); LinearTransformationProcess linearTransformationProcess = new LinearTransformationProcess(); linearTransformationProcess.addMenuItem(Jmetrik.this, transformMenu, dialogs, workspace, workspaceList); transformMenu.addSeparator(); IrtLinkingProcess irtLinkingProcess = new IrtLinkingProcess(); irtLinkingProcess.addMenuItem(Jmetrik.this, transformMenu, dialogs, workspace, workspaceList); IrtEquatingProcess irtEquatingProcess = new IrtEquatingProcess(); irtEquatingProcess.addMenuItem(Jmetrik.this, transformMenu, dialogs, workspace, workspaceList); menuBar.add(transformMenu); //============================================================================================ // Analyze Menu //============================================================================================ JMenu analyzeMenu = new JMenu("Analyze"); analyzeMenu.setMnemonic('a'); FrequencyProcess frequencyProcess = new FrequencyProcess(); frequencyProcess.addMenuItem(Jmetrik.this, analyzeMenu, dialogs, workspace, workspaceList); DescriptiveProcess descriptiveProcess = new DescriptiveProcess(); descriptiveProcess.addMenuItem(Jmetrik.this, analyzeMenu, dialogs, workspace, workspaceList); CorrelationProcess correlationProcess = new CorrelationProcess(); correlationProcess.addMenuItem(Jmetrik.this, analyzeMenu, dialogs, workspace, workspaceList); analyzeMenu.addSeparator(); ItemAnalysisProcess itemAnalysisProcess = new ItemAnalysisProcess(); itemAnalysisProcess.addMenuItem(Jmetrik.this, analyzeMenu, dialogs, workspace, workspaceList); CmhProcess cmhProcess = new CmhProcess(); cmhProcess.addMenuItem(Jmetrik.this, analyzeMenu, dialogs, workspace, workspaceList); analyzeMenu.addSeparator(); RaschAnalysisProcess raschAnalysisProcess = new RaschAnalysisProcess(); raschAnalysisProcess.addMenuItem(Jmetrik.this, analyzeMenu, dialogs, workspace, workspaceList); IrtItemCalibrationProcess irtItemCalibrationProcess = new IrtItemCalibrationProcess(); irtItemCalibrationProcess.addMenuItem(Jmetrik.this, analyzeMenu, dialogs, workspace, workspaceList); IrtPersonScoringProcess irtPersonScoringProcess = new IrtPersonScoringProcess(); irtPersonScoringProcess.addMenuItem(Jmetrik.this, analyzeMenu, dialogs, workspace, workspaceList); menuBar.add(analyzeMenu); //============================================================================================ // Graph Menu //============================================================================================ JMenu graphMenu = new JMenu("Graph"); graphMenu.setMnemonic('g'); BarChartProcess barchartProcess = new BarChartProcess(); barchartProcess.addMenuItem(Jmetrik.this, graphMenu, dialogs, workspace, workspaceList); PieChartProcess piechartProcess = new PieChartProcess(); piechartProcess.addMenuItem(Jmetrik.this, graphMenu, dialogs, workspace, workspaceList); graphMenu.addSeparator(); HistogramProcess histogramProcess = new HistogramProcess(); histogramProcess.addMenuItem(Jmetrik.this, graphMenu, dialogs, workspace, workspaceList); DensityProcess densityProcess = new DensityProcess(); densityProcess.addMenuItem(Jmetrik.this, graphMenu, dialogs, workspace, workspaceList); LineChartProcess lineChartProcess = new LineChartProcess(); lineChartProcess.addMenuItem(Jmetrik.this, graphMenu, dialogs, workspace, workspaceList); ScatterplotProcess scatterplotProcess = new ScatterplotProcess(); scatterplotProcess.addMenuItem(Jmetrik.this, graphMenu, dialogs, workspace, workspaceList); graphMenu.addSeparator(); NonparametricCurveProcess nonparametricCurveProcess = new NonparametricCurveProcess(); nonparametricCurveProcess.addMenuItem(Jmetrik.this, graphMenu, dialogs, workspace, workspaceList); mItem = new JMenuItem("Irt Plot..."); mItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { DataTableName tableName = (DataTableName) workspaceList.getSelectedValue(); if (tableName == null) { JOptionPane.showMessageDialog(Jmetrik.this, "You must open a database and select a table. \n " + "Select a table to continue scoring.", "No Table Selected", JOptionPane.ERROR_MESSAGE); } else { if (irtPlotDialog == null && workspace.tableOpen()) { //Note that starting this dialog is different because variables //names must be obtained from the rows of a table. DatabaseAccessObject dao = workspace.getDatabaseFactory().getDatabaseAccessObject(); try { ArrayList<VariableAttributes> tempVar = dao.getVariableAttributesFromColumn( workspace.getConnection(), workspace.getCurrentDataTable(), new VariableName("name")); irtPlotDialog = new IrtPlotDialog(Jmetrik.this, workspace.getDatabaseName(), tableName, tempVar, (SortedListModel<DataTableName>) workspaceList.getModel()); } catch (SQLException ex) { logger.fatal(ex.getMessage(), ex); firePropertyChange("error", "", "Error - Check log for details."); } } if (irtPlotDialog != null) irtPlotDialog.setVisible(true); } if (irtPlotDialog != null && irtPlotDialog.canRun()) { workspace.runProcess(irtPlotDialog.getCommand()); } } }); graphMenu.add(mItem); ItemMapProcess itemMapProcess = new ItemMapProcess(); itemMapProcess.addMenuItem(Jmetrik.this, graphMenu, dialogs, workspace, workspaceList); menuBar.add(graphMenu); //============================================================================================ // Command Menu //============================================================================================ JMenu commandMenu = new JMenu("Commands"); commandMenu.setMnemonic('c'); mItem = new JMenuItem("Run command"); mItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JScrollPane pain = (JScrollPane) tabbedPane.getSelectedComponent(); JViewport vp = pain.getViewport(); Component c = vp.getComponent(0); if (c instanceof JmetrikTextFile) { JmetrikTab tempTab = (JmetrikTab) tabbedPane.getTabComponentAt(tabbedPane.getSelectedIndex()); JmetrikTextFile textFile = (JmetrikTextFile) c; workspace.runFromSyntax(textFile.getText()); } } }); commandMenu.add(mItem); mItem = new JMenuItem("Stop command"); mItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { //add something } }); mItem.setEnabled(false); commandMenu.add(mItem); mItem = new JMenuItem("Command Reference..."); mItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { //add something } }); mItem.setEnabled(false); commandMenu.add(mItem); menuBar.add(commandMenu); //============================================================================================ // Help Menu //============================================================================================ JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic('h'); mItem = new JMenuItem("Quick Start Guide"); mItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Desktop deskTop = Desktop.getDesktop(); try { URI uri = new URI("http://www.itemanalysis.com/quick-start-guide.php"); deskTop.browse(uri); } catch (URISyntaxException ex) { logger.fatal(ex.getMessage(), ex); firePropertyChange("error", "", "Error - Check log for details."); } catch (IOException ex) { logger.fatal(ex.getMessage(), ex); firePropertyChange("error", "", "Error - Check log for details."); } } }); helpMenu.add(mItem); urlString = "/org/tango-project/tango-icon-theme/16x16/apps/help-browser.png"; url = this.getClass().getResource(urlString); ImageIcon iconAbout = new ImageIcon(url, "About"); mItem = new JMenuItem("About"); mItem.setIcon(iconAbout); mItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JmetrikAboutDialog aboutDialog = new JmetrikAboutDialog(Jmetrik.this, APP_NAME, VERSION, AUTHOR, RELEASE_DATE, COPYRIGHT_YEAR, BETA_VERSION); aboutDialog.setVisible(true); } }); helpMenu.add(mItem); menuBar.add(helpMenu); return menuBar; }
From source file:net.sf.dvstar.transmission.TransmissionView.java
/** This method is called from within the constructor to * initialize the form.//from w w w .ja v a 2s . c o m * 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() { java.awt.GridBagConstraints gridBagConstraints; mainPanel = new javax.swing.JPanel(); spMain = new javax.swing.JSplitPane(); jPanel1 = new javax.swing.JPanel(); jPanel10 = new javax.swing.JPanel(); lbFind = new javax.swing.JLabel(); tfFindItem = new javax.swing.JTextField(); lbFindInfo = new javax.swing.JLabel(); cbFilterStatus = new javax.swing.JComboBox(); jPanel11 = new javax.swing.JPanel(); spTorrentList = new javax.swing.JScrollPane(); tblTorrentList = new javax.swing.JTable(); jPanel3 = new javax.swing.JPanel(); btFirst = new javax.swing.JButton(); btPrev = new javax.swing.JButton(); tfCurrentRow = new javax.swing.JTextField(); btNext = new javax.swing.JButton(); btLast = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jTabbedPane1 = new javax.swing.JTabbedPane(); plInfo = new javax.swing.JPanel(); plInfoCommon = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); tfTimeAll = new javax.swing.JTextField(); tfDownloaded = new javax.swing.JTextField(); tfSpeedDn = new javax.swing.JTextField(); tfState = new javax.swing.JTextField(); tfComment = new javax.swing.JTextField(); jLabel10 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); tfTimeAll1 = new javax.swing.JTextField(); tfUploaded = new javax.swing.JTextField(); tfSpeedDn1 = new javax.swing.JTextField(); tfStartedAt = new javax.swing.JTextField(); jLabel14 = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); lbErrorInfo = new javax.swing.JLabel(); tfSeeds = new javax.swing.JTextField(); tfLeechers = new javax.swing.JTextField(); tfRate = new javax.swing.JTextField(); tfCreatedAt = new javax.swing.JTextField(); jLabel16 = new javax.swing.JLabel(); tfStorePath = new javax.swing.JTextField(); jLabel17 = new javax.swing.JLabel(); tfSpeedDn3 = new javax.swing.JTextField(); jLabel18 = new javax.swing.JLabel(); tfSpeedUp = new javax.swing.JTextField(); jLabel19 = new javax.swing.JLabel(); tfCreator = new javax.swing.JTextField(); tfErrorInfo = new javax.swing.JTextField(); jLabel15 = new javax.swing.JLabel(); jPanel9 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); plPieces = new javax.swing.JPanel(); lbProgress = new javax.swing.JLabel(); plFiles = new javax.swing.JPanel(); jScrollPane3 = new javax.swing.JScrollPane(); tblTorrentFiles = new javax.swing.JTable(); plPeers = new javax.swing.JPanel(); jScrollPane2 = new javax.swing.JScrollPane(); tblTorrentPeers = new javax.swing.JTable(); plTrackers = new javax.swing.JPanel(); plSpeed = new javax.swing.JPanel(); menuBar = new javax.swing.JMenuBar(); javax.swing.JMenu fileMenu = new javax.swing.JMenu(); miFileConnect = new javax.swing.JMenuItem(); jSeparator3 = new javax.swing.JSeparator(); miFileQuickAddFile = new javax.swing.JMenuItem(); miFileExtAddFile = new javax.swing.JMenuItem(); miFileInfo = new javax.swing.JMenuItem(); miFileAddURL = new javax.swing.JMenuItem(); jSeparator2 = new javax.swing.JSeparator(); javax.swing.JMenuItem miFileExit = new javax.swing.JMenuItem(); configMenu = new javax.swing.JMenu(); miConfigClient = new javax.swing.JMenuItem(); miConfigServer = new javax.swing.JMenuItem(); jSeparator1 = new javax.swing.JSeparator(); mnConfigLocale = new javax.swing.JMenu(); torrentMenu = new javax.swing.JMenu(); miTorrentStart = new javax.swing.JMenuItem(); miTorrentStop = new javax.swing.JMenuItem(); miTorrentRefresh = new javax.swing.JMenuItem(); miTorrentCheck = new javax.swing.JMenuItem(); miTorrentProperties = new javax.swing.JMenuItem(); miTorrentDelete = new javax.swing.JMenuItem(); miTorrentDeleteAll = new javax.swing.JMenuItem(); miTorrentAnnounce = new javax.swing.JMenuItem(); miTorrentMove = new javax.swing.JMenuItem(); miTorrentLocation = new javax.swing.JMenuItem(); jSeparator4 = new javax.swing.JSeparator(); miTorrentStartAll = new javax.swing.JMenuItem(); miTorrentStopAll = new javax.swing.JMenuItem(); javax.swing.JMenu helpMenu = new javax.swing.JMenu(); javax.swing.JMenuItem miHelpAbout = new javax.swing.JMenuItem(); statusPanel = new javax.swing.JPanel(); javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator(); statusMessageLabel = new javax.swing.JLabel(); statusAnimationLabel = new javax.swing.JLabel(); progressBar = new javax.swing.JProgressBar(); maiToolBar = new javax.swing.JToolBar(); btConnect = new javax.swing.JButton(); jSeparator5 = new javax.swing.JToolBar.Separator(); btAdd = new javax.swing.JButton(); btAddUrl = new javax.swing.JButton(); jSeparator8 = new javax.swing.JToolBar.Separator(); btStart = new javax.swing.JButton(); btStop = new javax.swing.JButton(); btRefresh = new javax.swing.JButton(); jSeparator9 = new javax.swing.JToolBar.Separator(); btStatistic = new javax.swing.JButton(); jSeparator6 = new javax.swing.JToolBar.Separator(); btConfigCli = new javax.swing.JButton(); jSeparator7 = new javax.swing.JToolBar.Separator(); btExit = new javax.swing.JButton(); mainPanel.setName("mainPanel"); // NOI18N mainPanel.setLayout(new java.awt.BorderLayout()); spMain.setDividerLocation(250); spMain.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); spMain.setResizeWeight(1.0); spMain.setName("spMain"); // NOI18N jPanel1.setMinimumSize(new java.awt.Dimension(21, 200)); jPanel1.setName("jPanel1"); // NOI18N jPanel1.setLayout(new java.awt.BorderLayout()); jPanel10.setName("jPanel10"); // NOI18N jPanel10.setPreferredSize(new java.awt.Dimension(680, 24)); org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application .getInstance(net.sf.dvstar.transmission.TransmissionApp.class).getContext() .getResourceMap(TransmissionView.class); lbFind.setIcon(resourceMap.getIcon("lbFind.icon")); // NOI18N lbFind.setText(resourceMap.getString("lbFind.text")); // NOI18N lbFind.setName("lbFind"); // NOI18N tfFindItem.setText(null); tfFindItem.setName("tfFindItem"); // NOI18N lbFindInfo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); lbFindInfo.setText(resourceMap.getString("lbFindInfo.text")); // NOI18N lbFindInfo.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); lbFindInfo.setName("lbFindInfo"); // NOI18N cbFilterStatus.setModel(new javax.swing.DefaultComboBoxModel( new String[] { "All", "Downloading", "Paused", "Seeding", "Checking", "Error" })); cbFilterStatus.setName("cbFilterStatus"); // NOI18N cbFilterStatus.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cbFilterStatusActionPerformed(evt); } }); javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10); jPanel10.setLayout(jPanel10Layout); jPanel10Layout.setHorizontalGroup(jPanel10Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel10Layout.createSequentialGroup().addContainerGap().addComponent(lbFind) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(tfFindItem, javax.swing.GroupLayout.DEFAULT_SIZE, 531, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lbFindInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(cbFilterStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); jPanel10Layout.setVerticalGroup(jPanel10Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel10Layout.createSequentialGroup() .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(tfFindItem, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbFind).addComponent(lbFindInfo).addComponent(cbFilterStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel1.add(jPanel10, java.awt.BorderLayout.NORTH); jPanel11.setName("jPanel11"); // NOI18N jPanel11.setLayout(new java.awt.BorderLayout()); spTorrentList.setName("spTorrentList"); // NOI18N spTorrentList.setPreferredSize(new java.awt.Dimension(454, 200)); tblTorrentList.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { }, new String[] { "", "Name", "Size", "Progress", "Status", "Seed", "Leech", "Dn Speed", "Up Speed", "Upload" }) { Class[] types = new Class[] { java.lang.Integer.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class }; boolean[] canEdit = new boolean[] { false, false, false, false, false, false, false, false, false, false }; public Class getColumnClass(int columnIndex) { return types[columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit[columnIndex]; } }); tblTorrentList.setColumnSelectionAllowed(true); tblTorrentList.setName("tblTorrentList"); // NOI18N tblTorrentList.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); tblTorrentList.getTableHeader().setReorderingAllowed(false); spTorrentList.setViewportView(tblTorrentList); tblTorrentList.getColumnModel().getSelectionModel() .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); tblTorrentList.getColumnModel().getColumn(0) .setHeaderValue(resourceMap.getString("tblTorrentList.columnModel.title0")); // NOI18N tblTorrentList.getColumnModel().getColumn(1) .setHeaderValue(resourceMap.getString("tblTorrentList.columnModel.title1")); // NOI18N tblTorrentList.getColumnModel().getColumn(2) .setHeaderValue(resourceMap.getString("tblTorrentList.columnModel.title2")); // NOI18N tblTorrentList.getColumnModel().getColumn(3) .setHeaderValue(resourceMap.getString("tblTorrentList.columnModel.title3")); // NOI18N tblTorrentList.getColumnModel().getColumn(4) .setHeaderValue(resourceMap.getString("tblTorrentList.columnModel.title4")); // NOI18N tblTorrentList.getColumnModel().getColumn(5) .setHeaderValue(resourceMap.getString("tblTorrentList.columnModel.title5")); // NOI18N tblTorrentList.getColumnModel().getColumn(6) .setHeaderValue(resourceMap.getString("tblTorrentList.columnModel.title6")); // NOI18N tblTorrentList.getColumnModel().getColumn(7) .setHeaderValue(resourceMap.getString("tblTorrentList.columnModel.title7")); // NOI18N tblTorrentList.getColumnModel().getColumn(8) .setHeaderValue(resourceMap.getString("tblTorrentList.columnModel.title8")); // NOI18N tblTorrentList.getColumnModel().getColumn(9) .setHeaderValue(resourceMap.getString("tblTorrentList.columnModel.title9")); // NOI18N jPanel11.add(spTorrentList, java.awt.BorderLayout.CENTER); jPanel1.add(jPanel11, java.awt.BorderLayout.CENTER); jPanel3.setName("jPanel3"); // NOI18N jPanel3.setPreferredSize(new java.awt.Dimension(981, 26)); jPanel3.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT, 4, 2)); btFirst.setIcon(resourceMap.getIcon("btFirst.icon")); // NOI18N btFirst.setText(resourceMap.getString("btFirst.text")); // NOI18N btFirst.setName("btFirst"); // NOI18N btFirst.setPreferredSize(new java.awt.Dimension(22, 22)); btFirst.addActionListener(new NavigatorButtonActionListener(NavigatorButtonActionListener.NAV_BUTTON_FIRS)); jPanel3.add(btFirst); btPrev.setIcon(resourceMap.getIcon("btPrev.icon")); // NOI18N btPrev.setName("btPrev"); // NOI18N btPrev.setPreferredSize(new java.awt.Dimension(22, 22)); btPrev.addActionListener(new NavigatorButtonActionListener(NavigatorButtonActionListener.NAV_BUTTON_PREV)); jPanel3.add(btPrev); tfCurrentRow.setColumns(6); tfCurrentRow.setText(resourceMap.getString("tfCurrentRow.text")); // NOI18N tfCurrentRow.setName("tfCurrentRow"); // NOI18N jPanel3.add(tfCurrentRow); btNext.setIcon(resourceMap.getIcon("btNext.icon")); // NOI18N btNext.setName("btNext"); // NOI18N btNext.setPreferredSize(new java.awt.Dimension(22, 22)); btNext.addActionListener(new NavigatorButtonActionListener(NavigatorButtonActionListener.NAV_BUTTON_NEXT)); jPanel3.add(btNext); btLast.setIcon(resourceMap.getIcon("btLast.icon")); // NOI18N btLast.setName("btLast"); // NOI18N btLast.setPreferredSize(new java.awt.Dimension(22, 22)); btLast.addActionListener(new NavigatorButtonActionListener(NavigatorButtonActionListener.NAV_BUTTON_LAST)); jPanel3.add(btLast); jPanel1.add(jPanel3, java.awt.BorderLayout.SOUTH); spMain.setLeftComponent(jPanel1); jPanel2.setName("jPanel2"); // NOI18N jPanel2.setPreferredSize(new java.awt.Dimension(590, 80)); jPanel2.setLayout(new java.awt.BorderLayout()); jTabbedPane1.setTabPlacement(javax.swing.JTabbedPane.BOTTOM); jTabbedPane1.setName("jTabbedPane1"); // NOI18N plInfo.setName("plInfo"); // NOI18N plInfo.setLayout(new java.awt.BorderLayout()); plInfoCommon.setBorder(javax.swing.BorderFactory.createTitledBorder("...")); plInfoCommon.setMinimumSize(new java.awt.Dimension(661, 162)); plInfoCommon.setName("plInfoCommon"); // NOI18N plInfoCommon.setPreferredSize(new java.awt.Dimension(661, 162)); plInfoCommon.setLayout(new java.awt.GridBagLayout()); jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N jLabel2.setName("jLabel2"); // NOI18N jLabel2.setPreferredSize(new java.awt.Dimension(72, 15)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.ipadx = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 2); plInfoCommon.add(jLabel2, gridBagConstraints); jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N jLabel3.setName("jLabel3"); // NOI18N jLabel3.setPreferredSize(new java.awt.Dimension(72, 15)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.ipadx = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 2); plInfoCommon.add(jLabel3, gridBagConstraints); jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N jLabel4.setName("jLabel4"); // NOI18N jLabel4.setPreferredSize(new java.awt.Dimension(72, 15)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.ipadx = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 2); plInfoCommon.add(jLabel4, gridBagConstraints); jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N jLabel5.setName("jLabel5"); // NOI18N jLabel5.setPreferredSize(new java.awt.Dimension(72, 15)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.ipadx = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 2); plInfoCommon.add(jLabel5, gridBagConstraints); jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N jLabel6.setName("jLabel6"); // NOI18N jLabel6.setPreferredSize(new java.awt.Dimension(72, 15)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 6; gridBagConstraints.ipadx = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 2); plInfoCommon.add(jLabel6, gridBagConstraints); tfTimeAll.setEditable(false); tfTimeAll.setBorder( javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("tfTimeAll.border.lineColor"))); // NOI18N tfTimeAll.setMinimumSize(new java.awt.Dimension(68, 16)); tfTimeAll.setName("tfTimeAll"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 30; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); plInfoCommon.add(tfTimeAll, gridBagConstraints); tfDownloaded.setEditable(false); tfDownloaded.setBorder( javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("tfTimeAll.border.lineColor"))); // NOI18N tfDownloaded.setMinimumSize(new java.awt.Dimension(68, 16)); tfDownloaded.setName("tfDownloaded"); // NOI18N tfDownloaded.setPreferredSize(new java.awt.Dimension(68, 16)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 30; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); plInfoCommon.add(tfDownloaded, gridBagConstraints); tfSpeedDn.setEditable(false); tfSpeedDn.setBorder( javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("tfTimeAll.border.lineColor"))); // NOI18N tfSpeedDn.setMinimumSize(new java.awt.Dimension(68, 16)); tfSpeedDn.setName("tfSpeedDn"); // NOI18N tfSpeedDn.setPreferredSize(new java.awt.Dimension(68, 16)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 30; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); plInfoCommon.add(tfSpeedDn, gridBagConstraints); tfState.setEditable(false); tfState.setBorder( javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("tfTimeAll.border.lineColor"))); // NOI18N tfState.setMinimumSize(new java.awt.Dimension(68, 16)); tfState.setName("tfState"); // NOI18N tfState.setPreferredSize(new java.awt.Dimension(68, 16)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 30; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); plInfoCommon.add(tfState, gridBagConstraints); tfComment.setEditable(false); tfComment.setBorder( javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("tfTimeAll.border.lineColor"))); // NOI18N tfComment.setName("tfComment"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 5; gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 3.0; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); plInfoCommon.add(tfComment, gridBagConstraints); jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N jLabel10.setName("jLabel10"); // NOI18N jLabel10.setPreferredSize(new java.awt.Dimension(72, 15)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.ipadx = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 2); plInfoCommon.add(jLabel10, gridBagConstraints); jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N jLabel8.setName("jLabel8"); // NOI18N jLabel8.setPreferredSize(new java.awt.Dimension(72, 15)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.ipadx = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 2); plInfoCommon.add(jLabel8, gridBagConstraints); jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N jLabel7.setName("jLabel7"); // NOI18N jLabel7.setPreferredSize(new java.awt.Dimension(72, 15)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 3; gridBagConstraints.ipadx = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 2); plInfoCommon.add(jLabel7, gridBagConstraints); jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N jLabel9.setName("jLabel9"); // NOI18N jLabel9.setPreferredSize(new java.awt.Dimension(72, 15)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 4; gridBagConstraints.ipadx = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 2); plInfoCommon.add(jLabel9, gridBagConstraints); tfTimeAll1.setEditable(false); tfTimeAll1.setBorder( javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("tfTimeAll.border.lineColor"))); // NOI18N tfTimeAll1.setMaximumSize(new java.awt.Dimension(68, 16)); tfTimeAll1.setMinimumSize(new java.awt.Dimension(68, 16)); tfTimeAll1.setName("tfTimeAll1"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 30; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); plInfoCommon.add(tfTimeAll1, gridBagConstraints); tfUploaded.setEditable(false); tfUploaded.setBorder( javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("tfTimeAll.border.lineColor"))); // NOI18N tfUploaded.setMinimumSize(new java.awt.Dimension(68, 16)); tfUploaded.setName("tfUploaded"); // NOI18N tfUploaded.setPreferredSize(new java.awt.Dimension(68, 16)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 30; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); plInfoCommon.add(tfUploaded, gridBagConstraints); tfSpeedDn1.setEditable(false); tfSpeedDn1.setBorder( javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("tfTimeAll.border.lineColor"))); // NOI18N tfSpeedDn1.setMinimumSize(new java.awt.Dimension(68, 16)); tfSpeedDn1.setName("tfSpeedDn1"); // NOI18N tfSpeedDn1.setPreferredSize(new java.awt.Dimension(68, 16)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 30; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); plInfoCommon.add(tfSpeedDn1, gridBagConstraints); tfStartedAt.setEditable(false); tfStartedAt.setBorder( javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("tfTimeAll.border.lineColor"))); // NOI18N tfStartedAt.setMinimumSize(new java.awt.Dimension(68, 16)); tfStartedAt.setName("tfStartedAt"); // NOI18N tfStartedAt.setPreferredSize(new java.awt.Dimension(68, 16)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 30; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); plInfoCommon.add(tfStartedAt, gridBagConstraints); jLabel14.setText(resourceMap.getString("jLabel14.text")); // NOI18N jLabel14.setName("jLabel14"); // NOI18N jLabel14.setPreferredSize(new java.awt.Dimension(72, 15)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 0; gridBagConstraints.ipadx = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 2); plInfoCommon.add(jLabel14, gridBagConstraints); jLabel12.setText(resourceMap.getString("jLabel12.text")); // NOI18N jLabel12.setName("jLabel12"); // NOI18N jLabel12.setPreferredSize(new java.awt.Dimension(72, 15)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 1; gridBagConstraints.ipadx = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 2); plInfoCommon.add(jLabel12, gridBagConstraints); jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N jLabel11.setName("jLabel11"); // NOI18N jLabel11.setPreferredSize(new java.awt.Dimension(72, 15)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 2; gridBagConstraints.ipadx = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 2); plInfoCommon.add(jLabel11, gridBagConstraints); lbErrorInfo.setForeground(resourceMap.getColor("tfErrorInfo.foreground")); // NOI18N lbErrorInfo.setText(resourceMap.getString("lbErrorInfo.text")); // NOI18N lbErrorInfo.setName("lbErrorInfo"); // NOI18N lbErrorInfo.setPreferredSize(new java.awt.Dimension(72, 15)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 5; gridBagConstraints.ipadx = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 2); plInfoCommon.add(lbErrorInfo, gridBagConstraints); tfSeeds.setEditable(false); tfSeeds.setBorder( javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("tfTimeAll.border.lineColor"))); // NOI18N tfSeeds.setMinimumSize(new java.awt.Dimension(68, 16)); tfSeeds.setName("tfSeeds"); // NOI18N tfSeeds.setPreferredSize(new java.awt.Dimension(68, 16)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 30; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); plInfoCommon.add(tfSeeds, gridBagConstraints); tfLeechers.setEditable(false); tfLeechers.setText(resourceMap.getString("tfLeechers.text")); // NOI18N tfLeechers.setBorder( javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("tfTimeAll.border.lineColor"))); // NOI18N tfLeechers.setMinimumSize(new java.awt.Dimension(68, 16)); tfLeechers.setName("tfLeechers"); // NOI18N tfLeechers.setPreferredSize(new java.awt.Dimension(68, 16)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 30; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); plInfoCommon.add(tfLeechers, gridBagConstraints); tfRate.setEditable(false); tfRate.setBorder( javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("tfTimeAll.border.lineColor"))); // NOI18N tfRate.setMinimumSize(new java.awt.Dimension(68, 16)); tfRate.setName("tfRate"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 30; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); plInfoCommon.add(tfRate, gridBagConstraints); tfCreatedAt.setEditable(false); tfCreatedAt.setBorder( javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("tfTimeAll.border.lineColor"))); // NOI18N tfCreatedAt.setMinimumSize(new java.awt.Dimension(68, 16)); tfCreatedAt.setName("tfCreatedAt"); // NOI18N tfCreatedAt.setPreferredSize(new java.awt.Dimension(68, 16)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 30; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); plInfoCommon.add(tfCreatedAt, gridBagConstraints); jLabel16.setText(resourceMap.getString("jLabel16.text")); // NOI18N jLabel16.setName("jLabel16"); // NOI18N jLabel16.setPreferredSize(new java.awt.Dimension(72, 15)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.ipadx = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 2); plInfoCommon.add(jLabel16, gridBagConstraints); tfStorePath.setEditable(false); tfStorePath.setBorder( javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("tfStorePath.border.lineColor"))); // NOI18N tfStorePath.setName("tfStorePath"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 6; gridBagConstraints.gridwidth = 5; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 3.0; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); plInfoCommon.add(tfStorePath, gridBagConstraints); jLabel17.setText(resourceMap.getString("jLabel17.text")); // NOI18N jLabel17.setName("jLabel17"); // NOI18N jLabel17.setPreferredSize(new java.awt.Dimension(72, 15)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.ipadx = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 2); plInfoCommon.add(jLabel17, gridBagConstraints); tfSpeedDn3.setEditable(false); tfSpeedDn3.setBorder( javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("tfSpeedDn3.border.lineColor"))); // NOI18N tfSpeedDn3.setMinimumSize(new java.awt.Dimension(68, 16)); tfSpeedDn3.setName("tfSpeedDn3"); // NOI18N tfSpeedDn3.setPreferredSize(new java.awt.Dimension(68, 16)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 30; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); plInfoCommon.add(tfSpeedDn3, gridBagConstraints); jLabel18.setText(resourceMap.getString("jLabel18.text")); // NOI18N jLabel18.setName("jLabel18"); // NOI18N jLabel18.setPreferredSize(new java.awt.Dimension(72, 15)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.ipadx = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 2); plInfoCommon.add(jLabel18, gridBagConstraints); tfSpeedUp.setEditable(false); tfSpeedUp.setBorder( javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("tfSpeedUp.border.lineColor"))); // NOI18N tfSpeedUp.setMaximumSize(new java.awt.Dimension(68, 16)); tfSpeedUp.setMinimumSize(new java.awt.Dimension(68, 16)); tfSpeedUp.setName("tfSpeedUp"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 30; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); plInfoCommon.add(tfSpeedUp, gridBagConstraints); jLabel19.setText(resourceMap.getString("jLabel19.text")); // NOI18N jLabel19.setName("jLabel19"); // NOI18N jLabel19.setPreferredSize(new java.awt.Dimension(72, 15)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 3; gridBagConstraints.ipadx = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 2); plInfoCommon.add(jLabel19, gridBagConstraints); tfCreator.setEditable(false); tfCreator.setBorder( javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("tfCreator.border.lineColor"))); // NOI18N tfCreator.setMinimumSize(new java.awt.Dimension(68, 16)); tfCreator.setName("tfCreator"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 30; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); plInfoCommon.add(tfCreator, gridBagConstraints); tfErrorInfo.setEditable(false); tfErrorInfo.setForeground(resourceMap.getColor("tfErrorInfo.foreground")); // NOI18N tfErrorInfo.setText(null); tfErrorInfo.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); tfErrorInfo.setName("tfErrorInfo"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 5; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); plInfoCommon.add(tfErrorInfo, gridBagConstraints); jLabel15.setText(resourceMap.getString("jLabel15.text")); // NOI18N jLabel15.setName("jLabel15"); // NOI18N jLabel15.setPreferredSize(new java.awt.Dimension(72, 15)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 4; gridBagConstraints.ipadx = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 2); plInfoCommon.add(jLabel15, gridBagConstraints); plInfo.add(plInfoCommon, java.awt.BorderLayout.CENTER); jPanel9.setName("jPanel9"); // NOI18N jPanel9.setPreferredSize(new java.awt.Dimension(644, 56)); jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N jLabel1.setName("jLabel1"); // NOI18N plPieces.setBackground(resourceMap.getColor("plPieces.background")); // NOI18N plPieces.setName("plPieces"); // NOI18N plPieces.setLayout(new java.awt.BorderLayout()); lbProgress.setText(resourceMap.getString("lbProgress.text")); // NOI18N lbProgress.setName("lbProgress"); // NOI18N javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9); jPanel9.setLayout(jPanel9Layout); jPanel9Layout .setHorizontalGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel9Layout.createSequentialGroup().addContainerGap().addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(plPieces, javax.swing.GroupLayout.DEFAULT_SIZE, 667, Short.MAX_VALUE) .addGap(18, 18, 18).addComponent(lbProgress).addContainerGap())); jPanel9Layout.setVerticalGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel9Layout.createSequentialGroup().addGroup(jPanel9Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel9Layout.createSequentialGroup().addGap(24, 24, 24).addComponent(jLabel1)) .addGroup(jPanel9Layout.createSequentialGroup().addGap(25, 25, 25).addComponent(lbProgress)) .addGroup(jPanel9Layout.createSequentialGroup().addContainerGap().addComponent(plPieces, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE))) .addContainerGap())); lbProgress.getAccessibleContext() .setAccessibleName(resourceMap.getString("lbProgress.AccessibleContext.accessibleName")); // NOI18N plInfo.add(jPanel9, java.awt.BorderLayout.NORTH); jTabbedPane1.addTab(resourceMap.getString("plInfo.TabConstraints.tabTitle"), plInfo); // NOI18N plFiles.setName("plFiles"); // NOI18N plFiles.setLayout(new java.awt.BorderLayout()); jScrollPane3.setName("jScrollPane3"); // NOI18N tblTorrentFiles.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { }, new String[] { "Path", "Type", "Complete", "Done", "Size" }) { boolean[] canEdit = new boolean[] { false, false, false, false, false }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit[columnIndex]; } }); tblTorrentFiles.setName("tblTorrentFiles"); // NOI18N tblTorrentFiles.getTableHeader().setReorderingAllowed(false); jScrollPane3.setViewportView(tblTorrentFiles); tblTorrentFiles.getColumnModel().getColumn(0) .setHeaderValue(resourceMap.getString("tblTorrentFiles.columnModel.title0")); // NOI18N tblTorrentFiles.getColumnModel().getColumn(1) .setHeaderValue(resourceMap.getString("tblTorrentFiles.columnModel.title1")); // NOI18N tblTorrentFiles.getColumnModel().getColumn(2) .setHeaderValue(resourceMap.getString("tblTorrentFiles.columnModel.title2")); // NOI18N tblTorrentFiles.getColumnModel().getColumn(3) .setHeaderValue(resourceMap.getString("tblTorrentFiles.columnModel.title3")); // NOI18N tblTorrentFiles.getColumnModel().getColumn(4) .setHeaderValue(resourceMap.getString("tblTorrentFiles.columnModel.title4")); // NOI18N plFiles.add(jScrollPane3, java.awt.BorderLayout.CENTER); jTabbedPane1.addTab(resourceMap.getString("plFiles.TabConstraints.tabTitle"), plFiles); // NOI18N plPeers.setName("plPeers"); // NOI18N plPeers.setLayout(new java.awt.BorderLayout()); jScrollPane2.setName("jScrollPane2"); // NOI18N tblTorrentPeers.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { }, new String[] { "IP", "Country", "Flags", "Client", "Port", "Progress", "Dn rate", "Up rate" }) { boolean[] canEdit = new boolean[] { false, false, false, false, false, false, false, false }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit[columnIndex]; } }); tblTorrentPeers.setName("tblTorrentPeers"); // NOI18N tblTorrentPeers.getTableHeader().setReorderingAllowed(false); jScrollPane2.setViewportView(tblTorrentPeers); tblTorrentPeers.getColumnModel().getColumn(0) .setHeaderValue(resourceMap.getString("tblTorrentPeers.columnModel.title0")); // NOI18N tblTorrentPeers.getColumnModel().getColumn(1) .setHeaderValue(resourceMap.getString("tblTorrentPeers.columnModel.title1")); // NOI18N tblTorrentPeers.getColumnModel().getColumn(2) .setHeaderValue(resourceMap.getString("tblTorrentPeers.columnModel.title2")); // NOI18N tblTorrentPeers.getColumnModel().getColumn(3) .setHeaderValue(resourceMap.getString("tblTorrentPeers.columnModel.title3")); // NOI18N tblTorrentPeers.getColumnModel().getColumn(4) .setHeaderValue(resourceMap.getString("tblTorrentPeers.columnModel.title4")); // NOI18N tblTorrentPeers.getColumnModel().getColumn(5) .setHeaderValue(resourceMap.getString("tblTorrentPeers.columnModel.title5")); // NOI18N tblTorrentPeers.getColumnModel().getColumn(6) .setHeaderValue(resourceMap.getString("tblTorrentPeers.columnModel.title6")); // NOI18N tblTorrentPeers.getColumnModel().getColumn(7) .setHeaderValue(resourceMap.getString("tblTorrentPeers.columnModel.title7")); // NOI18N plPeers.add(jScrollPane2, java.awt.BorderLayout.CENTER); jTabbedPane1.addTab(resourceMap.getString("plPeers.TabConstraints.tabTitle"), plPeers); // NOI18N plTrackers.setName("plTrackers"); // NOI18N javax.swing.GroupLayout plTrackersLayout = new javax.swing.GroupLayout(plTrackers); plTrackers.setLayout(plTrackersLayout); plTrackersLayout.setHorizontalGroup(plTrackersLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 822, Short.MAX_VALUE)); plTrackersLayout.setVerticalGroup(plTrackersLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 233, Short.MAX_VALUE)); jTabbedPane1.addTab(resourceMap.getString("plTrackers.TabConstraints.tabTitle"), plTrackers); // NOI18N plSpeed.setName("plSpeed"); // NOI18N javax.swing.GroupLayout plSpeedLayout = new javax.swing.GroupLayout(plSpeed); plSpeed.setLayout(plSpeedLayout); plSpeedLayout.setHorizontalGroup(plSpeedLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 822, Short.MAX_VALUE)); plSpeedLayout.setVerticalGroup(plSpeedLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 233, Short.MAX_VALUE)); jTabbedPane1.addTab(resourceMap.getString("plSpeed.TabConstraints.tabTitle"), plSpeed); // NOI18N jPanel2.add(jTabbedPane1, java.awt.BorderLayout.CENTER); spMain.setRightComponent(jPanel2); mainPanel.add(spMain, java.awt.BorderLayout.CENTER); menuBar.setName("menuBar"); // NOI18N fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N fileMenu.setName("fileMenu"); // NOI18N javax.swing.ActionMap actionMap = org.jdesktop.application.Application .getInstance(net.sf.dvstar.transmission.TransmissionApp.class).getContext() .getActionMap(TransmissionView.class, this); miFileConnect.setAction(actionMap.get("doConnect")); // NOI18N miFileConnect.setIcon(resourceMap.getIcon("miFileConnect.icon")); // NOI18N miFileConnect.setText(resourceMap.getString("miFileConnect.text")); // NOI18N miFileConnect.setName("miFileConnect"); // NOI18N fileMenu.add(miFileConnect); jSeparator3.setName("jSeparator3"); // NOI18N fileMenu.add(jSeparator3); miFileQuickAddFile.setAction(actionMap.get("doAddTorrentQuick")); // NOI18N miFileQuickAddFile.setIcon(resourceMap.getIcon("miFileQuickAddFile.icon")); // NOI18N miFileQuickAddFile.setText(resourceMap.getString("miFileQuickAddFile.text")); // NOI18N miFileQuickAddFile.setName("miFileQuickAddFile"); // NOI18N fileMenu.add(miFileQuickAddFile); miFileExtAddFile.setAction(actionMap.get("doAddTorrentExt")); // NOI18N miFileExtAddFile.setIcon(resourceMap.getIcon("miFileExtAddFile.icon")); // NOI18N miFileExtAddFile.setText(resourceMap.getString("miFileExtAddFile.text")); // NOI18N miFileExtAddFile.setName("miFileExtAddFile"); // NOI18N fileMenu.add(miFileExtAddFile); miFileInfo.setAction(actionMap.get("doTorrentInfo")); // NOI18N miFileInfo.setIcon(resourceMap.getIcon("miFileInfo.icon")); // NOI18N miFileInfo.setText(resourceMap.getString("miFileInfo.text")); // NOI18N miFileInfo.setName("miFileInfo"); // NOI18N fileMenu.add(miFileInfo); miFileAddURL.setIcon(resourceMap.getIcon("miFileAddURL.icon")); // NOI18N miFileAddURL.setText(resourceMap.getString("miFileAddURL.text")); // NOI18N miFileAddURL.setName("miFileAddURL"); // NOI18N fileMenu.add(miFileAddURL); jSeparator2.setName("jSeparator2"); // NOI18N fileMenu.add(jSeparator2); miFileExit.setAction(actionMap.get("doQuit")); // NOI18N miFileExit.setIcon(resourceMap.getIcon("miFileExit.icon")); // NOI18N miFileExit.setName("miFileExit"); // NOI18N fileMenu.add(miFileExit); menuBar.add(fileMenu); configMenu.setText(resourceMap.getString("configMenu.text")); // NOI18N configMenu.setName("configMenu"); // NOI18N miConfigClient.setAction(actionMap.get("doConfigClient")); // NOI18N miConfigClient.setIcon(resourceMap.getIcon("miConfigClient.icon")); // NOI18N miConfigClient.setText(resourceMap.getString("miConfigClient.text")); // NOI18N miConfigClient.setName("miConfigClient"); // NOI18N configMenu.add(miConfigClient); miConfigServer.setAction(actionMap.get("doConfigServer")); // NOI18N miConfigServer.setIcon(resourceMap.getIcon("miConfigServer.icon")); // NOI18N miConfigServer.setText(resourceMap.getString("miConfigServer.text")); // NOI18N miConfigServer.setName("miConfigServer"); // NOI18N configMenu.add(miConfigServer); jSeparator1.setName("jSeparator1"); // NOI18N configMenu.add(jSeparator1); mnConfigLocale.setIcon(resourceMap.getIcon("mnConfigLocale.icon")); // NOI18N mnConfigLocale.setText(resourceMap.getString("mnConfigLocale.text")); // NOI18N mnConfigLocale.setName("mnConfigLocale"); // NOI18N configMenu.add(mnConfigLocale); menuBar.add(configMenu); torrentMenu.setAction(actionMap.get("doMoveTorrent")); // NOI18N torrentMenu.setText(resourceMap.getString("torrentMenu.text")); // NOI18N torrentMenu.setName("torrentMenu"); // NOI18N miTorrentStart.setAction(actionMap.get("doStartTorrent")); // NOI18N miTorrentStart.setIcon(resourceMap.getIcon("miTorrentStart.icon")); // NOI18N miTorrentStart.setText(resourceMap.getString("miTorrentStart.text")); // NOI18N miTorrentStart.setName("miTorrentStart"); // NOI18N torrentMenu.add(miTorrentStart); miTorrentStop.setAction(actionMap.get("doPauseTorrent")); // NOI18N miTorrentStop.setIcon(resourceMap.getIcon("miTorrentStop.icon")); // NOI18N miTorrentStop.setText(resourceMap.getString("miTorrentStop.text")); // NOI18N miTorrentStop.setName("miTorrentStop"); // NOI18N torrentMenu.add(miTorrentStop); miTorrentRefresh.setAction(actionMap.get("doRefresh")); // NOI18N miTorrentRefresh.setIcon(resourceMap.getIcon("miTorrentRefresh.icon")); // NOI18N miTorrentRefresh.setText(resourceMap.getString("miTorrentRefresh.text")); // NOI18N miTorrentRefresh.setName("miTorrentRefresh"); // NOI18N torrentMenu.add(miTorrentRefresh); miTorrentCheck.setIcon(resourceMap.getIcon("miTorrentCheck.icon")); // NOI18N miTorrentCheck.setText(resourceMap.getString("miTorrentCheck.text")); // NOI18N miTorrentCheck.setName("miTorrentCheck"); // NOI18N torrentMenu.add(miTorrentCheck); miTorrentProperties.setIcon(resourceMap.getIcon("miTorrentProperties.icon")); // NOI18N miTorrentProperties.setText(resourceMap.getString("miTorrentProperties.text")); // NOI18N miTorrentProperties.setName("miTorrentProperties"); // NOI18N torrentMenu.add(miTorrentProperties); miTorrentDelete.setIcon(resourceMap.getIcon("miTorrentDelete.icon")); // NOI18N miTorrentDelete.setText(resourceMap.getString("miTorrentDelete.text")); // NOI18N miTorrentDelete.setName("miTorrentDelete"); // NOI18N torrentMenu.add(miTorrentDelete); miTorrentDeleteAll.setIcon(resourceMap.getIcon("miTorrentDeleteAll.icon")); // NOI18N miTorrentDeleteAll.setText(resourceMap.getString("miTorrentDeleteAll.text")); // NOI18N miTorrentDeleteAll.setName("miTorrentDeleteAll"); // NOI18N torrentMenu.add(miTorrentDeleteAll); miTorrentAnnounce.setIcon(resourceMap.getIcon("miTorrentAnnounce.icon")); // NOI18N miTorrentAnnounce.setText(resourceMap.getString("miTorrentAnnounce.text")); // NOI18N miTorrentAnnounce.setName("miTorrentAnnounce"); // NOI18N torrentMenu.add(miTorrentAnnounce); miTorrentMove.setAction(actionMap.get("doMoveTorrent")); // NOI18N miTorrentMove.setIcon(resourceMap.getIcon("miTorrentMove.icon")); // NOI18N miTorrentMove.setText(resourceMap.getString("miTorrentMove.text")); // NOI18N miTorrentMove.setName("miTorrentMove"); // NOI18N torrentMenu.add(miTorrentMove); miTorrentLocation.setIcon(resourceMap.getIcon("miTorrentLocation.icon")); // NOI18N miTorrentLocation.setText(resourceMap.getString("miTorrentLocation.text")); // NOI18N miTorrentLocation.setName("miTorrentLocation"); // NOI18N torrentMenu.add(miTorrentLocation); jSeparator4.setName("jSeparator4"); // NOI18N torrentMenu.add(jSeparator4); miTorrentStartAll.setIcon(resourceMap.getIcon("miTorrentStartAll.icon")); // NOI18N miTorrentStartAll.setText(resourceMap.getString("miTorrentStartAll.text")); // NOI18N miTorrentStartAll.setName("miTorrentStartAll"); // NOI18N torrentMenu.add(miTorrentStartAll); miTorrentStopAll.setIcon(resourceMap.getIcon("miTorrentStopAll.icon")); // NOI18N miTorrentStopAll.setText(resourceMap.getString("miTorrentStopAll.text")); // NOI18N miTorrentStopAll.setName("miTorrentStopAll"); // NOI18N torrentMenu.add(miTorrentStopAll); menuBar.add(torrentMenu); helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N helpMenu.setName("helpMenu"); // NOI18N miHelpAbout.setAction(actionMap.get("showAboutBox")); // NOI18N miHelpAbout.setIcon(resourceMap.getIcon("miHelpAbout.icon")); // NOI18N miHelpAbout.setName("miHelpAbout"); // NOI18N helpMenu.add(miHelpAbout); menuBar.add(helpMenu); statusPanel.setName("statusPanel"); // NOI18N statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N statusMessageLabel.setName("statusMessageLabel"); // NOI18N statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N progressBar.setName("progressBar"); // NOI18N javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel); statusPanel.setLayout(statusPanelLayout); statusPanelLayout.setHorizontalGroup(statusPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 829, Short.MAX_VALUE) .addGroup(statusPanelLayout.createSequentialGroup().addContainerGap() .addComponent(statusMessageLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 645, Short.MAX_VALUE) .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(statusAnimationLabel).addContainerGap())); statusPanelLayout.setVerticalGroup(statusPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(statusPanelLayout.createSequentialGroup() .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(statusMessageLabel).addComponent(statusAnimationLabel) .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(3, 3, 3))); maiToolBar.setRollover(true); maiToolBar.setName("maiToolBar"); // NOI18N btConnect.setAction(actionMap.get("doConnect")); // NOI18N btConnect.setIcon(resourceMap.getIcon("btConnect.icon")); // NOI18N btConnect.setFocusable(false); btConnect.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btConnect.setMinimumSize(new java.awt.Dimension(0, 0)); btConnect.setName("btConnect"); // NOI18N btConnect.setPreferredSize(new java.awt.Dimension(45, 43)); btConnect.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); maiToolBar.add(btConnect); jSeparator5.setName("jSeparator5"); // NOI18N jSeparator5.setSeparatorSize(new java.awt.Dimension(5, 40)); maiToolBar.add(jSeparator5); btAdd.setAction(actionMap.get("doAddTorrentExt")); // NOI18N btAdd.setIcon(resourceMap.getIcon("btAdd.icon")); // NOI18N btAdd.setFocusable(false); btAdd.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btAdd.setName("btAdd"); // NOI18N btAdd.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); maiToolBar.add(btAdd); btAddUrl.setAction(actionMap.get("addTorentURL")); // NOI18N btAddUrl.setIcon(resourceMap.getIcon("btAddUrl.icon")); // NOI18N btAddUrl.setFocusable(false); btAddUrl.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btAddUrl.setName("btAddUrl"); // NOI18N btAddUrl.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); maiToolBar.add(btAddUrl); jSeparator8.setName("jSeparator8"); // NOI18N jSeparator8.setSeparatorSize(new java.awt.Dimension(5, 40)); maiToolBar.add(jSeparator8); btStart.setAction(actionMap.get("doStartTorrent")); // NOI18N btStart.setIcon(resourceMap.getIcon("btStart.icon")); // NOI18N btStart.setFocusable(false); btStart.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btStart.setName("btStart"); // NOI18N btStart.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); maiToolBar.add(btStart); btStop.setAction(actionMap.get("doPauseTorrent")); // NOI18N btStop.setIcon(resourceMap.getIcon("btStop.icon")); // NOI18N btStop.setFocusable(false); btStop.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btStop.setName("btStop"); // NOI18N btStop.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); maiToolBar.add(btStop); btRefresh.setAction(actionMap.get("doRefresh")); // NOI18N btRefresh.setIcon(resourceMap.getIcon("btRefresh.icon")); // NOI18N btRefresh.setFocusable(false); btRefresh.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btRefresh.setName("btRefresh"); // NOI18N btRefresh.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); maiToolBar.add(btRefresh); jSeparator9.setName("jSeparator9"); // NOI18N jSeparator9.setSeparatorSize(new java.awt.Dimension(5, 40)); maiToolBar.add(jSeparator9); btStatistic.setAction(actionMap.get("doStatisticDialog")); // NOI18N btStatistic.setIcon(resourceMap.getIcon("btStatistic.icon")); // NOI18N btStatistic.setFocusable(false); btStatistic.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btStatistic.setName("btStatistic"); // NOI18N btStatistic.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); maiToolBar.add(btStatistic); jSeparator6.setName("jSeparator6"); // NOI18N jSeparator6.setSeparatorSize(new java.awt.Dimension(5, 40)); maiToolBar.add(jSeparator6); btConfigCli.setAction(actionMap.get("doConfigClient")); // NOI18N btConfigCli.setIcon(resourceMap.getIcon("btConfigCli.icon")); // NOI18N btConfigCli.setFocusable(false); btConfigCli.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btConfigCli.setName("btConfigCli"); // NOI18N btConfigCli.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); maiToolBar.add(btConfigCli); jSeparator7.setName("jSeparator7"); // NOI18N jSeparator7.setSeparatorSize(new java.awt.Dimension(5, 40)); maiToolBar.add(jSeparator7); btExit.setAction(actionMap.get("doQuit")); // NOI18N btExit.setIcon(resourceMap.getIcon("btExit.icon")); // NOI18N btExit.setText(resourceMap.getString("btExit.text")); // NOI18N btExit.setFocusable(false); btExit.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btExit.setName("btExit"); // NOI18N btExit.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); maiToolBar.add(btExit); setComponent(mainPanel); setMenuBar(menuBar); setStatusBar(statusPanel); setToolBar(maiToolBar); }
From source file:org.executequery.gui.editor.QueryEditorPopupMenu.java
private JMenuItem createMenuItem(String actionName, String text) { JMenuItem menuItem = MenuItemFactory.createMenuItem(ActionBuilder.get(actionName)); menuItem.setIcon(null); if (StringUtils.isNotBlank(text)) { menuItem.setText(text);/*from w ww .j a v a 2 s.c o m*/ } return menuItem; }
From source file:org.freeplane.view.swing.features.time.mindmapmode.nodelist.NodeList.java
public void startup() { if (dialog != null) { dialog.toFront();//from w ww .j a v a 2s .co m return; } NodeList.COLUMN_MODIFIED = TextUtils.getText(PLUGINS_TIME_LIST_XML_MODIFIED); NodeList.COLUMN_CREATED = TextUtils.getText(PLUGINS_TIME_LIST_XML_CREATED); NodeList.COLUMN_ICONS = TextUtils.getText(PLUGINS_TIME_LIST_XML_ICONS); NodeList.COLUMN_TEXT = TextUtils.getText(PLUGINS_TIME_LIST_XML_TEXT); NodeList.COLUMN_DETAILS = TextUtils.getText(PLUGINS_TIME_LIST_XML_DETAILS); NodeList.COLUMN_DATE = TextUtils.getText(PLUGINS_TIME_LIST_XML_DATE); NodeList.COLUMN_NOTES = TextUtils.getText(PLUGINS_TIME_LIST_XML_NOTES); dialog = new JDialog(Controller.getCurrentController().getViewController().getFrame(), modal /* modal */); String windowTitle; if (showAllNodes) { windowTitle = PLUGINS_TIME_MANAGEMENT_XML_WINDOW_TITLE_ALL_NODES; } else { windowTitle = PLUGINS_TIME_MANAGEMENT_XML_WINDOW_TITLE; } dialog.setTitle(TextUtils.getText(windowTitle)); dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); final WindowAdapter windowListener = new WindowAdapter() { @Override public void windowGainedFocus(WindowEvent e) { mFilterTextSearchField.getEditor().selectAll(); } @Override public void windowClosing(final WindowEvent event) { disposeDialog(); } }; dialog.addWindowListener(windowListener); dialog.addWindowFocusListener(windowListener); UITools.addEscapeActionToDialog(dialog, new AbstractAction() { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { disposeDialog(); } }); final Container contentPane = dialog.getContentPane(); final GridBagLayout gbl = new GridBagLayout(); contentPane.setLayout(gbl); final GridBagConstraints layoutConstraints = new GridBagConstraints(); layoutConstraints.gridx = 0; layoutConstraints.gridy = 0; layoutConstraints.gridwidth = 1; layoutConstraints.gridheight = 1; layoutConstraints.weightx = 0.0; layoutConstraints.weighty = 0.0; layoutConstraints.anchor = GridBagConstraints.WEST; layoutConstraints.fill = GridBagConstraints.HORIZONTAL; contentPane.add(new JLabel(TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_FIND)), layoutConstraints); layoutConstraints.gridwidth = 1; layoutConstraints.gridx++; contentPane.add(Box.createHorizontalStrut(40), layoutConstraints); layoutConstraints.gridx++; contentPane.add(new JLabel(TextUtils.getText("filter_match_case")), layoutConstraints); layoutConstraints.gridx++; contentPane.add(matchCase, layoutConstraints); layoutConstraints.gridx++; contentPane.add(Box.createHorizontalStrut(40), layoutConstraints); layoutConstraints.gridx++; contentPane.add(new JLabel(TextUtils.getText("regular_expressions")), layoutConstraints); layoutConstraints.gridx++; contentPane.add(useRegexInFind, layoutConstraints); layoutConstraints.gridx = 0; layoutConstraints.weightx = 1.0; layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; layoutConstraints.gridy++; contentPane.add(/* new JScrollPane */(mFilterTextSearchField), layoutConstraints); layoutConstraints.gridy++; layoutConstraints.weightx = 0.0; layoutConstraints.gridwidth = 1; contentPane.add(new JLabel(TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_REPLACE)), layoutConstraints); layoutConstraints.gridx = 5; contentPane.add(new JLabel(TextUtils.getText("regular_expressions")), layoutConstraints); layoutConstraints.gridx++; contentPane.add(useRegexInReplace, layoutConstraints); layoutConstraints.gridx = 0; layoutConstraints.weightx = 1.0; layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; layoutConstraints.gridy++; contentPane.add(/* new JScrollPane */(mFilterTextReplaceField), layoutConstraints); dateRenderer = new DateRenderer(); textRenderer = new TextRenderer(); iconsRenderer = new IconsRenderer(); tableView = new FlatNodeTable(); tableView.addKeyListener(new FlatNodeTableKeyListener()); tableView.addMouseListener(new FlatNodeTableMouseAdapter()); tableView.getTableHeader().setReorderingAllowed(false); tableModel = updateModel(); mFlatNodeTableFilterModel = new FlatNodeTableFilterModel(tableModel, new int[] { NodeList.NODE_TEXT_COLUMN, NodeList.NODE_DETAILS_COLUMN, NodeList.NODE_NOTES_COLUMN }); sorter = new TableSorter(mFlatNodeTableFilterModel); tableView.setModel(sorter); sorter.setTableHeader(tableView.getTableHeader()); sorter.setColumnComparator(Date.class, TableSorter.COMPARABLE_COMPARATOR); sorter.setColumnComparator(NodeModel.class, TableSorter.LEXICAL_COMPARATOR); sorter.setColumnComparator(IconsHolder.class, TableSorter.COMPARABLE_COMPARATOR); sorter.setSortingStatus(NodeList.DATE_COLUMN, TableSorter.ASCENDING); final JScrollPane pane = new JScrollPane(tableView); UITools.setScrollbarIncrement(pane); layoutConstraints.gridy++; GridBagConstraints tableConstraints = (GridBagConstraints) layoutConstraints.clone(); tableConstraints.weightx = 1; tableConstraints.weighty = 10; tableConstraints.fill = GridBagConstraints.BOTH; contentPane.add(pane, tableConstraints); mTreeLabel = new JLabel(); layoutConstraints.gridy++; GridBagConstraints treeConstraints = (GridBagConstraints) layoutConstraints.clone(); treeConstraints.fill = GridBagConstraints.BOTH; @SuppressWarnings("serial") JScrollPane scrollPane = new JScrollPane(mTreeLabel) { @Override public boolean isValidateRoot() { return false; } }; contentPane.add(scrollPane, treeConstraints); final AbstractAction exportAction = new AbstractAction( TextUtils.getText("plugins/TimeManagement.xml_Export")) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { exportSelectedRowsAndClose(); } }; final JButton exportButton = new JButton(exportAction); final AbstractAction replaceAllAction = new AbstractAction( TextUtils.getText("plugins/TimeManagement.xml_Replace_All")) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { replace(new HolderAccessor(false)); } }; final JButton replaceAllButton = new JButton(replaceAllAction); final AbstractAction replaceSelectedAction = new AbstractAction( TextUtils.getText("plugins/TimeManagement.xml_Replace_Selected")) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { replace(new HolderAccessor(true)); } }; final JButton replaceSelectedButton = new JButton(replaceSelectedAction); final AbstractAction gotoAction = new AbstractAction(TextUtils.getText("plugins/TimeManagement.xml_Goto")) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { selectSelectedRows(); } }; final JButton gotoButton = new JButton(gotoAction); final AbstractAction disposeAction = new AbstractAction( TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_CLOSE)) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { disposeDialog(); } }; final JButton cancelButton = new JButton(disposeAction); /* Initial State */ gotoAction.setEnabled(false); exportAction.setEnabled(false); replaceSelectedAction.setEnabled(false); final Box bar = Box.createHorizontalBox(); bar.add(Box.createHorizontalGlue()); bar.add(cancelButton); bar.add(exportButton); bar.add(replaceAllButton); bar.add(replaceSelectedButton); bar.add(gotoButton); bar.add(Box.createHorizontalGlue()); layoutConstraints.gridy++; contentPane.add(/* new JScrollPane */(bar), layoutConstraints); final JMenuBar menuBar = new JMenuBar(); final JMenu menu = new JMenu(TextUtils.getText("plugins/TimeManagement.xml_menu_actions")); final AbstractAction[] actionList = new AbstractAction[] { gotoAction, replaceSelectedAction, replaceAllAction, exportAction, disposeAction }; for (int i = 0; i < actionList.length; i++) { final AbstractAction action = actionList[i]; final JMenuItem item = menu.add(action); item.setIcon(new BlindIcon(UIBuilder.ICON_SIZE)); } menuBar.add(menu); dialog.setJMenuBar(menuBar); final ListSelectionModel rowSM = tableView.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(final ListSelectionEvent e) { if (e.getValueIsAdjusting()) { return; } final ListSelectionModel lsm = (ListSelectionModel) e.getSource(); final boolean enable = !(lsm.isSelectionEmpty()); replaceSelectedAction.setEnabled(enable); gotoAction.setEnabled(enable); exportAction.setEnabled(enable); } }); rowSM.addListSelectionListener(new ListSelectionListener() { String getNodeText(final NodeModel node) { return TextController.getController().getShortText(node) + ((node.isRoot()) ? "" : (" <- " + getNodeText(node.getParentNode()))); } public void valueChanged(final ListSelectionEvent e) { if (e.getValueIsAdjusting()) { return; } final ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (lsm.isSelectionEmpty()) { mTreeLabel.setText(""); return; } final int selectedRow = lsm.getLeadSelectionIndex(); final NodeModel mindMapNode = getMindMapNode(selectedRow); mTreeLabel.setText(getNodeText(mindMapNode)); } }); final String marshalled = ResourceController.getResourceController() .getProperty(NodeList.WINDOW_PREFERENCE_STORAGE_PROPERTY); final WindowConfigurationStorage result = TimeWindowConfigurationStorage.decorateDialog(marshalled, dialog); final WindowConfigurationStorage storage = result; if (storage != null) { tableView.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); int column = 0; for (final TimeWindowColumnSetting setting : ((TimeWindowConfigurationStorage) storage) .getListTimeWindowColumnSettingList()) { tableView.getColumnModel().getColumn(column).setPreferredWidth(setting.getColumnWidth()); sorter.setSortingStatus(column, setting.getColumnSorting()); column++; } } mFlatNodeTableFilterModel.setFilter((String) mFilterTextSearchField.getSelectedItem(), matchCase.isSelected(), useRegexInFind.isSelected()); dialog.setVisible(true); }
From source file:org.freeplane.view.swing.features.time.mindmapmode.NodeList.java
public void startup() { if (dialog != null) { dialog.toFront();/*from ww w . java 2 s . c o m*/ return; } NodeList.COLUMN_MODIFIED = TextUtils.getText(PLUGINS_TIME_LIST_XML_MODIFIED); NodeList.COLUMN_CREATED = TextUtils.getText(PLUGINS_TIME_LIST_XML_CREATED); NodeList.COLUMN_ICONS = TextUtils.getText(PLUGINS_TIME_LIST_XML_ICONS); NodeList.COLUMN_TEXT = TextUtils.getText(PLUGINS_TIME_LIST_XML_TEXT); NodeList.COLUMN_DATE = TextUtils.getText(PLUGINS_TIME_LIST_XML_DATE); NodeList.COLUMN_NOTES = TextUtils.getText(PLUGINS_TIME_LIST_XML_NOTES); dialog = new JDialog(Controller.getCurrentController().getViewController().getFrame(), modal /* modal */); String windowTitle; if (showAllNodes) { windowTitle = PLUGINS_TIME_MANAGEMENT_XML_WINDOW_TITLE_ALL_NODES; } else { windowTitle = PLUGINS_TIME_MANAGEMENT_XML_WINDOW_TITLE; } dialog.setTitle(TextUtils.getText(windowTitle)); dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); final WindowAdapter windowListener = new WindowAdapter() { @Override public void windowGainedFocus(WindowEvent e) { mFilterTextSearchField.getEditor().selectAll(); } @Override public void windowClosing(final WindowEvent event) { disposeDialog(); } }; dialog.addWindowListener(windowListener); dialog.addWindowFocusListener(windowListener); UITools.addEscapeActionToDialog(dialog, new AbstractAction() { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { disposeDialog(); } }); final Container contentPane = dialog.getContentPane(); final GridBagLayout gbl = new GridBagLayout(); contentPane.setLayout(gbl); final GridBagConstraints layoutConstraints = new GridBagConstraints(); layoutConstraints.gridx = 0; layoutConstraints.gridy = 0; layoutConstraints.gridwidth = 1; layoutConstraints.gridheight = 1; layoutConstraints.weightx = 0.0; layoutConstraints.weighty = 0.0; layoutConstraints.anchor = GridBagConstraints.WEST; layoutConstraints.fill = GridBagConstraints.HORIZONTAL; contentPane.add(new JLabel(TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_FIND)), layoutConstraints); layoutConstraints.gridwidth = 1; layoutConstraints.gridx++; contentPane.add(Box.createHorizontalStrut(40), layoutConstraints); layoutConstraints.gridx++; contentPane.add(new JLabel(TextUtils.getText("filter_match_case")), layoutConstraints); layoutConstraints.gridx++; contentPane.add(matchCase, layoutConstraints); layoutConstraints.gridx++; contentPane.add(Box.createHorizontalStrut(40), layoutConstraints); layoutConstraints.gridx++; contentPane.add(new JLabel(TextUtils.getText("regular_expressions")), layoutConstraints); layoutConstraints.gridx++; contentPane.add(useRegexInFind, layoutConstraints); layoutConstraints.gridx = 0; layoutConstraints.weightx = 1.0; layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; layoutConstraints.gridy++; contentPane.add(/* new JScrollPane */(mFilterTextSearchField), layoutConstraints); layoutConstraints.gridy++; layoutConstraints.weightx = 0.0; layoutConstraints.gridwidth = 1; contentPane.add(new JLabel(TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_REPLACE)), layoutConstraints); layoutConstraints.gridx = 5; contentPane.add(new JLabel(TextUtils.getText("regular_expressions")), layoutConstraints); layoutConstraints.gridx++; contentPane.add(useRegexInReplace, layoutConstraints); layoutConstraints.gridx = 0; layoutConstraints.weightx = 1.0; layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; layoutConstraints.gridy++; contentPane.add(/* new JScrollPane */(mFilterTextReplaceField), layoutConstraints); dateRenderer = new DateRenderer(); nodeRenderer = new NodeRenderer(); notesRenderer = new NotesRenderer(); iconsRenderer = new IconsRenderer(); timeTable = new FlatNodeTable(); timeTable.addKeyListener(new FlatNodeTableKeyListener()); timeTable.addMouseListener(new FlatNodeTableMouseAdapter()); timeTable.getTableHeader().setReorderingAllowed(false); timeTableModel = updateModel(); mFlatNodeTableFilterModel = new FlatNodeTableFilterModel(timeTableModel, NodeList.NODE_TEXT_COLUMN); sorter = new TableSorter(mFlatNodeTableFilterModel); timeTable.setModel(sorter); sorter.setTableHeader(timeTable.getTableHeader()); sorter.setColumnComparator(Date.class, TableSorter.COMPARABLE_COMPARATOR); sorter.setColumnComparator(NodeModel.class, TableSorter.LEXICAL_COMPARATOR); sorter.setColumnComparator(IconsHolder.class, TableSorter.COMPARABLE_COMPARATOR); sorter.setSortingStatus(NodeList.DATE_COLUMN, TableSorter.ASCENDING); final JScrollPane pane = new JScrollPane(timeTable); UITools.setScrollbarIncrement(pane); layoutConstraints.gridy++; GridBagConstraints tableConstraints = (GridBagConstraints) layoutConstraints.clone(); tableConstraints.weightx = 1; tableConstraints.weighty = 10; tableConstraints.fill = GridBagConstraints.BOTH; contentPane.add(pane, tableConstraints); mTreeLabel = new JLabel(); layoutConstraints.gridy++; GridBagConstraints treeConstraints = (GridBagConstraints) layoutConstraints.clone(); treeConstraints.fill = GridBagConstraints.BOTH; @SuppressWarnings("serial") JScrollPane scrollPane = new JScrollPane(mTreeLabel) { @Override public boolean isValidateRoot() { return false; } }; contentPane.add(scrollPane, treeConstraints); final AbstractAction exportAction = new AbstractAction( TextUtils.getText("plugins/TimeManagement.xml_Export")) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { exportSelectedRowsAndClose(); } }; final JButton exportButton = new JButton(exportAction); final AbstractAction replaceAllAction = new AbstractAction( TextUtils.getText("plugins/TimeManagement.xml_Replace_All")) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { replace(new ReplaceAllInfo()); } }; final JButton replaceAllButton = new JButton(replaceAllAction); final AbstractAction replaceSelectedAction = new AbstractAction( TextUtils.getText("plugins/TimeManagement.xml_Replace_Selected")) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { replace(new ReplaceSelectedInfo()); } }; final JButton replaceSelectedButton = new JButton(replaceSelectedAction); final AbstractAction gotoAction = new AbstractAction(TextUtils.getText("plugins/TimeManagement.xml_Goto")) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { selectSelectedRows(); } }; final JButton gotoButton = new JButton(gotoAction); final AbstractAction disposeAction = new AbstractAction( TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_CLOSE)) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { disposeDialog(); } }; final JButton cancelButton = new JButton(disposeAction); /* Initial State */ gotoAction.setEnabled(false); exportAction.setEnabled(false); replaceSelectedAction.setEnabled(false); final Box bar = Box.createHorizontalBox(); bar.add(Box.createHorizontalGlue()); bar.add(cancelButton); bar.add(exportButton); bar.add(replaceAllButton); bar.add(replaceSelectedButton); bar.add(gotoButton); bar.add(Box.createHorizontalGlue()); layoutConstraints.gridy++; contentPane.add(/* new JScrollPane */(bar), layoutConstraints); final JMenuBar menuBar = new JMenuBar(); final JMenu menu = new JMenu(TextUtils.getText("plugins/TimeManagement.xml_menu_actions")); final AbstractAction[] actionList = new AbstractAction[] { gotoAction, replaceSelectedAction, replaceAllAction, exportAction, disposeAction }; for (int i = 0; i < actionList.length; i++) { final AbstractAction action = actionList[i]; final JMenuItem item = menu.add(action); item.setIcon(new BlindIcon(UIBuilder.ICON_SIZE)); } menuBar.add(menu); dialog.setJMenuBar(menuBar); final ListSelectionModel rowSM = timeTable.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(final ListSelectionEvent e) { if (e.getValueIsAdjusting()) { return; } final ListSelectionModel lsm = (ListSelectionModel) e.getSource(); final boolean enable = !(lsm.isSelectionEmpty()); replaceSelectedAction.setEnabled(enable); gotoAction.setEnabled(enable); exportAction.setEnabled(enable); } }); rowSM.addListSelectionListener(new ListSelectionListener() { String getNodeText(final NodeModel node) { return TextController.getController().getShortText(node) + ((node.isRoot()) ? "" : (" <- " + getNodeText(node.getParentNode()))); } public void valueChanged(final ListSelectionEvent e) { if (e.getValueIsAdjusting()) { return; } final ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (lsm.isSelectionEmpty()) { mTreeLabel.setText(""); return; } final int selectedRow = lsm.getLeadSelectionIndex(); final NodeModel mindMapNode = getMindMapNode(selectedRow); mTreeLabel.setText(getNodeText(mindMapNode)); } }); final String marshalled = ResourceController.getResourceController() .getProperty(NodeList.WINDOW_PREFERENCE_STORAGE_PROPERTY); final WindowConfigurationStorage result = TimeWindowConfigurationStorage.decorateDialog(marshalled, dialog); final WindowConfigurationStorage storage = result; if (storage != null) { timeTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); int column = 0; for (final TimeWindowColumnSetting setting : ((TimeWindowConfigurationStorage) storage) .getListTimeWindowColumnSettingList()) { timeTable.getColumnModel().getColumn(column).setPreferredWidth(setting.getColumnWidth()); sorter.setSortingStatus(column, setting.getColumnSorting()); column++; } } mFlatNodeTableFilterModel.setFilter((String) mFilterTextSearchField.getSelectedItem(), matchCase.isSelected(), useRegexInFind.isSelected()); dialog.setVisible(true); }
From source file:org.gofleet.module.routing.RoutingMap.java
@Override protected JPopupMenu getContextMenu() { JPopupMenu menu = new JPopupMenu(); menu.setBackground(Color.decode("#E8EDF6")); String mapMenuTituloPlanning = i18n.getString("map.menu.titulo.planning"); String mapMenuNewPlanning = i18n.getString("map.menu.new.planning"); // Ttulo//from ww w.j av a2s. c o m final JMenuItem titulo = new JMenuItem(mapMenuTituloPlanning); titulo.setFont(LogicConstants.deriveBoldFont(10.0f)); titulo.setBackground(Color.decode("#A4A4A4")); titulo.setFocusable(false); menu.add(titulo); // New Planning final JMenuItem to = new JMenuItem(mapMenuNewPlanning, KeyEvent.VK_F6); to.setIcon(LogicConstants.getIcon("menucontextual_icon_destinoruta")); to.addActionListener(this); menu.add(to); menu.addSeparator(); return menu; }
From source file:org.gtdfree.GTDFree.java
protected TrayIcon getTrayIcon() { if (trayIcon == null) { if (ApplicationHelper.isGTKLaF()) { trayIcon = new TrayIcon(ApplicationHelper.loadImage(ApplicationHelper.icon_name_large_tray_splash)); } else {/*from w w w . j a v a2s .com*/ trayIcon = new TrayIcon(ApplicationHelper.loadImage(ApplicationHelper.icon_name_small_tray_splash)); } trayIcon.setImageAutoSize(true); trayIcon.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { trayIconPopup.setVisible(false); if (getJFrame().isVisible()) { getJFrame().setVisible(false); } else { pushVisible(); } } else { if (trayIconPopup.isVisible()) { trayIconPopup.setVisible(false); } else { Point p = new Point(e.getPoint()); /* * Disabled, because we are anyway doing things like rollover, * which are probably done by Frame. if (getJFrame().isShowing()) { SwingUtilities.convertPointFromScreen(p, getJFrame()); trayIconPopup.show(getJFrame(), p.x, p.y); } else { }*/ trayIconPopup.show(null, p.x, p.y); } } } }); trayIcon.setToolTip("GTD-Free - " + Messages.getString("GTDFree.Tray.desc")); //$NON-NLS-1$ //$NON-NLS-2$ /* * Necessary only when popup is showing with null window. Hides popup. */ MouseListener hideMe = new MouseAdapter() { @Override public void mouseExited(MouseEvent e) { if (e.getComponent() instanceof JMenuItem) { JMenuItem jm = (JMenuItem) e.getComponent(); jm.getModel().setRollover(false); jm.getModel().setArmed(false); jm.repaint(); } Point p = SwingUtilities.convertPoint(e.getComponent(), e.getPoint(), trayIconPopup); //System.out.println(p.x+" "+p.y+" "+trayIconPopup.getWidth()+" "+trayIconPopup.getHeight()); if (p.x < 0 || p.x >= trayIconPopup.getWidth() || p.y < 0 || p.y >= trayIconPopup.getHeight()) { trayIconPopup.setVisible(false); } } @Override public void mouseEntered(MouseEvent e) { if (e.getComponent() instanceof JMenuItem) { JMenuItem jm = (JMenuItem) e.getComponent(); jm.getModel().setRollover(true); jm.getModel().setArmed(true); jm.repaint(); } } }; trayIconPopup = new JPopupMenu(); trayIconPopup.addMouseListener(hideMe); JMenuItem mi = new JMenuItem(Messages.getString("GTDFree.Tray.Drop")); //$NON-NLS-1$ mi.setIcon(ApplicationHelper.getIcon(ApplicationHelper.icon_name_small_collecting)); mi.setToolTipText(Messages.getString("GTDFree.Tray.Drop.desc")); //$NON-NLS-1$ mi.addMouseListener(hideMe); /* * Workaround for tray, if JFrame is showing, then mouse click is not fired */ mi.addMouseListener(new MouseAdapter() { private boolean click = false; @Override public void mousePressed(MouseEvent e) { click = true; } @Override public void mouseReleased(MouseEvent e) { if (click) { click = false; doMouseClicked(e); } } @Override public void mouseExited(MouseEvent e) { click = false; } private void doMouseClicked(MouseEvent e) { trayIconPopup.setVisible(false); Clipboard c = null; if (e.getButton() == MouseEvent.BUTTON1) { c = Toolkit.getDefaultToolkit().getSystemClipboard(); } else if (e.getButton() == MouseEvent.BUTTON2) { c = Toolkit.getDefaultToolkit().getSystemSelection(); } else { return; } try { Object o = c.getData(DataFlavor.stringFlavor); if (o != null) { getEngine().getGTDModel().collectAction(o.toString()); } flashMessage(Messages.getString("GTDFree.Tray.Collect.ok"), e.getLocationOnScreen()); //$NON-NLS-1$ } catch (Exception e1) { Logger.getLogger(this.getClass()).debug("Internal error.", e1); //$NON-NLS-1$ flashMessage(Messages.getString("GTDFree.Tray.Collect.fail") + e1.getMessage(), //$NON-NLS-1$ e.getLocationOnScreen()); } } }); TransferHandler th = new TransferHandler() { private static final long serialVersionUID = 1L; @Override public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) { return DataFlavor.selectBestTextFlavor(transferFlavors) != null; } @Override public boolean importData(JComponent comp, Transferable t) { try { DataFlavor f = DataFlavor.selectBestTextFlavor(t.getTransferDataFlavors()); Object o = t.getTransferData(f); if (o != null) { getEngine().getGTDModel().collectAction(o.toString()); } return true; } catch (UnsupportedFlavorException e) { Logger.getLogger(this.getClass()).debug("Internal error.", e); //$NON-NLS-1$ } catch (IOException e) { Logger.getLogger(this.getClass()).debug("Internal error.", e); //$NON-NLS-1$ } return false; } }; mi.setTransferHandler(th); trayIconPopup.add(mi); mi = new JMenuItem(); mi.setIcon(ApplicationHelper.getIcon(ApplicationHelper.icon_name_large_delete)); mi.setText(Messages.getString("GTDFree.Tray.Hide")); //$NON-NLS-1$ mi.setToolTipText(Messages.getString("GTDFree.Tray.Hide.desc")); //$NON-NLS-1$ mi.addMouseListener(hideMe); mi.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { trayIconPopup.setVisible(false); if (getJFrame().isVisible()) { getJFrame().setVisible(false); } } }); trayIconPopup.add(mi); mi = new JMenuItem(); mi.setIcon(ApplicationHelper.getIcon(ApplicationHelper.icon_name_small_splash)); mi.setText(Messages.getString("GTDFree.Tray.Show")); //$NON-NLS-1$ mi.setToolTipText(Messages.getString("GTDFree.Tray.Show.desc")); //$NON-NLS-1$ mi.addMouseListener(hideMe); mi.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { trayIconPopup.setVisible(false); pushVisible(); } }); trayIconPopup.add(mi); mi = new JMenuItem(); mi.setIcon(ApplicationHelper.getIcon(ApplicationHelper.icon_name_large_exit)); mi.setText(Messages.getString("GTDFree.Tray.Exit")); //$NON-NLS-1$ mi.addMouseListener(hideMe); mi.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { trayIconPopup.setVisible(false); close(false); } }); trayIconPopup.add(mi); } return trayIcon; }