List of usage examples for javax.swing JMenu setName
public void setName(String name)
From source file:au.org.ala.delta.intkey.Intkey.java
/** * Build the help menu//w w w . jav a 2 s . co m * * @param actionMap * The action map for the main GUI window * @return The JMenu for the help menu */ private JMenu buildHelpMenu(boolean advancedMode, ActionMap actionMap) { JMenu mnuHelp = new JMenu(); mnuHelp.setName("mnuHelp"); JMenuItem mnuItHelpTopics = new JMenuItem(); mnuItHelpTopics.setName("mnuItHelpTopics"); mnuItHelpTopics.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { UIUtils.displayHelpTopic(HELP_ID_TOPICS, getMainFrame(), e); } }); mnuHelp.add(mnuItHelpTopics); if (advancedMode) { JMenuItem mnuItHelpCommands = new JMenuItem(); mnuItHelpCommands.setName("mnuItHelpCommands"); mnuItHelpCommands.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { UIUtils.displayHelpTopic(HELP_ID_COMMANDS, getMainFrame(), e); } }); mnuHelp.add(mnuItHelpCommands); } if (isMac()) { configureMacAboutBox(actionMap.get("mnuItHelpAbout")); } else { JMenuItem mnuItAbout = new JMenuItem(); mnuItAbout.setAction(actionMap.get("mnuItHelpAbout")); mnuHelp.add(mnuItAbout); } return mnuHelp; }
From source file:au.org.ala.delta.intkey.Intkey.java
/** * Build the queries menu//www .jav a 2s.com * * @param actionMap * The action map for the main GUI window * @return The JMenu for the queries menu */ private JMenu buildQueriesMenu(ActionMap actionMap) { // Some menus/menu items should be disabled if no dataset is loaded. boolean isDatasetLoaded = _context.getDataset() != null; JMenu mnuQueries = new JMenu(); mnuQueries.setName("mnuQueries"); JMenuItem mnuItRestart = new JMenuItem(new DirectiveAction(new RestartDirective(), _context)); mnuItRestart.setName("mnuItRestart"); mnuItRestart.setEnabled(isDatasetLoaded); mnuQueries.add(mnuItRestart); mnuQueries.addSeparator(); JMenuItem mnuItDescribe = new JMenuItem(new DirectiveAction(new DescribeDirective(), _context)); mnuItDescribe.setName("mnuItDescribe"); mnuItDescribe.setEnabled(isDatasetLoaded); mnuQueries.add(mnuItDescribe); JMenuItem mnuItDiagnose = new JMenuItem(new DirectiveAction(new DiagnoseDirective(), _context)); mnuItDiagnose.setName("mnuItDiagnose"); mnuItDiagnose.setEnabled(isDatasetLoaded); mnuQueries.add(mnuItDiagnose); mnuQueries.addSeparator(); JMenuItem mnuItDifferences = new JMenuItem(new DirectiveAction(new DifferencesDirective(), _context)); mnuItDifferences.setName("mnuItDifferences"); mnuItDifferences.setEnabled(isDatasetLoaded); mnuQueries.add(mnuItDifferences); JMenuItem mnuItSimilarities = new JMenuItem(new DirectiveAction(new SimilaritiesDirective(), _context)); mnuItSimilarities.setName("mnuItSimilarities"); mnuItSimilarities.setEnabled(isDatasetLoaded); mnuQueries.add(mnuItSimilarities); mnuQueries.addSeparator(); JMenuItem mnuItSummary = new JMenuItem(new DirectiveAction(new SummaryDirective(), _context)); mnuItSummary.setName("mnuItSummary"); mnuItSummary.setEnabled(isDatasetLoaded); mnuQueries.add(mnuItSummary); return mnuQueries; }
From source file:au.org.ala.delta.intkey.Intkey.java
/** * Build a menu of recently opened datasets * /*from ww w.jav a 2 s. c o m*/ * @return A JMenu of recently opened datasets */ private JMenu buildRecentFilesMenu() { Map<String, String> datasetIndexMap = UIUtils.getDatasetIndexAsMap(); JMenu mnuFileRecents = new JMenu(); mnuFileRecents.setName("mnuFileRecents"); List<Pair<String, String>> recentFiles = UIUtils.getPreviouslyUsedFiles(); for (int i = 0; i < recentFiles.size(); i++) { Pair<String, String> recentFile = recentFiles.get(i); final String filePath = recentFile.getFirst(); int fileNumber = i + 1; String title; // If the dataset at the path as listed in the most recently used // datasets is listed in the index, // use the description listed in the dataset index. if (datasetIndexMap.containsKey(filePath)) { title = fileNumber + ". " + datasetIndexMap.get(filePath); } else { title = fileNumber + ". " + recentFile.getSecond(); } JMenuItem mnuItRecentFile = new JMenuItem(title); mnuItRecentFile.setToolTipText(filePath); mnuItRecentFile.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { openPreviouslyOpenedFile(filePath); } }); mnuFileRecents.add(mnuItRecentFile); } return mnuFileRecents; }
From source file:au.org.ala.delta.intkey.Intkey.java
/** * Build the window menu/*from w w w . j a v a2 s . c o m*/ * * @param actionMap * The action map for the main GUI window * @return The JMenu for the window menu */ private JMenu buildWindowMenu(ActionMap actionMap) { JMenu mnuWindow = new JMenu(); mnuWindow.setName("mnuWindow"); JMenuItem mnuItCascade = new JMenuItem(); mnuItCascade.setAction(actionMap.get("mnuItCascadeWindows")); mnuItCascade.setEnabled(true); mnuWindow.add(mnuItCascade); JMenuItem mnuItTile = new JMenuItem(); mnuItTile.setAction(actionMap.get("mnuItTileWindows")); mnuItTile.setEnabled(true); mnuWindow.add(mnuItTile); mnuWindow.addSeparator(); JMenuItem mnuItCloseAll = new JMenuItem(); mnuItCloseAll.setAction(actionMap.get("mnuItCloseAllWindows")); mnuItCloseAll.setEnabled(true); mnuWindow.add(mnuItCloseAll); mnuWindow.addSeparator(); JMenu mnuLF = new JMenu(); mnuLF.setName("mnuLF"); mnuWindow.add(mnuLF); JMenuItem mnuItMetalLF = new JMenuItem(); mnuItMetalLF.setAction(actionMap.get("metalLookAndFeel")); mnuLF.add(mnuItMetalLF); JMenuItem mnuItWindowsLF = new JMenuItem(); mnuItWindowsLF.setAction(actionMap.get("systemLookAndFeel")); mnuLF.add(mnuItWindowsLF); try { // Nimbus L&F was added in update java 6 update 10. Class.forName("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel").newInstance(); JMenuItem mnuItNimbusLF = new JMenuItem(); mnuItNimbusLF.setAction(actionMap.get("nimbusLookAndFeel")); mnuLF.add(mnuItNimbusLF); } catch (Exception e) { // The Nimbus L&F is not available, no matter. } JMenuItem mnuItSetFont = new JMenuItem(); mnuItSetFont.setAction(actionMap.get("chooseFont")); mnuItSetFont.setEnabled(true); mnuWindow.add(mnuItSetFont); JMenuItem mnuItSetMainWindowSize = new JMenuItem(); mnuItSetMainWindowSize.setAction(actionMap.get("mnuItSetMainWindowSize")); mnuItSetMainWindowSize.setEnabled(true); mnuWindow.add(mnuItSetMainWindowSize); return mnuWindow; }
From source file:au.org.ala.delta.intkey.Intkey.java
/** * Build the browsing menu/*w w w. ja v a 2 s .co m*/ * * @param actionMap * The action map for the main GUI window * @return The JMenu for the browsing menu */ private JMenu buildBrowsingMenu(ActionMap actionMap) { // Some menus/menu items should be disabled if no dataset is loaded. boolean isDatasetLoaded = _context.getDataset() != null; JMenu mnuBrowsing = new JMenu(); mnuBrowsing.setName("mnuBrowsing"); JMenuItem mnuItCharacters = new JMenuItem(new DirectiveAction(new CharactersDirective(), _context)); mnuItCharacters.setName("mnuItCharacters"); mnuItCharacters.setEnabled(isDatasetLoaded); mnuBrowsing.add(mnuItCharacters); JMenuItem mnuItTaxa = new JMenuItem(new DirectiveAction(new TaxaDirective(), _context)); mnuItTaxa.setName("mnuItTaxa"); mnuItTaxa.setEnabled(isDatasetLoaded); mnuBrowsing.add(mnuItTaxa); mnuBrowsing.addSeparator(); JMenu mnuFind = new JMenu(); mnuFind.setName("mnuFind"); JMenuItem mnuItFindCharacters = new JMenuItem(new DirectiveAction(new FindCharactersDirective(), _context)); mnuItFindCharacters.setName("mnuItFindCharacters"); mnuItFindCharacters.setEnabled(isDatasetLoaded); mnuFind.add(mnuItFindCharacters); JMenuItem mnuItFindTaxa = new JMenuItem(new DirectiveAction(new FindTaxaDirective(), _context)); mnuItFindTaxa.setName("mnuItFindTaxa"); mnuItFindTaxa.setEnabled(isDatasetLoaded); mnuFind.setEnabled(isDatasetLoaded); mnuFind.add(mnuItFindTaxa); mnuBrowsing.add(mnuFind); mnuBrowsing.addSeparator(); JMenu mnuIllustrate = new JMenu(); mnuIllustrate.setName("mnuIllustrate"); JMenuItem mnuItIllustrateCharacters = new JMenuItem( new DirectiveAction(new IllustrateCharactersDirective(), _context)); mnuItIllustrateCharacters.setName("mnuItIllustrateCharacters"); mnuItIllustrateCharacters.setEnabled(isDatasetLoaded); mnuIllustrate.add(mnuItIllustrateCharacters); JMenuItem mnuItIllustrateTaxa = new JMenuItem(new DirectiveAction(new IllustrateTaxaDirective(), _context)); mnuItIllustrateTaxa.setName("mnuItIllustrateTaxa"); mnuItIllustrateTaxa.setEnabled(isDatasetLoaded); mnuIllustrate.setEnabled(isDatasetLoaded); mnuIllustrate.add(mnuItIllustrateTaxa); mnuBrowsing.add(mnuIllustrate); mnuBrowsing.addSeparator(); JMenuItem mnuItInformation = new JMenuItem(new DirectiveAction(new InformationDirective(), _context)); mnuItInformation.setName("mnuItInformation"); mnuItInformation.setEnabled(isDatasetLoaded); mnuBrowsing.add(mnuItInformation); return mnuBrowsing; }
From source file:au.org.ala.delta.intkey.Intkey.java
/** * Build the settings menu/* w w w . j a v a 2 s . c om*/ * * @param actionMap * The action map for the main GUI window * @return The JMenu for the settings menu */ private JMenu buildSettingsMenu(ActionMap actionMap) { // Some menus/menu items should be disabled if no dataset is loaded. boolean isDatasetLoaded = _context.getDataset() != null; JMenu mnuSettings = new JMenu(); mnuSettings.setName("mnuSettings"); // "Set" submenu MenuBuilder mnuSetBuilder = new MenuBuilder("mnuSet", _context); mnuSetBuilder.startSubMenu("mnuAutotolerance", true); mnuSetBuilder.addOnOffDirectiveMenuItem("mnuItAutotoleranceOn", new SetAutoToleranceDirective(), true); mnuSetBuilder.addOnOffDirectiveMenuItem("mnuItAutotoleranceOff", new SetAutoToleranceDirective(), false); mnuSetBuilder.endSubMenu(); mnuSetBuilder.startSubMenu("mnuDemonstration", true); mnuSetBuilder.addOnOffDirectiveMenuItem("mnuItDemonstrationOn", new SetDemonstrationDirective(), true); mnuSetBuilder.addOnOffDirectiveMenuItem("mnuItDemonstrationOff", new SetDemonstrationDirective(), false); mnuSetBuilder.endSubMenu(); mnuSetBuilder.addDirectiveMenuItem("mnuItDiagLevel", new SetDiagLevelDirective(), true); mnuSetBuilder.startSubMenu("mnuDiagType", true); mnuSetBuilder.addDirectiveMenuItem("mnuItDiagTypeSpecimens", new SetDiagTypeSpecimensDirective(), true); mnuSetBuilder.addDirectiveMenuItem("mnuItDiagTypeTaxa", new SetDiagTypeTaxaDirective(), true); mnuSetBuilder.endSubMenu(); mnuSetBuilder.addDirectiveMenuItem("mnuItExact", new SetExactDirective(), true); mnuSetBuilder.startSubMenu("mnuFix", true); mnuSetBuilder.addOnOffDirectiveMenuItem("mnuItFixOn", new SetFixDirective(), true); mnuSetBuilder.addOnOffDirectiveMenuItem("mnuItFixOff", new SetFixDirective(), false); mnuSetBuilder.endSubMenu(); mnuSetBuilder.addDirectiveMenuItem("mnuItImagePath", new SetImagePathDirective(), true); mnuSetBuilder.addDirectiveMenuItem("mnuItInfoPath", new SetInfoPathDirective(), true); mnuSetBuilder.addDirectiveMenuItem("mnuItMatch", new SetMatchDirective(), true); mnuSetBuilder.addDirectiveMenuItem("mnuItRbase", new SetRBaseDirective(), true); mnuSetBuilder.addDirectiveMenuItem("mnuItReliabilities", new SetReliabilitiesDirective(), true); mnuSetBuilder.addDirectiveMenuItem("mnuItStopBest", new SetStopBestDirective(), true); mnuSetBuilder.addDirectiveMenuItem("mnuItTolerance", new SetToleranceDirective(), true); mnuSetBuilder.addDirectiveMenuItem("mnuItVaryWt", new SetVaryWtDirective(), true); mnuSettings.add(mnuSetBuilder.getMenu()); // "Display" submenu MenuBuilder mnuDisplayBuilder = new MenuBuilder("mnuDisplay", _context); mnuDisplayBuilder.startSubMenu("mnuCharacterOrder", true); mnuDisplayBuilder.addDirectiveMenuItem("mnuItCharacterOrderBest", new DisplayCharacterOrderBestDirective(), true); mnuDisplayBuilder.addDirectiveMenuItem("mnuItCharacterOrderNatural", new DisplayCharacterOrderNaturalDirective(), true); mnuDisplayBuilder.addDirectiveMenuItem("mnuItCharacterOrderSeparate", new DisplayCharacterOrderSeparateDirective(), true); mnuDisplayBuilder.endSubMenu(); mnuDisplayBuilder.startSubMenu("mnuComments", true); mnuDisplayBuilder.addOnOffDirectiveMenuItem("mnuItCommentsOn", new DisplayCommentsDirective(), true); mnuDisplayBuilder.addOnOffDirectiveMenuItem("mnuItCommentsOff", new DisplayCommentsDirective(), false); mnuDisplayBuilder.endSubMenu(); mnuDisplayBuilder.startSubMenu("mnuContinuous", true); mnuDisplayBuilder.addOnOffDirectiveMenuItem("mnuItContinuousOn", new DisplayContinuousDirective(), true); mnuDisplayBuilder.addOnOffDirectiveMenuItem("mnuItContinuousOff", new DisplayContinuousDirective(), false); mnuDisplayBuilder.endSubMenu(); mnuDisplayBuilder.startSubMenu("mnuEndIdentify", true); mnuDisplayBuilder.addOnOffDirectiveMenuItem("mnuItEndIdentifyOn", new DisplayEndIdentifyDirective(), true); mnuDisplayBuilder.addOnOffDirectiveMenuItem("mnuItEndIdentifyOff", new DisplayEndIdentifyDirective(), false); mnuDisplayBuilder.endSubMenu(); mnuDisplayBuilder.addDirectiveMenuItem("mnuItImages", new DisplayImagesDirective(), true); mnuDisplayBuilder.startSubMenu("mnuInapplicables", true); mnuDisplayBuilder.addOnOffDirectiveMenuItem("mnuItInapplicablesOn", new DisplayInapplicablesDirective(), true); mnuDisplayBuilder.addOnOffDirectiveMenuItem("mnuItInapplicablesOff", new DisplayInapplicablesDirective(), false); mnuDisplayBuilder.endSubMenu(); mnuDisplayBuilder.startSubMenu("mnuInput", true); mnuDisplayBuilder.addOnOffDirectiveMenuItem("mnuItInputOn", new DisplayInputDirective(), true); mnuDisplayBuilder.addOnOffDirectiveMenuItem("mnuItInputOff", new DisplayInputDirective(), false); mnuDisplayBuilder.endSubMenu(); mnuDisplayBuilder.startSubMenu("mnuKeywords", true); mnuDisplayBuilder.addOnOffDirectiveMenuItem("mnuItKeywordsOn", new DisplayKeywordsDirective(), true); mnuDisplayBuilder.addOnOffDirectiveMenuItem("mnuItKeywordsOff", new DisplayKeywordsDirective(), false); mnuDisplayBuilder.endSubMenu(); mnuDisplayBuilder.startSubMenu("mnuLog", true); mnuDisplayBuilder.addOnOffDirectiveMenuItem("mnuItLogOn", new DisplayLogDirective(), true); mnuDisplayBuilder.addOnOffDirectiveMenuItem("mnuItLogOff", new DisplayLogDirective(), false); mnuDisplayBuilder.endSubMenu(); mnuDisplayBuilder.startSubMenu("mnuNumbering", true); mnuDisplayBuilder.addOnOffDirectiveMenuItem("mnuItNumberingOn", new DisplayNumberingDirective(), true); mnuDisplayBuilder.addOnOffDirectiveMenuItem("mnuItNumberingOff", new DisplayNumberingDirective(), false); mnuDisplayBuilder.endSubMenu(); mnuDisplayBuilder.startSubMenu("mnuScaled", true); mnuDisplayBuilder.addOnOffDirectiveMenuItem("mnuItScaledOn", new DisplayScaledDirective(), true); mnuDisplayBuilder.addOnOffDirectiveMenuItem("mnuItScaledOff", new DisplayScaledDirective(), false); mnuDisplayBuilder.endSubMenu(); mnuDisplayBuilder.startSubMenu("mnuUnknowns", true); mnuDisplayBuilder.addOnOffDirectiveMenuItem("mnuItUnknownsOn", new DisplayUnknownsDirective(), true); mnuDisplayBuilder.addOnOffDirectiveMenuItem("mnuItUnknownsOff", new DisplayUnknownsDirective(), false); mnuDisplayBuilder.endSubMenu(); mnuSettings.add(mnuDisplayBuilder.getMenu()); // "Define" submenu MenuBuilder mnuDefineBuilder = new MenuBuilder("mnuDefine", _context); mnuDefineBuilder.addDirectiveMenuItem("mnuItDefineCharacters", new DefineCharactersDirective(), isDatasetLoaded); mnuDefineBuilder.addDirectiveMenuItem("mnuItDefineTaxa", new DefineTaxaDirective(), isDatasetLoaded); mnuDefineBuilder.addDirectiveMenuItem("mnuItDefineNames", new DefineNamesDirective(), isDatasetLoaded); mnuDefineBuilder.addDirectiveMenuItem("mnuItDefineButton", new DefineButtonDirective(), isDatasetLoaded); mnuDefineBuilder.addDirectiveMenuItem("mnuItDefineEndIdentify", new DefineEndIdentifyDirective(), isDatasetLoaded); mnuDefineBuilder.addDirectiveMenuItem("mnuItDefineInformation", new DefineInformationDirective(), isDatasetLoaded); mnuDefineBuilder.addDirectiveMenuItem("mnuItDefineSubjects", new DefineSubjectsDirective(), isDatasetLoaded); JMenu mnuDefine = mnuDefineBuilder.getMenu(); mnuDefine.setEnabled(isDatasetLoaded); mnuSettings.add(mnuDefineBuilder.getMenu()); // "Include" submenu MenuBuilder mnuIncludeBuilder = new MenuBuilder("mnuInclude", _context); mnuIncludeBuilder.addDirectiveMenuItem("mnuItIncludeCharacters", new IncludeCharactersDirective(), isDatasetLoaded); mnuIncludeBuilder.addDirectiveMenuItem("mnuItIncludeTaxa", new IncludeTaxaDirective(), isDatasetLoaded); JMenu mnuInclude = mnuIncludeBuilder.getMenu(); mnuInclude.setEnabled(isDatasetLoaded); mnuSettings.add(mnuInclude); // "Exclude" submenu MenuBuilder mnuExcludeBuilder = new MenuBuilder("mnuExclude", _context); mnuExcludeBuilder.addDirectiveMenuItem("mnuItExcludeCharacters", new ExcludeCharactersDirective(), isDatasetLoaded); mnuExcludeBuilder.addDirectiveMenuItem("mnuItExcludeTaxa", new ExcludeTaxaDirective(), isDatasetLoaded); JMenu mnuExclude = mnuExcludeBuilder.getMenu(); mnuExclude.setEnabled(isDatasetLoaded); mnuSettings.add(mnuExclude); // "Status" submenu MenuBuilder mnuStatusBuilder = new MenuBuilder("mnuStatus", _context); mnuStatusBuilder.addDirectiveMenuItem("mnuItStatusDisplay", new StatusDisplayDirective(), isDatasetLoaded); mnuStatusBuilder.startSubMenu("mnuStatusInclude", true); mnuStatusBuilder.addDirectiveMenuItem("mnuItStatusIncludeCharacters", new StatusIncludeCharactersDirective(), isDatasetLoaded); mnuStatusBuilder.addDirectiveMenuItem("mnuItStatusIncludeTaxa", new StatusIncludeTaxaDirective(), isDatasetLoaded); mnuStatusBuilder.endSubMenu(); mnuStatusBuilder.startSubMenu("mnuStatusExclude", true); mnuStatusBuilder.addDirectiveMenuItem("mnuItStatusExcludeCharacters", new StatusExcludeCharactersDirective(), isDatasetLoaded); mnuStatusBuilder.addDirectiveMenuItem("mnuItStatusExcludeTaxa", new StatusExcludeTaxaDirective(), isDatasetLoaded); mnuStatusBuilder.endSubMenu(); mnuStatusBuilder.addDirectiveMenuItem("mnuItStatusFiles", new StatusFilesDirective(), isDatasetLoaded); mnuStatusBuilder.addDirectiveMenuItem("mnuItStatusSet", new StatusSetDirective(), isDatasetLoaded); mnuStatusBuilder.addDirectiveMenuItem("mnuItStatusAll", new StatusAllDirective(), isDatasetLoaded); mnuSettings.add(mnuStatusBuilder.getMenu()); return mnuSettings; }
From source file:examples.monalisa.gui.GeneticDrawingView.java
/** This method is called from within the constructor to * initialize the form./*w w w . ja v a2 s . com*/ * 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() { mainPanel = new javax.swing.JPanel(); chooseImage = new javax.swing.JButton(); startEvolution = new javax.swing.JToggleButton(); targetImageLabel = new javax.swing.JLabel(); JFreeChart chart = ChartFactory.createXYLineChart("Fitness versus Generation", "Generation", "Fitness", new XYSeriesCollection(new XYSeries("")), org.jfree.chart.plot.PlotOrientation.VERTICAL, false, false, false); chartPanel = new ChartPanel(chart); menuBar = new javax.swing.JMenuBar(); javax.swing.JMenu fileMenu = new javax.swing.JMenu(); javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem(); javax.swing.JMenu helpMenu = new javax.swing.JMenu(); javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem(); mainPanel.setName("mainPanel"); // NOI18N javax.swing.ActionMap actionMap = org.jdesktop.application.Application .getInstance(examples.monalisa.gui.GeneticDrawingApp.class).getContext() .getActionMap(GeneticDrawingView.class, this); chooseImage.setAction(actionMap.get("chooseImage")); // NOI18N org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application .getInstance(examples.monalisa.gui.GeneticDrawingApp.class).getContext() .getResourceMap(GeneticDrawingView.class); chooseImage.setText(resourceMap.getString("chooseImage.text")); // NOI18N chooseImage.setName("chooseImage"); // NOI18N startEvolution.setAction(actionMap.get("startEvolution")); // NOI18N startEvolution.setText(resourceMap.getString("startEvolution.text")); // NOI18N startEvolution.setName("startEvolution"); // NOI18N targetImageLabel.setIcon(resourceMap.getIcon("targetImageLabel.icon")); // NOI18N targetImageLabel.setText(resourceMap.getString("targetImageLabel.text")); // NOI18N targetImageLabel.setName("targetImageLabel"); // NOI18N chartPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); chartPanel.setName("chartPanel"); // NOI18N org.jdesktop.layout.GroupLayout chartPanelLayout = new org.jdesktop.layout.GroupLayout(chartPanel); chartPanel.setLayout(chartPanelLayout); chartPanelLayout.setHorizontalGroup(chartPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(0, 399, Short.MAX_VALUE)); chartPanelLayout.setVerticalGroup(chartPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(0, 234, Short.MAX_VALUE)); org.jdesktop.layout.GroupLayout mainPanelLayout = new org.jdesktop.layout.GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup(mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(mainPanelLayout.createSequentialGroup().add(mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(mainPanelLayout.createSequentialGroup().add(47, 47, 47).add(chooseImage) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(startEvolution) .add(38, 38, 38)) .add(org.jdesktop.layout.GroupLayout.TRAILING, mainPanelLayout.createSequentialGroup() .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(targetImageLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 200, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(80, 80, 80))) .add(chartPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); mainPanelLayout.setVerticalGroup(mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, mainPanelLayout.createSequentialGroup() .addContainerGap() .add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(org.jdesktop.layout.GroupLayout.LEADING, chartPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(mainPanelLayout.createSequentialGroup() .add(targetImageLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 202, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(startEvolution).add(chooseImage)))) .addContainerGap())); chooseImage.getAccessibleContext() .setAccessibleName(resourceMap.getString("jButton1.AccessibleContext.accessibleName")); // NOI18N menuBar.setName("menuBar"); // NOI18N fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N fileMenu.setName("fileMenu"); // NOI18N exitMenuItem.setAction(actionMap.get("quit")); // NOI18N exitMenuItem.setName("exitMenuItem"); // NOI18N fileMenu.add(exitMenuItem); menuBar.add(fileMenu); helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N helpMenu.setName("helpMenu"); // NOI18N aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N aboutMenuItem.setName("aboutMenuItem"); // NOI18N helpMenu.add(aboutMenuItem); menuBar.add(helpMenu); setComponent(mainPanel); setMenuBar(menuBar); }
From source file:gd.gui.GeneticDrawingView.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor./* ww w .j av a 2 s .c o m*/ */ // <editor-fold defaultstate="collapsed" desc="Generated // Code">//GEN-BEGIN:initComponents private void initComponents() { mainPanel = new javax.swing.JPanel(); chooseImage = new javax.swing.JButton(); chooseImage.setVisible(false); startEvolution = new javax.swing.JToggleButton(); startEvolution.setVisible(false); targetImageLabel = new javax.swing.JLabel(); JFreeChart chart = ChartFactory.createXYLineChart("Fitness versus Generation", "Generation", "Fitness", new XYSeriesCollection(new XYSeries("")), org.jfree.chart.plot.PlotOrientation.VERTICAL, false, false, false); chartPanel = new ChartPanel(chart); menuBar = new javax.swing.JMenuBar(); javax.swing.JMenu fileMenu = new javax.swing.JMenu(); javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem(); // javax.swing.JMenu helpMenu = new javax.swing.JMenu(); javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem(); mainPanel.setName("mainPanel"); // NOI18N javax.swing.ActionMap actionMap = org.jdesktop.application.Application .getInstance(gd.gui.GeneticDrawingApp.class).getContext() .getActionMap(GeneticDrawingView.class, this); chooseImage.setAction(actionMap.get("chooseImage")); // NOI18N org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application .getInstance(gd.gui.GeneticDrawingApp.class).getContext().getResourceMap(GeneticDrawingView.class); chooseImage.setText(resourceMap.getString("chooseImage.text")); // NOI18N chooseImage.setName("chooseImage"); // NOI18N startEvolution.setAction(actionMap.get("startEvolution")); // NOI18N startEvolution.setText(resourceMap.getString("startEvolution.text")); // NOI18N startEvolution.setName("startEvolution"); // NOI18N targetImageLabel.setIcon(resourceMap.getIcon("targetImageLabel.icon")); // NOI18N targetImageLabel.setText(resourceMap.getString("targetImageLabel.text")); // NOI18N targetImageLabel.setName("targetImageLabel"); // NOI18N chartPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); chartPanel.setName("chartPanel"); // NOI18N org.jdesktop.layout.GroupLayout chartPanelLayout = new org.jdesktop.layout.GroupLayout(chartPanel); chartPanel.setLayout(chartPanelLayout); chartPanelLayout.setHorizontalGroup(chartPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(0, 399, Short.MAX_VALUE)); chartPanelLayout.setVerticalGroup(chartPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(0, 234, Short.MAX_VALUE)); org.jdesktop.layout.GroupLayout mainPanelLayout = new org.jdesktop.layout.GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup(mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(mainPanelLayout.createSequentialGroup().add(mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(mainPanelLayout.createSequentialGroup().add(47, 47, 47).add(chooseImage) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(startEvolution) .add(38, 38, 38)) .add(org.jdesktop.layout.GroupLayout.TRAILING, mainPanelLayout.createSequentialGroup() .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(targetImageLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 200, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(80, 80, 80))) .add(chartPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); mainPanelLayout.setVerticalGroup(mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, mainPanelLayout.createSequentialGroup() .addContainerGap() .add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(org.jdesktop.layout.GroupLayout.LEADING, chartPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(mainPanelLayout.createSequentialGroup() .add(targetImageLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 202, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(startEvolution).add(chooseImage)))) .addContainerGap())); chooseImage.getAccessibleContext() .setAccessibleName(resourceMap.getString("jButton1.AccessibleContext.accessibleName")); // NOI18N menuBar.setName("menuBar"); // NOI18N fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N fileMenu.setName("fileMenu"); // NOI18N exitMenuItem.setAction(actionMap.get("quit")); // NOI18N exitMenuItem.setName("exitMenuItem"); // NOI18N fileMenu.add(exitMenuItem); menuBar.add(fileMenu); // helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N // helpMenu.setName("helpMenu"); // NOI18N aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N aboutMenuItem.setName("aboutMenuItem"); // NOI18N // helpMenu.add(aboutMenuItem); // menuBar.add(helpMenu); setComponent(mainPanel); setMenuBar(menuBar); }
From source file:src.examples.monalisa.gui.GeneticDrawingView.java
/** This method is called from within the constructor to * initialize the form.//from w ww . j a v a 2s .c o m * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { mainPanel = new javax.swing.JPanel(); chooseImage = new javax.swing.JButton(); startEvolution = new javax.swing.JToggleButton(); targetImageLabel = new javax.swing.JLabel(); JFreeChart chart = ChartFactory.createXYLineChart("Fitness versus Generation", "Generation", "Fitness", new XYSeriesCollection(new XYSeries("")), org.jfree.chart.plot.PlotOrientation.VERTICAL, false, false, false); chartPanel = new ChartPanel(chart); menuBar = new javax.swing.JMenuBar(); javax.swing.JMenu fileMenu = new javax.swing.JMenu(); javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem(); javax.swing.JMenu helpMenu = new javax.swing.JMenu(); javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem(); mainPanel.setName("mainPanel"); // NOI18N javax.swing.ActionMap actionMap = org.jdesktop.application.Application .getInstance(src.examples.monalisa.gui.GeneticDrawingApp.class).getContext() .getActionMap(GeneticDrawingView.class, this); chooseImage.setAction(actionMap.get("chooseImage")); // NOI18N org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application .getInstance(src.examples.monalisa.gui.GeneticDrawingApp.class).getContext() .getResourceMap(GeneticDrawingView.class); chooseImage.setText(resourceMap.getString("chooseImage.text")); // NOI18N chooseImage.setName("chooseImage"); // NOI18N startEvolution.setAction(actionMap.get("startEvolution")); // NOI18N startEvolution.setText(resourceMap.getString("startEvolution.text")); // NOI18N startEvolution.setName("startEvolution"); // NOI18N targetImageLabel.setIcon(resourceMap.getIcon("targetImageLabel.icon")); // NOI18N targetImageLabel.setText(resourceMap.getString("targetImageLabel.text")); // NOI18N targetImageLabel.setName("targetImageLabel"); // NOI18N chartPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); chartPanel.setName("chartPanel"); // NOI18N org.jdesktop.layout.GroupLayout chartPanelLayout = new org.jdesktop.layout.GroupLayout(chartPanel); chartPanel.setLayout(chartPanelLayout); chartPanelLayout.setHorizontalGroup(chartPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(0, 399, Short.MAX_VALUE)); chartPanelLayout.setVerticalGroup(chartPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(0, 234, Short.MAX_VALUE)); org.jdesktop.layout.GroupLayout mainPanelLayout = new org.jdesktop.layout.GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup(mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(mainPanelLayout.createSequentialGroup().add(mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(mainPanelLayout.createSequentialGroup().add(47, 47, 47).add(chooseImage) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(startEvolution) .add(38, 38, 38)) .add(org.jdesktop.layout.GroupLayout.TRAILING, mainPanelLayout.createSequentialGroup() .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(targetImageLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 200, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(80, 80, 80))) .add(chartPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); mainPanelLayout.setVerticalGroup(mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, mainPanelLayout.createSequentialGroup() .addContainerGap() .add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(org.jdesktop.layout.GroupLayout.LEADING, chartPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(mainPanelLayout.createSequentialGroup() .add(targetImageLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 202, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(startEvolution).add(chooseImage)))) .addContainerGap())); chooseImage.getAccessibleContext() .setAccessibleName(resourceMap.getString("jButton1.AccessibleContext.accessibleName")); // NOI18N menuBar.setName("menuBar"); // NOI18N fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N fileMenu.setName("fileMenu"); // NOI18N exitMenuItem.setAction(actionMap.get("quit")); // NOI18N exitMenuItem.setName("exitMenuItem"); // NOI18N fileMenu.add(exitMenuItem); menuBar.add(fileMenu); helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N helpMenu.setName("helpMenu"); // NOI18N aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N aboutMenuItem.setName("aboutMenuItem"); // NOI18N helpMenu.add(aboutMenuItem); menuBar.add(helpMenu); setComponent(mainPanel); setMenuBar(menuBar); }
From source file:base.BasePlayer.Main.java
static void addGenomeFile(String genomeName) { Main.genomehash.put(genomeName, new ArrayList<File>()); JMenu addMenu = new JMenu(genomeName); addMenu.addMouseListener(thisMainListener); addMenu.setName(genomeName); if (Main.drawCanvas != null) { clicked = false;//from w ww . j a v a 2 s . c om refModel.removeElementAt(refModel.getSize() - 1); refModel.addElement(genomeName); refModel.addElement("Add new reference..."); clicked = true; genome.add(addMenu); genome.revalidate(); } }