List of usage examples for javax.swing ButtonGroup ButtonGroup
public ButtonGroup()
ButtonGroup
. From source file:de.juwimm.cms.content.panel.PanDocuments.java
private void loadThumbs(Integer unit) { this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try {/*from w ww .j a va 2s .c o m*/ tblDocumentsModel = new DocumentTableModel(); tblDocumentSorter = new TableSorter(tblDocumentsModel, tblDocuments.getTableHeader()); tblDocuments.getSelectionModel().clearSelection(); tblDocuments.setModel(tblDocumentSorter); DocumentSlimValue[] dsva = null; if (((CboModel) cboRegion.getSelectedItem()).isUnit) { dsva = comm.getAllSlimDocumentValues(unit); } else { dsva = comm.getAllSlimDocumentValues4ViewComponent(viewComponentId); } panDocumentButtons.removeAll(); anzahlItems = 0; bgrp = new ButtonGroup(); for (int i = 0; i < dsva.length; i++) { DocumentSlimValue dsv = dsva[i]; tblDocumentsModel.addRow(dsv); PanDocumentSymbol pan = new PanDocumentSymbol(); // pan.setPreferredSize(new Dimension(95,95)); pan.getFileButton().setIcon(Utils.getIcon4Extension(Utils.getExtension(dsv.getDocumentName()))); pan.getFileNameLabel().setText(dsv.getDocumentName()); pan.getFileButton().setActionCommand(dsv.getDocumentId() + ""); pan.getFileButton().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnFileActionPerformed(e); } }); if (intDocId != null && (intDocId.intValue() == dsv.getDocumentId())) { pan.getFileButton().doClick(); mimeType = dsv.getMimeType(); selectDocument(intDocId); } panDocumentButtons.add(pan, null); anzahlItems++; bgrp.add(pan.getFileButton()); this.setMaxButtonWidth(pan); } panDocumentButtons.validate(); panDocumentButtons.repaint(); resizeScrollpane(); } catch (Exception exe) { log.error("Error loading thumbs", exe); } this.setCursor(Cursor.getDefaultCursor()); }
From source file:com.emental.mindraider.ui.frames.MindRaiderMainWindow.java
/** * Build main menu.//w w w .j a v a 2s .c om * * @param spiders */ private void buildMenu(final SpidersGraph spiders) { JMenuBar menuBar; JMenu menu, submenu; JMenuItem menuItem, subMenuItem; JRadioButtonMenuItem rbMenuItem; // create the menu bar menuBar = new JMenuBar(); setJMenuBar(menuBar); // - main menu ------------------------------------------------------- menu = new JMenu(MindRaiderConstants.MR_TITLE); menu.setMnemonic(KeyEvent.VK_M); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.setActiveNotebookAsHome")); menuItem.setMnemonic(KeyEvent.VK_H); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { MindRaider.profile.setHomeNotebook(); } }); menu.add(menuItem); menu.add(menuItem); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.preferences")); menuItem.setMnemonic(KeyEvent.VK_P); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new PreferencesJDialog(); } }); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.exit"), KeyEvent.VK_X); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { exitMindRaider(); } }); menu.add(menuItem); menuBar.add(menu); // - Find ---------------------------------------------------------- menu = new JMenu(Messages.getString("MindRaiderJFrame.search")); menu.setMnemonic(KeyEvent.VK_F); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.searchNotebooks")); menuItem.setMnemonic(KeyEvent.VK_N); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK)); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new OpenOutlineJDialog(); } }); menu.add(menuItem); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.searchFulltext")); menuItem.setMnemonic(KeyEvent.VK_F); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK)); menuItem.setEnabled(true); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new FtsJDialog(); } }); menu.add(menuItem); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.searchConceptsInNotebook")); menuItem.setMnemonic(KeyEvent.VK_C); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK)); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (MindRaider.profile.getActiveOutlineUri() != null) { new OpenNoteJDialog(); } } }); menu.add(menuItem); // search by tag menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.searchConceptsByTag")); menuItem.setEnabled(true); menuItem.setMnemonic(KeyEvent.VK_T); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_T, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK)); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new OpenConceptByTagJDialog(); } }); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.previousNote")); menuItem.setEnabled(true); menuItem.setMnemonic(KeyEvent.VK_P); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, ActionEvent.ALT_MASK)); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { MindRaider.recentConcepts.moveOneNoteBack(); } }); menu.add(menuItem); // global RDF search // menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.searchRdql")); // menuItem.setEnabled(false); // menuItem.setMnemonic(KeyEvent.VK_R); // menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, // ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK)); // menuItem.addActionListener(new ActionListener() { // // public void actionPerformed(ActionEvent e) { // // TODO rdql to be implemented // } // }); // menu.add(menuItem); menuBar.add(menu); // - view ------------------------------------------------------------ menu = new JMenu(Messages.getString("MindRaiderJFrame.view")); menu.setMnemonic(KeyEvent.VK_V); // TODO localize L&F menu ButtonGroup lfGroup = new ButtonGroup(); submenu = new JMenu(Messages.getString("MindRaiderJFrame.lookAndFeel")); logger.debug("Look and feel is: " + MindRaider.profile.getLookAndFeel()); // {{debug}} submenu.setMnemonic(KeyEvent.VK_L); subMenuItem = new JRadioButtonMenuItem(Messages.getString("MindRaiderJFrame.lookAndFeelNative")); if (MindRaider.LF_NATIVE.equals(MindRaider.profile.getLookAndFeel())) { subMenuItem.setSelected(true); } subMenuItem.setEnabled(true); subMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setLookAndFeel(MindRaider.LF_NATIVE); } }); submenu.add(subMenuItem); lfGroup.add(subMenuItem); subMenuItem = new JRadioButtonMenuItem(Messages.getString("MindRaiderJFrame.lookAndFeelJava")); if (MindRaider.LF_JAVA_DEFAULT.equals(MindRaider.profile.getLookAndFeel())) { subMenuItem.setSelected(true); } subMenuItem.setEnabled(true); subMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setLookAndFeel(MindRaider.LF_JAVA_DEFAULT); } }); submenu.add(subMenuItem); lfGroup.add(subMenuItem); menu.add(submenu); menu.addSeparator(); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.leftSideBar")); menuItem.setMnemonic(KeyEvent.VK_L); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (leftSidebarSplitPane.getDividerLocation() == 1) { leftSidebarSplitPane.resetToPreferredSizes(); } else { closeLeftSidebar(); } } }); menu.add(menuItem); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.rightSideBar")); menuItem.setMnemonic(KeyEvent.VK_R); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { OutlineJPanel.getInstance().toggleRightSidebar(); } }); menu.add(menuItem); // TODO tips to be implemented // JCheckBoxMenuItem helpCheckbox=new JCheckBoxMenuItem("Tips",true); // menu.add(helpCheckbox); // TODO localize menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.toolbar")); menuItem.setMnemonic(KeyEvent.VK_T); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { MindRaider.masterToolBar.toggleVisibility(); } }); menu.add(menuItem); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.rdfNavigatorDashboard")); menuItem.setMnemonic(KeyEvent.VK_D); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { MindRaider.spidersGraph.getGlPanel().toggleControlPanel(); } }); menu.add(menuItem); JCheckBoxMenuItem checkboxMenuItem; ButtonGroup colorSchemeGroup; // if (!MindRaider.OUTLINER_PERSPECTIVE.equals(MindRaider.profile // .getUiPerspective())) { menu.addSeparator(); // Facets submenu = new JMenu(Messages.getString("MindRaiderJFrame.facet")); submenu.setMnemonic(KeyEvent.VK_F); colorSchemeGroup = new ButtonGroup(); String[] facetLabels = FacetCustodian.getInstance().getFacetLabels(); if (!ArrayUtils.isEmpty(facetLabels)) { for (String facetLabel : facetLabels) { rbMenuItem = new JRadioButtonMenuItem(facetLabel); rbMenuItem.addActionListener(new FacetActionListener(facetLabel)); colorSchemeGroup.add(rbMenuItem); submenu.add(rbMenuItem); if (BriefFacet.LABEL.equals(facetLabel)) { rbMenuItem.setSelected(true); } } } menu.add(submenu); checkboxMenuItem = new JCheckBoxMenuItem(Messages.getString("MindRaiderJFrame.graphLabelAsUri")); checkboxMenuItem.setMnemonic(KeyEvent.VK_G); checkboxMenuItem.setState(MindRaider.spidersGraph.isUriLabels()); checkboxMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof JCheckBoxMenuItem) { JCheckBoxMenuItem j = (JCheckBoxMenuItem) e.getSource(); MindRaider.spidersGraph.setUriLabels(j.getState()); MindRaider.spidersGraph.renderModel(); MindRaider.profile.setGraphShowLabelsAsUris(j.getState()); MindRaider.profile.save(); } } }); menu.add(checkboxMenuItem); checkboxMenuItem = new JCheckBoxMenuItem(Messages.getString("MindRaiderJFrame.predicateNodes")); checkboxMenuItem.setMnemonic(KeyEvent.VK_P); checkboxMenuItem.setState(!MindRaider.spidersGraph.getHidePredicates()); checkboxMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof JCheckBoxMenuItem) { JCheckBoxMenuItem j = (JCheckBoxMenuItem) e.getSource(); MindRaider.spidersGraph.hidePredicates(!j.getState()); MindRaider.spidersGraph.renderModel(); MindRaider.profile.setGraphHidePredicates(!j.getState()); MindRaider.profile.save(); } } }); menu.add(checkboxMenuItem); checkboxMenuItem = new JCheckBoxMenuItem(Messages.getString("MindRaiderJFrame.multilineLabels")); checkboxMenuItem.setMnemonic(KeyEvent.VK_M); checkboxMenuItem.setState(MindRaider.spidersGraph.isMultilineNodes()); checkboxMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof JCheckBoxMenuItem) { JCheckBoxMenuItem j = (JCheckBoxMenuItem) e.getSource(); MindRaider.spidersGraph.setMultilineNodes(j.getState()); MindRaider.spidersGraph.renderModel(); MindRaider.profile.setGraphMultilineLabels(j.getState()); MindRaider.profile.save(); } } }); menu.add(checkboxMenuItem); // } menu.addSeparator(); // Antialias checkboxMenuItem = new JCheckBoxMenuItem(Messages.getString("MindRaiderJFrame.antiAliased"), true); checkboxMenuItem.setMnemonic(KeyEvent.VK_A); checkboxMenuItem.setState(SpidersGraph.antialiased); checkboxMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof JCheckBoxMenuItem) { JCheckBoxMenuItem j = (JCheckBoxMenuItem) e.getSource(); SpidersGraph.antialiased = j.getState(); MindRaider.spidersGraph.renderModel(); } } }); menu.add(checkboxMenuItem); // Enable hyperbolic checkboxMenuItem = new JCheckBoxMenuItem(Messages.getString("MindRaiderJFrame.hyperbolic"), true); checkboxMenuItem.setMnemonic(KeyEvent.VK_H); checkboxMenuItem.setState(SpidersGraph.hyperbolic); checkboxMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof JCheckBoxMenuItem) { JCheckBoxMenuItem j = (JCheckBoxMenuItem) e.getSource(); SpidersGraph.hyperbolic = j.getState(); MindRaider.spidersGraph.renderModel(); } } }); menu.add(checkboxMenuItem); // Show FPS checkboxMenuItem = new JCheckBoxMenuItem(Messages.getString("MindRaiderJFrame.fps"), true); checkboxMenuItem.setMnemonic(KeyEvent.VK_F); checkboxMenuItem.setState(SpidersGraph.fps); checkboxMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof JCheckBoxMenuItem) { JCheckBoxMenuItem j = (JCheckBoxMenuItem) e.getSource(); SpidersGraph.fps = j.getState(); MindRaider.spidersGraph.renderModel(); } } }); menu.add(checkboxMenuItem); // Graph color scheme submenu = new JMenu(Messages.getString("MindRaiderJFrame.colorScheme")); submenu.setMnemonic(KeyEvent.VK_C); String[] allProfilesUris = MindRaider.spidersColorProfileRegistry.getAllProfilesUris(); colorSchemeGroup = new ButtonGroup(); for (int i = 0; i < allProfilesUris.length; i++) { rbMenuItem = new UriJRadioButtonMenuItem( MindRaider.spidersColorProfileRegistry.getColorProfileByUri(allProfilesUris[i]).getLabel(), allProfilesUris[i]); rbMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof UriJRadioButtonMenuItem) { MindRaider.spidersColorProfileRegistry .setCurrentProfile(((UriJRadioButtonMenuItem) e.getSource()).uri); MindRaider.spidersGraph .setRenderingProfile(MindRaider.spidersColorProfileRegistry.getCurrentProfile()); MindRaider.spidersGraph.renderModel(); } } }); colorSchemeGroup.add(rbMenuItem); submenu.add(rbMenuItem); } menu.add(submenu); // Annotation color scheme submenu = new JMenu(Messages.getString("MindRaiderJFrame.colorSchemeAnnotation")); submenu.setMnemonic(KeyEvent.VK_A); allProfilesUris = MindRaider.annotationColorProfileRegistry.getAllProfilesUris(); colorSchemeGroup = new ButtonGroup(); for (int i = 0; i < allProfilesUris.length; i++) { rbMenuItem = new UriJRadioButtonMenuItem( MindRaider.annotationColorProfileRegistry.getColorProfileByUri(allProfilesUris[i]).getLabel(), allProfilesUris[i]); rbMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof UriJRadioButtonMenuItem) { MindRaider.annotationColorProfileRegistry .setCurrentProfile(((UriJRadioButtonMenuItem) e.getSource()).uri); OutlineJPanel.getInstance().conceptJPanel.refresh(); } } }); colorSchemeGroup.add(rbMenuItem); submenu.add(rbMenuItem); } menu.add(submenu); menu.addSeparator(); checkboxMenuItem = new JCheckBoxMenuItem(Messages.getString("MindRaiderJFrame.fullScreen")); checkboxMenuItem.setMnemonic(KeyEvent.VK_U); checkboxMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F11, 0)); checkboxMenuItem.setState(false); checkboxMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof JCheckBoxMenuItem) { JCheckBoxMenuItem j = (JCheckBoxMenuItem) e.getSource(); if (j.getState()) { Gfx.toggleFullScreen(MindRaiderMainWindow.this); } else { Gfx.toggleFullScreen(null); } } } }); menu.add(checkboxMenuItem); menuBar.add(menu); // - outline // ---------------------------------------------------------------------- menu = new JMenu(Messages.getString("MindRaiderJFrame.notebook")); menu.setMnemonic(KeyEvent.VK_N); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.newNotebook")); menuItem.setMnemonic(KeyEvent.VK_N); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK)); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // TODO clear should be optional - only if creation finished // MindRider.spidersGraph.clear(); new NewOutlineJDialog(); } }); menu.add(menuItem); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.open")); menuItem.setMnemonic(KeyEvent.VK_O); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK)); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new OpenOutlineJDialog(); } }); menu.add(menuItem); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.close")); menuItem.setMnemonic(KeyEvent.VK_C); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { MindRaider.outlineCustodian.close(); OutlineJPanel.getInstance().refresh(); MindRaider.spidersGraph.renderModel(); } }); menu.add(menuItem); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.discard")); menuItem.setMnemonic(KeyEvent.VK_D); menuItem.setEnabled(false); // TODO discard method must be implemented menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int result = JOptionPane.showConfirmDialog(MindRaiderMainWindow.this, Messages.getString( "MindRaiderJFrame.confirmDiscardNotebook", MindRaider.profile.getActiveOutline())); if (result == JOptionPane.YES_OPTION) { if (MindRaider.profile.getActiveOutlineUri() != null) { try { MindRaider.labelCustodian .discardOutline(MindRaider.profile.getActiveOutlineUri().toString()); MindRaider.outlineCustodian.close(); } catch (Exception e1) { logger.error(Messages.getString("MindRaiderJFrame.unableToDiscardNotebook"), e1); } } } } }); menu.add(menuItem); menu.addSeparator(); // export submenu = new JMenu(Messages.getString("MindRaiderJFrame.export")); submenu.setMnemonic(KeyEvent.VK_E); // Atom subMenuItem = new JMenuItem("Atom"); subMenuItem.setEnabled(true); subMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { exportActiveOutlineToAtom(); } }); submenu.add(subMenuItem); // OPML subMenuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.opml")); subMenuItem.setEnabled(true); subMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (MindRaider.profile.getActiveOutline() == null) { JOptionPane.showMessageDialog(MindRaiderMainWindow.this, Messages.getString("MindRaiderJFrame.exportNotebookWarning"), Messages.getString("MindRaiderJFrame.exportError"), JOptionPane.ERROR_MESSAGE); return; } JFileChooser fc = new JFileChooser(); fc.setApproveButtonText(Messages.getString("MindRaiderJFrame.export")); fc.setControlButtonsAreShown(true); fc.setDialogTitle(Messages.getString("MindRaiderJFrame.chooseExportDirectory")); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); // prepare directory String exportDirectory = MindRaider.profile.getHomeDirectory() + File.separator + "export" + File.separator + "opml"; Utils.createDirectory(exportDirectory); fc.setCurrentDirectory(new File(exportDirectory)); int returnVal = fc.showOpenDialog(MindRaiderMainWindow.this); if (returnVal == JFileChooser.APPROVE_OPTION) { String dstFileName = fc.getSelectedFile().getAbsolutePath() + File.separator + "OPML-EXPORT-" + MindRaider.outlineCustodian.getActiveNotebookNcName() + ".xml"; logger.debug(Messages.getString("MindRaiderJFrame.exportingToFile", dstFileName)); MindRaider.outlineCustodian.exportOutline(OutlineCustodian.FORMAT_OPML, dstFileName); Launcher.launchViaStart(dstFileName); } else { logger.debug(Messages.getString("MindRaiderJFrame.exportCommandCancelledByUser")); } } }); submenu.add(subMenuItem); // TWiki subMenuItem = new JMenuItem("TWiki"); subMenuItem.setEnabled(true); subMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (MindRaider.profile.getActiveOutline() == null) { JOptionPane.showMessageDialog(MindRaiderMainWindow.this, Messages.getString("MindRaiderJFrame.exportNotebookWarning"), Messages.getString("MindRaiderJFrame.exportError"), JOptionPane.ERROR_MESSAGE); return; } JFileChooser fc = new JFileChooser(); fc.setApproveButtonText(Messages.getString("MindRaiderJFrame.export")); fc.setControlButtonsAreShown(true); fc.setDialogTitle(Messages.getString("MindRaiderJFrame.chooseExportDirectory")); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); // prepare directory String exportDirectory = MindRaider.profile.getHomeDirectory() + File.separator + "export" + File.separator + "twiki"; Utils.createDirectory(exportDirectory); fc.setCurrentDirectory(new File(exportDirectory)); int returnVal = fc.showOpenDialog(MindRaiderMainWindow.this); if (returnVal == JFileChooser.APPROVE_OPTION) { final String dstFileName = fc.getSelectedFile().getAbsolutePath() + File.separator + "TWIKI-EXPORT-" + MindRaider.outlineCustodian.getActiveNotebookNcName() + ".txt"; logger.debug(Messages.getString("MindRaiderJFrame.exportingToFile", dstFileName)); MindRaider.outlineCustodian.exportOutline(OutlineCustodian.FORMAT_TWIKI, dstFileName); } else { logger.debug(Messages.getString("MindRaiderJFrame.exportCommandCancelledByUser")); } } }); submenu.add(subMenuItem); menu.add(submenu); // import submenu = new JMenu(Messages.getString("MindRaiderJFrame.import")); submenu.setMnemonic(KeyEvent.VK_I); subMenuItem = new JMenuItem("Atom"); subMenuItem.setEnabled(true); subMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { importFromAtom(); } }); submenu.add(subMenuItem); // TWiki subMenuItem = new JMenuItem("TWiki"); subMenuItem.setEnabled(true); subMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // choose file to be transformed OutlineJPanel.getInstance().clear(); MindRaider.profile.setActiveOutlineUri(null); JFileChooser fc = new JFileChooser(); int returnVal = fc.showOpenDialog(MindRaiderMainWindow.this); if (returnVal == JFileChooser.APPROVE_OPTION) { final File file = fc.getSelectedFile(); MindRaider.profile.deleteActiveModel(); logger.debug( Messages.getString("MindRaiderJFrame.importingTWikiTopic", file.getAbsolutePath())); // perform it async final SwingWorker worker = new SwingWorker() { public Object construct() { ProgressDialogJFrame progressDialogJFrame = new ProgressDialogJFrame( Messages.getString("MindRaiderJFrame.twikiImport"), Messages.getString("MindRaiderJFrame.processingTopicTWiki")); try { MindRaider.outlineCustodian.importNotebook(OutlineCustodian.FORMAT_TWIKI, (file != null ? file.getAbsolutePath() : null), progressDialogJFrame); } finally { if (progressDialogJFrame != null) { progressDialogJFrame.dispose(); } } return null; } }; worker.start(); } else { logger.debug(Messages.getString("MindRaiderJFrame.openCommandCancelledByUser")); } } }); submenu.add(subMenuItem); menu.add(submenu); menuBar.add(menu); // - note // ---------------------------------------------------------------------- menu = new JMenu(Messages.getString("MindRaiderJFrame.concept")); menu.setMnemonic(KeyEvent.VK_C); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.new")); menuItem.setMnemonic(KeyEvent.VK_N); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK)); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { OutlineJPanel.getInstance().newConcept(); } }); menu.add(menuItem); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.open")); menuItem.setMnemonic(KeyEvent.VK_O); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK)); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (MindRaider.profile.getActiveOutlineUri() != null) { new OpenNoteJDialog(); } } }); menu.add(menuItem); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.discard")); // do not accelerate this command with DEL - it's already handled // elsewhere menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)); menuItem.setMnemonic(KeyEvent.VK_D); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { OutlineJPanel.getInstance().conceptDiscard(); } }); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.up")); menuItem.setMnemonic(KeyEvent.VK_U); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_UP, ActionEvent.CTRL_MASK)); menuItem.setEnabled(true); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { OutlineJPanel.getInstance().conceptUp(); } }); menu.add(menuItem); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.promote")); menuItem.setMnemonic(KeyEvent.VK_P); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, ActionEvent.CTRL_MASK)); menuItem.setEnabled(true); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { OutlineJPanel.getInstance().conceptPromote(); } }); menu.add(menuItem); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.demote")); menuItem.setMnemonic(KeyEvent.VK_D); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, ActionEvent.CTRL_MASK)); menuItem.setEnabled(true); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { OutlineJPanel.getInstance().conceptDemote(); } }); menu.add(menuItem); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.down")); menuItem.setMnemonic(KeyEvent.VK_O); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, ActionEvent.CTRL_MASK)); menuItem.setEnabled(true); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { OutlineJPanel.getInstance().conceptDown(); } }); menu.add(menuItem); menuBar.add(menu); // - Tools ----------------------------------------------------------- menu = new JMenu(Messages.getString("MindRaiderJFrame.tools")); menu.setMnemonic(KeyEvent.VK_T); menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.checkAndFix")); menuItem.setMnemonic(KeyEvent.VK_F); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Checker.checkAndFixRepositoryAsync(); } }); menu.add(menuItem); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.backupRepository")); menuItem.setMnemonic(KeyEvent.VK_B); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Installer.backupRepositoryAsync(); } }); menu.add(menuItem); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.rebuildSearchIndex")); menuItem.setMnemonic(KeyEvent.VK_R); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SearchCommander.rebuildSearchAndTagIndices(); } }); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.captureScreen")); menuItem.setMnemonic(KeyEvent.VK_S); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(); fc.setApproveButtonText(Messages.getString("MindRaiderJFrame.screenshot")); fc.setControlButtonsAreShown(true); fc.setDialogTitle(Messages.getString("MindRaiderJFrame.chooseScreenshotDirectory")); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); // prepare directory String exportDirectory = MindRaider.profile.getHomeDirectory() + File.separator + "Screenshots"; Utils.createDirectory(exportDirectory); fc.setCurrentDirectory(new File(exportDirectory)); int returnVal = fc.showOpenDialog(MindRaiderMainWindow.this); if (returnVal == JFileChooser.APPROVE_OPTION) { final String filename = fc.getSelectedFile().getAbsolutePath() + File.separator + "screenshot.jpg"; // do it in async (redraw screen) Thread thread = new Thread() { public void run() { OutputStream file = null; try { file = new FileOutputStream(filename); Robot robot = new Robot(); robot.delay(1000); JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(file); encoder.encode(robot.createScreenCapture( new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()))); } catch (Exception e1) { logger.error("Unable to capture screen!", e1); } finally { if (file != null) { try { file.close(); } catch (IOException e1) { logger.error("Unable to close stream", e1); } } } } }; thread.setDaemon(true); thread.start(); } } }); menu.add(menuItem); menuBar.add(menu); // - MindForger ----------------------------------------------------------- menu = new JMenu(Messages.getString("MindRaiderMainWindow.menuMindForger")); menu.setMnemonic(KeyEvent.VK_O); //menu.setIcon(IconsRegistry.getImageIcon("tasks-internet.png")); menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.menuMindForgerVideoTutorial")); menuItem.setMnemonic(KeyEvent.VK_G); menuItem.setToolTipText("http://mindraider.sourceforge.net/mindforger.html"); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Launcher.launchInBrowser("http://mindraider.sourceforge.net/mindforger.html"); } }); menuItem.setEnabled(true); menu.add(menuItem); menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.signUp")); menuItem.setMnemonic(KeyEvent.VK_S); menuItem.setToolTipText("http://www.mindforger.com"); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Launcher.launchInBrowser("http://www.mindforger.com"); } }); menuItem.setEnabled(true); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.menuMindForgerUpload")); menuItem.setMnemonic(KeyEvent.VK_U); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // fork in order to enable status updates in the main window new MindForgerUploadOutlineJDialog(); } }); menuItem.setEnabled(true); menu.add(menuItem); menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.menuMindForgerDownload")); menuItem.setMnemonic(KeyEvent.VK_U); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { downloadAnOutlineFromMindForger(); } }); menuItem.setEnabled(true); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.menuMindForgerMyOutlines")); menuItem.setMnemonic(KeyEvent.VK_O); menuItem.setEnabled(true); menuItem.setToolTipText("http://web.mindforger.com"); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Launcher.launchInBrowser("http://web.mindforger.com"); } }); menu.add(menuItem); menuBar.add(menu); // - align Help on right ------------------------------------------------------------- menuBar.add(Box.createHorizontalGlue()); // - help ------------------------------------------------------------- menu = new JMenu(Messages.getString("MindRaiderJFrame.help")); menu.setMnemonic(KeyEvent.VK_H); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.documentation")); menuItem.setMnemonic(KeyEvent.VK_D); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { MindRaider.outlineCustodian.loadOutline(new URI(MindRaiderVocabulary .getNotebookUri(OutlineCustodian.MR_DOC_NOTEBOOK_DOCUMENTATION_LOCAL_NAME))); OutlineJPanel.getInstance().refresh(); } catch (Exception e1) { logger.error(Messages.getString("MindRaiderJFrame.unableToLoadHelp", e1.getMessage())); } } }); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.webHomepage")); menuItem.setMnemonic(KeyEvent.VK_H); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Launcher.launchInBrowser("http://mindraider.sourceforge.net"); } }); menu.add(menuItem); menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.reportBug")); menuItem.setMnemonic(KeyEvent.VK_R); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Launcher.launchInBrowser("http://sourceforge.net/forum/?group_id=128454"); } }); menu.add(menuItem); menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.updateCheck")); menuItem.setMnemonic(KeyEvent.VK_F); menuItem.setEnabled(true); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // just open html page at: // http://mindraider.sourceforge.net/update-7.2.html // this page will either contain "you have the last version" or will ask user to // download the latest version from main page Launcher.launchInBrowser("http://mindraider.sourceforge.net/" + "update-" + MindRaiderConstants.majorVersion + "." + MindRaiderConstants.minorVersion + ".html"); } }); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.about", MindRaiderConstants.MR_TITLE)); menuItem.setMnemonic(KeyEvent.VK_A); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new AboutJDialog(); } }); menu.add(menuItem); menuBar.add(menu); }
From source file:edu.ku.brc.specify.dbsupport.cleanuptools.GeographyAssignISOs.java
/** * @return// w w w . j a va 2 s . c om */ @SuppressWarnings("rawtypes") public boolean buildAsyncOrig(final int earthId) { String sql = adjustSQL( "SELECT COUNT(*) FROM geography WHERE GeographyCode IS NOT NULL AND RankID = 100 AND GeographyTreeDefID = GEOTREEDEFID"); int numContinentsWithNames = BasicSQLUtils.getCountAsInt(sql); continentsCBX = createCheckBox("All Continents"); // I18N CellConstraints cc = new CellConstraints(); PanelBuilder pb1 = new PanelBuilder(new FormLayout("f:p:g", "p,4px,p,4px,p,8px")); countriesCBX = createCheckBox("All Countries"); stateCBX = createCheckBox("All States"); countiesCBX = createCheckBox("All Counties"); pb1.add(countriesCBX, cc.xy(1, 1)); pb1.add(stateCBX, cc.xy(1, 3)); //pb1.add(countiesCBX, cc.xy(1, 5)); allCountriesRB = new JRadioButton("Choose the Geography level to be processed"); //L18N singleCountryRB = new JRadioButton("Choose an individual Country"); btnGroup = new ButtonGroup(); btnGroup.add(this.allCountriesRB); btnGroup.add(this.singleCountryRB); if (numContinentsWithNames == 0) { continentsCBX.setEnabled(false); continentsCBX.setSelected(true); } countriesCBX.setEnabled(true); stateCBX.setEnabled(false); countiesCBX.setEnabled(false); countryIds.clear(); sql = "SELECT g.GeographyID, g.Name, g2.Name FROM geography g LEFT JOIN geography g2 ON g.ParentID = g2.GeographyID " + "WHERE g.Name IS NOT NULL && LENGTH(g.Name) > 0 AND g.RankID = 200 AND g.GeographyTreeDefID = GEOTREEDEFID ORDER BY g.Name"; sql = adjustSQL(sql); Vector<Object[]> rows = query(sql); Object[] titles = new Object[rows.size() + 1]; int i = 0; titles[i++] = "None"; // I18N countryIds.add(-1); for (Object[] r : rows) { countryIds.add((Integer) r[0]); String countryStr = (String) r[1]; String contStr = (String) r[2]; titles[i++] = countryStr != null ? (countryStr + " (" + contStr + ")") : countryStr; } PanelBuilder pb2 = new PanelBuilder(new FormLayout("8px,p,2px,f:p:g", "p,4px,p,8px")); spCountriesLbl = createFormLabel("Country"); // I18N spCountriesCmbx = createComboBox(titles); spStatesCBX = createCheckBox("States (Required)"); // I18N spCountiesCBX = createCheckBox("Counties"); // I18N pb2.add(spCountriesLbl, cc.xy(2, 1)); pb2.add(spCountriesCmbx, cc.xy(4, 1)); pb2.add(spStatesCBX, cc.xyw(1, 3, 4)); //pb2.add(spCountiesCBX, cc.xyw(1, 5, 4)); spCountriesCmbx.setSelectedIndex(0); spStatesCBX.setSelected(true); spStatesCBX.setEnabled(false); spCountiesCBX.setEnabled(false); String rowDef = createDuplicateJGoodiesDef("p", "4px", 8); PanelBuilder pb = new PanelBuilder(new FormLayout("16px,f:p:g", rowDef)); pb.addSeparator("Continents to be processed", cc.xyw(1, 1, 2)); pb.add(continentsCBX, cc.xyw(1, 3, 2)); pb.addSeparator("Countries to be processed", cc.xyw(1, 5, 2)); pb.add(allCountriesRB, cc.xyw(1, 7, 2)); pb.add(pb1.getPanel(), cc.xyw(2, 9, 1)); pb.add(singleCountryRB, cc.xyw(1, 11, 2)); pb.add(pb2.getPanel(), cc.xyw(2, 13, 1)); pb.add(createGeoStatsPanel(), cc.xyw(1, 15, 2)); pb.setDefaultDialogBorder(); final CustomDialog dlg = new CustomDialog((Frame) getTopWindow(), "ISO Code Processing", true, CustomDialog.OKCANCELHELP, pb.getPanel()); // I18N dlg.setHelpContext("GeoCleanUpLevelChooser"); // Setup actions ChangeListener rbChangeListener = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { radioSelected(dlg); } }; allCountriesRB.addChangeListener(rbChangeListener); singleCountryRB.addChangeListener(null); countriesCBX.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { boolean isSel = countriesCBX.isSelected(); stateCBX.setEnabled(isSel); countiesCBX.setEnabled(false); if (!isSel) { stateCBX.setSelected(false); countiesCBX.setSelected(false); } calcGeoStats(); dlg.getOkBtn().setEnabled(isSel || spCountriesCmbx.getSelectedIndex() > 0); } }); stateCBX.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { countiesCBX.setEnabled(stateCBX.isSelected()); if (!stateCBX.isSelected()) { countiesCBX.setSelected(false); } calcGeoStats(); } }); // Special spCountriesCmbx.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean isSel = spCountriesCmbx.getSelectedIndex() > 0; spStatesCBX.setSelected(isSel); spCountiesCBX.setEnabled(isSel); if (!isSel) { spStatesCBX.setSelected(false); spCountiesCBX.setSelected(false); } calcGeoStats(); dlg.getOkBtn().setEnabled(isSel || countriesCBX.isSelected()); } }); spStatesCBX.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { spCountiesCBX.setEnabled(stateCBX.isSelected()); calcGeoStats(); } }); allCountriesRB.setSelected(true); dlg.createUI(); dlg.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); // Must be called after 'createUI' dlg.getOkBtn().setEnabled(false); // AUTO Don't show Dialog because it is automatically setting what to do centerAndShow(dlg); if (dlg.isCancelled()) { return false; } connectToDB(); if (true) // AUTO { doAllCountries = new boolean[] { countriesCBX.isSelected(), stateCBX.isSelected(), countiesCBX.isSelected(), false }; doInvCountry = new boolean[] { spCountriesCmbx.getSelectedIndex() > 0, spStatesCBX.isSelected(), spCountiesCBX.isSelected(), false }; doIndvCountryId = doInvCountry[0] ? countryIds.get(spCountriesCmbx.getSelectedIndex()) : null; } else { int indexOfUSA = getUnitedStatesIndex(titles); if (indexOfUSA == -1) { Vector<Object> nameList = new Vector<Object>(); Collections.addAll(nameList, titles); JList list = createList(nameList); JScrollPane sp = createScrollPane(list); pb = new PanelBuilder(new FormLayout("f:p:g", "p,8px,f:p:g")); pb.add(createLabel("Select the United States"), cc.xy(1, 1)); pb.add(sp, cc.xy(1, 3)); pb.setDefaultDialogBorder(); final CustomDialog askDlg = new CustomDialog((Frame) getTopWindow(), "Choose", true, CustomDialog.OKCANCELHELP, pb.getPanel()); // I18N dlg.setHelpContext("GeoCleanUpLevelChooser"); centerAndShow(askDlg); if (!askDlg.isCancelled()) { indexOfUSA = list.getSelectedIndex(); } } doAllCountries = new boolean[] { true, false, false, false }; doInvCountry = new boolean[] { indexOfUSA > -1, true, false, false }; doIndvCountryId = doInvCountry[0] ? countryIds.get(indexOfUSA) : null; } // Check to see if it needs indexing. boolean shouldIndex = luceneSearch.shouldIndex(); if (shouldIndex) { frame = new ProgressFrame("Building Geography Authority..."); // I18N frame.getCloseBtn().setVisible(false); frame.turnOffOverAll(); frame.setDesc("Loading Geonames data..."); // I18N frame.pack(); frame.setSize(450, frame.getBounds().height + 10); UIHelper.centerAndShow(frame, 450, frame.getBounds().height + 10); luceneSearch.startIndexingProcessAsync(earthId, frame, new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { frame.setVisible(false); frame = null; if (((Boolean) e.getSource())) { GeographyAssignISOs.this.startTraversal(); } } }); } else { sql = "SELECT Name, geonameId, iso_alpha2 FROM countryinfo"; for (Object[] row : query(sql)) { countryInfo.add(new GeoSearchResultsItem((String) row[0], (Integer) row[1], (String) row[2])); } startTraversal(); } return true; }
From source file:edu.ku.brc.specify.plugins.ipadexporter.InstitutionConfigDlg.java
private JPanel createURLPanel() { //setTitle(getResourceString("IMAGE_SRC_TITLE")); useAttachTitle = getResourceString("ATTCH_MGR"); useDirectTitle = getResourceString("DIR_URL"); CellConstraints cc = new CellConstraints(); PanelBuilder pb = new PanelBuilder(new FormLayout("p,2px,p,f:p:g", "p,4px,p,4px,p,4px,p,4px,p,4px")); label = createLabel(useAttachTitle + ":"); urlTextField = new ValTextField(40); statusLbl = createLabel(""); useAttchmentMgrRB = createI18NRadioButton("USE_ATT_MGR"); useDirectUrlRB = createI18NRadioButton("USE_DIR_URL"); int y = 1;//from w ww .ja v a 2 s. c om pb.add(createI18NLabel("HOW_IMG_ACCESS"), cc.xy(1, y)); y += 2; pb.add(useAttchmentMgrRB, cc.xyw(1, y, 4)); y += 2; pb.add(useDirectUrlRB, cc.xyw(1, y, 4)); y += 2; PanelBuilder pbInner = new PanelBuilder(new FormLayout("p,2px,f:p:g", "p")); pbInner.add(label, cc.xy(1, 1)); pbInner.add(urlTextField, cc.xy(3, 1)); pb.add(pbInner.getPanel(), cc.xyw(1, y, 4)); y += 2; pb.add(statusLbl, cc.xyw(1, y, 4)); y += 2; pb.setDefaultDialogBorder(); KeyAdapter ka = new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { updateOKBtn(); } }; urlTextField.addKeyListener(ka); super.createUI(); ButtonGroup group = new ButtonGroup(); group.add(useAttchmentMgrRB); group.add(useDirectUrlRB); ActionListener al = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { radBtnSelected(); } }; useAttchmentMgrRB.addActionListener(al); useDirectUrlRB.addActionListener(al); // Set Data into form or initialize it String typeStr = AppPreferences.getRemote().get(getRemoteImageURLTypePrefName(), null); String imgURLPath = AppPreferences.getRemote().get(getRemoteImageURLPrefName(), null); //System.out.println(String.format("%s=%s", getRemoteImageURLTypePrefName(), typeStr)); //System.out.println(String.format("%s=%s", getRemoteImageURLPrefName(), imgURLPath)); if (isNotEmpty(typeStr) && isNotEmpty(imgURLPath)) { urlTextField.setText(imgURLPath); boolean isAttachMgr = isNotEmpty(typeStr) && typeStr.equals(ATTMGR); useAttchmentMgrRB.setSelected(isAttachMgr); useDirectUrlRB.setSelected(!isAttachMgr); } else { fillWithDefaultAttMgr(); } return pb.getPanel(); }
From source file:com.mirth.connect.connectors.file.FileWriter.java
private void initComponents() { schemeLabel = new JLabel(); schemeLabel.setText("Method:"); schemeComboBox = new MirthComboBox(); schemeComboBox.setModel(new DefaultComboBoxModel(new String[] { "file", "ftp", "sftp", "smb", "webdav" })); schemeComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { schemeComboBoxActionPerformed(evt); }/*from w ww . j av a 2 s . c o m*/ }); testConnectionButton = new JButton(); testConnectionButton.setText("Test Write"); testConnectionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { testConnectionActionPerformed(evt); } }); advancedSettingsButton = new JButton(new ImageIcon(Frame.class.getResource("images/wrench.png"))); advancedSettingsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { advancedFileSettingsActionPerformed(); } }); summaryLabel = new JLabel("Advanced Options:"); summaryField = new JLabel(""); directoryLabel = new JLabel(); directoryLabel.setText("Directory:"); directoryField = new MirthTextField(); hostLabel = new JLabel(); hostLabel.setText("ftp://"); hostField = new MirthTextField(); pathLabel = new JLabel(); pathLabel.setText("/"); pathField = new MirthTextField(); fileNameLabel = new JLabel(); fileNameLabel.setText("File Name:"); fileNameField = new MirthTextField(); anonymousLabel = new JLabel(); anonymousLabel.setText("Anonymous:"); anonymousYesRadio = new MirthRadioButton(); anonymousYesRadio.setBackground(UIConstants.BACKGROUND_COLOR); anonymousYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); anonymousYesRadio.setText("Yes"); anonymousYesRadio.setMargin(new Insets(0, 0, 0, 0)); anonymousYesRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { anonymousYesActionPerformed(evt); } }); anonymousNoRadio = new MirthRadioButton(); anonymousNoRadio.setBackground(UIConstants.BACKGROUND_COLOR); anonymousNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); anonymousNoRadio.setSelected(true); anonymousNoRadio.setText("No"); anonymousNoRadio.setMargin(new Insets(0, 0, 0, 0)); anonymousNoRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { anonymousNoActionPerformed(evt); } }); anonymousButtonGroup = new ButtonGroup(); anonymousButtonGroup.add(anonymousYesRadio); anonymousButtonGroup.add(anonymousNoRadio); usernameLabel = new JLabel(); usernameLabel.setText("Username:"); usernameField = new MirthTextField(); passwordLabel = new JLabel(); passwordLabel.setText("Password:"); passwordField = new MirthPasswordField(); timeoutLabel = new JLabel(); timeoutLabel.setText("Timeout (ms):"); timeoutField = new MirthTextField(); secureModeLabel = new JLabel(); secureModeLabel.setText("Secure Mode:"); secureModeYesRadio = new MirthRadioButton(); secureModeYesRadio.setBackground(UIConstants.BACKGROUND_COLOR); secureModeYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); secureModeYesRadio.setText("Yes"); secureModeYesRadio.setMargin(new Insets(0, 0, 0, 0)); secureModeYesRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { secureModeYesActionPerformed(evt); } }); secureModeNoRadio = new MirthRadioButton(); secureModeNoRadio.setBackground(UIConstants.BACKGROUND_COLOR); secureModeNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); secureModeNoRadio.setSelected(true); secureModeNoRadio.setText("No"); secureModeNoRadio.setMargin(new Insets(0, 0, 0, 0)); secureModeNoRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { secureModeNoActionPerformed(evt); } }); secureModeButtonGroup = new ButtonGroup(); secureModeButtonGroup.add(secureModeYesRadio); secureModeButtonGroup.add(secureModeNoRadio); passiveModeLabel = new JLabel(); passiveModeLabel.setText("Passive Mode:"); passiveModeYesRadio = new MirthRadioButton(); passiveModeYesRadio.setBackground(UIConstants.BACKGROUND_COLOR); passiveModeYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); passiveModeYesRadio.setText("Yes"); passiveModeYesRadio.setMargin(new Insets(0, 0, 0, 0)); passiveModeNoRadio = new MirthRadioButton(); passiveModeNoRadio.setBackground(UIConstants.BACKGROUND_COLOR); passiveModeNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); passiveModeNoRadio.setSelected(true); passiveModeNoRadio.setText("No"); passiveModeNoRadio.setMargin(new Insets(0, 0, 0, 0)); passiveModeButtonGroup = new ButtonGroup(); passiveModeButtonGroup.add(passiveModeYesRadio); passiveModeButtonGroup.add(passiveModeNoRadio); validateConnectionLabel = new JLabel(); validateConnectionLabel.setText("Validate Connection:"); validateConnectionYesRadio = new MirthRadioButton(); validateConnectionYesRadio.setBackground(UIConstants.BACKGROUND_COLOR); validateConnectionYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); validateConnectionYesRadio.setText("Yes"); validateConnectionYesRadio.setMargin(new Insets(0, 0, 0, 0)); validateConnectionNoRadio = new MirthRadioButton(); validateConnectionNoRadio.setBackground(UIConstants.BACKGROUND_COLOR); validateConnectionNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); validateConnectionNoRadio.setText("No"); validateConnectionNoRadio.setMargin(new Insets(0, 0, 0, 0)); validateConnectionButtonGroup = new ButtonGroup(); validateConnectionButtonGroup.add(validateConnectionYesRadio); validateConnectionButtonGroup.add(validateConnectionNoRadio); fileExistsLabel = new JLabel(); fileExistsLabel.setText("File Exists:"); fileExistsAppendRadio = new MirthRadioButton(); fileExistsAppendRadio.setBackground(new java.awt.Color(255, 255, 255)); fileExistsAppendRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); fileExistsAppendRadio.setText("Append"); fileExistsAppendRadio.setMargin(new java.awt.Insets(0, 0, 0, 0)); fileExistsAppendRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { fileExistsAppendRadioActionPerformed(evt); } }); fileExistsOverwriteRadio = new MirthRadioButton(); fileExistsOverwriteRadio.setBackground(new java.awt.Color(255, 255, 255)); fileExistsOverwriteRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); fileExistsOverwriteRadio.setText("Overwrite"); fileExistsOverwriteRadio.setMargin(new java.awt.Insets(0, 0, 0, 0)); fileExistsOverwriteRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { fileExistsOverwriteRadioActionPerformed(evt); } }); fileExistsErrorRadio = new MirthRadioButton(); fileExistsErrorRadio.setBackground(new java.awt.Color(255, 255, 255)); fileExistsErrorRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); fileExistsErrorRadio.setSelected(true); fileExistsErrorRadio.setText("Error"); fileExistsErrorRadio.setMargin(new java.awt.Insets(0, 0, 0, 0)); fileExistsErrorRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { fileExistsErrorRadioActionPerformed(evt); } }); fileExistsButtonGroup = new ButtonGroup(); fileExistsButtonGroup.add(fileExistsAppendRadio); fileExistsButtonGroup.add(fileExistsOverwriteRadio); fileExistsButtonGroup.add(fileExistsErrorRadio); tempFileLabel = new JLabel(); tempFileLabel.setText("Create Temp File:"); tempFileYesRadio = new MirthRadioButton(); tempFileYesRadio.setBackground(new java.awt.Color(255, 255, 255)); tempFileYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); tempFileYesRadio.setText("Yes"); tempFileYesRadio.setMargin(new java.awt.Insets(0, 0, 0, 0)); tempFileNoRadio = new MirthRadioButton(); tempFileNoRadio.setBackground(new java.awt.Color(255, 255, 255)); tempFileNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); tempFileNoRadio.setSelected(true); tempFileNoRadio.setText("No"); tempFileNoRadio.setMargin(new java.awt.Insets(0, 0, 0, 0)); tempFileButtonGroup = new ButtonGroup(); tempFileButtonGroup.add(tempFileYesRadio); tempFileButtonGroup.add(tempFileNoRadio); fileTypeLabel = new JLabel(); fileTypeLabel.setText("File Type:"); fileTypeBinary = new MirthRadioButton(); fileTypeBinary.setBackground(UIConstants.BACKGROUND_COLOR); fileTypeBinary.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); fileTypeBinary.setText("Binary"); fileTypeBinary.setMargin(new Insets(0, 0, 0, 0)); fileTypeBinary.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { fileTypeBinaryActionPerformed(evt); } }); fileTypeText = new MirthRadioButton(); fileTypeText.setBackground(UIConstants.BACKGROUND_COLOR); fileTypeText.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); fileTypeText.setSelected(true); fileTypeText.setText("Text"); fileTypeText.setMargin(new Insets(0, 0, 0, 0)); fileTypeText.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { fileTypeASCIIActionPerformed(evt); } }); fileTypeButtonGroup = new ButtonGroup(); fileTypeButtonGroup.add(fileTypeBinary); fileTypeButtonGroup.add(fileTypeText); encodingLabel = new JLabel(); encodingLabel.setText("Encoding:"); charsetEncodingComboBox = new MirthComboBox(); charsetEncodingComboBox.setModel(new DefaultComboBoxModel(new String[] { "Default", "UTF-8", "ISO-8859-1", "UTF-16 (le)", "UTF-16 (be)", "UTF-16 (bom)", "US-ASCII" })); templateLabel = new JLabel(); templateLabel.setText("Template:"); fileContentsTextPane = new MirthSyntaxTextArea(); fileContentsTextPane.setBorder(BorderFactory.createEtchedBorder()); }
From source file:corelyzer.ui.CorelyzerGLCanvas.java
void createPopupMenuUI() { JPopupMenu.setDefaultLightWeightPopupEnabled(false); this.scenePopupMenu = new JPopupMenu(); JMenuItem trackName = new JMenuItem("Track Name"); trackName.setEnabled(false);//from w w w. j a va 2 s.c om this.scenePopupMenu.add(trackName); JMenuItem sectionName = new JMenuItem("Section name"); sectionName.setEnabled(false); this.scenePopupMenu.add(sectionName); this.scenePopupMenu.addSeparator(); // Mode menu JMenu modeMenu = new JMenu("Mode"); ButtonGroup modeGroup = new ButtonGroup(); this.normalMode = new JRadioButtonMenuItem("Normal mode"); this.normalMode.setIcon(new ImageIcon(getClass().getResource("/corelyzer/ui/resources/normal.gif"))); this.normalMode.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { CorelyzerApp.getApp().getToolFrame().setMode(0); } }); this.normalMode.setSelected(true); modeGroup.add(this.normalMode); modeMenu.add(this.normalMode); this.clastMode = new JRadioButtonMenuItem("Create annotation mode"); this.clastMode.setIcon(new ImageIcon(getClass().getResource("/corelyzer/ui/resources/copyright.gif"))); this.clastMode.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { CorelyzerApp.getApp().getToolFrame().setMode(3); } }); modeGroup.add(this.clastMode); modeMenu.add(this.clastMode); this.markerMode = new JRadioButtonMenuItem("Modify annotation marker mode"); this.markerMode.setIcon(new ImageIcon(getClass().getResource("/corelyzer/ui/resources/marker.gif"))); this.markerMode.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { CorelyzerApp.getApp().getToolFrame().setMode(2); } }); modeGroup.add(this.markerMode); modeMenu.add(this.markerMode); this.measureMode = new JRadioButtonMenuItem("Measure mode"); this.measureMode.setIcon(new ImageIcon(getClass().getResource("/corelyzer/ui/resources/ruler.gif"))); this.measureMode.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { CorelyzerApp.getApp().getToolFrame().setMode(1); } }); modeGroup.add(this.measureMode); modeMenu.add(this.measureMode); this.cutMode = new JRadioButtonMenuItem("Cut mode"); this.cutMode.setIcon(new ImageIcon(getClass().getResource("/corelyzer/ui/resources/cut.gif"))); this.cutMode.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { CorelyzerApp.getApp().getToolFrame().setMode(4); } }); modeGroup.add(this.cutMode); modeMenu.add(this.cutMode); this.scenePopupMenu.add(modeMenu); JMenuItem hideTrackMenuItem = new JMenuItem("Hide track"); hideTrackMenuItem.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { doHideTrack(); } }); this.scenePopupMenu.add(hideTrackMenuItem); JMenuItem exportTrackMenuItem = new JMenuItem("Export track"); exportTrackMenuItem.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent actionEvent) { doExportTrack(); } }); this.scenePopupMenu.add(exportTrackMenuItem); JMenuItem lockSectionMenuItem = new JCheckBoxMenuItem("Lock Section"); lockSectionMenuItem.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent actionEvent) { AbstractButton b = (AbstractButton) actionEvent.getSource(); doLockSection(b.getModel().isSelected()); } }); JMenuItem lockSectionGraphMenuItem = new JCheckBoxMenuItem("Lock Section Graphs"); lockSectionGraphMenuItem.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent actionEvent) { AbstractButton b = (AbstractButton) actionEvent.getSource(); doLockSectionGraph(b.getModel().isSelected()); } }); JMenuItem graphMenuItem = new JMenuItem("Graph..."); graphMenuItem.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { doGraphDialog(); } }); this.propertyMenuItem = new JMenuItem("Properties..."); this.propertyMenuItem.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { SectionImagePropertyDialog dialog = new SectionImagePropertyDialog(canvas); dialog.setProperties(selectedTrack, selectedTrackSection); dialog.pack(); dialog.setLocationRelativeTo(canvas); dialog.setVisible(true); dialog.dispose(); } }); splitMenuItem = new JMenuItem("Split..."); splitMenuItem.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { CorelyzerApp app = CorelyzerApp.getApp(); if (app != null) { app.getController().sectionSplit(); } } }); JMenuItem deleteItem = new JMenuItem("Delete..."); deleteItem.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent actionEvent) { doDeleteSection(); } }); JMenuItem staggerSectionsItem = new JCheckBoxMenuItem("Stagger Sections", false); staggerSectionsItem.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { AbstractButton b = (AbstractButton) e.getSource(); doStaggerSections(b.getModel().isSelected()); } }); JMenuItem trimSectionsItem = new JMenuItem("Trim Sections..."); trimSectionsItem.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { doTrimSections(); } }); JMenuItem stackSectionsItem = new JMenuItem("Stack Sections"); stackSectionsItem.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { doStackSections(); } }); this.scenePopupMenu.addSeparator(); this.scenePopupMenu.add(lockSectionMenuItem); this.scenePopupMenu.add(lockSectionGraphMenuItem); this.scenePopupMenu.addSeparator(); this.scenePopupMenu.add(graphMenuItem); this.scenePopupMenu.add(splitMenuItem); this.scenePopupMenu.add(propertyMenuItem); this.scenePopupMenu.add(deleteItem); this.scenePopupMenu.add(staggerSectionsItem); this.scenePopupMenu.add(trimSectionsItem); this.scenePopupMenu.add(stackSectionsItem); CorelyzerApp.getApp().getPluginManager().addPluginPopupSubMenus(this.scenePopupMenu); }
From source file:com.att.aro.ui.view.menu.tools.RegexWizard.java
private JPanel getMatcherPanel() { if (matcherPanel == null) { matcherPanel = new JPanel(); matcherPanel.setLayout(new GridBagLayout()); Color bgColor = matcherPanel.getBackground(); matcherPanel.setBorder(new RoundedBorderPanel(bgColor)); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0;/*from www. ja va 2s . co m*/ constraint.gridy = 0; constraint.insets = new Insets(0, 0, 0, 0); constraint.anchor = GridBagConstraints.FIRST_LINE_START; constraint.weightx = 0.5; ignore = new JRadioButton(ResourceBundleHelper.getMessageString("videoTab.ignore")); match = new JRadioButton(ResourceBundleHelper.getMessageString("videoTab.match")); ButtonGroup groupBtn = new ButtonGroup(); groupBtn.add(ignore); groupBtn.add(match); keep = new JCheckBox(ResourceBundleHelper.getMessageString("videoTab.keep")); alpha = new JCheckBox(ResourceBundleHelper.getMessageString("videoTab.alpha")); characters = new JCheckBox(ResourceBundleHelper.getMessageString("videoTab.characters")); charField = new JTextField(20); numeric = new JCheckBox(ResourceBundleHelper.getMessageString("videoTab.numeric")); lengthMin = new JCheckBox(ResourceBundleHelper.getMessageString("videoTab.min.length")); lengthMax = new JCheckBox(ResourceBundleHelper.getMessageString("videoTab.max.length")); lengthMinField = new JTextField(10); lengthMaxField = new JTextField(10); matcherPanel.add(ignore, constraint); constraint.gridy = 1; constraint.anchor = GridBagConstraints.WEST; matcherPanel.add(match, constraint); constraint.anchor = GridBagConstraints.EAST; enterBtn = new JButton(ResourceBundleHelper.getMessageString("videoTab.enter")); enterBtn.setName(ResourceBundleHelper.getMessageString("videoTab.enter")); enterBtn.addActionListener(this); matcherPanel.add(enterBtn, constraint); constraint.anchor = GridBagConstraints.WEST; constraint.gridy = 2; matcherPanel.add(keep, constraint); constraint.gridy = 3; matcherPanel.add(alpha, constraint); constraint.gridy = 4; JPanel panelChar = new JPanel(new FlowLayout()); panelChar.add(characters); panelChar.add(charField); matcherPanel.add(panelChar, constraint); constraint.gridy = 5; matcherPanel.add(numeric, constraint); constraint.gridy = 6; JPanel panelNumericLength = new JPanel(); panelNumericLength.setLayout(new BoxLayout(panelNumericLength, BoxLayout.Y_AXIS)); JPanel panelMinLength = new JPanel(new FlowLayout()); panelMinLength.add(lengthMin); panelMinLength.add(lengthMinField); panelNumericLength.add(panelMinLength); JPanel panelMaxLength = new JPanel(new FlowLayout()); panelMaxLength.add(lengthMax); panelMaxLength.add(lengthMaxField); panelNumericLength.add(panelMaxLength); matcherPanel.add(panelNumericLength, constraint); constraint.weighty = 1; matcherPanel.add(new JPanel(), constraint); } return matcherPanel; }
From source file:lab4.YouQuiz.java
private void initComponents() { menuBar = new JMenuBar(); menuBarFile = new JMenu(); menuBarExit = new JMenuItem(); menuBarMode = new JMenu(); menuBarEdit = new JRadioButtonMenuItem(); menuBarQuiz = new JRadioButtonMenuItem(); menuBarHelp = new JMenu(); menuBarAbout = new JMenuItem(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setTitle("YouQuiz | Your Quiz Factory"); setIconImage((new ImageIcon(getClass().getClassLoader().getResource("resources/icon.png"))).getImage()); setMinimumSize(new Dimension(800, 500)); setResizable(false);// w w w. j av a 2s . c o m menuBarFile.setText("File"); menuBarExit.setAccelerator( KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_MASK)); menuBarExit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.exit(0); } }); menuBarExit.setText("Exit"); menuBarFile.add(menuBarExit); menuBar.add(menuBarFile); menuBarMode.setText("Mode"); menuBarEdit.setAccelerator( KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK)); menuBarEdit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { //Execute when button is pressed System.out.println("You clicked the button"); } }); menuBarEdit.setText("Edit Mode"); menuBarQuiz.setAccelerator( KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.CTRL_MASK)); menuBarQuiz.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { //Execute when button is pressed System.out.println("You clicked the button"); } }); menuBarQuiz.setSelected(true); menuBarQuiz.setText("Quiz Mode"); ButtonGroup menuBarGroup = new ButtonGroup(); menuBarGroup.add(menuBarEdit); menuBarGroup.add(menuBarQuiz); menuBarMode.add(menuBarEdit); menuBarMode.add(menuBarQuiz); menuBar.add(menuBarMode); menuBarHelp.setText("Help"); menuBarAbout.setAccelerator( KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK)); menuBarAbout.setText("About"); menuBarAbout.addActionListener(new ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { JOptionPane.showMessageDialog(null, "By Anwar Mohamed ~ 2491", "YouQuiz", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getClassLoader().getResource("resources/icon-48.png"))); } }); menuBarHelp.add(menuBarAbout); menuBar.add(menuBarHelp); setJMenuBar(menuBar); pack(); setLocationRelativeTo(null); }
From source file:TexBug.java
JPanel texture2DPanel() { JPanel panel = new JPanel(); panel.setLayout(new GridLayout(1, 0)); // horizontal JPanel leftPanel = new JPanel(); leftPanel.setLayout(new GridLayout(0, 1)); // vertical panel.add(leftPanel);//from ww w . j a v a 2 s. c o m JPanel rightPanel = new JPanel(); rightPanel.setLayout(new GridLayout(0, 1)); // vertical panel.add(rightPanel); texEnableCheckBox = new JCheckBox(texEnableString); // set up the action commands texEnableCheckBox.setActionCommand(texEnableString); // register the applet as the listener for the buttons texEnableCheckBox.addActionListener(this); // set the initial value texEnableCheckBox.setSelected(texEnable); // add the checkbox to the panel leftPanel.add(texEnableCheckBox); // texture boundary S leftPanel.add(new JLabel("Boundary S Mode:")); // create the buttons JRadioButton texBoundarySWrapButton = new JRadioButton(wrapString); JRadioButton texBoundarySClampButton = new JRadioButton(clampString); // set up the action commands texBoundarySWrapButton.setActionCommand(texBoundarySWrapString); texBoundarySClampButton.setActionCommand(texBoundarySClampString); // add the buttons to a group so that only one can be selected ButtonGroup boundSButtonGroup = new ButtonGroup(); boundSButtonGroup.add(texBoundarySWrapButton); boundSButtonGroup.add(texBoundarySClampButton); // register the applet as the listener for the buttons texBoundarySWrapButton.addActionListener(this); texBoundarySClampButton.addActionListener(this); // add the buttons to the panel leftPanel.add(texBoundarySWrapButton); leftPanel.add(texBoundarySClampButton); // set the default texBoundarySWrapButton.setSelected(true); // texture boundary T leftPanel.add(new JLabel("Boundary T Mode:")); // create the buttons JRadioButton texBoundaryTWrapButton = new JRadioButton(wrapString); JRadioButton texBoundaryTClampButton = new JRadioButton(clampString); // set up the action commands texBoundaryTWrapButton.setActionCommand(texBoundaryTWrapString); texBoundaryTClampButton.setActionCommand(texBoundaryTClampString); // add the buttons to a group so that only one can be selected ButtonGroup boundTButtonGroup = new ButtonGroup(); boundTButtonGroup.add(texBoundaryTWrapButton); boundTButtonGroup.add(texBoundaryTClampButton); // register the applet as the listener for the buttons texBoundaryTWrapButton.addActionListener(this); texBoundaryTClampButton.addActionListener(this); // add the buttons to the panel leftPanel.add(texBoundaryTWrapButton); leftPanel.add(texBoundaryTClampButton); // set the default texBoundaryTWrapButton.setSelected(true); // texture min filter rightPanel.add(new JLabel("Min Filter:")); // create the buttons JRadioButton texMinFilterBasePointButton = new JRadioButton(texFilterBasePointString); JRadioButton texMinFilterBaseLinearButton = new JRadioButton(texFilterBaseLinearString); JRadioButton texMinFilterMultiPointButton = new JRadioButton(texFilterMultiPointString); JRadioButton texMinFilterMultiLinearButton = new JRadioButton(texFilterMultiLinearString); JRadioButton texMinFilterNicestButton = new JRadioButton(nicestString); JRadioButton texMinFilterFastestButton = new JRadioButton(fastestString); // set up the action commands texMinFilterBasePointButton.setActionCommand(texMinFilterBasePointString); texMinFilterBaseLinearButton.setActionCommand(texMinFilterBaseLinearString); texMinFilterMultiPointButton.setActionCommand(texMinFilterMultiPointString); texMinFilterMultiLinearButton.setActionCommand(texMinFilterMultiLinearString); texMinFilterNicestButton.setActionCommand(texMinFilterNicestString); texMinFilterFastestButton.setActionCommand(texMinFilterFastestString); // add the buttons to a group so that only one can be selected ButtonGroup minFilterButtonGroup = new ButtonGroup(); minFilterButtonGroup.add(texMinFilterBasePointButton); minFilterButtonGroup.add(texMinFilterBaseLinearButton); minFilterButtonGroup.add(texMinFilterMultiPointButton); minFilterButtonGroup.add(texMinFilterMultiLinearButton); minFilterButtonGroup.add(texMinFilterNicestButton); minFilterButtonGroup.add(texMinFilterFastestButton); // register the applet as the listener for the buttons texMinFilterBasePointButton.addActionListener(this); texMinFilterBaseLinearButton.addActionListener(this); texMinFilterMultiPointButton.addActionListener(this); texMinFilterMultiLinearButton.addActionListener(this); texMinFilterNicestButton.addActionListener(this); texMinFilterFastestButton.addActionListener(this); // add the buttons to the panel rightPanel.add(texMinFilterBasePointButton); rightPanel.add(texMinFilterBaseLinearButton); rightPanel.add(texMinFilterMultiPointButton); rightPanel.add(texMinFilterMultiLinearButton); rightPanel.add(texMinFilterNicestButton); rightPanel.add(texMinFilterFastestButton); // set the default texMinFilterBasePointButton.setSelected(true); // texture max filter rightPanel.add(new JLabel("Mag Filter:")); // create the buttons JRadioButton texMagFilterBasePointButton = new JRadioButton(texFilterBasePointString); JRadioButton texMagFilterBaseLinearButton = new JRadioButton(texFilterBaseLinearString); JRadioButton texMagFilterNicestButton = new JRadioButton(nicestString); JRadioButton texMagFilterFastestButton = new JRadioButton(fastestString); // set up the action commands texMagFilterBasePointButton.setActionCommand(texMagFilterBasePointString); texMagFilterBaseLinearButton.setActionCommand(texMagFilterBaseLinearString); texMagFilterNicestButton.setActionCommand(texMagFilterNicestString); texMagFilterFastestButton.setActionCommand(texMagFilterFastestString); // add the buttons to a group so that only one can be selected ButtonGroup magFilterButtonGroup = new ButtonGroup(); magFilterButtonGroup.add(texMagFilterBasePointButton); magFilterButtonGroup.add(texMagFilterBaseLinearButton); magFilterButtonGroup.add(texMagFilterNicestButton); magFilterButtonGroup.add(texMagFilterFastestButton); // register the applet as the listener for the buttons texMagFilterBasePointButton.addActionListener(this); texMagFilterBaseLinearButton.addActionListener(this); texMagFilterNicestButton.addActionListener(this); texMagFilterFastestButton.addActionListener(this); // add the buttons to the panel rightPanel.add(texMagFilterBasePointButton); rightPanel.add(texMagFilterBaseLinearButton); rightPanel.add(texMagFilterNicestButton); rightPanel.add(texMagFilterFastestButton); // set the default texMagFilterBasePointButton.setSelected(true); // MipMap Mode leftPanel.add(new JLabel("MipMap Mode:")); // create the buttons JRadioButton texMipMapBaseButton = new JRadioButton(texMipMapBaseString); JRadioButton texMipMapMultiButton = new JRadioButton(texMipMapMultiString); // set up the action commands texMipMapBaseButton.setActionCommand(texMipMapBaseString); texMipMapMultiButton.setActionCommand(texMipMapMultiString); // add the buttons to a group so that only one can be selected ButtonGroup texMipMapButtonGroup = new ButtonGroup(); texMipMapButtonGroup.add(texMipMapBaseButton); texMipMapButtonGroup.add(texMipMapMultiButton); // register the applet as the listener for the buttons texMipMapBaseButton.addActionListener(this); texMipMapMultiButton.addActionListener(this); // add the buttons to the panel leftPanel.add(texMipMapBaseButton); leftPanel.add(texMipMapMultiButton); // set the default texMipMapBaseButton.setSelected(true); return panel; }
From source file:org.gumtree.vis.plot1d.Plot1DChartEditor.java
private JPanel createMaskingPanel(JFreeChart chart) { JPanel wrap = new JPanel(new BorderLayout()); JPanel maskingPanel = new JPanel(new GridLayout(1, 1)); maskingPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); //Horizontal group JPanel managePanel = new JPanel(new BorderLayout()); managePanel.setBorder(/*from w ww.j a v a 2 s . c o m*/ BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Region of Interests")); JPanel inner = new JPanel(new LCBLayout(6)); inner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); inner.add(new JLabel("Select Region")); roiCombo = new JComboBox(panel.getMasks().toArray()); // colourScaleCombo.setMaximumRowCount(7); roiCombo.setSelectedIndex(-1); roiCombo.setActionCommand(CHANGE_ROI_COMMAND); roiCombo.addActionListener(this); inner.add(roiCombo); inner.add(new JLabel()); inner.add(new JLabel("or create")); newRectangleButton = new JButton("New Region of Interests"); newRectangleButton.setActionCommand(CREATE_NEW_RECT_REGION_COMMAND); newRectangleButton.addActionListener(this); inner.add(newRectangleButton); inner.add(new JLabel()); JPanel editPanel = new JPanel(new BorderLayout()); editPanel .setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Edit the Region")); JPanel editInner = new JPanel(new LCBLayout(6)); editInner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); editInner.add(new JLabel("Name")); roiName = new JTextField(10); // colourScaleCombo.setMaximumRowCount(7); roiName.setActionCommand(CHANGE_ROI_NAME_COMMAND); roiName.addActionListener(this); editInner.add(roiName); editInner.add(new JLabel()); editInner.add(new JLabel("Usage")); ButtonGroup buttonGroup = new ButtonGroup(); JPanel radioPanel = new JPanel(new GridLayout(1, 2)); inclusiveRadio = new JRadioButton("inclusive"); inclusiveRadio.setActionCommand(USE_INCLUSIVE_COMMAND); inclusiveRadio.addActionListener(this); buttonGroup.add(inclusiveRadio); radioPanel.add(inclusiveRadio); exclusiveRadio = new JRadioButton("exclusive"); exclusiveRadio.setActionCommand(USE_EXCLUSIVE_COMMAND); exclusiveRadio.addActionListener(this); buttonGroup.add(exclusiveRadio); radioPanel.add(exclusiveRadio); editInner.add(radioPanel); editInner.add(new JLabel()); editInner.add(new JLabel("X Range")); JPanel xRangePanel = new JPanel(new GridLayout(1, 2)); JPanel xMinPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); xMinPanel.add(new JLabel("min: ")); xMin = new JTextField(10); // xMin.setActionCommand(CHANGE_XMIN_COMMAND); // xMin.addActionListener(this); xMin.addKeyListener(this); xMinPanel.add(xMin); xRangePanel.add(xMinPanel); JPanel xMaxPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); xMaxPanel.add(new JLabel("max: ")); xMax = new JTextField(10); // xMax.setActionCommand(CHANGE_XMAX_COMMAND); xMax.addKeyListener(this); xMaxPanel.add(xMax); xRangePanel.add(xMaxPanel); editInner.add(xRangePanel); editInner.add(new JLabel()); editInner.add(new JLabel()); JPanel applyPanel = new JPanel(new GridLayout(1, 2)); deleteButton = new JButton("Remove"); deleteButton.setEnabled(false); deleteButton.setActionCommand(REMOVE_CHANGE_ACTION); deleteButton.addActionListener(this); applyPanel.add(deleteButton); applyPanel.add(new JLabel()); applyButton = new JButton("Apply"); applyButton.setEnabled(false); applyButton.setActionCommand(APPLY_CHANGE_ACTION); applyButton.addActionListener(this); applyPanel.add(applyButton); editInner.add(applyPanel); editInner.add(new JLabel()); // inner.add(new JLabel("X Range")); // inner.add(inclusiveRadio); // exclusiveRadio = new JRadioButton("exclusive"); // exclusiveRadio.setActionCommand(USE_EXCLUSIVE_COMMAND); // exclusiveRadio.addActionListener(this); // inner.add(exclusiveRadio); editPanel.add(editInner, BorderLayout.NORTH); managePanel.add(editPanel, BorderLayout.SOUTH); managePanel.add(inner, BorderLayout.NORTH); maskingPanel.add(managePanel); wrap.setName("ROI"); wrap.add(maskingPanel, BorderLayout.NORTH); return wrap; }