Example usage for javax.swing JToolBar addSeparator

List of usage examples for javax.swing JToolBar addSeparator

Introduction

In this page you can find the example usage for javax.swing JToolBar addSeparator.

Prototype

public void addSeparator() 

Source Link

Document

Appends a separator of default size to the end of the tool bar.

Usage

From source file:com.mgmtp.perfload.loadprofiles.ui.AppFrame.java

private void initToolBar(final JToolBar toolBar) {
    toolBar.add(fileNewLoadProfileConfigAction);
    toolBar.add(fileOpenLoadProfileConfigAction);
    toolBar.add(fileSaveLoadProfileConfigAction);
    toolBar.addSeparator();
    toolBar.add(toolsAddStairsAction);/*from w  w  w.  j  a v a2 s . c om*/
    toolBar.add(toolsAddOneTimeAction);
    toolBar.add(toolsAddMarkerAction);
    toolBar.add(toolsDeleteLoadProfileEntityAction);
    toolBar.addSeparator();
    toolBar.add(toolsExportEventListAction);
    toolBar.addSeparator();
    toolBar.add(toolsSettingsAction);
    toolBar.addSeparator();
    toolBar.add(helpAboutAction);
}

From source file:org.fhaes.jsea.JSEAFrame.java

/**
 * Setup toolbar.//from  w ww .j  ava2s  . c om
 */
private void setupToolbar() {

    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);
    toolBar.setRollover(true);
    getContentPane().add(toolBar, "cell 0 0");
    {
        JToolBarButton btnNew = new JToolBarButton(actionReset);
        btnNew.setToolTipText("Start new analysis");
        toolBar.add(btnNew);

        JToolBarButton btnSaveAll = new JToolBarButton(actionSaveAll);
        btnSaveAll.setToolTipText("Save all results");
        toolBar.add(btnSaveAll);

        toolBar.addSeparator();

        JToolBarButton btnCopy = new JToolBarButton(actionCopy);
        btnSaveAll.setToolTipText("Copy");
        toolBar.add(btnCopy);

        JToolBarButton btnChartProperties = new JToolBarButton(actionChartProperties);
        btnChartProperties.setToolTipText("Chart properties");
        toolBar.add(btnChartProperties);

        toolBar.addSeparator();

        JToolBarButton btnRun = new JToolBarButton(actionRun);
        btnRun.setToolTipText("Run analysis");
        toolBar.add(btnRun);

        toolBar.addSeparator();

        JToolBarButton btnLagMap = new JToolBarButton(actionLagMap);
        btnLagMap.setToolTipText("Launch LagMap");
        toolBar.add(btnLagMap);
    }
}

From source file:org.fhaes.fhsamplesize.view.FHSampleSize.java

/**
 * Initialize GUI components.//from  w  w w.  j  a  v  a  2  s. c om
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
private void initGUI() {

    App.init();

    // setBounds(100, 100, 972, 439);
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setIconImage(Builder.getApplicationIcon());
    setTitle("Sample Size Analysis");
    getContentPane().setLayout(new MigLayout("", "[1136px,grow,fill]", "[30px][405px,grow]"));

    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);
    getContentPane().add(toolBar, "cell 0 0,growx,aligny top");

    JToolBarButton btnOpen = new JToolBarButton(actionBrowse);
    btnOpen.setIcon(Builder.getImageIcon("fileopen.png"));
    toolBar.add(btnOpen);

    JToolBarButton btnSave = new JToolBarButton(actionSaveTable);
    btnSave.setIcon(Builder.getImageIcon("save.png"));
    toolBar.add(btnSave);

    JToolBarButton btnExportPDF = new JToolBarButton(actionExportPDF);
    btnExportPDF.setIcon(Builder.getImageIcon("pdf.png"));
    toolBar.add(btnExportPDF);

    JToolBarButton btnExportPNG = new JToolBarButton(actionExportPNG);
    btnExportPNG.setIcon(Builder.getImageIcon("formatpng.png"));
    toolBar.add(btnExportPNG);

    toolBar.addSeparator();

    JToolBarButton btnRun = new JToolBarButton(actionRun);
    btnRun.setIcon(Builder.getImageIcon("run.png"));
    toolBar.add(btnRun);

    JPanel panelMain = new JPanel();
    getContentPane().add(panelMain, "cell 0 1,grow");
    panelMain.setLayout(new BorderLayout(0, 0));

    JSplitPane splitPaneMain = new JSplitPane();
    splitPaneMain.setOneTouchExpandable(true);
    panelMain.add(splitPaneMain);

    JPanel panelParameters = new JPanel();
    splitPaneMain.setLeftComponent(panelParameters);
    panelParameters.setLayout(new MigLayout("", "[grow,right]", "[][][][193.00,grow,fill][]"));

    JPanel panelInput = new JPanel();
    panelInput.setBorder(new TitledBorder(null, "Input", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelParameters.add(panelInput, "cell 0 0,grow");
    panelInput.setLayout(new MigLayout("", "[100px:100px:180px,right][grow,fill][]", "[]"));

    JLabel lblInputFile = new JLabel("Input file:");
    panelInput.add(lblInputFile, "cell 0 0");

    txtInputFile = new JTextField();
    panelInput.add(txtInputFile, "cell 1 0,growx");
    txtInputFile.setActionCommand("NewFileTyped");
    txtInputFile.addActionListener(this);
    txtInputFile.setColumns(10);

    JButton btnBrowse = new JButton("");
    panelInput.add(btnBrowse, "cell 2 0");
    btnBrowse.setAction(actionBrowse);
    btnBrowse.setText("");
    btnBrowse.setIcon(Builder.getImageIcon("fileopen16.png"));
    btnBrowse.setPreferredSize(new Dimension(25, 25));
    btnBrowse.setMaximumSize(new Dimension(25, 25));
    btnBrowse.putClientProperty("JButton.buttonType", "segmentedTextured");
    btnBrowse.putClientProperty("JButton.segmentPosition", "middle");

    JPanel panelAnalysisOptions = new JPanel();
    panelAnalysisOptions.setBorder(new TitledBorder(null, "Analysis and filtering options",
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelParameters.add(panelAnalysisOptions, "cell 0 1,grow");
    panelAnalysisOptions.setLayout(new MigLayout("", "[100px:100px:180px,right][grow][][]", "[][][][][]"));

    JLabel lblEventTypes = new JLabel("Event type:");
    panelAnalysisOptions.add(lblEventTypes, "cell 0 0");

    cboEventType = new JComboBox();
    panelAnalysisOptions.add(cboEventType, "cell 1 0 3 1");
    cboEventType.setModel(new DefaultComboBoxModel(EventTypeToProcess.values()));
    new EventTypeWrapper(cboEventType, PrefKey.EVENT_TYPE_TO_PROCESS, EventTypeToProcess.FIRE_EVENT);

    chkCommonYears = new JCheckBox("<html>Only analyze years all series have in common");
    chkCommonYears.setEnabled(false);
    new CheckBoxWrapper(chkCommonYears, PrefKey.SSIZ_CHK_COMMON_YEARS, false);
    panelAnalysisOptions.add(chkCommonYears, "cell 1 1 3 1");

    chkExcludeSeriesWithNoEvents = new JCheckBox("<html>Exclude series/segments with no events");
    chkExcludeSeriesWithNoEvents.setEnabled(false);
    new CheckBoxWrapper(chkExcludeSeriesWithNoEvents, PrefKey.SSIZ_CHK_EXCLUDE_SERIES_WITH_NO_EVENTS, false);
    panelAnalysisOptions.add(chkExcludeSeriesWithNoEvents, "cell 1 2 3 1");

    JLabel lblThresholdType = new JLabel("Threshold:");
    panelAnalysisOptions.add(lblThresholdType, "cell 0 3");

    cboThresholdType = new JComboBox();
    panelAnalysisOptions.add(cboThresholdType, "cell 1 3");
    cboThresholdType.setModel(new DefaultComboBoxModel(FireFilterType.values()));
    new FireFilterTypeWrapper(cboThresholdType, PrefKey.COMPOSITE_FILTER_TYPE_WITH_ALL_TREES,
            FireFilterType.NUMBER_OF_EVENTS);

    JLabel label = new JLabel(">=");
    panelAnalysisOptions.add(label, "flowx,cell 2 3");

    spnThresholdValueGT = new JSpinner();
    panelAnalysisOptions.add(spnThresholdValueGT, "cell 3 3");
    spnThresholdValueGT.setModel(new SpinnerNumberModel(1, 1, 999, 1));
    new SpinnerWrapper(spnThresholdValueGT, PrefKey.COMPOSITE_FILTER_VALUE, 1);

    chkEnableLessThan = new JCheckBox("");
    chkEnableLessThan.setActionCommand("LessThanThresholdStatus");
    chkEnableLessThan.addActionListener(this);
    panelAnalysisOptions.add(chkEnableLessThan, "flowx,cell 1 4,alignx right");

    lblLessThan = new JLabel("<=");
    lblLessThan.setEnabled(false);
    panelAnalysisOptions.add(lblLessThan, "cell 2 4");

    spnThresholdValueLT = new JSpinner();
    spnThresholdValueLT.setEnabled(false);
    spnThresholdValueLT.setModel(new SpinnerNumberModel(1, 1, 999, 1));
    panelAnalysisOptions.add(spnThresholdValueLT, "cell 3 4");

    lblAnd = new JLabel("and");
    panelAnalysisOptions.add(lblAnd, "cell 1 4");

    JPanel panelSimulations = new JPanel();
    panelSimulations.setBorder(
            new TitledBorder(null, "Simulations", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelParameters.add(panelSimulations, "cell 0 2,grow");
    panelSimulations.setLayout(new MigLayout("", "[100px:100px:180px,right][fill]", "[][][]"));

    JLabel lblSimulations = new JLabel("Simulations:");
    panelSimulations.add(lblSimulations, "cell 0 0");

    spnSimulations = new JSpinner();
    panelSimulations.add(spnSimulations, "cell 1 0");
    spnSimulations.setModel(new SpinnerNumberModel(new Integer(1000), new Integer(1), null, new Integer(1)));
    new SpinnerWrapper(spnSimulations, PrefKey.SSIZ_SIMULATION_COUNT, 1000);

    JLabel lblSeedNumber = new JLabel("Seed number:");
    panelSimulations.add(lblSeedNumber, "cell 0 1");

    spnSeed = new JSpinner();
    panelSimulations.add(spnSeed, "cell 1 1");
    spnSeed.setModel(new SpinnerNumberModel(new Integer(30188), null, null, new Integer(1)));
    new SpinnerWrapper(spnSeed, PrefKey.SSIZ_SEED_NUMBER, 30188);

    JLabel lblResampling = new JLabel("Resampling:");
    panelSimulations.add(lblResampling, "cell 0 2");

    cboResampling = new JComboBox();
    panelSimulations.add(cboResampling, "cell 1 2");
    cboResampling
            .setModel(new DefaultComboBoxModel(new String[] { "With replacement", "Without replacement" }));
    new ResamplingTypeWrapper(cboResampling, PrefKey.SSIZ_RESAMPLING_TYPE, ResamplingType.WITH_REPLACEMENT);

    segmentationPanel = new SegmentationPanel();
    segmentationPanel.chkSegmentation.setText("Process subset or segments of dataset?");
    segmentationPanel.chkSegmentation.setEnabled(false);
    panelParameters.add(segmentationPanel, "cell 0 3,growx");

    JPanel panel_3 = new JPanel();
    panelParameters.add(panel_3, "cell 0 4,grow");
    panel_3.setLayout(new MigLayout("", "[left][grow][right]", "[]"));

    JButton btnReset = new JButton("Reset");
    btnReset.setActionCommand("Reset");
    btnReset.addActionListener(this);
    panel_3.add(btnReset, "cell 0 0,grow");

    JButton btnRunAnalysis = new JButton("Run Analysis");
    btnRunAnalysis.setAction(actionRun);
    panel_3.add(btnRunAnalysis, "cell 2 0,grow");

    JPanel panelResults = new JPanel();
    splitPaneMain.setRightComponent(panelResults);
    panelResults.setLayout(new BorderLayout(0, 0));

    splitPaneResults = new JSplitPane();
    splitPaneResults.setResizeWeight(0.5);
    splitPaneResults.setOneTouchExpandable(true);
    splitPaneResults.setDividerLocation(0.5d);
    panelResults.add(splitPaneResults, BorderLayout.CENTER);
    splitPaneResults.setOrientation(JSplitPane.VERTICAL_SPLIT);

    JPanel panelResultsTop = new JPanel();
    splitPaneResults.setLeftComponent(panelResultsTop);
    panelResultsTop.setLayout(new BorderLayout(0, 0));

    JPanel panelChartOptions = new JPanel();
    panelChartOptions.setBackground(Color.WHITE);
    panelResultsTop.add(panelChartOptions, BorderLayout.SOUTH);
    panelChartOptions.setLayout(new MigLayout("", "[][][][][][grow][grow]", "[15px,center]"));

    JLabel lblNewLabel = new JLabel("Plot:");
    panelChartOptions.add(lblNewLabel, "cell 0 0,alignx trailing,aligny center");

    cboChartMetric = new JComboBox();
    cboChartMetric.setEnabled(false);
    cboChartMetric.setModel(new DefaultComboBoxModel(MiddleMetric.values()));
    panelChartOptions.add(cboChartMetric, "cell 1 0,growx");
    cboChartMetric.setBackground(Color.WHITE);

    JLabel lblOfSegment = new JLabel("of segment:");
    panelChartOptions.add(lblOfSegment, "cell 2 0,alignx trailing");

    cboSegment = new JComboBox();
    cboSegment.setBackground(Color.WHITE);
    cboSegment.setActionCommand("UpdateChart");
    cboSegment.addActionListener(this);

    panelChartOptions.add(cboSegment, "cell 3 0,growx");
    cboChartMetric.setActionCommand("UpdateChart");

    JLabel lblWithAsymptoteType = new JLabel("with asymptote type:");
    panelChartOptions.add(lblWithAsymptoteType, "cell 4 0,alignx trailing");

    JComboBox comboBox = new JComboBox();
    comboBox.setEnabled(false);
    comboBox.setModel(new DefaultComboBoxModel(new String[] { "none", "Weibull", "Michaelis-Menten",
            "Modified Michaelis-Menten", "Logistic", "Modified exponential" }));
    comboBox.setBackground(Color.WHITE);
    panelChartOptions.add(comboBox, "cell 5 0,growx");
    cboChartMetric.addActionListener(this);

    panelChart = new JPanel();
    panelChart.setMinimumSize(new Dimension(200, 200));
    panelResultsTop.add(panelChart, BorderLayout.CENTER);
    panelChart.setLayout(new BorderLayout(0, 0));
    panelChart.setBackground(Color.WHITE);

    JTabbedPane panelResultsBottom = new JTabbedPane(JTabbedPane.BOTTOM);
    splitPaneResults.setRightComponent(panelResultsBottom);

    simulationsTable = new SSIZResultsTable();
    simulationsTable.setEnabled(false);
    simulationsTable.addMouseListener(new TablePopClickListener());
    simulationsTable.setVisibleRowCount(10);

    adapter = new JTableSpreadsheetByRowAdapter(simulationsTable);

    scrollPaneSimulations = new JScrollPane();
    panelResultsBottom.addTab("Simulations", null, scrollPaneSimulations, null);
    scrollPaneSimulations.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPaneSimulations.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPaneSimulations.setViewportView(simulationsTable);

    JPanel panelAsymptote = new JPanel();

    asymptoteTable = new AsymptoteTable();
    asymptoteTable.setEnabled(false);
    // asymptoteTable.addMouseListener(new TablePopClickListener());
    asymptoteTable.setVisibleRowCount(10);

    scrollPaneAsymptote = new JScrollPane();

    scrollPaneAsymptote.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPaneAsymptote.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPaneAsymptote.setViewportView(asymptoteTable);
    panelAsymptote.setLayout(new BorderLayout());
    panelAsymptote.add(scrollPaneAsymptote, BorderLayout.CENTER);
    panelResultsBottom.addTab("Asymptote", null, panelAsymptote, null);

    // Disable asymptote tab until it is implemented
    panelResultsBottom.setEnabledAt(1, false);

    panelProgressBar = new JPanel();
    panelProgressBar.setLayout(new BorderLayout());

    btnCancelAnalysis = new JButton("Cancel");
    btnCancelAnalysis.setIcon(Builder.getImageIcon("delete.png"));
    btnCancelAnalysis.setVisible(false);
    btnCancelAnalysis.setActionCommand("CancelAnalysis");
    btnCancelAnalysis.addActionListener(this);

    progressBar = new JProgressBar();
    panelProgressBar.add(progressBar, BorderLayout.CENTER);
    panelProgressBar.add(btnCancelAnalysis, BorderLayout.EAST);
    progressBar.setStringPainted(true);

    fileDialogWasUsed = false;
    mouseListenersActive = false;

    this.setGUIForFHFileReader();
    this.setGUIForThresholdStatus();

    pack();
    this.setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH);
    setVisible(true);
}

From source file:com.isencia.passerelle.hmi.HMIBase.java

public JToolBar createDefaultToolbar() {
    final JToolBar toolBar = new JToolBar();

    if (modelExecutor == null) {
        modelExecutor = new ModelExecutor(this);
    }/*from   w w  w.ja  v a2 s .c o m*/
    if (modelStopper == null) {
        modelStopper = new ModelStopper(this);
    }
    if (modelDebugger == null) {
        modelDebugger = new ModelDebugger(this);
    }
    if (modelDebugStepper == null) {
        modelDebugStepper = new ModelDebugStepper(this);
    }
    if (modelSuspender == null) {
        modelSuspender = new ModelSuspender(this);
    }
    if (modelResumer == null) {
        modelResumer = new ModelResumer(this);
    }
    if (saveAction == null) {
        saveAction = new SaveAction(this);
    }
    // DBA : add tooltip for each button
    createToolbarButton(modelExecutor, toolBar, HMIMessages.getString(HMIMessages.MENU_EXECUTE));
    createToolbarButton(modelSuspender, toolBar, HMIMessages.getString(HMIMessages.MENU_SUSPEND));
    createToolbarButton(modelResumer, toolBar, HMIMessages.getString(HMIMessages.MENU_RESUME));
    createToolbarButton(modelStopper, toolBar, HMIMessages.getString(HMIMessages.MENU_STOP));
    toolBar.addSeparator();
    createToolbarButton(modelDebugger, toolBar, HMIMessages.getString(HMIMessages.MENU_DEBUG));
    createToolbarButton(modelDebugStepper, toolBar, HMIMessages.getString(HMIMessages.MENU_DEBUG_STEP));
    toolBar.addSeparator();
    toolBar.addSeparator();
    createToolbarButton(saveAction, toolBar, HMIMessages.getString(HMIMessages.MENU_SAVE));

    StateMachine.getInstance().registerActionForState(StateMachine.MODEL_OPEN, HMIMessages.MENU_EXECUTE,
            modelExecutor);
    StateMachine.getInstance().registerActionForState(StateMachine.MODEL_OPEN, HMIMessages.MENU_DEBUG,
            modelDebugger);
    StateMachine.getInstance().registerActionForState(StateMachine.MODEL_DEBUGGING, HMIMessages.MENU_DEBUG_STEP,
            modelDebugStepper);
    StateMachine.getInstance().registerActionForState(StateMachine.MODEL_DEBUGGING, HMIMessages.MENU_STOP,
            modelStopper);
    StateMachine.getInstance().registerActionForState(StateMachine.MODEL_EXECUTING, HMIMessages.MENU_STOP,
            modelStopper);
    StateMachine.getInstance().registerActionForState(StateMachine.MODEL_EXECUTING_SUSPENDED,
            HMIMessages.MENU_STOP, modelStopper);
    StateMachine.getInstance().registerActionForState(StateMachine.MODEL_EXECUTING, HMIMessages.MENU_SUSPEND,
            modelSuspender);
    StateMachine.getInstance().registerActionForState(StateMachine.MODEL_EXECUTING_SUSPENDED,
            HMIMessages.MENU_RESUME, modelResumer);
    StateMachine.getInstance().registerActionForState(StateMachine.MODEL_DEBUGGING, HMIMessages.MENU_RESUME,
            modelResumer);

    StateMachine.getInstance().compile();
    StateMachine.getInstance().transitionTo(StateMachine.READY);

    return toolBar;
}

From source file:com.emental.mindraider.ui.outline.OutlineJPanel.java

private JToolBar createToolbar() {
    JToolBar toolbar = new JToolBar();
    newButton = new JButton("", IconsRegistry.getImageIcon("add.png"));
    newButton.setToolTipText(Messages.getString("NotebookOutlineJPanel.newConcept"));
    newButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            newConcept();/*from   ww w .jav  a 2s  .c o  m*/
        }
    });
    toolbar.add(newButton);

    attachButton = new JButton("", IconsRegistry.getImageIcon("attach.png"));
    attachButton.setToolTipText(Messages.getString("NotebookOutlineJPanel.attachDragDropResourceToConcept"));
    attachButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            conceptAttach();
        }
    });
    toolbar.add(attachButton);

    discardButton = new JButton("", IconsRegistry.getImageIcon("explorerDiscardSmall.png"));
    discardButton.setToolTipText(Messages.getString("NotebookOutlineJPanel.discardConcept"));
    discardButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            conceptDiscard();
        }
    });
    toolbar.add(discardButton);

    toolbar.addSeparator();

    promoteButton = new JButton("", IconsRegistry.getImageIcon("back.png"));
    promoteButton.setToolTipText(Messages.getString("NotebookOutlineJPanel.promoteConceptToParentLevel"));
    promoteButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            conceptPromote();
        }
    });
    toolbar.add(promoteButton);
    firstButton = new JButton("", IconsRegistry.getImageIcon("upup.png"));
    firstButton.setToolTipText(Messages.getString("NotebookOutlineJPanel.moveConceptFirst"));
    firstButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            while (conceptUp())
                ;
        }
    });
    toolbar.add(firstButton);
    upButton = new JButton("", IconsRegistry.getImageIcon("up.png"));
    upButton.setToolTipText(Messages.getString("NotebookOutlineJPanel.moveConceptUp"));
    upButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            conceptUp();
        }
    });
    toolbar.add(upButton);
    downButton = new JButton("", IconsRegistry.getImageIcon("down.png"));
    downButton.setToolTipText(Messages.getString("NotebookOutlineJPanel.moveConceptDown"));
    downButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            conceptDown();
        }
    });
    toolbar.add(downButton);
    lastButton = new JButton("", IconsRegistry.getImageIcon("downdown.png"));
    lastButton.setToolTipText(Messages.getString("NotebookOutlineJPanel.moveConceptLast"));
    lastButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            while (conceptDown())
                ;
        }
    });
    toolbar.add(lastButton);
    demoteButton = new JButton("", IconsRegistry.getImageIcon("forward.png"));
    demoteButton.setToolTipText(Messages.getString("NotebookOutlineJPanel.demoteConceptToChildrenLevel"));
    demoteButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            conceptDemote();
        }
    });
    toolbar.add(demoteButton);

    toolbar.addSeparator();

    refactorButton = new JButton("", IconsRegistry.getImageIcon("refactorConcept.png"));
    refactorButton
            .setToolTipText(Messages.getString("NotebookOutlineJPanel.refactorConceptsToAnotherNotebook"));
    refactorButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            /*
             * in this case refactoring means: o discard of the concept in
             * this notebook o creation of the concept in the target
             * notebook concept is not deleted because URN should be never
             * deleted. this feature will be important for example for
             * vodyanoi.
             */
            conceptRefactor();
            treeTable.tree.updateUI();
        }
    });
    toolbar.add(refactorButton);

    refreshButton = new JButton("", IconsRegistry.getImageIcon("explorerReloadSmall.png"));
    refreshButton.setToolTipText(Messages.getString("NotebookOutlineJPanel.reloadNotebook"));
    refreshButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            refresh();
        }
    });
    toolbar.add(refreshButton);

    toolbar.addSeparator();

    expandTreeButton = new JButton("", IconsRegistry.getImageIcon("expandTree.png"));
    expandTreeButton.setToolTipText("Expand Concept tree");
    expandTreeButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            expandAllTreeTableRows();
        }
    });
    toolbar.add(expandTreeButton);

    collapseTreeButton = new JButton("", IconsRegistry.getImageIcon("collapseTree.png"));
    collapseTreeButton.setToolTipText("Collapse Concept tree");
    collapseTreeButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            collapseAllTreeTableRows();
        }
    });
    toolbar.add(collapseTreeButton);

    toolbar.addSeparator();

    // Gnowsis: link
    gnowsisLinkButton = new JButton("", IconsRegistry.getImageIcon("gnowsisLink.png"));
    gnowsisLinkButton.setToolTipText("Send Concept to Gnowsis to be linked");
    gnowsisLinkButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (MindRaider.profile.getActiveOutline() == null) {
                JOptionPane.showMessageDialog(OutlineJPanel.this,
                        "To send URI to Gnowsis a notebook must be loaded!", "Gnowsis Error",
                        JOptionPane.ERROR_MESSAGE);
                return;
            }
            // determine selected resource URI
            DefaultMutableTreeNode node = getSelectedTreeNode();
            if (node != null) {
                String uri = ((OutlineNode) node).getUri();
                logger.debug("Gnowsis hub: sending URI: '" + uri + "'");
                GnowsisClient.linkResource(uri);
            } else {
                logger.debug("No node selected!");
            }
        }
    });
    if (MindRaider.profile.isEnableGnowsisSupport()) {
        toolbar.add(gnowsisLinkButton);
    }

    // Gnowsis: browse
    gnowsisBrowseButton = new JButton("", IconsRegistry.getImageIcon("gnowsisBrowse.png"));
    gnowsisBrowseButton.setToolTipText("Browse Concept in Gnowsis");
    gnowsisBrowseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (MindRaider.profile.getActiveOutline() == null) {
                JOptionPane.showMessageDialog(OutlineJPanel.this,
                        "To browse URI in Gnowsis a notebook must be loaded!", "Gnowsis Error",
                        JOptionPane.ERROR_MESSAGE);
                return;
            }
            // determine selected resource URI
            DefaultMutableTreeNode node = getSelectedTreeNode();
            if (node != null) {
                String uri = ((OutlineNode) node).getUri();
                logger.debug("Gnowsis hub: sending browse URI: '" + uri + "'");
                GnowsisClient.browseResource(uri);
            } else {
                logger.debug("No node selected!");
            }
        }
    });
    if (MindRaider.profile.isEnableGnowsisSupport()) {
        toolbar.add(gnowsisBrowseButton);

        toolbar.addSeparator();
    }

    //        JButton button = new JButton("", IconsRegistry.getImageIcon("collapseTree.png"));
    //        button.setToolTipText("Hide/Show annotation column");
    //        button.addActionListener(new ActionListener() {
    //            public void actionPerformed(ActionEvent e) {
    //                hideTreeTableAnnotationColumn();
    //            }
    //        });
    //        mainPanelControls.add(button);
    //        mainPanelControls.addSeparator();

    onTheFlyTWikiExportButton = new JButton("", IconsRegistry.getImageIcon("mozillaTwiki.png"));
    onTheFlyTWikiExportButton.setToolTipText("'On the fly' TWiki Export 2 HTML");
    onTheFlyTWikiExportButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (MindRaider.profile.getActiveOutline() == null) {
                JOptionPane.showMessageDialog(OutlineJPanel.this, "To export a notebook it must be loaded!",
                        "Export Error", JOptionPane.ERROR_MESSAGE);
                return;
            }

            // prepare directory
            String exportDirectory = MindRaider.profile.getHomeDirectory() + File.separator + "export"
                    + File.separator + "twiki" + File.separator + "tmp";
            Utils.createDirectory(exportDirectory);
            String dstFileName = exportDirectory + File.separator + "TWIKI-EXPORT-"
                    + MindRaider.outlineCustodian.getActiveNotebookNcName() + ".html";
            logger.debug("Exporting to file: " + dstFileName);
            MindRaider.outlineCustodian.exportOutline(OutlineCustodian.FORMAT_TWIKI_HTML, dstFileName);
            Launcher.launchInBrowser(dstFileName);
        }
    });
    // TODO removed mainPanelControls.add(onTheFlyTWikiExportButton);

    twikiExportJButton = new JButton("", IconsRegistry.getImageIcon("twikiExport.png"));
    twikiExportJButton.setToolTipText("Export back to the imported TWiki file");
    twikiExportJButton.setEnabled(false);
    twikiExportJButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (MindRaider.profile.getActiveOutline() == null) {
                JOptionPane.showMessageDialog(OutlineJPanel.this, "To export a notebook it must be loaded!",
                        "Export Error", JOptionPane.ERROR_MESSAGE);
                return;
            }
            // take the path from the notebook custodian
            String dstFileName;
            OutlineResource notebookResource = MindRaider.outlineCustodian.getActiveOutlineResource();
            if (notebookResource != null && notebookResource.getSourceTWikiFileProperty() != null) {
                dstFileName = notebookResource.getSourceTWikiFileProperty().getPath();
                StatusBar.show("Exporting Notebook to TWiki file: '" + dstFileName + "'...");
                MindRaider.outlineCustodian.exportOutline(OutlineCustodian.FORMAT_TWIKI, dstFileName);
            }
        }
    });
    toolbar.add(twikiExportJButton);

    // TODO removed mainPanelControls.addSeparator();

    onTheFlyExportButton = new JButton("", IconsRegistry.getImageIcon("mozilla.png"));
    onTheFlyExportButton.setToolTipText("'On the fly' OPML Export 2 HTML");
    onTheFlyExportButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (MindRaider.profile.getActiveOutline() == null) {
                JOptionPane.showMessageDialog(OutlineJPanel.this, "To export a notebook it must be loaded!",
                        "Export Error", JOptionPane.ERROR_MESSAGE);
                return;
            }

            // prepare directory
            String exportDirectory = MindRaider.profile.getHomeDirectory() + File.separator + "export"
                    + File.separator + "opml" + File.separator + "tmp";
            Utils.createDirectory(exportDirectory);
            String dstFileName = exportDirectory + File.separator + "OPML-EXPORT-"
                    + MindRaider.outlineCustodian.getActiveNotebookNcName() + ".html";
            logger.debug("Exporting to file: " + dstFileName);
            MindRaider.outlineCustodian.exportOutline(OutlineCustodian.FORMAT_OPML_HTML, dstFileName);
            Launcher.launchInBrowser(dstFileName);

        }
    });
    // TODO removed mainPanelControls.add(onTheFlyExportButton);

    toolbar.addSeparator();

    mindForgerUploadJButton = new JButton("", IconsRegistry.getImageIcon("tasks-internet.png"));
    mindForgerUploadJButton.setToolTipText("Upload this Outline to Online Edition");
    mindForgerUploadJButton.setEnabled(false);
    mindForgerUploadJButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (MindRaider.profile.getActiveOutline() == null) {
                JOptionPane.showMessageDialog(OutlineJPanel.this, "To upload an Outline it must be loaded!",
                        "Upload Error", JOptionPane.ERROR_MESSAGE);
                return;
            }
            // take the path from the notebook custodian
            MindRaiderMainWindow.getInstance().handleMindForgerActiveOutlineUpload();
        }
    });
    toolbar.add(mindForgerUploadJButton);

    return toolbar;
}

From source file:com._17od.upm.gui.MainWindow.java

private JToolBar createToolBar() {

    JToolBar toolbar = new JToolBar();
    toolbar.setFloatable(false);//from   w w  w.  java 2 s . c  o m
    toolbar.setRollover(true);

    // The "Add Account" button
    addAccountButton = new JButton();
    addAccountButton.setToolTipText(Translator.translate(ADD_ACCOUNT_TXT));
    addAccountButton.setIcon(Util.loadImage("add_account.gif"));
    addAccountButton.setDisabledIcon(Util.loadImage("add_account_d.gif"));
    ;
    addAccountButton.addActionListener(this);
    addAccountButton.setEnabled(false);
    addAccountButton.setActionCommand(ADD_ACCOUNT_TXT);
    toolbar.add(addAccountButton);

    // The "Edit Account" button
    editAccountButton = new JButton();
    editAccountButton.setToolTipText(Translator.translate(EDIT_ACCOUNT_TXT));
    editAccountButton.setIcon(Util.loadImage("edit_account.gif"));
    editAccountButton.setDisabledIcon(Util.loadImage("edit_account_d.gif"));
    ;
    editAccountButton.addActionListener(this);
    editAccountButton.setEnabled(false);
    editAccountButton.setActionCommand(EDIT_ACCOUNT_TXT);
    toolbar.add(editAccountButton);

    // The "Delete Account" button
    deleteAccountButton = new JButton();
    deleteAccountButton.setToolTipText(Translator.translate(DELETE_ACCOUNT_TXT));
    deleteAccountButton.setIcon(Util.loadImage("delete_account.gif"));
    deleteAccountButton.setDisabledIcon(Util.loadImage("delete_account_d.gif"));
    ;
    deleteAccountButton.addActionListener(this);
    deleteAccountButton.setEnabled(false);
    deleteAccountButton.setActionCommand(DELETE_ACCOUNT_TXT);
    toolbar.add(deleteAccountButton);

    toolbar.addSeparator();

    // The "Copy Username" button
    copyUsernameButton = new JButton();
    copyUsernameButton.setToolTipText(Translator.translate(COPY_USERNAME_TXT));
    copyUsernameButton.setIcon(Util.loadImage("copy_username.gif"));
    copyUsernameButton.setDisabledIcon(Util.loadImage("copy_username_d.gif"));
    ;
    copyUsernameButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            copyUsernameToClipboard();
        }
    });
    copyUsernameButton.setEnabled(false);
    toolbar.add(copyUsernameButton);

    // The "Copy Password" button
    copyPasswordButton = new JButton();
    copyPasswordButton.setToolTipText(Translator.translate(COPY_PASSWORD_TXT));
    copyPasswordButton.setIcon(Util.loadImage("copy_password.gif"));
    copyPasswordButton.setDisabledIcon(Util.loadImage("copy_password_d.gif"));
    ;
    copyPasswordButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            copyPasswordToClipboard();
        }
    });
    copyPasswordButton.setEnabled(false);
    toolbar.add(copyPasswordButton);

    // The "Launch URL" button
    launchURLButton = new JButton();
    launchURLButton.setToolTipText(Translator.translate(LAUNCH_URL_TXT));
    launchURLButton.setIcon(Util.loadImage("launch_URL.gif"));
    launchURLButton.setDisabledIcon(Util.loadImage("launch_URL_d.gif"));
    ;
    launchURLButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {

            AccountInformation accInfo = dbActions.getSelectedAccount();
            String uRl = accInfo.getUrl();

            // Check if the selected url is null or emty and inform the user
            // via JoptioPane message
            if ((uRl == null) || (uRl.length() == 0)) {
                JOptionPane.showMessageDialog(launchURLButton.getParent(),
                        Translator.translate("EmptyUrlJoptionpaneMsg"),
                        Translator.translate("UrlErrorJoptionpaneTitle"), JOptionPane.WARNING_MESSAGE);

                // Check if the selected url is a valid formated url(via
                // urlIsValid() method) and inform the user via JoptioPane
                // message
            } else if (!(urlIsValid(uRl))) {
                JOptionPane.showMessageDialog(launchURLButton.getParent(),
                        Translator.translate("InvalidUrlJoptionpaneMsg"),
                        Translator.translate("UrlErrorJoptionpaneTitle"), JOptionPane.WARNING_MESSAGE);

                // Call the method LaunchSelectedURL() using the selected
                // url as input
            } else {
                LaunchSelectedURL(uRl);

            }
        }
    });
    launchURLButton.setEnabled(false);
    toolbar.add(launchURLButton);

    toolbar.addSeparator();

    // The "Option" button
    optionsButton = new JButton();
    optionsButton.setToolTipText(Translator.translate(OPTIONS_TXT));
    optionsButton.setIcon(Util.loadImage("options.gif"));
    optionsButton.setDisabledIcon(Util.loadImage("options_d.gif"));
    ;
    optionsButton.addActionListener(this);
    optionsButton.setEnabled(true);
    optionsButton.setActionCommand(OPTIONS_TXT);
    toolbar.add(optionsButton);

    toolbar.addSeparator();

    // The Sync database button
    syncDatabaseButton = new JButton();
    syncDatabaseButton.setToolTipText(Translator.translate(SYNC_DATABASE_TXT));
    syncDatabaseButton.setIcon(Util.loadImage("sync.png"));
    syncDatabaseButton.setDisabledIcon(Util.loadImage("sync_d.png"));
    ;
    syncDatabaseButton.addActionListener(this);
    syncDatabaseButton.setEnabled(false);
    syncDatabaseButton.setActionCommand(SYNC_DATABASE_TXT);
    toolbar.add(syncDatabaseButton);

    return toolbar;
}

From source file:com.itemanalysis.jmetrik.gui.Jmetrik.java

private JToolBar createToolBar() {
    String urlString;//from ww w  .j  a va2  s  .c om
    URL url;
    final JToolBar tools = new JToolBar("jMetrik Tool Bar");
    JButton button;

    urlString = "/org/tango-project/tango-icon-theme/16x16/actions/document-new.png";
    url = this.getClass().getResource(urlString);
    ImageIcon iconNew = new ImageIcon(url, "New");
    button = new JButton(new NewTextFileAction("", iconNew));
    tools.add(button);

    urlString = "/org/tango-project/tango-icon-theme/16x16/actions/document-open.png";
    url = this.getClass().getResource(urlString);
    ImageIcon iconOpen = new ImageIcon(url, "Open");
    button = new JButton(new OpenFileAction("", iconOpen));
    tools.add(button);

    urlString = "/org/tango-project/tango-icon-theme/16x16/actions/document-save.png";
    url = this.getClass().getResource(urlString);
    ImageIcon iconSave = new ImageIcon(url, "Save As");
    button = new JButton(new SaveAction("", iconSave));
    tools.add(button);

    urlString = "/org/tango-project/tango-icon-theme/16x16/actions/document-save-as.png";
    url = this.getClass().getResource(urlString);
    ImageIcon iconSaveAs = new ImageIcon(url, "Save As");
    button = new JButton(new SaveAsAction("", iconSaveAs));
    tools.add(button);

    tools.addSeparator();

    urlString = "/org/tango-project/tango-icon-theme/16x16/actions/document-print.png";
    url = this.getClass().getResource(urlString);
    ImageIcon iconPrint = new ImageIcon(url, "Print");
    button = new JButton(new PrintAction("", iconPrint));
    tools.add(button);

    tools.addSeparator();

    //        urlString = "/org/tango-project/tango-icon-theme/16x16/actions/edit-cut.png";
    //        url = this.getClass().getResource( urlString );
    //        ImageIcon iconCut = new ImageIcon(url, "Cut");
    //        button = new JButton(new DefaultEditorKit.CutAction());
    //        button.setText("");
    //        button.setIcon(iconCut);
    //        tools.addArgument(button);
    //
    //        urlString = "/org/tango-project/tango-icon-theme/16x16/actions/edit-copy.png";
    //        url = this.getClass().getResource( urlString );
    //        ImageIcon iconCopy = new ImageIcon(url, "Copy");
    //        button = new JButton(new DefaultEditorKit.CopyAction());
    //        button.setText("");
    //        button.setIcon(iconCopy);
    //        tools.addArgument(button);
    //
    //        urlString = "/org/tango-project/tango-icon-theme/16x16/actions/edit-paste.png";
    //        url = this.getClass().getResource( urlString );
    //        ImageIcon iconPaste = new ImageIcon(url, "Paste");
    //        button = new JButton(new DefaultEditorKit.PasteAction());
    //        button.setIcon(iconPaste);
    //        button.setText("");
    //        tools.addArgument(button);
    //
    //        tools.addSeparator();

    urlString = "/org/tango-project/tango-icon-theme/16x16/actions/edit-undo.png";
    url = this.getClass().getResource(urlString);
    ImageIcon iconUndo = new ImageIcon(url, "Undo");
    button = new JButton(new UndoAction("", iconUndo));
    tools.add(button);

    urlString = "/org/tango-project/tango-icon-theme/16x16/actions/edit-redo.png";
    url = this.getClass().getResource(urlString);
    ImageIcon iconRedo = new ImageIcon(url, "Redo");
    button = new JButton(new RedoAction("", iconRedo));
    tools.add(button);

    tools.addSeparator();

    urlString = "/org/tango-project/tango-icon-theme/16x16/apps/accessories-text-editor.png";
    url = this.getClass().getResource(urlString);
    ImageIcon iconDesc = new ImageIcon(url, "Descriptions");
    button = new JButton("", iconDesc);
    button.setToolTipText("View table descriptions");
    button.addActionListener(new TableDescriptionActionListener());
    tools.add(button);

    tools.addSeparator();

    urlString = "/org/tango-project/tango-icon-theme/16x16/actions/media-playback-start.png";
    url = this.getClass().getResource(urlString);
    ImageIcon iconStart = new ImageIcon(url, "Run Analysis from Syntax");
    button = new JButton(iconStart);
    button.setToolTipText("Run commands");
    button.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JScrollPane pain = (JScrollPane) tabbedPane.getSelectedComponent();
            JViewport vp = pain.getViewport();
            Component c = vp.getComponent(0);
            if (c instanceof JmetrikTextFile) {
                JmetrikTab tempTab = (JmetrikTab) tabbedPane.getTabComponentAt(tabbedPane.getSelectedIndex());
                JmetrikTextFile textFile = (JmetrikTextFile) c;
                workspace.runFromSyntax(textFile.getText());
            }
        }
    });
    tools.add(button);

    urlString = "/org/tango-project/tango-icon-theme/16x16/actions/media-playback-stop.png";
    url = this.getClass().getResource(urlString);
    ImageIcon iconStopThreads = new ImageIcon(url, "Stop Analysis");
    //        button = new JButton(new StopAllThreadsAction("",iconStopThreads));
    button = new JButton(iconStopThreads);
    tools.add(button);

    tools.addSeparator();

    urlString = "/org/tango-project/tango-icon-theme/16x16/apps/utilities-system-monitor.png";
    url = this.getClass().getResource(urlString);
    ImageIcon iconStartMemoryMonitor = new ImageIcon(url, "Start Memory Monitor");
    button = new JButton(iconStartMemoryMonitor);
    button.setToolTipText("View memory allocation");
    button.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            double m = (double) Runtime.getRuntime().maxMemory();
            double f = (double) Runtime.getRuntime().freeMemory();
            double t = (double) Runtime.getRuntime().totalMemory();
            f = f / 1048576.0;
            t = t / 1048576.0;
            m = m / 1048576.0;
            double amem = Precision.round(f / t * 100.0, 2);

            JOptionPane.showMessageDialog(Jmetrik.this,
                    "Total memory available: " + Precision.round(m, 2) + " MB\n" + "Current allocation: "
                            + Precision.round(t, 2) + " MB\n" + "Current amount free: " + Precision.round(f, 2)
                            + " MB (" + amem + "%)",
                    "JVM Memory Available", JOptionPane.INFORMATION_MESSAGE);
        }
    });
    tools.add(button);

    urlString = "/org/tango-project/tango-icon-theme/16x16/status/folder-visiting.png";
    url = this.getClass().getResource(urlString);
    ImageIcon iconCloseAllTabs = new ImageIcon(url, "Close All");
    button = new JButton(new CloseAllTabsAction("", iconCloseAllTabs));
    tools.add(button);

    urlString = "/org/tango-project/tango-icon-theme/16x16/actions/view-refresh.png";
    url = this.getClass().getResource(urlString);
    ImageIcon iconRefreshData = new ImageIcon(url, "Refresh Data View");
    refreshButton = new JButton("", iconRefreshData);
    refreshButton.setEnabled(false);
    tools.add(refreshButton);
    refreshButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            workspace.reloadTable(workspace.getCurrentDataTable());
            refreshButton.setEnabled(false);
            refreshButton.setText("");
        }
    });
    workspace.setRefreshButton(refreshButton);

    return tools;
}

From source file:es.darkhogg.hazelnutt.EditorFrame.java

private void initializeGui() {
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    setBounds(100, 100, 640, 480);/*from w ww. j ava 2s .com*/

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent arg0) {
            actionExit();
        }
    });

    fileChooser = new JFileChooser();
    //fileChooser.setFileFilter( hlfFileFilter );

    hlfFileChooser = new JFileChooser();
    hlfFileChooser.setFileFilter(hlfFileFilter);

    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    JMenu mnFile = new JMenu("File");
    mnFile.setMnemonic('F');
    menuBar.add(mnFile);

    menuLoadRom = new JMenuItem("Load ROM...");
    menuLoadRom.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK));
    menuLoadRom.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionOpenRom(null);
        }
    });
    menuLoadRom.setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_open.png")));
    menuLoadRom.setMnemonic('O');
    mnFile.add(menuLoadRom);

    menuSaveRom = new JMenuItem("Save ROM");
    menuSaveRom.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionSaveRom();
        }
    });
    menuSaveRom.setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_save.png")));
    menuSaveRom.setMnemonic('S');
    menuSaveRom.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK));
    mnFile.add(menuSaveRom);

    menuSaveRomAs = new JMenuItem("Save ROM As...");
    menuSaveRomAs.setMnemonic('a');
    menuSaveRomAs.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_MASK));
    menuSaveRomAs.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionSaveRomAs();
        }
    });
    menuSaveRomAs
            .setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_save_as.png")));
    mnFile.add(menuSaveRomAs);

    mnFile.addSeparator();

    menuLoadLevel = new JMenuItem("Load Level...");
    menuLoadLevel.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0));
    menuLoadLevel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionLoadLevel();
        }
    });
    menuLoadLevel.setIcon(
            new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_load_level.png")));
    menuLoadLevel.setMnemonic('L');
    mnFile.add(menuLoadLevel);

    menuReloadLevel = new JMenuItem("Reload Level");
    menuReloadLevel.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0));
    menuReloadLevel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionReloadLevel();
        }
    });
    menuReloadLevel.setMnemonic('R');
    menuReloadLevel.setIcon(
            new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_reload_level.png")));
    mnFile.add(menuReloadLevel);

    menuSaveLevel = new JMenuItem("Save Level");
    menuSaveLevel.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F7, 0));
    menuSaveLevel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionSaveLevel();
        }
    });
    menuSaveLevel.setIcon(
            new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_save_level.png")));
    menuSaveLevel.setMnemonic('v');

    mnFile.add(menuSaveLevel);

    //*
    mnFile.addSeparator();

    menuImportLevel = new JMenuItem("Import Level...");
    menuImportLevel.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0));
    menuImportLevel.setMnemonic('i');
    menuImportLevel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionImportLevel();
        }
    });
    menuImportLevel
            .setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_import.png")));
    mnFile.add(menuImportLevel);

    menuExportLevel = new JMenuItem("Export Level...");
    menuExportLevel.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0));
    menuExportLevel.setMnemonic('e');
    menuExportLevel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionExportLevel();
        }
    });
    menuExportLevel
            .setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_export.png")));
    mnFile.add(menuExportLevel);
    //*/

    mnFile.addSeparator();

    menuExit = new JMenuItem("Exit");
    menuExit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));
    menuExit.setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_exit.png")));
    menuExit.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            actionExit();
        }
    });

    menuRecentFiles = new JMenu("Recent Files...");
    mnFile.add(menuRecentFiles);

    mnFile.addSeparator();
    menuExit.setMnemonic('X');
    mnFile.add(menuExit);

    JMenu mnEdit = new JMenu("Edit");
    mnEdit.setMnemonic('E');
    menuBar.add(mnEdit);

    menuViewSpawn = new JCheckBoxMenuItem("View Spawn Point");
    menuViewSpawn.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, 0));
    menuViewSpawn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionToggle(false);
        }
    });

    menuClearLevel = new JMenuItem("Clear Level");
    menuClearLevel.setMnemonic('c');
    menuClearLevel.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK));
    menuClearLevel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionClearLevel();
        }
    });
    menuClearLevel.setIcon(
            new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_clear_level.png")));
    mnEdit.add(menuClearLevel);

    mnEdit.addSeparator();

    menuViewSpawn
            .setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_spawn.png")));
    menuViewSpawn.setMnemonic('S');
    menuViewSpawn.setSelected(true);
    mnEdit.add(menuViewSpawn);

    menuViewItems = new JCheckBoxMenuItem("View Items");
    menuViewItems.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, 0));
    menuViewItems.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionToggle(false);
        }
    });
    menuViewItems.setSelected(true);
    menuViewItems
            .setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_items.png")));
    menuViewItems.setMnemonic('I');
    mnEdit.add(menuViewItems);

    menuViewDoorItems = new JCheckBoxMenuItem("View Door Items");
    menuViewDoorItems.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_3, 0));
    menuViewDoorItems.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionToggle(false);
        }
    });
    menuViewDoorItems.setSelected(true);
    menuViewDoorItems.setIcon(
            new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_door_items.png")));
    menuViewDoorItems.setMnemonic('D');
    mnEdit.add(menuViewDoorItems);

    menuViewEnemies = new JCheckBoxMenuItem("View Enemies");
    menuViewEnemies.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_4, 0));
    menuViewEnemies.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionToggle(false);
        }
    });
    menuViewEnemies.setSelected(true);
    menuViewEnemies
            .setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_enemies.png")));
    menuViewEnemies.setMnemonic('E');
    mnEdit.add(menuViewEnemies);

    menuViewTypes = new JCheckBoxMenuItem("View Combo Types");
    menuViewTypes.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_5, 0));
    menuViewTypes.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionToggle(false);
        }
    });
    menuViewTypes.setSelected(true);
    menuViewTypes.setIcon(
            new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_combo_infos.png")));
    menuViewTypes.setMnemonic('C');
    mnEdit.add(menuViewTypes);

    mnEdit.addSeparator();

    scaleMenuItem = new JCheckBoxMenuItem("Scale Level Display");
    scaleMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_6, 0));
    scaleMenuItem.setMnemonic('l');
    scaleMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionScale(false);
        }
    });
    scaleMenuItem.setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_x2.png")));
    mnEdit.add(scaleMenuItem);

    gridMenuItem = new JCheckBoxMenuItem("Display grid");
    gridMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_7, 0));
    gridMenuItem.setMnemonic('G');
    gridMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionGrid(false);
        }
    });
    gridMenuItem.setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_grid.png")));
    mnEdit.add(gridMenuItem);

    //mnEdit.addSeparator();

    mntmPreferences = new JMenuItem("Preferences...");
    mntmPreferences.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionPreferences();
        }
    });
    mntmPreferences.setMnemonic('P');
    mntmPreferences.setIcon(
            new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_preferences.png")));
    //mnEdit.add(mntmPreferences);

    mnHelp = new JMenu("Help");
    mnHelp.setMnemonic('H');
    menuBar.add(mnHelp);

    mntmCheckUpdates = new JMenuItem("Check for Updates...");
    mntmCheckUpdates.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_MASK));
    mntmCheckUpdates.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionCheckUpdates();
        }
    });
    mntmCheckUpdates.setMnemonic('c');
    mntmCheckUpdates
            .setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_update.png")));
    mnHelp.add(mntmCheckUpdates);

    mntmAbout = new JMenuItem("Readme...");
    mntmAbout.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
    mntmAbout.setMnemonic('r');
    mntmAbout.setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/about.png")));
    mntmAbout.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionAbout();
        }
    });
    mnHelp.addSeparator();
    mnHelp.add(mntmAbout);

    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    contentPane.setLayout(new BorderLayout(0, 0));
    setContentPane(contentPane);

    JToolBar toolBar = new JToolBar();
    toolBar.setRollover(true);
    toolBar.setFloatable(false);
    contentPane.add(toolBar, BorderLayout.NORTH);

    barLoadRom = new JButton("");
    barLoadRom.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionOpenRom(null);
        }
    });
    barLoadRom.setToolTipText("Open");
    barLoadRom.setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_open.png")));
    toolBar.add(barLoadRom);

    barSaveRom = new JButton("");
    barSaveRom.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionSaveRom();
        }
    });
    barSaveRom.setToolTipText("Save");
    barSaveRom.setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_save.png")));
    toolBar.add(barSaveRom);

    toolBar.addSeparator();

    barImportLevel = new JButton("");
    barImportLevel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionImportLevel();
        }
    });
    barImportLevel.setToolTipText("Import Level");
    barImportLevel
            .setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_import.png")));
    toolBar.add(barImportLevel);

    barExportLevel = new JButton("");
    barExportLevel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionExportLevel();
        }
    });
    barExportLevel.setToolTipText("Export Level");
    barExportLevel
            .setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_export.png")));
    toolBar.add(barExportLevel);

    toolBar.addSeparator();

    barLoadLevel = new JButton("");
    barLoadLevel.setToolTipText("Load Level");
    barLoadLevel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionLoadLevel();
        }
    });
    barLoadLevel.setIcon(
            new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_load_level.png")));
    toolBar.add(barLoadLevel);

    barReloadLevel = new JButton("");
    barReloadLevel.setToolTipText("Reload Current Level");
    barReloadLevel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionReloadLevel();
        }
    });
    barReloadLevel.setIcon(
            new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_reload_level.png")));
    toolBar.add(barReloadLevel);

    barSaveLevel = new JButton("");
    barSaveLevel.setToolTipText("Save Level");
    barSaveLevel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionSaveLevel();
        }
    });
    barSaveLevel.setIcon(
            new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_save_level.png")));
    toolBar.add(barSaveLevel);

    toolBar.addSeparator();

    barViewItems = new JToggleButton("");
    barViewItems.setToolTipText("Toggle View Items");
    barViewItems.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionToggle(true);
        }
    });

    barViewSpawn = new JToggleButton("");
    barViewSpawn.setToolTipText("Toggle View Spawn");
    barViewSpawn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionToggle(true);
        }
    });

    barClearLevel = new JButton("");
    barClearLevel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionClearLevel();
        }
    });
    barClearLevel.setToolTipText("Clear Level");
    barClearLevel.setIcon(
            new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_clear_level.png")));
    toolBar.add(barClearLevel);

    toolBar.addSeparator();

    barViewSpawn.setSelected(true);
    barViewSpawn.setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_spawn.png")));
    toolBar.add(barViewSpawn);
    barViewItems.setSelected(true);
    barViewItems.setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_items.png")));
    toolBar.add(barViewItems);

    barViewDoorItems = new JToggleButton("");
    barViewDoorItems.setToolTipText("Toggle View Door Items");
    barViewDoorItems.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionToggle(true);
        }
    });
    barViewDoorItems.setSelected(true);
    barViewDoorItems.setIcon(
            new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_door_items.png")));
    toolBar.add(barViewDoorItems);

    barViewEnemies = new JToggleButton("");
    barViewEnemies.setToolTipText("toggle View Enemies");
    barViewEnemies.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionToggle(true);
        }
    });
    barViewEnemies.setSelected(true);
    barViewEnemies
            .setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_enemies.png")));
    toolBar.add(barViewEnemies);

    barViewTypes = new JToggleButton("");
    barViewTypes.setToolTipText("Toggle view Combo Help");
    barViewTypes.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionToggle(true);
        }
    });
    barViewTypes.setSelected(true);
    barViewTypes.setIcon(
            new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_combo_infos.png")));
    toolBar.add(barViewTypes);

    barViewSpawn.setSelected(config.getBoolean("Hazelnutt.gui.viewSpawn", true));
    barViewItems.setSelected(config.getBoolean("Hazelnutt.gui.viewItems", true));
    barViewDoorItems.setSelected(config.getBoolean("Hazelnutt.gui.viewDoorItems", true));
    barViewEnemies.setSelected(config.getBoolean("Hazelnutt.gui.viewEnemies", true));
    barViewTypes.setSelected(config.getBoolean("Hazelnutt.gui.viewHelp", true));

    panel = new JPanel();
    contentPane.add(panel, BorderLayout.EAST);
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

    selectorPanel = new SelectorPanel();
    selectorPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"),
            "Combo & Entity Selector", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 70, 213)));
    panel.add(selectorPanel);

    propertiesPanel = new PropertiesPanel(null);
    propertiesPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Level Properties",
            TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 70, 213)));
    panel.add(propertiesPanel);

    toolBar.addSeparator();

    scaleButton = new JToggleButton("");
    scaleButton.setToolTipText("Toggle Scale Display");
    scaleButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionScale(true);
        }
    });
    scaleButton.setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_x2.png")));
    toolBar.add(scaleButton);

    scaleButton.setSelected(config.getBoolean("Hazelnutt.gui.scaled", false));

    gridButton = new JToggleButton("");
    gridButton.setToolTipText("Display Grid");
    gridButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            actionGrid(true);
        }
    });
    gridButton.setIcon(new ImageIcon(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/icon_grid.png")));
    toolBar.add(gridButton);

    gridButton.setSelected(config.getBoolean("Hazelnutt.gui.grid", false));

    Component horizontalGlue = Box.createHorizontalGlue();
    toolBar.add(horizontalGlue);

    Component verticalGlue = Box.createVerticalGlue();
    panel.add(verticalGlue);

    levelWrapper = new JPanel();
    levelWrapper.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Level",
            TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 70, 213)));
    contentPane.add(levelWrapper, BorderLayout.CENTER);
    levelWrapper.setLayout(new BorderLayout(0, 0));

    scrollPane = new JScrollPane();
    scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0));
    levelWrapper.add(scrollPane);

    levelDisplay = new LevelDisplay();
    levelDisplay.addEditListener(new EditListener() {
        @Override
        public void leftPressed(int x, int y) {
            SelectionType st = selectorPanel.getSelectionType();
            Object so = selectorPanel.getSelectedObject();

            if (st == SelectionType.COMBO) {
                paintComboAt(x, y, ((Byte) so).byteValue());
            } else if (st == SelectionType.SPAWN) {
                selectedLevel.getRomLevel().setSpawn(new IntVector(x, y));

                levelHasChanged = true;
            } else if (st == SelectionType.ITEM) {
                Item ent = new Item((ItemType) so, x, y);
                EntityCollection<Item> ents = selectedLevel.getRomLevel().getItems();
                for (Iterator<Item> it = ents.iterator(); it.hasNext();) {
                    Item item = it.next();
                    if (item.getX() == x && item.getY() == y) {
                        it.remove();
                    }
                }
                if (ents.size() <= ents.maxSize()) {
                    ents.add(ent);
                    levelHasChanged = true;
                }
            } else if (st == SelectionType.DOOR_ITEM) {
                Item ent = new Item((ItemType) so, x, y);
                EntityCollection<Item> ents = selectedLevel.getRomLevel().getDoorItems();
                for (Iterator<Item> it = ents.iterator(); it.hasNext();) {
                    Item item = it.next();
                    if (item.getX() == x && item.getY() == y) {
                        it.remove();
                    }
                }
                if (ents.size() <= ents.maxSize()) {
                    ents.add(ent);
                    levelHasChanged = true;
                }
            } else if (st == SelectionType.ENEMY) {
                Enemy ent = new Enemy((EnemyType) so, x, y);
                EntityCollection<Enemy> ents = selectedLevel.getRomLevel().getEnemies();
                for (Iterator<Enemy> it = ents.iterator(); it.hasNext();) {
                    Enemy enem = it.next();
                    if (enem.getX() == x && enem.getY() == y) {
                        it.remove();
                    }
                }
                if (ents.size() <= ents.maxSize()) {
                    ents.add(ent);
                    levelHasChanged = true;
                }
            }

            updateTitle();
            levelDisplay.repaint();
            levelHasChanged = true;
        }

        @Override
        public void centerPressed(int x, int y) {
            selectorPanel.forceComboSelection(selectedLevel.getRomLevel().getData()[x][y]);
        }

        @Override
        public void rightPressed(int x, int y) {
            deleteVisibleEntitiesAt(x, y);
        }

        @Override
        public void leftDragged(int x, int y) {
            if (selectorPanel.getSelectionType() == SelectionType.COMBO) {
                paintComboAt(x, y, ((Byte) selectorPanel.getSelectedObject()).byteValue());
            }
        }

        @Override
        public void centerDragged(int x, int y) {
            // Nothing to de here
        }

        @Override
        public void rightDragged(int x, int y) {
            deleteVisibleEntitiesAt(x, y);
        }

        // Utility methods
        /*private void selectComboAt ( int x, int y ) {
                   
        }/**/
        private void paintComboAt(int x, int y, byte value) {
            selectedLevel.getRomLevel().getData()[x][y] = value;
            levelHasChanged = true;

            updateTitle();
            levelDisplay.repaint();
        }

        private void deleteVisibleEntitiesAt(int x, int y) {
            Collection<Item> items = selectedLevel.getRomLevel().getItems();
            Collection<Item> doorItems = selectedLevel.getRomLevel().getDoorItems();
            Collection<Enemy> enemies = selectedLevel.getRomLevel().getEnemies();

            if (barViewItems.isSelected()) {
                for (Iterator<Item> it = items.iterator(); it.hasNext();) {
                    Item item = it.next();
                    if (item.getX() == x && item.getY() == y) {
                        it.remove();
                        levelHasChanged = true;
                    }
                }
            }

            if (barViewDoorItems.isSelected()) {
                for (Iterator<Item> it = doorItems.iterator(); it.hasNext();) {
                    Item doorItem = it.next();
                    if (doorItem.getX() == x && doorItem.getY() == y) {
                        it.remove();
                        levelHasChanged = true;
                    }
                }
            }

            if (barViewEnemies.isSelected()) {
                for (Iterator<Enemy> it = enemies.iterator(); it.hasNext();) {
                    Enemy enem = it.next();
                    if (enem.getX() == x && enem.getY() == y) {
                        it.remove();
                        levelHasChanged = true;
                    }
                }
            }

            updateTitle();
            levelDisplay.repaint();
        }
    });
    scrollPane.setViewportView(levelDisplay);

    updateTitle();
    actionToggle(true);
    actionScale(true);
    actionGrid(true);
    setIconImage(Toolkit.getDefaultToolkit()
            .getImage(EditorFrame.class.getResource("/es/darkhogg/hazelnutt/witch_hazel_big.png")));
    setRomFeaturesEnabled(false);
    setLevelFeaturesEnabled(false);

    if (config.getBoolean("Hazelnutt.gui.maximum", false)) {
        setExtendedState(getExtendedState() | JFrame.MAXIMIZED_BOTH);
    } else {
        int x = config.getInt("Hazelnutt.gui.location.x", Integer.MIN_VALUE);
        int y = config.getInt("Hazelnutt.gui.location.y", Integer.MIN_VALUE);
        int w = config.getInt("Hazelnutt.gui.size.width", Integer.MIN_VALUE);
        int h = config.getInt("Hazelnutt.gui.size.height", Integer.MIN_VALUE);

        if (x == Integer.MIN_VALUE || x == Integer.MIN_VALUE || w == Integer.MIN_VALUE
                || h == Integer.MIN_VALUE) {
            setLocationRelativeTo(null);
        } else {
            setLocation(x, y);
            setSize(w, h);
        }
    }

    propertiesPanel.addApplyListener(new PropertiesPanel.ApplyListener() {
        @Override
        public void apply() {
            levelHasChanged = true;
            updateTitle();
            updateDisplay();
        }
    });

    if (config.containsKey("Hazelnutt.gui.lastDirectory")) {
        File lastDir = new File(config.getString("Hazelnutt.gui.lastDirectory"));
        if (lastDir.exists() && lastDir.isDirectory()) {
            //logger.debug( "Resetting the last directory: '" + lastDir + "'" );
            fileChooser.setCurrentDirectory(lastDir);
        }
    }

    // Configure the PgUp and PgDn shortcuts
    InputMap im = contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    im.put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0), "PgUp");
    im.put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0), "PgDn");
    ActionMap am = contentPane.getActionMap();
    am.put("PgUp", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            actionLevelUp();
        }
    });
    am.put("PgDn", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            actionLevelDown();
        }
    });

    // Get the recent files
    recentFiles = new LinkedList<String>(Arrays.asList(config.getStringArray("Hazelnutt.gui.recentFiles")));
    updateRecentFiles();

}

From source file:com.diversityarrays.kdxplore.curate.TrialDataEditor.java

@Override
public JToolBar getJToolBar() {

    if (toolBar == null) {

        JToolBar tbar = new JToolBar("Curation Toolbar");
        tbar.add(makeToolbarButton(saveChangesAction));
        tbar.add(makeToolbarButton(exportCuratedData));

        tbar.addSeparator();

        tbar.add(makeToolbarButton(undoAction));
        tbar.add(makeToolbarButton(redoAction));

        tbar.addSeparator();/* w w w .  ja va2s. c o m*/

        for (JButton button : createVisualisationButtons()) {
            button.setText(null);
            tbar.add(button);
        }

        tbar.addSeparator();

        tbar.add(showFieldViewButton);

        tbar.add(Box.createGlue());
        toolBar = tbar;
    }

    return toolBar;
}

From source file:net.sf.jabref.gui.entryeditor.EntryEditor.java

private void setupToolBar() {
    JPanel leftPan = new JPanel();
    leftPan.setLayout(new BorderLayout());
    JToolBar toolBar = new OSXCompatibleToolbar(SwingConstants.VERTICAL);

    toolBar.setBorder(null);//from w w  w .  j  a  v a  2 s  .  c om
    toolBar.setRollover(true);

    toolBar.setMargin(new Insets(0, 0, 0, 2));

    // The toolbar carries all the key bindings that are valid for the whole
    // window.
    ActionMap actionMap = toolBar.getActionMap();
    InputMap inputMap = toolBar.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);

    inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_ENTRY_EDITOR), "close");
    actionMap.put("close", closeAction);
    inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.ENTRY_EDITOR_STORE_FIELD), "store");
    actionMap.put("store", getStoreFieldAction());
    inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.AUTOGENERATE_BIBTEX_KEYS), "generateKey");
    actionMap.put("generateKey", getGenerateKeyAction());
    inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.AUTOMATICALLY_LINK_FILES), "autoLink");
    actionMap.put("autoLink", autoLinkAction);
    inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.ENTRY_EDITOR_PREVIOUS_ENTRY), "prev");
    actionMap.put("prev", getPrevEntryAction());
    inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.ENTRY_EDITOR_NEXT_ENTRY), "next");
    actionMap.put("next", getNextEntryAction());
    inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.UNDO), "undo");
    actionMap.put("undo", undoAction);
    inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.REDO), "redo");
    actionMap.put("redo", redoAction);
    inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.HELP), "help");
    actionMap.put("help", getHelpAction());

    toolBar.setFloatable(false);

    // Add actions (and thus buttons)
    JButton closeBut = new JButton(closeAction);
    closeBut.setText(null);
    closeBut.setBorder(null);
    closeBut.setMargin(new Insets(8, 0, 8, 0));
    leftPan.add(closeBut, BorderLayout.NORTH);

    // Create type-label
    TypedBibEntry typedEntry = new TypedBibEntry(entry, Optional.empty(),
            panel.getBibDatabaseContext().getMode());
    leftPan.add(new TypeLabel(typedEntry.getTypeForDisplay()), BorderLayout.CENTER);
    TypeButton typeButton = new TypeButton();

    toolBar.add(typeButton);
    toolBar.add(getGenerateKeyAction());
    toolBar.add(autoLinkAction);

    toolBar.add(writeXmp);

    toolBar.addSeparator();

    toolBar.add(deleteAction);
    toolBar.add(getPrevEntryAction());
    toolBar.add(getNextEntryAction());

    toolBar.addSeparator();

    toolBar.add(getHelpAction());

    Component[] comps = toolBar.getComponents();

    for (Component comp : comps) {
        ((JComponent) comp).setOpaque(false);
    }

    leftPan.add(toolBar, BorderLayout.SOUTH);
    add(leftPan, BorderLayout.WEST);
}