Example usage for java.awt.event KeyEvent VK_C

List of usage examples for java.awt.event KeyEvent VK_C

Introduction

In this page you can find the example usage for java.awt.event KeyEvent VK_C.

Prototype

int VK_C

To view the source code for java.awt.event KeyEvent VK_C.

Click Source Link

Document

Constant for the "C" key.

Usage

From source file:com.AandR.beans.plotting.imagePlotPanel.CanvasPanel.java

private void createPopupMenu() {
    popupMenu = new JPopupMenu();
    popupMenu.add(createPopupMenuItem("Toggle Log Plot", null, KeyStroke.getKeyStroke(KeyEvent.VK_L, 0)));
    popupMenu.add(createPopupMenuItem("Slice Here", null, KeyStroke.getKeyStroke(KeyEvent.VK_C, 10)));
    popupMenu.addSeparator();//from   w  ww  . ja va  2s . c  o  m

    JMenu navigateMenu = new JMenu("Navigate");
    navigateMenu.add(createPopupMenuItem("View First Frame", null, KeyStroke.getKeyStroke(KeyEvent.VK_F, 2)));
    navigateMenu
            .add(createPopupMenuItem("View Previous Frame", null, KeyStroke.getKeyStroke(KeyEvent.VK_P, 2)));
    navigateMenu
            .add(createPopupMenuItem("Choose Frame To View", null, KeyStroke.getKeyStroke(KeyEvent.VK_C, 2)));
    navigateMenu.add(createPopupMenuItem("View Next Frame", null, KeyStroke.getKeyStroke(KeyEvent.VK_N, 2)));
    navigateMenu.add(createPopupMenuItem("View Last Frame", null, KeyStroke.getKeyStroke(KeyEvent.VK_L, 2)));
    popupMenu.add(navigateMenu);
    popupMenu.addSeparator();

    popupMenu.add(createPopupMenuItem("Set Zoom Level", null, KeyStroke.getKeyStroke(KeyEvent.VK_Z, 2)));
    popupMenu.add(createPopupMenuItem("Set Min/Max", null, KeyStroke.getKeyStroke(KeyEvent.VK_R, 2)));
    popupMenu.add(createPopupMenuItem("Set Physical Extent", null, KeyStroke.getKeyStroke(KeyEvent.VK_E, 2)));
    popupMenu.addSeparator();
    popupMenu.add(createPopupMenuItem("Recenter on Viewport", null, KeyStroke.getKeyStroke(KeyEvent.VK_C, 0)));
    popupMenu.addSeparator();
    popupMenu.add(createPopupMenuItem("Set Colormap", null, KeyStroke.getKeyStroke(KeyEvent.VK_M, 2)));
    popupMenu.addSeparator();

    JMenu overlayMenu = new JMenu("Overlays");
    overlayMenu.add(createPopupMenuItem("Add Text Overlay", null, KeyStroke.getKeyStroke(KeyEvent.VK_T, 2)));
    overlayMenu.add(createPopupMenuItem("Add Shape Overlay", null, KeyStroke.getKeyStroke(KeyEvent.VK_O, 2)));
    overlayMenu.add(createPopupMenuItem("Add Annulus Overlay", null, KeyStroke.getKeyStroke(KeyEvent.VK_U, 2)));
    overlayMenu.add(createPopupMenuItem("Add Arrow Overlay", null, KeyStroke.getKeyStroke(KeyEvent.VK_A, 2)));
    popupMenu.add(overlayMenu);
    popupMenu.addSeparator();

    JMenu pngMenu = new JMenu("To PNG");
    pngMenu.add(createPopupMenuItem("Export Original Image", null, KeyStroke.getKeyStroke(KeyEvent.VK_S, 10)));
    pngMenu.add(createPopupMenuItem("Export Viewport Image", null, KeyStroke.getKeyStroke(KeyEvent.VK_S, 2)));
    pngMenu.addSeparator();
    pngMenu.add(createPopupMenuItem("Export Viewport Series", null, KeyStroke.getKeyStroke(KeyEvent.VK_S, 8)));

    JMenu pdfMenu = new JMenu("To PDF");
    pdfMenu.add(createPopupMenuItem("Export Original Image", null,
            KeyStroke.getKeyStroke(KeyEvent.VK_P, KeyEvent.SHIFT_DOWN_MASK | KeyEvent.CTRL_DOWN_MASK)));
    pdfMenu.add(createPopupMenuItem("Export Viewport Image", null,
            KeyStroke.getKeyStroke(KeyEvent.VK_P, KeyEvent.ALT_DOWN_MASK | KeyEvent.CTRL_DOWN_MASK)));

    JMenu exportMenu = new JMenu("Export");
    exportMenu.add(pngMenu);
    exportMenu.add(pdfMenu);
    popupMenu.add(exportMenu);
    popupMenu.addSeparator();

    JMenu losslessMenu = new JMenu("Lossless Modifications");
    losslessMenu.add(createPopupMenuItem("Flip Horizontally", null, KeyStroke.getKeyStroke(KeyEvent.VK_H, 10)));
    losslessMenu.add(createPopupMenuItem("Flip Vertically", null, KeyStroke.getKeyStroke(KeyEvent.VK_V, 10)));
    losslessMenu.addSeparator();
    losslessMenu.add(createPopupMenuItem("Rotate +90", null, KeyStroke.getKeyStroke(KeyEvent.VK_R, 10)));
    losslessMenu.add(createPopupMenuItem("Rotate -90", null, KeyStroke.getKeyStroke(KeyEvent.VK_L, 10)));
    popupMenu.add(losslessMenu);
}

From source file:org.apache.tika.gui.TikaGUI.java

private void addMenuBar() {
    JMenuBar bar = new JMenuBar();

    JMenu file = new JMenu("File");
    file.setMnemonic(KeyEvent.VK_F);
    addMenuItem(file, "Open...", "openfile", KeyEvent.VK_O);
    addMenuItem(file, "Open URL...", "openurl", KeyEvent.VK_U);
    file.addSeparator();//from www .  ja v  a2  s  .c  o m
    addMenuItem(file, "Exit", "exit", KeyEvent.VK_X);
    bar.add(file);

    JMenu view = new JMenu("View");
    view.setMnemonic(KeyEvent.VK_V);
    addMenuItem(view, "Metadata", "metadata", KeyEvent.VK_M);
    addMenuItem(view, "Formatted text", "html", KeyEvent.VK_F);
    addMenuItem(view, "Plain text", "text", KeyEvent.VK_P);
    addMenuItem(view, "Main content", "main", KeyEvent.VK_C);
    addMenuItem(view, "Structured text", "xhtml", KeyEvent.VK_S);
    addMenuItem(view, "Recursive JSON", "json", KeyEvent.VK_J);
    bar.add(view);

    bar.add(Box.createHorizontalGlue());
    JMenu help = new JMenu("Help");
    help.setMnemonic(KeyEvent.VK_H);
    addMenuItem(help, "About Tika", "about", KeyEvent.VK_A);
    bar.add(help);

    setJMenuBar(bar);
}

From source file:it.unifi.rcl.chess.traceanalysis.gui.TracePanel.java

private void initialize() {

    this.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

    JPanel pnlInfo = new JPanel();
    JPanel pnlBound = new JPanel();
    JPanel pnlPlot = new JPanel();
    JPanel pnlPhases = new JPanel();

    pnlInfo.setLayout(new BoxLayout(pnlInfo, BoxLayout.Y_AXIS));
    pnlBound.setLayout(new BoxLayout(pnlBound, BoxLayout.Y_AXIS));
    pnlPlot.setLayout(new BoxLayout(pnlPlot, BoxLayout.Y_AXIS));
    pnlPhases.setLayout(new BoxLayout(pnlPhases, BoxLayout.Y_AXIS));

    //      pnlInfo.setBorder(BorderFactory.createLineBorder(Color.black));
    //      pnlBound.setBorder(BorderFactory.createLineBorder(Color.black));
    //      pnlPlot.setBorder(BorderFactory.createLineBorder(Color.black));
    //      pnlPhases.setBorder(BorderFactory.createLineBorder(Color.black));
    pnlInfo.setPreferredSize(new Dimension(300, 250));
    pnlBound.setPreferredSize(new Dimension(400, 250));
    pnlPlot.setPreferredSize(new Dimension(300, 250));
    pnlPhases.setPreferredSize(new Dimension(400, 250));

    pnlInfo.setBorder(new EmptyBorder(6, 6, 6, 6));
    pnlBound.setBorder(new EmptyBorder(6, 6, 6, 6));
    pnlPlot.setBorder(new EmptyBorder(6, 6, 6, 6));
    pnlPhases.setBorder(new EmptyBorder(6, 6, 6, 6));

    this.add(pnlInfo);
    this.add(pnlBound);
    this.add(pnlPlot);
    this.add(pnlPhases);

    lblInfo = new JPlainLabel("<html><b>TRACE SUMMARY</b><br/>"
            + "<em>Information about the loaded trace.</em><br/><br/></html>");
    pnlInfo.add(lblInfo);/*w  w w. jav a2  s . com*/

    lblPoints = new JPlainLabel("#Points");
    pnlInfo.add(lblPoints);

    lblTraceName = new JPlainLabel();
    pnlInfo.add(lblTraceName);

    lblStat = new JPlainLabel();
    pnlInfo.add(lblStat);

    btnReload = new JButton("Reload");
    btnReload.addActionListener(new ButtonAction("Reload", KeyEvent.VK_L));
    pnlInfo.add(btnReload);

    btnClose = new JButton("Close");
    btnClose.addActionListener(new ButtonAction("Close", KeyEvent.VK_U));
    pnlInfo.add(btnClose);

    /* Bound evaluation */
    lblSectionBounds = new JPlainLabel("<html><b>BOUND EVALUATION</b><br/>"
            + "<em>Compute probabilistic bounds on manually selected portions of the trace.</em></html>");
    lblSectionBounds.setToolTipText("Compute probabilistic bounds on manually selected portions of the trace");
    lblSectionBounds.setFont(new Font("Dialog", Font.PLAIN, 12));
    //      lblSectionBounds.setBorder(BorderFactory.createLineBorder(Color.black));
    pnlBound.add(lblSectionBounds);

    scrollTabBounds = new JScrollPane();
    scrollTabBounds.setPreferredSize(new Dimension(400, 100));
    pnlBound.add(scrollTabBounds);

    tableBounds = new BoundsTable();
    scrollTabBounds.setViewportView(tableBounds);

    btnUpdateBoundsTable = new JButton("Update");
    btnUpdateBoundsTable.addActionListener(new ButtonAction("Update", KeyEvent.VK_U));
    pnlBound.add(btnUpdateBoundsTable);

    btnClearBoundsTable = new JButton("Clear Table");
    btnClearBoundsTable.addActionListener(new ButtonAction("Clear Table", KeyEvent.VK_C));
    pnlBound.add(btnClearBoundsTable);

    /* Plotting */
    lblSectionPlot = new JPlainLabel("<html><b>PLOTTING</b><br/>"
            + "<em>Plot the trace, together with \"dynamic\" probabilistic bounds, i.e., bounds obtained dynamically as if they were evaluated at runtime with a fixed window size.</em></html>");
    lblSectionPlot.setToolTipText("Plot the trace and dynamic bounds");
    pnlPlot.add(lblSectionPlot);

    scrollTabWSize = new JScrollPane();
    scrollTabWSize.setPreferredSize(new Dimension(400, 200));
    pnlPlot.add(scrollTabWSize);

    tableWindowSize = new JDynamicTable();
    tableWindowSize.setModel(new DefaultTableModel(new Object[][] { { 100, 0.99 }, { null, null } },
            new String[] { "WindowSize", "Confidence" }) {

        Class[] columnTypes = new Class[] { Integer.class, Double.class };

        public Class getColumnClass(int columnIndex) {
            return columnTypes[columnIndex];
        }
    });
    tableWindowSize.setMonitoredColumn(0);
    tableWindowSize.setMonitoredColumn(1);
    tableWindowSize.getColumnModel().getColumn(0).setPreferredWidth(10);
    tableWindowSize.getColumnModel().getColumn(1).setPreferredWidth(10);
    scrollTabWSize.setViewportView(tableWindowSize);

    btnPlot = new JButton("Plot");
    btnPlot.addActionListener(new ButtonAction("Plot", KeyEvent.VK_P));
    pnlPlot.add(btnPlot);

    btnBoundExport = new JButton("Export");
    btnBoundExport.addActionListener(new ButtonAction("Export", KeyEvent.VK_E));
    pnlPlot.add(btnBoundExport);

    btnCompareAll = new JButton("Compare All Traces");
    btnCompareAll.addActionListener(new ButtonAction("Compare All Traces", KeyEvent.VK_A));
    pnlPlot.add(btnCompareAll);

    btnClearWSizeTable = new JButton("Clear Table");
    btnClearWSizeTable.addActionListener(new ButtonAction("Clear Table", KeyEvent.VK_C));
    pnlPlot.add(btnClearWSizeTable);

    /* Phases analysis */
    lblSectionPhases = new JPlainLabel("<html><b>PHASES ANALYSIS</b><br/>"
            + "<em>Detect phases in the trace having different probabilistic properties.</em></html>.");
    lblSectionPhases.setToolTipText("Detect phases in the trace having different probabilistic properties");
    pnlPhases.add(lblSectionPhases);

    scrollTabPhases = new JScrollPane();
    scrollTabPhases.setPreferredSize(new Dimension(200, 150));
    pnlPhases.add(scrollTabPhases);

    tablePhases = new JTable();
    tablePhases.setModel(new DefaultTableModel(new Object[][] { { null, null, null, null } },
            new String[] { "Start", "End", "Distribution*", "Bound*" }) {

        Class[] columnTypes = new Class[] { Integer.class, Integer.class, String.class, String.class };

        public Class getColumnClass(int columnIndex) {
            return columnTypes[columnIndex];
        }

        @Override
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    });
    tablePhases.getColumnModel().getColumn(0).setPreferredWidth(10);
    tablePhases.getColumnModel().getColumn(1).setPreferredWidth(10);
    tablePhases.getColumnModel().getColumn(2).setPreferredWidth(100);
    tablePhases.getColumnModel().getColumn(3).setPreferredWidth(100);
    scrollTabPhases.setViewportView(tablePhases);

    lblPhasesCoverage = new JPlainLabel("Coverage: ");
    pnlPhases.add(lblPhasesCoverage);
    txtPhasesCoverage = new JTextField("0.99");
    pnlPhases.add(txtPhasesCoverage);

    lblPhasesWSize = new JPlainLabel("Window Size: ");
    pnlPhases.add(lblPhasesWSize);
    txtPhasesWSize = new JTextField("20");
    pnlPhases.add(txtPhasesWSize);

    btnPhaseDetection = new JButton("Phases Analysis");
    ;
    btnPhaseDetection.addActionListener(new ButtonAction("PhasesAnalysis", KeyEvent.VK_P));
    pnlPhases.add(btnPhaseDetection);
}

From source file:es.emergya.ui.gis.HistoryMapViewer.java

@Override
protected JPopupMenu getContextMenu() {
    JPopupMenu menu = new JPopupMenu();
    // Centrar aqui
    JMenuItem cent = new JMenuItem(i18n.getString("map.menu.centerHere"), KeyEvent.VK_C);
    cent.setIcon(LogicConstants.getIcon("menucontextual_icon_centrar"));
    cent.addActionListener(new ActionListener() {

        @Override//from  w w w  . jav  a 2s .  c o m
        public void actionPerformed(ActionEvent e) {
            mapView.zoomToFactor(mapView.getEastNorth(eventOriginal.getX(), eventOriginal.getY()),
                    mapView.zoomFactor);
        }
    });
    menu.add(cent);

    menu.addPopupMenuListener(new PopupMenuListener() {

        @Override
        public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
            eventOriginal = HistoryMapViewer.this.mapView.lastMEvent;
        }

        @Override
        public void popupMenuCanceled(PopupMenuEvent arg0) {
        }

        @Override
        public void popupMenuWillBecomeInvisible(PopupMenuEvent arg0) {
        }
    });
    return menu;
}

From source file:org.rdv.ui.MainPanel.java

private void initActions() {
    fileAction = new DataViewerAction("File", "File Menu", KeyEvent.VK_F);

    connectAction = new DataViewerAction("Connect", "Connect to RBNB server", KeyEvent.VK_C,
            KeyStroke.getKeyStroke(KeyEvent.VK_C, menuShortcutKeyMask | ActionEvent.SHIFT_MASK)) {
        /** serialization version identifier */
        private static final long serialVersionUID = 5038790506859429244L;

        public void actionPerformed(ActionEvent ae) {
            if (rbnbConnectionDialog == null) {
                rbnbConnectionDialog = new RBNBConnectionDialog(frame, rbnb, dataPanelManager);
            } else {
                rbnbConnectionDialog.setVisible(true);
            }//from  w w  w  . jav  a2s .  co  m
        }
    };

    disconnectAction = new DataViewerAction("Disconnect", "Disconnect from RBNB server", KeyEvent.VK_D,
            KeyStroke.getKeyStroke(KeyEvent.VK_D, menuShortcutKeyMask | ActionEvent.SHIFT_MASK)) {
        /** serialization version identifier */
        private static final long serialVersionUID = -1871076535376405181L;

        public void actionPerformed(ActionEvent ae) {
            dataPanelManager.closeAllDataPanels();
            rbnb.disconnect();
        }
    };

    loginAction = new DataViewerAction("Login", "Login as a NEES user") {
        /** serialization version identifier */
        private static final long serialVersionUID = 6105503896620555072L;

        public void actionPerformed(ActionEvent ae) {
            if (loginDialog == null) {
                loginDialog = new LoginDialog(frame);
            } else {
                loginDialog.setVisible(true);
            }
        }
    };

    logoutAction = new DataViewerAction("Logout", "Logout as a NEES user") {
        /** serialization version identifier */
        private static final long serialVersionUID = -2517567766044673777L;

        public void actionPerformed(ActionEvent ae) {
            AuthenticationManager.getInstance().setAuthentication(null);
        }
    };

    loadAction = new DataViewerAction("Load Setup", "Load data viewer setup from file") {
        /** serialization version identifier */
        private static final long serialVersionUID = 7197815395398039821L;

        public void actionPerformed(ActionEvent ae) {
            File configFile = UIUtilities.getFile(new RDVConfigurationFileFilter(), "Load");
            if (configFile != null) {
                try {
                    URL configURL = configFile.toURI().toURL();
                    ConfigurationManager.loadConfiguration(configURL);
                } catch (MalformedURLException e) {
                    DataViewer.alertError("\"" + configFile + "\" is not a valid configuration file URL.");
                }
            }
        }
    };

    saveAction = new DataViewerAction("Save Setup", "Save data viewer setup to file") {
        /** serialization version identifier */
        private static final long serialVersionUID = -8259994975940624038L;

        public void actionPerformed(ActionEvent ae) {
            File file = UIUtilities.saveFile(new RDVConfigurationFileFilter());
            if (file != null) {
                if (file.getName().indexOf(".") == -1) {
                    file = new File(file.getAbsolutePath() + ".rdv");
                }

                // prompt for overwrite if file already exists
                if (file.exists()) {
                    int overwriteReturn = JOptionPane.showConfirmDialog(null,
                            file.getName() + " already exists. Do you want to overwrite it?", "Overwrite file?",
                            JOptionPane.YES_NO_OPTION);
                    if (overwriteReturn == JOptionPane.NO_OPTION) {
                        return;
                    }
                }

                ConfigurationManager.saveConfiguration(file);
            }
        }
    };

    importAction = new DataViewerAction("Import", "Import Menu", KeyEvent.VK_I, "icons/import.gif");

    exportAction = new DataViewerAction("Export", "Export Menu", KeyEvent.VK_E, "icons/export.gif");

    exportVideoAction = new DataViewerAction("Export video channels",
            "Export video on the server to the local computer") {
        /** serialization version identifier */
        private static final long serialVersionUID = -6420430928972633313L;

        public void actionPerformed(ActionEvent ae) {
            showExportVideoDialog();
        }
    };

    exitAction = new DataViewerAction("Exit", "Exit RDV", KeyEvent.VK_X) {
        /** serialization version identifier */
        private static final long serialVersionUID = 3137490972014710133L;

        public void actionPerformed(ActionEvent ae) {
            Application.getInstance().exit(ae);
        }
    };

    controlAction = new DataViewerAction("Control", "Control Menu", KeyEvent.VK_C);

    realTimeAction = new DataViewerAction("Real Time", "View data in real time", KeyEvent.VK_R,
            KeyStroke.getKeyStroke(KeyEvent.VK_R, menuShortcutKeyMask), "icons/rt.gif") {
        /** serialization version identifier */
        private static final long serialVersionUID = -7564783609370910512L;

        public void actionPerformed(ActionEvent ae) {
            rbnb.monitor();
        }
    };

    playAction = new DataViewerAction("Play", "Playback data", KeyEvent.VK_P,
            KeyStroke.getKeyStroke(KeyEvent.VK_P, menuShortcutKeyMask), "icons/play.gif") {
        /** serialization version identifier */
        private static final long serialVersionUID = 5974457444931142938L;

        public void actionPerformed(ActionEvent ae) {
            rbnb.play();
        }
    };

    pauseAction = new DataViewerAction("Pause", "Pause data display", KeyEvent.VK_A,
            KeyStroke.getKeyStroke(KeyEvent.VK_S, menuShortcutKeyMask), "icons/pause.gif") {
        /** serialization version identifier */
        private static final long serialVersionUID = -5297742186923194460L;

        public void actionPerformed(ActionEvent ae) {
            rbnb.pause();
        }
    };

    beginningAction = new DataViewerAction("Go to beginning", "Move the location to the start of the data",
            KeyEvent.VK_B, KeyStroke.getKeyStroke(KeyEvent.VK_B, menuShortcutKeyMask), "icons/begin.gif") {
        /** serialization version identifier */
        private static final long serialVersionUID = 9171304956895497898L;

        public void actionPerformed(ActionEvent ae) {
            controlPanel.setLocationBegin();
        }
    };

    endAction = new DataViewerAction("Go to end", "Move the location to the end of the data", KeyEvent.VK_E,
            KeyStroke.getKeyStroke(KeyEvent.VK_E, menuShortcutKeyMask), "icons/end.gif") {
        /** serialization version identifier */
        private static final long serialVersionUID = 1798579248452726211L;

        public void actionPerformed(ActionEvent ae) {
            controlPanel.setLocationEnd();
        }
    };

    gotoTimeAction = new DataViewerAction("Go to time", "Move the location to specific date time of the data",
            KeyEvent.VK_T, KeyStroke.getKeyStroke(KeyEvent.VK_T, menuShortcutKeyMask)) {
        /** serialization version identifier */
        private static final long serialVersionUID = -6411442297488926326L;

        public void actionPerformed(ActionEvent ae) {
            TimeRange timeRange = RBNBHelper.getChannelsTimeRange();
            double time = DateTimeDialog.showDialog(frame, rbnb.getLocation(), timeRange.start, timeRange.end);
            if (time >= 0) {
                rbnb.setLocation(time);
            }
        }
    };

    updateChannelListAction = new DataViewerAction("Update Channel List", "Update the channel list",
            KeyEvent.VK_U, KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0), "icons/refresh.gif") {
        /** serialization version identifier */
        private static final long serialVersionUID = -170096772973697277L;

        public void actionPerformed(ActionEvent ae) {
            rbnb.updateMetadata();
        }
    };

    dropDataAction = new DataViewerAction("Drop Data", "Drop data if plaback can't keep up with data rate",
            KeyEvent.VK_D, "icons/drop_data.gif") {
        /** serialization version identifier */
        private static final long serialVersionUID = 7079791364881120134L;

        public void actionPerformed(ActionEvent ae) {
            JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ae.getSource();
            rbnb.dropData(menuItem.isSelected());
        }
    };

    viewAction = new DataViewerAction("View", "View Menu", KeyEvent.VK_V);

    showChannelListAction = new DataViewerAction("Show Channels", "", KeyEvent.VK_L, "icons/channels.gif") {
        /** serialization version identifier */
        private static final long serialVersionUID = 4982129759386009112L;

        public void actionPerformed(ActionEvent ae) {
            JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ae.getSource();
            channelListPanel.setVisible(menuItem.isSelected());
            layoutSplitPane();
            leftPanel.resetToPreferredSizes();
        }
    };

    showMetadataPanelAction = new DataViewerAction("Show Properties", "", KeyEvent.VK_P,
            "icons/properties.gif") {
        /** serialization version identifier */
        private static final long serialVersionUID = 430106771704397810L;

        public void actionPerformed(ActionEvent ae) {
            JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ae.getSource();
            metadataPanel.setVisible(menuItem.isSelected());
            layoutSplitPane();
            leftPanel.resetToPreferredSizes();
        }
    };

    showControlPanelAction = new DataViewerAction("Show Control Panel", "", KeyEvent.VK_C,
            "icons/control.gif") {
        /** serialization version identifier */
        private static final long serialVersionUID = 6401715717710735485L;

        public void actionPerformed(ActionEvent ae) {
            JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ae.getSource();
            controlPanel.setVisible(menuItem.isSelected());
        }
    };

    showAudioPlayerPanelAction = new DataViewerAction("Show Audio Player", "", KeyEvent.VK_A,
            "icons/audio.gif") {
        /** serialization version identifier */
        private static final long serialVersionUID = -4248275698973916287L;

        public void actionPerformed(ActionEvent ae) {
            JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ae.getSource();
            audioPlayerPanel.setVisible(menuItem.isSelected());
        }
    };

    showMarkerPanelAction = new DataViewerAction("Show Marker Panel", "", KeyEvent.VK_M, "icons/info.gif") {
        /** serialization version identifier */
        private static final long serialVersionUID = -5253555511660929640L;

        public void actionPerformed(ActionEvent ae) {
            JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ae.getSource();
            markerSubmitPanel.setVisible(menuItem.isSelected());
        }
    };

    dataPanelAction = new DataViewerAction("Arrange", "Arrange Data Panel Orientation", KeyEvent.VK_D);

    dataPanelHorizontalLayoutAction = new DataViewerAction("Horizontal Data Panel Orientation", "", -1,
            "icons/vertical.gif") {
        /** serialization version identifier */
        private static final long serialVersionUID = 3356151813557187908L;

        public void actionPerformed(ActionEvent ae) {
            dataPanelContainer.setLayout(DataPanelContainer.VERTICAL_LAYOUT);
        }
    };

    dataPanelVerticalLayoutAction = new DataViewerAction("Vertical Data Panel Orientation", "", -1,
            "icons/horizontal.gif") {
        /** serialization version identifier */
        private static final long serialVersionUID = -4629920180285927138L;

        public void actionPerformed(ActionEvent ae) {
            dataPanelContainer.setLayout(DataPanelContainer.HORIZONTAL_LAYOUT);
        }
    };

    showHiddenChannelsAction = new DataViewerAction("Show Hidden Channels", "", KeyEvent.VK_H,
            KeyStroke.getKeyStroke(KeyEvent.VK_H, menuShortcutKeyMask), "icons/hidden.gif") {
        /** serialization version identifier */
        private static final long serialVersionUID = -2723464261568074033L;

        public void actionPerformed(ActionEvent ae) {
            JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ae.getSource();
            boolean selected = menuItem.isSelected();
            channelListPanel.showHiddenChannels(selected);
        }
    };

    hideEmptyTimeAction = new DataViewerAction("Hide time with no data", "", KeyEvent.VK_D) {
        /** serialization version identifier */
        private static final long serialVersionUID = -3123608144249355642L;

        public void actionPerformed(ActionEvent ae) {
            JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ae.getSource();
            boolean selected = menuItem.isSelected();
            controlPanel.hideEmptyTime(selected);
        }
    };

    fullScreenAction = new DataViewerAction("Full Screen", "", KeyEvent.VK_F,
            KeyStroke.getKeyStroke(KeyEvent.VK_F11, 0)) {
        /** serialization version identifier */
        private static final long serialVersionUID = -6882310862616235602L;

        public void actionPerformed(ActionEvent ae) {
            JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ae.getSource();
            if (menuItem.isSelected()) {
                if (enterFullScreenMode()) {
                    menuItem.setSelected(true);
                } else {
                    menuItem.setSelected(false);
                }
            } else {
                leaveFullScreenMode();
                menuItem.setSelected(false);
            }
        }
    };

    windowAction = new DataViewerAction("Window", "Window Menu", KeyEvent.VK_W);

    closeAllDataPanelsAction = new DataViewerAction("Close all data panels", "", KeyEvent.VK_C,
            "icons/closeall.gif") {
        /** serialization version identifier */
        private static final long serialVersionUID = -8104876009869238037L;

        public void actionPerformed(ActionEvent ae) {
            dataPanelManager.closeAllDataPanels();
        }
    };

    helpAction = new DataViewerAction("Help", "Help Menu", KeyEvent.VK_H);

    usersGuideAction = new DataViewerAction("RDV Help", "Open the RDV User's Guide", KeyEvent.VK_H,
            KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)) {
        /** serialization version identifier */
        private static final long serialVersionUID = -2837190869008153291L;

        public void actionPerformed(ActionEvent ae) {
            try {
                URL usersGuideURL = new URL("http://it.nees.org/library/telepresence/rdv-19-users-guide.php");
                DataViewer.browse(usersGuideURL);
            } catch (Exception e) {
            }
        }
    };

    supportAction = new DataViewerAction("RDV Support", "Get support from NEESit", KeyEvent.VK_S) {
        /** serialization version identifier */
        private static final long serialVersionUID = -6855670513381679226L;

        public void actionPerformed(ActionEvent ae) {
            try {
                URL supportURL = new URL("http://it.nees.org/support/");
                DataViewer.browse(supportURL);
            } catch (Exception e) {
            }
        }
    };

    releaseNotesAction = new DataViewerAction("Release Notes", "Open the RDV Release Notes", KeyEvent.VK_R) {
        /** serialization version identifier */
        private static final long serialVersionUID = 7223639998298692494L;

        public void actionPerformed(ActionEvent ae) {
            try {
                URL releaseNotesURL = new URL("http://it.nees.org/library/rdv/rdv-release-notes.php");
                DataViewer.browse(releaseNotesURL);
            } catch (Exception e) {
            }
        }
    };

    aboutAction = new DataViewerAction("About RDV", "", KeyEvent.VK_A) {
        /** serialization version identifier */
        private static final long serialVersionUID = 3978467903181198979L;

        public void actionPerformed(ActionEvent ae) {
            showAboutDialog();
        }
    };

}

From source file:org.sakuli.actions.environment.Environment.java

/**
 * copy the current selected item or text to the clipboard. Will do the same as "CTRL + V".
 *
 * @return this {@link Environment}.// w  w  w.j  a  v a 2  s  . com
 */
@ModifySahiTimer
@LogToResult(message = "copy the current selection to the clipboard", logClassInstance = false)
public Environment copyIntoClipboard() {
    int mod = Key.getHotkeyModifier();
    IRobot r = loader.getScreen().getRobot();
    r.keyDown(mod);
    r.keyDown(KeyEvent.VK_C);
    r.keyUp(KeyEvent.VK_C);
    r.keyUp(mod);
    return this;
}

From source file:org.nebulaframework.ui.swing.cluster.ClusterMainUI.java

/**
 * Setups the Menu Bar//from   www.j a v  a2 s. c  om
 * @return
 */
private JMenuBar setupMenu() {
    JMenuBar menuBar = new JMenuBar();

    /* -- Cluster Menu -- */
    JMenu clusterMenu = new JMenu("Cluster");
    clusterMenu.setMnemonic(KeyEvent.VK_C);
    menuBar.add(clusterMenu);

    // Discover Submenu
    JMenu clusterDiscoverMenu = new JMenu("Disover Peers");
    clusterDiscoverMenu.setMnemonic(KeyEvent.VK_D);
    clusterMenu.add(clusterDiscoverMenu);

    // Discover -> Multicast
    JMenuItem clusterDiscoverMulticast = new JMenuItem("Multicast");
    clusterDiscoverMulticast.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0));
    clusterDiscoverMulticast.setEnabled(false);
    clusterDiscoverMulticast.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doDiscoverMulticast();
        }
    });
    clusterDiscoverMenu.add(clusterDiscoverMulticast);
    addUIElement("menu.cluster.discover.multicast", clusterDiscoverMulticast); // Add to components map

    // Discover -> WS
    JMenuItem clusterDiscoverWS = new JMenuItem("Colombus Web Service");
    clusterDiscoverWS.setEnabled(false);
    clusterDiscoverWS.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F10, 0));
    clusterDiscoverWS.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doDiscoverWS();
        }
    });
    clusterDiscoverMenu.add(clusterDiscoverWS);
    addUIElement("menu.cluster.discover.ws", clusterDiscoverWS); // Add to components map

    clusterMenu.addSeparator();

    // Cluster-> Shutdown
    JMenuItem clusterShutdownItem = new JMenuItem("Shutdown", 'u');
    clusterShutdownItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0));
    clusterShutdownItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doShutdownCluster();
        }
    });
    clusterMenu.add(clusterShutdownItem);
    addUIElement("menu.cluster.shutdown", clusterShutdownItem); // Add to components map

    /* -- Options Menu -- */
    JMenu optionsMenu = new JMenu("Options");
    optionsMenu.setMnemonic(KeyEvent.VK_O);
    menuBar.add(optionsMenu);

    // Configuration
    JMenuItem optionsConfigItem = new JMenuItem("Configuration...", 'C');
    optionsConfigItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            showConfiguration();
        }
    });
    optionsMenu.add(optionsConfigItem);
    optionsConfigItem.setEnabled(false); // TODO Create Configuration Options

    /* -- Help Menu -- */
    JMenu helpMenu = new JMenu("Help");
    helpMenu.setMnemonic(KeyEvent.VK_H);
    menuBar.add(helpMenu);

    // Help Contents
    JMenuItem helpContentsItem = new JMenuItem("Help Contents", 'H');
    helpContentsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
    helpContentsItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            showHelp();
        }
    });
    helpMenu.add(helpContentsItem);

    helpMenu.addSeparator();

    JMenuItem helpAboutItem = new JMenuItem("About", 'A');
    helpAboutItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            showAbout();
        }
    });
    helpMenu.add(helpAboutItem);

    return menuBar;
}

From source file:de.tor.tribes.ui.views.DSWorkbenchFarmManager.java

/**
 * Creates new form DSWorkbenchFarmManager
 */// www .  j av  a2s.  c o m
DSWorkbenchFarmManager() {
    initComponents();
    centerPanel = new GenericTestPanel();
    jCenterPanel.add(centerPanel, BorderLayout.CENTER);
    centerPanel.setChildComponent(jFarmPanel);
    buildMenu();
    jFarmTable.setModel(new FarmTableModel());
    jFarmTable.getTableHeader().setDefaultRenderer(new de.tor.tribes.ui.renderer.DefaultTableHeaderRenderer());
    ColorHighlighter p = new ColorHighlighter(new FarmPredicate(FarmPredicate.PType.BARBARIAN));
    p.setBackground(Color.LIGHT_GRAY);
    ColorHighlighter p1 = new ColorHighlighter(new FarmPredicate(FarmPredicate.PType.PLAYER));
    p1.setBackground(new Color(0xffffcc));
    jFarmTable.setHighlighters(
            HighlighterFactory.createAlternateStriping(Constants.DS_ROW_A, Constants.DS_ROW_B), p, p1);
    jFarmTable.setDefaultRenderer(Boolean.class,
            new CustomBooleanRenderer(CustomBooleanRenderer.LayoutStyle.RES_IN_STORAGE));
    jFarmTable.setDefaultRenderer(Date.class, new de.tor.tribes.ui.renderer.DateCellRenderer());
    jFarmTable.setDefaultRenderer(Float.class, new de.tor.tribes.ui.renderer.PercentCellRenderer());
    jFarmTable.setDefaultRenderer(FarmInformation.FARM_STATUS.class,
            new EnumImageCellRenderer(EnumImageCellRenderer.LayoutStyle.FarmStatus));
    jFarmTable.setDefaultRenderer(FarmInformation.FARM_RESULT.class,
            new EnumImageCellRenderer(EnumImageCellRenderer.LayoutStyle.FarmResult));
    jFarmTable.setDefaultRenderer(StorageStatus.class, new de.tor.tribes.ui.renderer.StorageCellRenderer());
    jFarmTable.setDefaultRenderer(FarmInformation.SIEGE_STATUS.class,
            new EnumImageCellRenderer(EnumImageCellRenderer.LayoutStyle.SiegeStatus));
    jFarmTable.setColumnControlVisible(true);
    jFarmTable.setSortsOnUpdates(false);
    FarmManager.getSingleton().addManagerListener(DSWorkbenchFarmManager.this);
    settingsPanel.setLayout(new BorderLayout());
    settingsPanel.add(jSettingsPanel, BorderLayout.CENTER);

    new Timer("FarmTableUpdate").schedule(new TimerTask() {

        @Override
        public void run() {
            jFarmTable.repaint();
        }
    }, new Date(), 1000);

    KeyStroke delete = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0, false);
    KeyStroke farmA = KeyStroke.getKeyStroke(KeyEvent.VK_A, 0, false);
    KeyStroke farmB = KeyStroke.getKeyStroke(KeyEvent.VK_B, 0, false);
    KeyStroke farmK = KeyStroke.getKeyStroke(KeyEvent.VK_K, 0, false);
    KeyStroke farmC = KeyStroke.getKeyStroke(KeyEvent.VK_C, 0, false);
    ActionListener listener = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            deleteSelection();
        }
    };

    capabilityInfoPanel1.addActionListener(listener);

    jFarmTable.setSortsOnUpdates(false);
    jFarmTable.registerKeyboardAction(listener, "Delete", delete,
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    jFarmTable.registerKeyboardAction(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            farmA();
        }
    }, "FarmA", farmA, JComponent.WHEN_IN_FOCUSED_WINDOW);
    jFarmTable.registerKeyboardAction(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            farmB();
        }
    }, "FarmB", farmB, JComponent.WHEN_IN_FOCUSED_WINDOW);
    jFarmTable.registerKeyboardAction(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            farmK();
        }
    }, "FarmK", farmK, JComponent.WHEN_IN_FOCUSED_WINDOW);
    jFarmTable.registerKeyboardAction(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            farmC();
        }
    }, "FarmC", farmC, JComponent.WHEN_IN_FOCUSED_WINDOW);

    aTroops = new TroopSelectionPanelDynamic();
    aTroops.setupFarm(TroopSelectionPanel.alignType.GROUPED, -1);
    bTroops = new TroopSelectionPanelDynamic();
    bTroops.setupFarm(TroopSelectionPanel.alignType.GROUPED, -1);
    kTroops = new TroopSelectionPanelDynamic();
    kTroops.setupFarm(TroopSelectionPanel.alignType.GROUPED, -1);
    cTroops = new TroopSelectionPanelDynamic();
    cTroops.setupFarm(TroopSelectionPanel.alignType.GROUPED, -1);
    rTroops = new TroopSelectionPanelDynamic();
    rTroops.setupFarm(TroopSelectionPanel.alignType.GROUPED, -1);
    jATroopsPanel.add(aTroops, BorderLayout.CENTER);
    jBTroopsPanel.add(bTroops, BorderLayout.CENTER);
    jKTroopsPanel.add(kTroops, BorderLayout.CENTER);
    jCTroopsPanel.add(cTroops, BorderLayout.CENTER);
    jRSettingsTab.add(rTroops, BorderLayout.CENTER);
    jXLabel1.setLineWrap(true);

    jFarmTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            showInfo(jFarmTable.getSelectedRowCount() + " Farm(en) gewhlt");
        }
    });

    coordSpinner = new CoordinateSpinner();
    coordSpinner.setEnabled(false);
    java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    jFarmFromBarbarianSelectionDialog.getContentPane().add(coordSpinner, gridBagConstraints);

    // <editor-fold defaultstate="collapsed" desc=" Init HelpSystem ">
    if (!Constants.DEBUG) {
        GlobalOptions.getHelpBroker().enableHelpKey(getRootPane(), "farmManager",
                GlobalOptions.getHelpBroker().getHelpSet());
    } // </editor-fold>
}

From source file:edu.harvard.mcz.imagecapture.encoder.UnitTrayLabelBrowser.java

/**
 * This method initializes jMenuItem   //from w  ww .  j a v a 2  s . c o m
 *    
 * @return javax.swing.JMenuItem   
 */
private JMenuItem getJMenuItem() {
    if (jMenuItemCopy == null) {
        jMenuItemCopy = new JMenuItem(new DefaultEditorKit.CopyAction());
        jMenuItemCopy.setText("Copy");
        jMenuItemCopy.setMnemonic(KeyEvent.VK_C);
        jMenuItemCopy.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK));
        jMenuItemCopy.setEnabled(true);
    }
    return jMenuItemCopy;
}

From source file:com.nbt.TreeFrame.java

private void createActions() {
    newAction = new NBTAction("New", "New", "New", KeyEvent.VK_N) {

        {//from w  w w .ja  va  2s. co m
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('N', Event.CTRL_MASK));
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            updateTreeTable(new CompoundTag(""));
        }

    };

    browseAction = new NBTAction("Browse...", "Open", "Browse...", KeyEvent.VK_O) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('O', Event.CTRL_MASK));
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            JFileChooser fc = createFileChooser();
            switch (fc.showOpenDialog(TreeFrame.this)) {
            case JFileChooser.APPROVE_OPTION:
                File file = fc.getSelectedFile();
                Preferences prefs = getPreferences();
                prefs.put(KEY_FILE, file.getAbsolutePath());
                doImport(file);
                break;
            }
        }

    };

    saveAction = new NBTAction("Save", "Save", "Save", KeyEvent.VK_S) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('S', Event.CTRL_MASK));
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            String path = textFile.getText();
            File file = new File(path);
            if (file.canWrite()) {
                doExport(file);
            } else {
                saveAsAction.actionPerformed(e);
            }
        }

    };

    saveAsAction = new NBTAction("Save As...", "SaveAs", "Save As...", KeyEvent.VK_UNDEFINED) {

        public void actionPerformed(ActionEvent e) {
            JFileChooser fc = createFileChooser();
            switch (fc.showSaveDialog(TreeFrame.this)) {
            case JFileChooser.APPROVE_OPTION:
                File file = fc.getSelectedFile();
                Preferences prefs = getPreferences();
                prefs.put(KEY_FILE, file.getAbsolutePath());
                doExport(file);
                break;
            }
        }

    };

    refreshAction = new NBTAction("Refresh", "Refresh", "Refresh", KeyEvent.VK_F5) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("F5"));
        }

        public void actionPerformed(ActionEvent e) {
            String path = textFile.getText();
            File file = new File(path);
            if (file.canRead())
                doImport(file);
            else
                showErrorDialog("The file could not be read.");
        }

    };

    exitAction = new NBTAction("Exit", "Exit", KeyEvent.VK_ESCAPE) {

        @Override
        public void actionPerformed(ActionEvent e) {
            // TODO: this should check to see if any changes have been made
            // before exiting
            System.exit(0);
        }

    };

    cutAction = new DefaultEditorKit.CutAction() {

        {
            String name = "Cut";
            putValue(NAME, name);
            putValue(SHORT_DESCRIPTION, name);
            putValue(MNEMONIC_KEY, KeyEvent.VK_X);
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('X', Event.CTRL_MASK));

            ImageFactory factory = new ImageFactory();
            try {
                putValue(SMALL_ICON, new ImageIcon(factory.readGeneralImage(name, NBTAction.smallIconSize)));
            } catch (IOException e) {
                e.printStackTrace();
            }

            try {
                putValue(LARGE_ICON_KEY,
                        new ImageIcon(factory.readGeneralImage(name, NBTAction.largeIconSize)));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    };

    copyAction = new DefaultEditorKit.CopyAction() {

        {
            String name = "Copy";
            putValue(NAME, name);
            putValue(SHORT_DESCRIPTION, name);
            putValue(MNEMONIC_KEY, KeyEvent.VK_C);
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('C', Event.CTRL_MASK));

            ImageFactory factory = new ImageFactory();
            try {
                putValue(SMALL_ICON, new ImageIcon(factory.readGeneralImage(name, NBTAction.smallIconSize)));
            } catch (IOException e) {
                e.printStackTrace();
            }

            try {
                putValue(LARGE_ICON_KEY,
                        new ImageIcon(factory.readGeneralImage(name, NBTAction.largeIconSize)));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    };

    pasteAction = new DefaultEditorKit.CutAction() {

        {
            String name = "Paste";
            putValue(NAME, name);
            putValue(SHORT_DESCRIPTION, name);
            putValue(MNEMONIC_KEY, KeyEvent.VK_V);
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('V', Event.CTRL_MASK));

            ImageFactory factory = new ImageFactory();
            try {
                putValue(SMALL_ICON, new ImageIcon(factory.readGeneralImage(name, NBTAction.smallIconSize)));
            } catch (IOException e) {
                e.printStackTrace();
            }

            try {
                putValue(LARGE_ICON_KEY,
                        new ImageIcon(factory.readGeneralImage(name, NBTAction.largeIconSize)));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    };

    deleteAction = new NBTAction("Delete", "Delete", "Delete", KeyEvent.VK_DELETE) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("DELETE"));
        }

        public void actionPerformed(ActionEvent e) {
            int row = treeTable.getSelectedRow();
            TreePath path = treeTable.getPathForRow(row);
            Object last = path.getLastPathComponent();

            if (last instanceof NBTFileBranch) {
                NBTFileBranch branch = (NBTFileBranch) last;
                File file = branch.getFile();
                String name = file.getName();
                String message = "Are you sure you want to delete " + name + "?";
                String title = "Continue?";
                int option = JOptionPane.showConfirmDialog(TreeFrame.this, message, title,
                        JOptionPane.OK_CANCEL_OPTION);
                switch (option) {
                case JOptionPane.CANCEL_OPTION:
                    return;
                }
                if (!FileUtils.deleteQuietly(file)) {
                    showErrorDialog(name + " could not be deleted.");
                    return;
                }
            }

            TreePath parentPath = path.getParentPath();
            Object parentLast = parentPath.getLastPathComponent();
            NBTTreeTableModel model = treeTable.getTreeTableModel();
            int index = model.getIndexOfChild(parentLast, last);
            if (parentLast instanceof Mutable<?>) {
                Mutable<?> mutable = (Mutable<?>) parentLast;
                if (last instanceof ByteWrapper) {
                    ByteWrapper wrapper = (ByteWrapper) last;
                    index = wrapper.getIndex();
                }
                mutable.remove(index);
            } else {
                System.err.println(last.getClass());
                return;
            }

            updateTreeTable();
            treeTable.expandPath(parentPath);
            scrollTo(parentLast);
            treeTable.setRowSelectionInterval(row, row);
        }

    };

    openAction = new NBTAction("Open...", "Open...", KeyEvent.VK_T) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('T', Event.CTRL_MASK));

            final int diamondPickaxe = 278;
            SpriteRecord record = NBTTreeTable.register.getRecord(diamondPickaxe);
            BufferedImage image = record.getImage();
            setSmallIcon(image);

            int width = 24, height = 24;
            Dimension size = new Dimension(width, height);
            Map<RenderingHints.Key, ?> hints = Thumbnail.createRenderingHints(Thumbnail.QUALITY);
            BufferedImage largeImage = Thumbnail.createThumbnail(image, size, hints);
            setLargeIcon(largeImage);
        }

        public void actionPerformed(ActionEvent e) {
            TreePath path = treeTable.getPath();
            if (path == null)
                return;

            Object last = path.getLastPathComponent();
            if (last instanceof Region) {
                Region region = (Region) last;
                createAndShowTileCanvas(new TileCanvas.TileWorld(region));
                return;
            } else if (last instanceof World) {
                World world = (World) last;
                createAndShowTileCanvas(world);
                return;
            }

            if (last instanceof NBTFileBranch) {
                NBTFileBranch fileBranch = (NBTFileBranch) last;
                File file = fileBranch.getFile();
                try {
                    open(file);
                } catch (IOException ex) {
                    ex.printStackTrace();
                    showErrorDialog(ex.getMessage());
                }
            }
        }

        private void open(File file) throws IOException {
            if (Desktop.isDesktopSupported()) {
                Desktop desktop = Desktop.getDesktop();
                if (desktop.isSupported(Desktop.Action.OPEN)) {
                    desktop.open(file);
                }
            }
        }

    };

    addByteAction = new NBTAction("Add Byte", NBTConstants.TYPE_BYTE, "Add Byte", KeyEvent.VK_1) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('1', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new ByteTag("new byte", (byte) 0));
        }

    };

    addShortAction = new NBTAction("Add Short", NBTConstants.TYPE_SHORT, "Add Short", KeyEvent.VK_2) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('2', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new ShortTag("new short", (short) 0));
        }

    };

    addIntAction = new NBTAction("Add Integer", NBTConstants.TYPE_INT, "Add Integer", KeyEvent.VK_3) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('3', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new IntTag("new int", 0));
        }

    };

    addLongAction = new NBTAction("Add Long", NBTConstants.TYPE_LONG, "Add Long", KeyEvent.VK_4) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('4', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new LongTag("new long", 0));
        }

    };

    addFloatAction = new NBTAction("Add Float", NBTConstants.TYPE_FLOAT, "Add Float", KeyEvent.VK_5) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('5', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new FloatTag("new float", 0));
        }

    };

    addDoubleAction = new NBTAction("Add Double", NBTConstants.TYPE_DOUBLE, "Add Double", KeyEvent.VK_6) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('6', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new DoubleTag("new double", 0));
        }

    };

    addByteArrayAction = new NBTAction("Add Byte Array", NBTConstants.TYPE_BYTE_ARRAY, "Add Byte Array",
            KeyEvent.VK_7) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('7', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new ByteArrayTag("new byte array"));
        }

    };

    addStringAction = new NBTAction("Add String", NBTConstants.TYPE_STRING, "Add String", KeyEvent.VK_8) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('8', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new StringTag("new string", "..."));
        }

    };

    addListAction = new NBTAction("Add List Tag", NBTConstants.TYPE_LIST, "Add List Tag", KeyEvent.VK_9) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('9', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            Class<? extends Tag> type = queryType();
            if (type != null)
                addTag(new ListTag("new list", null, type));
        }

        private Class<? extends Tag> queryType() {
            Object[] items = { NBTConstants.TYPE_BYTE, NBTConstants.TYPE_SHORT, NBTConstants.TYPE_INT,
                    NBTConstants.TYPE_LONG, NBTConstants.TYPE_FLOAT, NBTConstants.TYPE_DOUBLE,
                    NBTConstants.TYPE_BYTE_ARRAY, NBTConstants.TYPE_STRING, NBTConstants.TYPE_LIST,
                    NBTConstants.TYPE_COMPOUND };
            JComboBox comboBox = new JComboBox(new DefaultComboBoxModel(items));
            comboBox.setRenderer(new DefaultListCellRenderer() {

                @Override
                public Component getListCellRendererComponent(JList list, Object value, int index,
                        boolean isSelected, boolean cellHasFocus) {
                    super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

                    if (value instanceof Integer) {
                        Integer i = (Integer) value;
                        Class<? extends Tag> c = NBTUtils.getTypeClass(i);
                        String name = NBTUtils.getTypeName(c);
                        setText(name);
                    }

                    return this;
                }

            });
            Object[] message = { new JLabel("Please select a type."), comboBox };
            String title = "Title goes here";
            int result = JOptionPane.showOptionDialog(TreeFrame.this, message, title,
                    JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
            switch (result) {
            case JOptionPane.OK_OPTION:
                ComboBoxModel model = comboBox.getModel();
                Object item = model.getSelectedItem();
                if (item instanceof Integer) {
                    Integer i = (Integer) item;
                    return NBTUtils.getTypeClass(i);
                }
            }
            return null;
        }

    };

    addCompoundAction = new NBTAction("Add Compound Tag", NBTConstants.TYPE_COMPOUND, "Add Compound Tag",
            KeyEvent.VK_0) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('0', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new CompoundTag());
        }

    };

    String name = "About " + TITLE;
    helpAction = new NBTAction(name, "Help", name, KeyEvent.VK_F1) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("F1"));
        }

        public void actionPerformed(ActionEvent e) {
            Object[] message = { new JLabel(TITLE + " " + VERSION),
                    new JLabel("\u00A9 Copyright Taggart Spilman 2011.  All rights reserved."),
                    new Hyperlink("<html><a href=\"#\">NamedBinaryTag.com</a></html>",
                            "http://www.namedbinarytag.com"),
                    new Hyperlink("<html><a href=\"#\">Contact</a></html>", "mailto:tagadvance@gmail.com"),
                    new JLabel(" "),
                    new Hyperlink("<html><a href=\"#\">JNBT was written by Graham Edgecombe</a></html>",
                            "http://jnbt.sf.net"),
                    new Hyperlink("<html><a href=\"#\">Available open-source under the BSD license</a></html>",
                            "http://jnbt.sourceforge.net/LICENSE.TXT"),
                    new JLabel(" "), new JLabel("This product includes software developed by"),
                    new Hyperlink("<html><a href=\"#\">The Apache Software Foundation</a>.</html>",
                            "http://www.apache.org"),
                    new JLabel(" "), new JLabel("Default texture pack:"),
                    new Hyperlink("<html><a href=\"#\">SOLID COLOUR. SOLID STYLE.</a></html>",
                            "http://www.minecraftforum.net/topic/72253-solid-colour-solid-style/"),
                    new JLabel("Bundled with the permission of Trigger_Proximity."),

            };
            String title = "About";
            JOptionPane.showMessageDialog(TreeFrame.this, message, title, JOptionPane.INFORMATION_MESSAGE);
        }

    };

}