Example usage for javax.swing ActionMap get

List of usage examples for javax.swing ActionMap get

Introduction

In this page you can find the example usage for javax.swing ActionMap get.

Prototype

public Action get(Object key) 

Source Link

Document

Returns the binding for key, messaging the parent ActionMap if the binding is not locally defined.

Usage

From source file:Main.java

public static void main(String args[]) {
    String ACTION_KEY = "The Action";

    JFrame frame = new JFrame("KeyStroke Sample");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JButton buttonA = new JButton("FOCUSED (control alt 7)");
    JButton buttonB = new JButton("FOCUS/RELEASE (VK_ENTER)");
    JButton buttonC = new JButton("ANCESTOR  (VK_F4+SHIFT_MASK)");
    JButton buttonD = new JButton("WINDOW (' ')");

    Action actionListener = new AbstractAction() {
        public void actionPerformed(ActionEvent actionEvent) {
            JButton source = (JButton) actionEvent.getSource();
            System.out.println("Activated: " + source.getText());
        }//w  w  w.j  a v  a  2s  .  c om
    };

    KeyStroke controlAlt7 = KeyStroke.getKeyStroke("control alt 7");
    InputMap inputMap = buttonA.getInputMap();
    inputMap.put(controlAlt7, ACTION_KEY);
    ActionMap actionMap = buttonA.getActionMap();
    Object[] keys = actionMap.keys();
    for (Object key : keys) {
        actionMap.get(key);
    }
    actionMap.put(ACTION_KEY, actionListener);

    KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true);
    inputMap = buttonB.getInputMap();
    inputMap.put(enter, ACTION_KEY);
    buttonB.setActionMap(actionMap);

    KeyStroke shiftF4 = KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.SHIFT_MASK);
    inputMap = buttonC.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    inputMap.put(shiftF4, ACTION_KEY);
    buttonC.setActionMap(actionMap);

    KeyStroke space = KeyStroke.getKeyStroke(' ');
    inputMap = buttonD.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    inputMap.put(space, ACTION_KEY);
    buttonD.setActionMap(actionMap);

    frame.setLayout(new GridLayout(2, 2));
    frame.add(buttonA);
    frame.add(buttonB);
    frame.add(buttonC);
    frame.add(buttonD);

    frame.setSize(400, 200);
    frame.setVisible(true);
}

From source file:Main.java

/**
 * Obtine actiunea inregistrata pentru apasarea de tasta
 * @return //w w  w. j a  v  a 2s  . c o  m
 */
public static Action getActionForKeystroke(JComponent component, int inputMapId, KeyStroke keyStroke) {
    //Identify the action key
    InputMap inputMap = component.getInputMap(inputMapId);
    String key = (String) inputMap.get(keyStroke);

    //Get the action
    if (key != null) {
        ActionMap localMap = component.getActionMap();
        return localMap.get(key);
    } else {
        return null;
    }
}

From source file:Main.java

static void list(ActionMap map, Object[] actionKeys) {
    if (actionKeys == null) {
        return;// w  w w. ja va2s  .  c  o m
    }
    for (int i = 0; i < actionKeys.length; i++) {
        // Get the action bound to this action key
        while (map.get(actionKeys[i]) == null) {
            map = map.getParent();
        }
        Action action = (Action) map.get(actionKeys[i]);
    }
}

From source file:Main.java

/**
 * Populates the toolbar with actions.//from   ww w . j  a va  2s  .  co m
 * 
 * @param toolBar
 * @param actionMap
 * @param list
 */
public static void populateToolbar(JToolBar toolBar, ActionMap actionMap, List<Object> list) {
    for (Object object : list) {
        if (object instanceof Action) {
            toolBar.add((Action) object);
        } else {
            toolBar.add(actionMap.get(object));
        }
    }
}

From source file:Main.java

/**
 * Creates a {@link JMenu} from the given list and action map.
 * /*w w w .  j  av  a2 s .  co m*/
 * @param actionMap
 * @param list
 * @return
 */
public static JMenu createMenu(ActionMap actionMap, List<?> list) {
    // The first item will be the action for the JMenu
    final Action titleAction = actionMap.get(list.get(0));
    if (titleAction == null) {
        return null;
    }
    final JMenu menu = new JMenu();
    menu.setAction(titleAction);

    // The rest of the items represent the menu items.
    for (Object element : list.subList(1, list.size())) {
        if (element == null) {
            menu.addSeparator();
        } else if (element instanceof List<?>) {
            JMenu newMenu = createMenu(actionMap, (List<?>) element);
            if (newMenu != null) {
                menu.add(newMenu);
            }
        } else if (element.getClass().isArray()) {
            JMenu newMenu = createMenu(actionMap, (Object[]) element);
            if (newMenu != null) {
                menu.add(newMenu);
            }
        } else {
            final Action action = actionMap.get(element);
            if (action == null) {
                continue;
            } else {
                menu.add(createMenuItem(action));
            }
        }
    }
    return menu;
}

From source file:Main.java

/**
 * Populates a {@link JToolBar} with the list items and {@link ActionMap}.
 * //from w  w w  .j  a  va2  s  . com
 * @param toolBar
 * @param actionMap
 * @param items
 */
public static void populate(JToolBar toolBar, ActionMap actionMap, List<?> items) {
    toolBar.setOpaque(false);
    for (Object item : items) {
        if (item instanceof Component) {
            toolBar.add((Component) item);
        } else if (item == null) {
            toolBar.addSeparator();
        } else {
            final Action action = item instanceof Action ? (Action) item : actionMap.get(item);
            final AbstractButton button = createToolbarItem(action);
            toolBar.add(button);
        }
    }
}

From source file:Main.java

/**
 * Populates a {@link JMenuBar} from the given list and {@link ActionMap}.
 * //from  www  .j a v a2s .  c o m
 * @param menubar
 * @param actionMap
 * @param list
 * @return
 */
public static void populate(JMenuBar menubar, ActionMap actionMap, List<?> list) {
    JMenu menu = null;

    for (Object element : list) {
        if (element == null) {
            if (menu != null) {
                menu.addSeparator();
            }
        } else if (element instanceof List<?>) {
            menu = createMenu(actionMap, (List<?>) element);
            if (menu != null) {
                menubar.add(menu);
            }
        } else if (element.getClass().isArray()) {
            menu = createMenu(actionMap, (Object[]) element);
            if (menu != null) {
                menubar.add(menu);
            }
        } else {
            if (menu != null) {
                menu.add(actionMap.get(element));
            }
        }
    }
}

From source file:examples.monalisa.gui.GeneticDrawingView.java

/** This method is called from within the constructor to
 * initialize the form./*from w w w  .  j a v  a 2  s .c  om*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    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:src.examples.monalisa.gui.GeneticDrawingView.java

/** This method is called from within the constructor to
 * initialize the form.//  w  ww.  ja  v  a2  s  .  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: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./*from   w ww .ja  v  a2 s  .  co 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);
}