List of usage examples for java.awt.event KeyEvent VK_P
int VK_P
To view the source code for java.awt.event KeyEvent VK_P.
Click Source Link
From source file:TextComponentDemo.java
protected void addBindings() { InputMap inputMap = textPane.getInputMap(); // Ctrl-b to go backward one character KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_B, Event.CTRL_MASK); inputMap.put(key, DefaultEditorKit.backwardAction); // Ctrl-f to go forward one character key = KeyStroke.getKeyStroke(KeyEvent.VK_F, Event.CTRL_MASK); inputMap.put(key, DefaultEditorKit.forwardAction); // Ctrl-p to go up one line key = KeyStroke.getKeyStroke(KeyEvent.VK_P, Event.CTRL_MASK); inputMap.put(key, DefaultEditorKit.upAction); // Ctrl-n to go down one line key = KeyStroke.getKeyStroke(KeyEvent.VK_N, Event.CTRL_MASK); inputMap.put(key, DefaultEditorKit.downAction); }
From source file:it.unibo.alchemist.boundary.monitors.Generic2DDisplay.java
private void bindKeys() { bindKey(KeyEvent.VK_S, () -> { if (status == ViewStatus.SELECTING) { resetStatus();// w w w . j ava2s . c o m this.selectedNodes.clear(); } else if (!isInteracting()) { this.status = ViewStatus.SELECTING; } this.repaint(); }); bindKey(KeyEvent.VK_O, () -> { if (status == ViewStatus.SELECTING) { this.status = ViewStatus.MOVING; } }); bindKey(KeyEvent.VK_C, () -> { if (status == ViewStatus.SELECTING) { this.status = ViewStatus.CLONING; } }); bindKey(KeyEvent.VK_E, () -> { if (status == ViewStatus.SELECTING) { this.status = ViewStatus.MOLECULING; final JFrame mol = Generic2DDisplay.makeFrame("Moleculing", new MoleculeInjectorGUI<>(selectedNodes)); mol.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); mol.addWindowListener(new WindowAdapter() { @Override public void windowClosed(final WindowEvent e) { selectedNodes.clear(); resetStatus(); } }); } }); bindKey(KeyEvent.VK_D, () -> { if (status == ViewStatus.SELECTING) { this.status = ViewStatus.DELETING; for (final Node<T> n : selectedNodes) { currentEnv.removeNode(n); } final Simulation<T> sim = currentEnv.getSimulation(); sim.schedule(() -> update(currentEnv, sim.getTime())); resetStatus(); } }); bindKey(KeyEvent.VK_M, () -> setMarkCloserNode(!isCloserNodeMarked())); bindKey(KeyEvent.VK_L, () -> setDrawLinks(!paintLinks)); bindKey(KeyEvent.VK_P, () -> Optional.ofNullable(currentEnv.getSimulation()).ifPresent(sim -> { if (sim.getStatus() == Status.RUNNING) { sim.pause(); } else { sim.play(); } })); bindKey(KeyEvent.VK_R, () -> setRealTime(!isRealTime())); bindKey(KeyEvent.VK_LEFT, () -> setStep(Math.max(1, st - Math.max(st / 10, 1)))); bindKey(KeyEvent.VK_RIGHT, () -> setStep(Math.max(st, st + Math.max(st / 10, 1)))); }
From source file:org.eurocarbdb.application.glycoworkbench.plugin.SpectraPanel.java
protected void createActions() { theActionManager.add("mslevel=ms", FileUtils.defaultThemeManager.getImageIcon("msms"), "Change current scan level", -1, "", this); theActionManager.add("mslevel=msms", FileUtils.defaultThemeManager.getImageIcon("ms"), "Change current scan level", -1, "", this); theActionManager.add("updateisotopecurves=true", FileUtils.defaultThemeManager.getImageIcon("isotopesoff"), "Automatic computation of isotopic distributions inactive", -1, "", this); theActionManager.add("updateisotopecurves=false", FileUtils.defaultThemeManager.getImageIcon("isotopeson"), "Automatic computation of isotopic distributions active", -1, "", this); theActionManager.add("showallisotopes=true", FileUtils.defaultThemeManager.getImageIcon("ftmodeoff"), "FTICR mode inactive", -1, "", this); theActionManager.add("showallisotopes=false", FileUtils.defaultThemeManager.getImageIcon("ftmodeon"), "FTICR mode active", -1, "", this); theActionManager.add("close", FileUtils.defaultThemeManager.getImageIcon("close"), "Close structure", KeyEvent.VK_S, "", this); theActionManager.add("previous", FileUtils.defaultThemeManager.getImageIcon("previous"), "Previous structure", KeyEvent.VK_L, "", this); theActionManager.add("next", FileUtils.defaultThemeManager.getImageIcon("next"), "Next structure", KeyEvent.VK_N, "", this); theActionManager.add("edit", FileUtils.defaultThemeManager.getImageIcon("edit"), "Edit scan data", -1, "", this); theActionManager.add("new", FileUtils.defaultThemeManager.getImageIcon("new"), "Clear", KeyEvent.VK_N, "", this); theActionManager.add("openspectra", FileUtils.defaultThemeManager.getImageIcon("openspectra"), "Open Spectra", KeyEvent.VK_O, "", this); theActionManager.add("print", FileUtils.defaultThemeManager.getImageIcon("print"), "Print...", KeyEvent.VK_P, "", this); theActionManager.add("addpeaks", FileUtils.defaultThemeManager.getImageIcon("addpeaks"), "Add selected peaks to list", -1, "", this); theActionManager.add("annotatepeaks", FileUtils.defaultThemeManager.getImageIcon("annotatepeaks"), "Find possible annotations for selected peaks", -1, "", this); theActionManager.add("baselinecorrection", FileUtils.defaultThemeManager.getImageIcon("baseline"), "Baseline correction of current spectrum", -1, "", this); theActionManager.add("noisefilter", FileUtils.defaultThemeManager.getImageIcon("noisefilter"), "Filter noise in current spectrum", -1, "", this); theActionManager.add("centroid", FileUtils.defaultThemeManager.getImageIcon("centroid"), "Compute peak centroids", -1, "", this); theActionManager.add("arrow", FileUtils.defaultThemeManager.getImageIcon("arrow"), "Activate zoom", -1, "", this); theActionManager.add("hand", FileUtils.defaultThemeManager.getImageIcon("hand"), "Activate moving", -1, "", this); theActionManager.add("zoomnone", FileUtils.defaultThemeManager.getImageIcon("zoomnone"), "Reset zoom", -1, "", this); theActionManager.add("zoomin", FileUtils.defaultThemeManager.getImageIcon("zoomin"), "Zoom in", -1, "", this); theActionManager.add("zoomout", FileUtils.defaultThemeManager.getImageIcon("zoomout"), "Zoom out", -1, "", this); }
From source file:TextComponentDemo.java
protected void addBindings() { InputMap inputMap = textPane.getInputMap(); //Ctrl-b to go backward one character KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_B, Event.CTRL_MASK); inputMap.put(key, DefaultEditorKit.backwardAction); //Ctrl-f to go forward one character key = KeyStroke.getKeyStroke(KeyEvent.VK_F, Event.CTRL_MASK); inputMap.put(key, DefaultEditorKit.forwardAction); //Ctrl-p to go up one line key = KeyStroke.getKeyStroke(KeyEvent.VK_P, Event.CTRL_MASK); inputMap.put(key, DefaultEditorKit.upAction); //Ctrl-n to go down one line key = KeyStroke.getKeyStroke(KeyEvent.VK_N, Event.CTRL_MASK); inputMap.put(key, DefaultEditorKit.downAction); }
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);//from w w w .j a va2 s. c o m 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:javazoom.jlgui.player.amp.StandalonePlayer.java
/** * Install keyboard shortcuts./* w ww.j a v a 2 s .c om*/ */ public void setKeyBoardShortcut() { KeyStroke jKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_J, 0, false); KeyStroke ctrlPKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_P, KeyEvent.CTRL_MASK, false); KeyStroke altSKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.ALT_MASK, false); KeyStroke vKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V, 0, false); String searchID = "TAGSEARCH"; String preferenceID = "PREFERENCES"; String skinbrowserID = "SKINBROWSER"; String stopplayerID = "STOPPLAYER"; Action searchAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (mp != null) mp.processJumpToFile(e.getModifiers()); } }; Action preferencesAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (mp != null) mp.processPreferences(e.getModifiers()); } }; Action skinbrowserAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (mp != null) mp.processSkinBrowser(e.getModifiers()); } }; Action stopplayerAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (mp != null) mp.processStop(MouseEvent.BUTTON1_MASK); } }; setKeyboardAction(searchID, jKeyStroke, searchAction); setKeyboardAction(preferenceID, ctrlPKeyStroke, preferencesAction); setKeyboardAction(skinbrowserID, altSKeyStroke, skinbrowserAction); setKeyboardAction(stopplayerID, vKeyStroke, stopplayerAction); }
From source file:org.intermine.install.swing.ProjectEditor.java
/** * Common initialisation: lays out the child components and wires up the necessary * event listeners. //from w w w . j av a 2s. c om */ private void init() { setName("Project Editor Frame"); setTitle(Messages.getMessage("projecteditor.title")); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(new MyWindowListener()); modelViewerFrame = new JFrame(); modelViewerFrame.setName("Model Viewer Frame"); modelViewer = new ModelViewer(); modelViewerFrame.setContentPane(modelViewer); modelViewerFrame.setTitle(Messages.getMessage("modelviewer.title")); modelViewerFrame.setSize(800, 600); newMineDialog = new NewMineDialog(this); createDatabaseDialog = new CreateDatabaseDialog(this); newMineDialog.setCreateDatabaseDialog(createDatabaseDialog); createPropertiesDialog = new CreatePropertiesDialog(this); createDatabaseDialog.setCreatePropertiesDialog(createPropertiesDialog); makeMineDialog = new MakeMineDialog(this); createPropertiesDialog.setMakeMineDialog(makeMineDialog); addSourceDialog = new AddSourceDialog(this); newDerivedSourceDialog = new NewDerivedTypeDialog(this); addSourceDialog.setNewDerivedDialog(newDerivedSourceDialog); postProcessorDialog = new PostProcessorDialog(this); buildProjectDialog = new BuildProjectDialog(this); preferencesDialog = new PreferencesDialog(this); ProjectListener projectListener = new MyProjectListener(); addSourceDialog.addProjectListener(projectListener); newDerivedSourceDialog.addProjectListener(projectListener); postProcessorDialog.addProjectListener(projectListener); sourcePanel.addProjectListener(projectListener); makeMineDialog.addProjectListener(projectListener); addProjectListener(projectListener); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); JMenu fileMenu = new JMenu(Messages.getMessage("file")); fileMenu.setMnemonic(KeyEvent.VK_P); menuBar.add(fileMenu); fileMenu.add(new NewMineAction()); fileMenu.add(new OpenAction()); fileMenu.addSeparator(); fileMenu.add(saveAction); fileMenu.addSeparator(); fileMenu.add(buildProjectAction); JMenu editMenu = new JMenu(Messages.getMessage("edit")); editMenu.setMnemonic(KeyEvent.VK_E); menuBar.add(editMenu); editMenu.add(addSourceAction); editMenu.add(deleteSourceAction); editMenu.addSeparator(); editMenu.add(postProcessorAction); JMenu viewMenu = new JMenu(Messages.getMessage("view")); viewMenu.setMnemonic(KeyEvent.VK_M); menuBar.add(viewMenu); viewMenu.add(new ViewModelAction()); JMenu toolsMenu = new JMenu(Messages.getMessage("tools")); toolsMenu.setMnemonic(KeyEvent.VK_T); menuBar.add(toolsMenu); toolsMenu.add(new PreferencesAction()); sourceListModel = new SourceListModel(); sourceList = new JList(sourceListModel); Container cp = getContentPane(); cp.setLayout(new BorderLayout()); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); cp.add(splitPane, BorderLayout.CENTER); initButtonPanel(); Box vbox = Box.createVerticalBox(); vbox.add(sourcePanel); vbox.add(buttonPanel); splitPane.setLeftComponent(new JScrollPane(sourceList)); splitPane.setRightComponent(vbox); splitPane.setDividerLocation(200); initStatusPanel(); cp.add(statusPanel, BorderLayout.SOUTH); sourceList.setCellRenderer(new SourceListRenderer()); sourceList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sourceList.addListSelectionListener(new SourceListSelectionListener()); statusMessageClearTimer = new Timer(4000, new StatusMessageClearer()); statusMessageClearTimer.setInitialDelay(4000); statusMessageClearTimer.setRepeats(false); setSize(800, 600); }
From source file:org.photovault.swingui.PhotoCollectionThumbView.java
void createUI() { photoTransferHandler = new PhotoCollectionTransferHandler(this); setTransferHandler(photoTransferHandler); setAutoscrolls(true);/*w w w. j a va 2 s . co m*/ addMouseListener(this); addMouseMotionListener(this); // Create the popup menu popup = new JPopupMenu(); ImageIcon propsIcon = getIcon("view_properties.png"); editSelectionPropsAction = new EditSelectionPropsAction(this, "Properties...", propsIcon, "Edit properties of the selected photos", KeyEvent.VK_P); JMenuItem propsItem = new JMenuItem(editSelectionPropsAction); ImageIcon colorsIcon = getIcon("colors.png"); editSelectionColorsAction = new EditSelectionColorsAction(this, null, "Adjust colors...", colorsIcon, "Adjust colors of the selected photos", KeyEvent.VK_A); JMenuItem colorsItem = new JMenuItem(editSelectionColorsAction); ImageIcon showIcon = getIcon("show_new_window.png"); showSelectedPhotoAction = new ShowSelectedPhotoAction(this, "Show image", showIcon, "Show the selected phot(s)", KeyEvent.VK_S); JMenuItem showItem = new JMenuItem(showSelectedPhotoAction); showHistoryAction = new ShowPhotoHistoryAction(this, "Show history", null, "Show history of selected photo", KeyEvent.VK_H, null); resolveConflictsAction = new ResolvePhotoConflictsAction(this, "Resolve conflicts", null, "Resolve synchronization conflicts", KeyEvent.VK_R, null); JMenuItem rotateCW = new JMenuItem(ctrl.getActionAdapter("rotate_cw")); JMenuItem rotateCCW = new JMenuItem(ctrl.getActionAdapter("rotate_ccw")); JMenuItem rotate180deg = new JMenuItem(ctrl.getActionAdapter("rotate_180")); JMenuItem addToFolder = new JMenuItem("Add to folder..."); addToFolder.addActionListener(this); addToFolder.setActionCommand(PHOTO_ADD_TO_FOLDER_CMD); addToFolder.setIcon(getIcon("empty_icon.png")); ImageIcon exportIcon = getIcon("filesave.png"); exportSelectedAction = new ExportSelectedAction(this, "Export selected...", exportIcon, "Export the selected photos to from archive database to image files", KeyEvent.VK_E); JMenuItem exportSelected = new JMenuItem(exportSelectedAction); ImageIcon deleteSelectedIcon = getIcon("delete_image.png"); deleteSelectedAction = new DeletePhotoAction(this, "Delete", deleteSelectedIcon, "Delete selected photos including all of their instances", KeyEvent.VK_D); JMenuItem deleteSelected = new JMenuItem(deleteSelectedAction); starIcon = getIcon("star_normal_border.png"); rejectedIcon = getIcon("quality_unusable.png"); rawIcon = getIcon("raw_icon.png"); JMenuItem showHistory = new JMenuItem(showHistoryAction); JMenuItem resolveConflicts = new JMenuItem(resolveConflictsAction); AddTagAction addTagAction = new AddTagAction(ctrl, "Add tag...", null, "Add tag to image", KeyEvent.VK_T); JMenuItem addTag = new JMenuItem(addTagAction); popup.add(showItem); popup.add(propsItem); popup.add(colorsItem); popup.add(rotateCW); popup.add(rotateCCW); popup.add(rotate180deg); popup.add(addToFolder); popup.add(exportSelected); popup.add(deleteSelected); popup.add(showHistory); popup.add(resolveConflicts); popup.add(addTag); MouseListener popupListener = new PopupListener(); addMouseListener(popupListener); ImageIcon selectNextIcon = getIcon("next.png"); selectNextAction = new ChangeSelectionAction(this, ChangeSelectionAction.MOVE_FWD, "Next photo", selectNextIcon, "Move to next photo", KeyEvent.VK_N, KeyStroke.getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); ImageIcon selectPrevIcon = getIcon("previous.png"); selectPrevAction = new ChangeSelectionAction(this, ChangeSelectionAction.MOVE_BACK, "Previous photo", selectPrevIcon, "Move to previous photo", KeyEvent.VK_P, KeyStroke.getKeyStroke(KeyEvent.VK_P, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); creatingThumbIcon = getIcon("creating_thumb.png"); }
From source file:edu.harvard.mcz.imagecapture.encoder.UnitTrayLabelBrowser.java
/** * This method initializes jMenuItem1 * // ww w .j a va2 s. co m * @return javax.swing.JMenuItem */ private JMenuItem getJMenuItem1() { if (jMenuItemPaste == null) { jMenuItemPaste = new JMenuItem(new DefaultEditorKit.PasteAction()); jMenuItemPaste.setText("Paste"); jMenuItemPaste.setMnemonic(KeyEvent.VK_P); jMenuItemPaste.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.CTRL_MASK)); jMenuItemPaste.setEnabled(true); } return jMenuItemPaste; }
From source file:com.adobe.aem.demomachine.gui.AemDemo.java
@SuppressWarnings({ "rawtypes", "unchecked" }) private void initialize() { // Initialize properties setDefaultProperties(AemDemoUtils/*from w w w . ja v a 2s .c o m*/ .loadProperties(buildFile.getParentFile().getAbsolutePath() + File.separator + "build.properties")); setPersonalProperties(AemDemoUtils.loadProperties(buildFile.getParentFile().getAbsolutePath() + File.separator + "conf" + File.separator + "build-personal.properties")); // Constructing the main frame frameMain = new JFrame(); frameMain.setBounds(100, 100, 700, 530); frameMain.getContentPane().setLayout(null); // Main menu bar for the Frame JMenuBar menuBar = new JMenuBar(); JMenu mnAbout = new JMenu("AEM Demo Machine"); mnAbout.setMnemonic(KeyEvent.VK_A); menuBar.add(mnAbout); JMenuItem mntmUpdates = new JMenuItem("Check for Updates"); mntmUpdates.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_R, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); mntmUpdates.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "demo_update"); } }); mnAbout.add(mntmUpdates); JMenuItem mntmDoc = new JMenuItem("Help and Documentation"); mntmDoc.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_H, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); mntmDoc.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.openWebpage(AemDemoUtils.getActualPropertyValue(defaultProperties, personalProperties, AemDemoConstants.OPTIONS_DOCUMENTATION)); } }); mnAbout.add(mntmDoc); JMenuItem mntmScripts = new JMenuItem("Demo Scripts (VPN)"); mntmScripts.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.openWebpage(AemDemoUtils.getActualPropertyValue(defaultProperties, personalProperties, AemDemoConstants.OPTIONS_SCRIPTS)); } }); mnAbout.add(mntmScripts); JMenuItem mntmDiagnostics = new JMenuItem("Diagnostics"); mntmDiagnostics.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Map<String, String> env = System.getenv(); System.out.println("====== System Environment Variables ======"); for (String envName : env.keySet()) { System.out.format("%s=%s%n", envName, env.get(envName)); } System.out.println("====== JVM Properties ======"); RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean(); List<String> jvmArgs = runtimeMXBean.getInputArguments(); for (String arg : jvmArgs) { System.out.println(arg); } System.out.println("====== Runtime Properties ======"); Properties props = System.getProperties(); props.list(System.out); } }); mnAbout.add(mntmDiagnostics); JMenuItem mntmQuit = new JMenuItem("Quit"); mntmQuit.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_Q, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); mntmQuit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(-1); } }); mnAbout.add(mntmQuit); JMenu mnNew = new JMenu("New"); menuBar.add(mnNew); // New Demo Machine JMenuItem mntmNewDemo = new JMenuItem("Demo Environment"); mntmNewDemo.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); mntmNewDemo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (AemDemo.this.getBuildInProgress()) { JOptionPane.showMessageDialog(null, "A Demo Environment is currently being built. Please wait until it is finished."); } else { final AemDemoNew dialogNew = new AemDemoNew(AemDemo.this); dialogNew.setModal(true); dialogNew.setVisible(true); dialogNew.getDemoBuildName().requestFocus(); ; } } }); mnNew.add(mntmNewDemo); JMenuItem mntmNewOptions = new JMenuItem("Demo Properties"); mntmNewOptions.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_P, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); mntmNewOptions.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final AemDemoOptions dialogOptions = new AemDemoOptions(AemDemo.this); dialogOptions.setModal(true); dialogOptions.setVisible(true); } }); mnNew.add(mntmNewOptions); JMenu mnUpdate = new JMenu("Add-ons"); menuBar.add(mnUpdate); // Sites Add-on JMenu mnSites = new JMenu("Sites"); mnUpdate.add(mnSites); JMenuItem mntmSitesDownloadAddOn = new JMenuItem("Download Demo Add-on"); mntmSitesDownloadAddOn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_sites"); } }); mnSites.add(mntmSitesDownloadAddOn); JMenuItem mntmSitesDownloadFP = new JMenuItem("Download Packages (PackageShare)"); mntmSitesDownloadFP.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_sites_packages"); } }); mnSites.add(mntmSitesDownloadFP); // Assets Add-on JMenu mnAssets = new JMenu("Assets"); mnUpdate.add(mnAssets); JMenuItem mntmAssetsDownloadAddOn = new JMenuItem("Download Demo Add-on"); mntmAssetsDownloadAddOn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_assets"); } }); mnAssets.add(mntmAssetsDownloadAddOn); JMenuItem mntmAssetsDownloadFP = new JMenuItem("Download Packages (PackageShare)"); mntmAssetsDownloadFP.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_assets_packages"); } }); mnAssets.add(mntmAssetsDownloadFP); // Communities Add-on JMenu mnCommunities = new JMenu("Communities/Livefyre"); mnUpdate.add(mnCommunities); JMenuItem mntmAemCommunitiesFeaturePacks = new JMenuItem("Download Packages (PackageShare)"); mntmAemCommunitiesFeaturePacks.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_communities_packages"); } }); mnCommunities.add(mntmAemCommunitiesFeaturePacks); // Forms Add-on JMenu mnForms = new JMenu("Forms"); mnUpdate.add(mnForms); JMenuItem mntmAemFormsAddon = new JMenuItem("Download Demo Add-on"); mntmAemFormsAddon.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_forms"); } }); mnForms.add(mntmAemFormsAddon); JMenuItem mntmAemFormsFP = new JMenuItem("Download Packages (PackageShare)"); mntmAemFormsFP.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_forms_packages"); } }); mnForms.add(mntmAemFormsFP); // Mobile Add-on JMenu mnApps = new JMenu("Mobile"); mnUpdate.add(mnApps); JMenuItem mntmAemAppsAddon = new JMenuItem("Download Demo Add-on"); mntmAemAppsAddon.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_apps"); } }); mnApps.add(mntmAemAppsAddon); JMenuItem mntmAemApps = new JMenuItem("Download Packages (PackageShare)"); mntmAemApps.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_apps_packages"); } }); mnApps.add(mntmAemApps); // Commerce Add-on JMenu mnCommerce = new JMenu("Commerce"); mnUpdate.add(mnCommerce); JMenu mnCommerceDownload = new JMenu("Download Packages"); mnCommerce.add(mnCommerceDownload); // Commerce EP JMenuItem mnCommerceDownloadEP = new JMenuItem("ElasticPath (PackageShare)"); mnCommerceDownloadEP.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_commerce_ep"); } }); mnCommerceDownload.add(mnCommerceDownloadEP); // Commerce WebSphere JMenuItem mnCommerceDownloadWAS = new JMenuItem("WebSphere (PackageShare)"); mnCommerceDownloadWAS.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_commerce_websphere"); } }); mnCommerceDownload.add(mnCommerceDownloadWAS); // WeRetail Add-on JMenu mnWeRetail = new JMenu("We-Retail"); mnUpdate.add(mnWeRetail); JMenuItem mnWeRetailAddon = new JMenuItem("Download Demo Add-on"); mnWeRetailAddon.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_weretail"); } }); mnWeRetail.add(mnWeRetailAddon); // Download all section mnUpdate.addSeparator(); JMenuItem mntmAemDownloadAll = new JMenuItem("Download All Add-ons"); mntmAemDownloadAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_all"); } }); mnUpdate.add(mntmAemDownloadAll); JMenu mnInfrastructure = new JMenu("Infrastructure"); menuBar.add(mnInfrastructure); JMenu mnMongo = new JMenu("MongoDB"); JMenuItem mntmInfraMongoDB = new JMenuItem("Download"); mntmInfraMongoDB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_mongo"); } }); mnMongo.add(mntmInfraMongoDB); JMenuItem mntmInfraMongoDBInstall = new JMenuItem("Install"); mntmInfraMongoDBInstall.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "install_mongo"); } }); mnMongo.add(mntmInfraMongoDBInstall); mnMongo.addSeparator(); JMenuItem mntmInfraMongoDBStart = new JMenuItem("Start"); mntmInfraMongoDBStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "mongo_start"); } }); mnMongo.add(mntmInfraMongoDBStart); JMenuItem mntmInfraMongoDBStop = new JMenuItem("Stop"); mntmInfraMongoDBStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "mongo_stop"); } }); mnMongo.add(mntmInfraMongoDBStop); mnInfrastructure.add(mnMongo); // SOLR options JMenu mnSOLR = new JMenu("SOLR"); JMenuItem mntmInfraSOLR = new JMenuItem("Download"); mntmInfraSOLR.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_solr"); } }); mnSOLR.add(mntmInfraSOLR); JMenuItem mntmInfraSOLRInstall = new JMenuItem("Install"); mntmInfraSOLRInstall.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "install_solr"); } }); mnSOLR.add(mntmInfraSOLRInstall); mnSOLR.addSeparator(); JMenuItem mntmInfraSOLRStart = new JMenuItem("Start"); mntmInfraSOLRStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "solr_start"); } }); mnSOLR.add(mntmInfraSOLRStart); JMenuItem mntmInfraSOLRStop = new JMenuItem("Stop"); mntmInfraSOLRStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "solr_stop"); } }); mnSOLR.add(mntmInfraSOLRStop); mnInfrastructure.add(mnSOLR); // MySQL options JMenu mnMySQL = new JMenu("MySQL"); JMenuItem mntmInfraMysql = new JMenuItem("Download"); mntmInfraMysql.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_mysql"); } }); mnMySQL.add(mntmInfraMysql); JMenuItem mntmInfraMysqlInstall = new JMenuItem("Install"); mntmInfraMysqlInstall.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "install_mysql"); } }); mnMySQL.add(mntmInfraMysqlInstall); mnMySQL.addSeparator(); JMenuItem mntmInfraMysqlStart = new JMenuItem("Start"); mntmInfraMysqlStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "mysql_start"); } }); mnMySQL.add(mntmInfraMysqlStart); JMenuItem mntmInfraMysqlStop = new JMenuItem("Stop"); mntmInfraMysqlStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "mysql_stop"); } }); mnMySQL.add(mntmInfraMysqlStop); mnInfrastructure.add(mnMySQL); // James options JMenu mnJames = new JMenu("James SMTP/POP"); JMenuItem mntmInfraJames = new JMenuItem("Download"); mntmInfraJames.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_james"); } }); mnJames.add(mntmInfraJames); JMenuItem mntmInfraJamesInstall = new JMenuItem("Install"); mntmInfraJamesInstall.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "install_james"); } }); mnJames.add(mntmInfraJamesInstall); mnJames.addSeparator(); JMenuItem mntmInfraJamesStart = new JMenuItem("Start"); mntmInfraJamesStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "james_start"); } }); mnJames.add(mntmInfraJamesStart); JMenuItem mntmInfraJamesStop = new JMenuItem("Stop"); mntmInfraJamesStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "james_stop"); } }); mnJames.add(mntmInfraJamesStop); mnInfrastructure.add(mnJames); // FFMPEPG options JMenu mnFFMPEG = new JMenu("FFMPEG"); JMenuItem mntmInfraFFMPEG = new JMenuItem("Download"); mntmInfraFFMPEG.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_ffmpeg"); } }); mnFFMPEG.add(mntmInfraFFMPEG); JMenuItem mntmInfraFFMPEGInstall = new JMenuItem("Install"); mntmInfraFFMPEGInstall.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "install_ffmpeg"); } }); mnFFMPEG.add(mntmInfraFFMPEGInstall); mnInfrastructure.add(mnFFMPEG); mnInfrastructure.addSeparator(); // InDesignServer options JMenu mnInDesignServer = new JMenu("InDesign Server"); JMenuItem mntmInfraInDesignServerDownload = new JMenuItem("Download"); mntmInfraInDesignServerDownload.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_indesignserver"); } }); mnInDesignServer.add(mntmInfraInDesignServerDownload); mnInDesignServer.addSeparator(); JMenuItem mntmInfraInDesignServerStart = new JMenuItem("Start"); mntmInfraInDesignServerStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "start_indesignserver"); } }); mnInDesignServer.add(mntmInfraInDesignServerStart); JMenuItem mntmInfraInDesignServerStop = new JMenuItem("Stop"); mntmInfraInDesignServerStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "stop_indesignserver"); } }); mnInDesignServer.add(mntmInfraInDesignServerStop); mnInfrastructure.add(mnInDesignServer); mnInfrastructure.addSeparator(); JMenuItem mntmInfraInstall = new JMenuItem("All in One Setup"); mntmInfraInstall.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "infrastructure"); } }); mnInfrastructure.add(mntmInfraInstall); JMenu mnOther = new JMenu("Other"); menuBar.add(mnOther); JMenu mntmAemDownload = new JMenu("AEM & License files (VPN)"); JMenuItem mntmAemLoad = new JMenuItem("Download Latest AEM Load"); mntmAemLoad.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_L, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); mntmAemLoad.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_load"); } }); mntmAemDownload.add(mntmAemLoad); JMenuItem mntmAemSnapshot = new JMenuItem("Download Latest AEM Snapshot"); mntmAemSnapshot.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_T, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); mntmAemSnapshot.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_snapshot"); } }); mntmAemDownload.add(mntmAemSnapshot); JMenuItem mntmAemDownloadAEM62 = new JMenuItem("Download AEM 6.2"); mntmAemDownloadAEM62.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_aem62"); } }); mntmAemDownload.add(mntmAemDownloadAEM62); JMenuItem mntmAemDownloadAEM61 = new JMenuItem("Download AEM 6.1"); mntmAemDownloadAEM61.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_aem61"); } }); mntmAemDownload.add(mntmAemDownloadAEM61); JMenuItem mntmAemDownloadAEM60 = new JMenuItem("Download AEM 6.0"); mntmAemDownloadAEM60.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_aem60"); } }); mntmAemDownload.add(mntmAemDownloadAEM60); JMenuItem mntmAemDownloadCQ561 = new JMenuItem("Download CQ 5.6.1"); mntmAemDownloadCQ561.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_cq561"); } }); mntmAemDownload.add(mntmAemDownloadCQ561); JMenuItem mntmAemDownloadCQ56 = new JMenuItem("Download CQ 5.6"); mntmAemDownloadCQ56.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_cq56"); } }); mntmAemDownload.add(mntmAemDownloadCQ56); JMenuItem mntmAemDownloadOthers = new JMenuItem("Other Releases & License files"); mntmAemDownloadOthers.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.openWebpage(AemDemoUtils.getActualPropertyValue(defaultProperties, personalProperties, AemDemoConstants.OPTIONS_DOWNLOAD)); } }); mntmAemDownload.add(mntmAemDownloadOthers); mnOther.add(mntmAemDownload); JMenuItem mntmAemHotfix = new JMenuItem("Download Latest Hotfixes (PackageShare)"); mntmAemHotfix.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_F, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); mntmAemHotfix.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_hotfixes_packages"); } }); mnOther.add(mntmAemHotfix); JMenuItem mntmAemAcs = new JMenuItem("Download Latest ACS Commons and Tools"); mntmAemAcs.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); mntmAemAcs.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_acs"); } }); mnOther.add(mntmAemAcs); // Adding the menu bar frameMain.setJMenuBar(menuBar); // Adding other form elements JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(24, 163, 650, 230); frameMain.getContentPane().add(scrollPane); final JTextArea textArea = new JTextArea(""); textArea.setEditable(false); scrollPane.setViewportView(textArea); // List of demo machines available JScrollPane scrollDemoList = new JScrollPane(); scrollDemoList.setBounds(24, 34, 208, 100); frameMain.getContentPane().add(scrollDemoList); listModelDemoMachines = AemDemoUtils.listDemoMachines(buildFile.getParentFile().getAbsolutePath()); listDemoMachines = new JList(listModelDemoMachines); listDemoMachines.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listDemoMachines.setSelectedIndex(AemDemoUtils.getSelectedIndex(listDemoMachines, this.getDefaultProperties(), this.getPersonalProperties(), AemDemoConstants.OPTIONS_BUILD_DEFAULT)); scrollDemoList.setViewportView(listDemoMachines); // Capturing the output stream of ANT commands AemDemoOutputStream out = new AemDemoOutputStream(textArea); System.setOut(new PrintStream(out)); JButton btnStart = new JButton("Start"); btnStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "start"); } }); btnStart.setBounds(250, 29, 117, 29); frameMain.getContentPane().add(btnStart); // Set Start as the default button JRootPane rootPane = SwingUtilities.getRootPane(btnStart); rootPane.setDefaultButton(btnStart); JButton btnInfo = new JButton("Details"); btnInfo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "details"); } }); btnInfo.setBounds(250, 59, 117, 29); frameMain.getContentPane().add(btnInfo); // Rebuild action JButton btnRebuild = new JButton("Rebuild"); btnRebuild.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (AemDemo.this.getBuildInProgress()) { JOptionPane.showMessageDialog(null, "A Demo Environment is currently being built. Please wait until it is finished."); } else { final AemDemoRebuild dialogRebuild = new AemDemoRebuild(AemDemo.this); dialogRebuild.setModal(true); dialogRebuild.setVisible(true); dialogRebuild.getDemoBuildName().requestFocus(); ; } } }); btnRebuild.setBounds(250, 89, 117, 29); frameMain.getContentPane().add(btnRebuild); // Stop action JButton btnStop = new JButton("Stop"); btnStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int dialogResult = JOptionPane.showConfirmDialog(null, "Are you sure you really want to stop the running instances?", "Warning", JOptionPane.YES_NO_OPTION); if (dialogResult == JOptionPane.NO_OPTION) { return; } AemDemoUtils.antTarget(AemDemo.this, "stop"); } }); btnStop.setBounds(500, 29, 117, 29); frameMain.getContentPane().add(btnStop); JButton btnExit = new JButton("Exit"); btnExit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(-1); } }); btnExit.setBounds(550, 408, 117, 29); frameMain.getContentPane().add(btnExit); JButton btnClear = new JButton("Clear"); btnClear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textArea.setText(""); } }); btnClear.setBounds(40, 408, 117, 29); frameMain.getContentPane().add(btnClear); JButton btnBackup = new JButton("Backup"); btnBackup.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "backup"); } }); btnBackup.setBounds(500, 59, 117, 29); frameMain.getContentPane().add(btnBackup); JButton btnRestore = new JButton("Restore"); btnRestore.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "restore"); } }); btnRestore.setBounds(500, 89, 117, 29); frameMain.getContentPane().add(btnRestore); JButton btnDelete = new JButton("Delete"); btnDelete.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int dialogResult = JOptionPane.showConfirmDialog(null, "Are you sure you really want to permanently delete the selected demo configuration?", "Warning", JOptionPane.YES_NO_OPTION); if (dialogResult == JOptionPane.NO_OPTION) { return; } AemDemoUtils.antTarget(AemDemo.this, "uninstall"); } }); btnDelete.setBounds(500, 119, 117, 29); frameMain.getContentPane().add(btnDelete); JLabel lblSelectYourDemo = new JLabel("Select your Demo Environment"); lblSelectYourDemo.setBounds(24, 10, 219, 16); frameMain.getContentPane().add(lblSelectYourDemo); JLabel lblCommandOutput = new JLabel("Command Output"); lblCommandOutput.setBounds(24, 143, 160, 16); frameMain.getContentPane().add(lblCommandOutput); // Initializing and launching the ticker String tickerOn = AemDemoUtils.getPropertyValue(buildFile, "demo.ticker"); if (tickerOn == null || (tickerOn != null && tickerOn.equals("true"))) { AemDemoMarquee mp = new AemDemoMarquee(AemDemoConstants.Credits, 60); mp.setBounds(140, 440, 650, 30); frameMain.getContentPane().add(mp); mp.start(); } // Launching the download tracker task AemDemoDownload aemDownload = new AemDemoDownload(AemDemo.this); ScheduledExecutorService executor = Executors.newScheduledThreadPool(1); executor.scheduleAtFixedRate(aemDownload, 0, 5, TimeUnit.SECONDS); // Loading up the README.md file String line = null; try { FileReader fileReader = new FileReader( buildFile.getParentFile().getAbsolutePath() + File.separator + "README.md"); BufferedReader bufferedReader = new BufferedReader(fileReader); while ((line = bufferedReader.readLine()) != null) { if (line.indexOf("AEM Demo Machine!") > 0) { line = line + " (version: " + aemDemoMachineVersion + ")"; } if (!line.startsWith("Double")) System.out.println(line); } bufferedReader.close(); } catch (Exception ex) { logger.error(ex.getMessage()); } }