List of usage examples for javax.swing JToolBar JToolBar
public JToolBar()
HORIZONTAL
. From source file:com.declarativa.interprolog.gui.Ini3.java
private void graphComponents() throws IOException { Forest<String, Integer> forest = new DelegateForest<>(); ObservableGraph g = new ObservableGraph(new BalloonLayoutDemo().createTree(forest)); Layout layout = new BalloonLayout(forest); //Layout layout = new TreeLayout(forest, 70, 70); final BaseJungScene scene = new SceneImpl(g, layout); jLayeredPane1.setLayout(new BorderLayout()); //jf.setLayout(new BorderLayout()); jLayeredPane1.add(new JScrollPane(scene.createView()), BorderLayout.CENTER); //jf.add(new JScrollPane(scene.createView()), BorderLayout.CENTER); JToolBar bar = new JToolBar(); bar.setMargin(new Insets(5, 5, 5, 5)); bar.setLayout(new FlowLayout(5)); DefaultComboBoxModel<Layout> mdl = new DefaultComboBoxModel<>(); mdl.addElement(new KKLayout(g)); mdl.addElement(layout);// ww w . j a va 2 s .co m mdl.addElement(new BalloonLayout(forest)); mdl.addElement(new RadialTreeLayout(forest)); mdl.addElement(new CircleLayout(g)); mdl.addElement(new FRLayout(g)); mdl.addElement(new FRLayout2(g)); mdl.addElement(new ISOMLayout(g)); mdl.addElement(new SpringLayout(g)); mdl.addElement(new SpringLayout2(g)); mdl.addElement(new DAGLayout(g)); mdl.addElement(new XLayout(g)); mdl.setSelectedItem(layout); final JCheckBox checkbox = new JCheckBox("Animate iterative layouts"); scene.setLayoutAnimationFramesPerSecond(48); final JComboBox<Layout> layouts = new JComboBox(mdl); layouts.setRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList<?> jlist, Object o, int i, boolean bln, boolean bln1) { o = o.getClass().getSimpleName(); return super.getListCellRendererComponent(jlist, o, i, bln, bln1); //To change body of generated methods, choose Tools | Templates. } }); bar.add(new JLabel(" Layout Type")); bar.add(layouts); layouts.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { Layout layout = (Layout) layouts.getSelectedItem(); // These two layouts implement IterativeContext, but they do // not evolve toward anything, they just randomly rearrange // themselves. So disable animation for these. if (layout instanceof ISOMLayout || layout instanceof DAGLayout) { checkbox.setSelected(false); } scene.setGraphLayout(layout, true); } }); bar.add(new JLabel(" Connection Shape")); DefaultComboBoxModel<Transformer<Context<Graph<String, Number>, Number>, Shape>> shapes = new DefaultComboBoxModel<>(); shapes.addElement(new EdgeShape.QuadCurve<String, Number>()); shapes.addElement(new EdgeShape.BentLine<String, Number>()); shapes.addElement(new EdgeShape.CubicCurve<String, Number>()); shapes.addElement(new EdgeShape.Line<String, Number>()); shapes.addElement(new EdgeShape.Box<String, Number>()); shapes.addElement(new EdgeShape.Orthogonal<String, Number>()); shapes.addElement(new EdgeShape.Wedge<String, Number>(10)); final JComboBox<Transformer<Context<Graph<String, Number>, Number>, Shape>> shapesBox = new JComboBox<>( shapes); shapesBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { Transformer<Context<Graph<String, Number>, Number>, Shape> xform = (Transformer<Context<Graph<String, Number>, Number>, Shape>) shapesBox .getSelectedItem(); scene.setConnectionEdgeShape(xform); } }); shapesBox.setRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList<?> jlist, Object o, int i, boolean bln, boolean bln1) { o = o.getClass().getSimpleName(); return super.getListCellRendererComponent(jlist, o, i, bln, bln1); //To change body of generated methods, choose Tools | Templates. } }); shapesBox.setSelectedItem(new EdgeShape.QuadCurve<>()); bar.add(shapesBox); //jf.add(bar, BorderLayout.NORTH); bar.add(new MinSizePanel(scene.createSatelliteView())); bar.setFloatable(false); bar.setRollover(true); final JLabel selectionLabel = new JLabel("<html> </html>"); System.out.println("LOOKUP IS " + scene.getLookup()); Lookup.Result<String> selectedNodes = scene.getLookup().lookupResult(String.class); LookupListener listener = new LookupListener() { @Override public void resultChanged(LookupEvent le) { System.out.println("RES CHANGED"); Lookup.Result<String> res = (Lookup.Result<String>) le.getSource(); StringBuilder sb = new StringBuilder("<html>"); List<String> l = new ArrayList<>(res.allInstances()); Collections.sort(l); for (String s : l) { if (sb.length() != 0) { sb.append(", "); } sb.append(s); } sb.append("</html>"); selectionLabel.setText(sb.toString()); System.out.println("LOOKUP EVENT " + sb); } }; selectedNodes.addLookupListener(listener); selectedNodes.allInstances(); bar.add(selectionLabel); checkbox.setSelected(true); checkbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { scene.setAnimateIterativeLayouts(checkbox.isSelected()); } }); bar.add(checkbox); jLayeredPane3.setLayout(new BorderLayout()); jLayeredPane3.add(bar); // jf.setSize(jf.getGraphicsConfiguration().getBounds().width - 120, 700); // jf.setSize(new Dimension(1280, 720)); // jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent we) { scene.relayout(true); scene.validate(); } }); }
From source file:com.peterbochs.sourceleveldebugger.SourceLevelDebugger3.java
private JToolBar getJToolBar2() { if (jToolBar2 == null) { jToolBar2 = new JToolBar(); jToolBar2.add(getRefreshCodeBaseButton()); jToolBar2.add(getSearchCodeBaseTextField()); }/*from w ww.ja va 2 s .c o m*/ return jToolBar2; }
From source file:com.peterbochs.sourceleveldebugger.SourceLevelDebugger3.java
private JToolBar getCallGraphToolBar() { if (callGraphToolBar == null) { callGraphToolBar = new JToolBar(); callGraphToolBar.add(getRefreshCallGrapphButton()); }// w ww. j av a 2s .c o m return callGraphToolBar; }
From source file:it.cnr.icar.eric.client.ui.swing.graph.JBGraph.java
/** * DOCUMENT ME!//from w w w .j a va 2s . c o m * * @return DOCUMENT ME! */ public JToolBar createToolBar() { JButton button = null; JToolBar toolbar = new JToolBar(); toolbar.setFloatable(false); //TODO: SwingBoost: Localize this TreeNode tempTreeNode = new DefaultMutableTreeNode("loading object types..."); objectTypeCombo = new it.cnr.icar.eric.client.ui.swing.TreeCombo(new DefaultTreeModel(tempTreeNode)); toolbar.add(objectTypeCombo); // use a SwingWorker to get the real model, since it might not have been initialized yet final SwingWorker worker = new SwingWorker(this) { public Object doNonUILogic() { ConceptsTreeModel objectTypesTreeModel = BusinessQueryPanel.getObjectTypesTreeModel(); return objectTypesTreeModel; } public void doUIUpdateLogic() { ConceptsTreeModel objectTypesTreeModel = (ConceptsTreeModel) get(); objectTypeCombo.setModel(objectTypesTreeModel); } }; worker.start(); // Insert URL insertUrl = getClass().getClassLoader().getResource("icons/insert.gif"); ImageIcon insertIcon = new ImageIcon(insertUrl); button = toolbar.add(new AbstractAction("", insertIcon) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(ActionEvent e) { insert(new Point(10, 10)); } }); button.setText(""); //an icon-only button button.setToolTipText("Insert"); // Toggle Connect Mode URL connectUrl = getClass().getClassLoader().getResource("icons/connecton.gif"); ImageIcon connectIcon = new ImageIcon(connectUrl); button = toolbar.add(new AbstractAction("", connectIcon) { /** * */ private static final long serialVersionUID = 657528648199915209L; public void actionPerformed(ActionEvent e) { setPortsVisible(!isPortsVisible()); URL connectUrl; if (isPortsVisible()) { connectUrl = getClass().getClassLoader().getResource("icons/connecton.gif"); } else { connectUrl = getClass().getClassLoader().getResource("icons/connectoff.gif"); } ImageIcon connectIcon = new ImageIcon(connectUrl); putValue(SMALL_ICON, connectIcon); } }); button.setText(""); //an icon-only button button.setToolTipText("Toggle Connect Mode"); // Undo toolbar.addSeparator(); URL undoUrl = getClass().getClassLoader().getResource("icons/undo.gif"); ImageIcon undoIcon = new ImageIcon(undoUrl); undo = new AbstractAction("", undoIcon) { /** * */ private static final long serialVersionUID = -740055667372297781L; public void actionPerformed(ActionEvent e) { undo(); } }; undo.setEnabled(false); button = toolbar.add(undo); button.setText(""); //an icon-only button button.setToolTipText("Undo"); // Redo URL redoUrl = getClass().getClassLoader().getResource("icons/redo.gif"); ImageIcon redoIcon = new ImageIcon(redoUrl); redo = new AbstractAction("", redoIcon) { /** * */ private static final long serialVersionUID = 5021485220988522968L; public void actionPerformed(ActionEvent e) { redo(); } }; redo.setEnabled(false); button = toolbar.add(redo); button.setText(""); //an icon-only button button.setToolTipText("Redo"); // // Edit Block // toolbar.addSeparator(); Action action; URL url; // Copy action = TransferHandler.getCopyAction(); url = getClass().getClassLoader().getResource("icons/copy.gif"); action.putValue(Action.SMALL_ICON, new ImageIcon(url)); //Commented out until we can figure out how to assign new id to copied objects //button = toolbar.add(copy = new EventRedirector(action)); button.setText(""); //an icon-only button button.setToolTipText("Copy"); // Paste action = TransferHandler.getPasteAction(); url = getClass().getClassLoader().getResource("icons/paste.gif"); action.putValue(Action.SMALL_ICON, new ImageIcon(url)); //Commented out until we can figure out how to assign new id to copied objects //button = toolbar.add(paste = new EventRedirector(action)); button.setText(""); //an icon-only button button.setToolTipText("Paste"); // Cut action = TransferHandler.getCutAction(); url = getClass().getClassLoader().getResource("icons/cut.gif"); action.putValue(Action.SMALL_ICON, new ImageIcon(url)); //Commented out until we can figure out how to assign new id to copied objects //button = toolbar.add(cut = new EventRedirector(action)); button.setText(""); //an icon-only button button.setToolTipText("Cut"); // Remove URL removeUrl = getClass().getClassLoader().getResource("icons/delete.gif"); ImageIcon removeIcon = new ImageIcon(removeUrl); remove = new AbstractAction("", removeIcon) { /** * */ private static final long serialVersionUID = 6889927067487680474L; public void actionPerformed(ActionEvent e) { if (!isSelectionEmpty()) { Object[] cells = getSelectionCells(); cells = getDescendants(cells); getModel().remove(cells); //Remove entry from map of cells on the graph for (int i = 0; i < cells.length; i++) { Object cell = cells[i]; if (cell instanceof JBGraphCell) { RegistryObject ro = ((JBGraphCell) cell).getRegistryObject(); registryObjectToCellMap.remove(ro); } } } } }; remove.setEnabled(false); button = toolbar.add(remove); button.setText(""); //an icon-only button button.setToolTipText(resourceBundle.getString("menu.graphPanel.removeFromView")); // Zoom Std toolbar.addSeparator(); URL zoomUrl = getClass().getClassLoader().getResource("icons/zoom.gif"); ImageIcon zoomIcon = new ImageIcon(zoomUrl); button = toolbar.add(new AbstractAction("", zoomIcon) { /** * */ private static final long serialVersionUID = -4404610379022823602L; public void actionPerformed(ActionEvent e) { setScale(1.0); } }); button.setText(""); //an icon-only button button.setToolTipText("Zoom"); // Zoom In URL zoomInUrl = getClass().getClassLoader().getResource("icons/zoomin.gif"); ImageIcon zoomInIcon = new ImageIcon(zoomInUrl); button = toolbar.add(new AbstractAction("", zoomInIcon) { /** * */ private static final long serialVersionUID = 6782766891458235321L; public void actionPerformed(ActionEvent e) { setScale(2 * getScale()); } }); button.setText(""); //an icon-only button button.setToolTipText("Zoom In"); // Zoom Out URL zoomOutUrl = getClass().getClassLoader().getResource("icons/zoomout.gif"); ImageIcon zoomOutIcon = new ImageIcon(zoomOutUrl); button = toolbar.add(new AbstractAction("", zoomOutIcon) { /** * */ private static final long serialVersionUID = -5480242207934335070L; public void actionPerformed(ActionEvent e) { setScale(getScale() / 2); } }); button.setText(""); //an icon-only button button.setToolTipText("Zoom Out"); // Group /* toolbar.addSeparator(); URL groupUrl = getClass().getClassLoader().getResource("icons/group.gif"); ImageIcon groupIcon = new ImageIcon(groupUrl); group = new AbstractAction("", groupIcon) { public void actionPerformed(ActionEvent e) { group(getSelectionCells()); } }; group.setEnabled(false); //button = toolbar.add(group); button.setText(""); //an icon-only button button.setToolTipText("Group"); // Ungroup URL ungroupUrl = getClass().getClassLoader().getResource("icons/ungroup.gif"); ImageIcon ungroupIcon = new ImageIcon(ungroupUrl); ungroup = new AbstractAction("", ungroupIcon) { public void actionPerformed(ActionEvent e) { ungroup(getSelectionCells()); } }; ungroup.setEnabled(false); //button = toolbar.add(ungroup); button.setText(""); //an icon-only button button.setToolTipText("Ungroup"); */ // To Front toolbar.addSeparator(); URL toFrontUrl = getClass().getClassLoader().getResource("icons/tofront.gif"); ImageIcon toFrontIcon = new ImageIcon(toFrontUrl); tofront = new AbstractAction("", toFrontIcon) { /** * */ private static final long serialVersionUID = -4901428890590828561L; public void actionPerformed(ActionEvent e) { if (!isSelectionEmpty()) { toFront(getSelectionCells()); } } }; tofront.setEnabled(false); button = toolbar.add(tofront); button.setText(""); //an icon-only button button.setToolTipText("To Front"); // To Back URL toBackUrl = getClass().getClassLoader().getResource("icons/toback.gif"); ImageIcon toBackIcon = new ImageIcon(toBackUrl); toback = new AbstractAction("", toBackIcon) { /** * */ private static final long serialVersionUID = -5942025518651424307L; public void actionPerformed(ActionEvent e) { if (!isSelectionEmpty()) { toBack(getSelectionCells()); } } }; toback.setEnabled(false); button = toolbar.add(toback); button.setText(""); //an icon-only button button.setToolTipText("To Back"); return toolbar; }
From source file:com.peterbochs.PeterBochsDebugger.java
private void initGUI() { try {/*w ww . j a v a 2s. c om*/ language = Utf8ResourceBundle.getBundle("language_" + Setting.getInstance().getCurrentLanguage()); // $hide>>$ if (os == OSType.win) { if (!new File("PauseBochs.exe").exists() || !new File("StopBochs.exe").exists()) { JOptionPane.showMessageDialog(null, MyLanguage.getString("PauseBochsExe"), MyLanguage.getString("Error"), JOptionPane.ERROR_MESSAGE); System.exit(1); } if (!new File("ndisasm.exe").exists()) { JOptionPane.showMessageDialog(null, MyLanguage.getString("NdisasmExe"), MyLanguage.getString("Error"), JOptionPane.ERROR_MESSAGE); System.exit(1); } } // $hide<<$ } catch (Exception e) { e.printStackTrace(); } try { { this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); if (Global.isBeta) { this.setTitle(MyLanguage.getString("Title") + " " + Global.version + " , This is beta version, if you found a bug, please try older official release"); } else { this.setTitle(MyLanguage.getString("Title") + " " + Global.version); } this.setIconImage( new ImageIcon(getClass().getClassLoader().getResource("com/peterbochs/icons/peter.png")) .getImage()); this.addWindowListener(new WindowAdapter() { public void windowOpened(WindowEvent evt) { thisWindowOpened(evt); } public void windowActivated(WindowEvent evt) { thisWindowActivated(evt); } public void windowClosing(WindowEvent evt) { thisWindowClosing(evt); } }); } { jToolBar1 = new JToolBar(); getContentPane().add(jToolBar1, BorderLayout.NORTH); { startBochsButton = new JButton(); jToolBar1.add(startBochsButton); startBochsButton.setText(MyLanguage.getString("Start_bochs")); startBochsButton.setToolTipText("Launch bochs"); startBochsButton.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("com/peterbochs/icons/famfam_icons/accept.png"))); startBochsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { startBochsButtonActionPerformed(evt); } }); } { stopBochsButton = new JButton(); jToolBar1.add(stopBochsButton); stopBochsButton.setText(MyLanguage.getString("Stop_bochs")); stopBochsButton.setToolTipText("Quit bochs"); stopBochsButton.setIcon(new ImageIcon( getClass().getClassLoader().getResource("com/peterbochs/icons/famfam_icons/stop.png"))); stopBochsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { stopBochsButtonActionPerformed(evt); } }); } { runBochsButton = new JDropDownButton(); jToolBar1.add(runBochsButton); runBochsButton.setText(MyLanguage.getString("Run_bochs")); runBochsButton.setToolTipText("Start emulation"); runBochsButton.setMaximumSize(new java.awt.Dimension(85, 26)); runBochsButton.add(getJRunBochsAndSkipBreakpointMenuItem()); runBochsButton.add(getJRunCustomCommandMenuItem()); runBochsButton.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("com/peterbochs/icons/famfam_icons/resultset_next.png"))); runBochsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { runBochsButtonActionPerformed(evt); } }); } { stepBochsButton = new JDropDownButton(); jToolBar1.add(stepBochsButton); jToolBar1.add(getJStepOverDropDownButton()); jToolBar1.add(getJFastStepBochsButton()); stepBochsButton.setIcon(new ImageIcon( getClass().getClassLoader().getResource("com/peterbochs/icons/famfam_icons/step.png"))); stepBochsButton.setText(MyLanguage.getString("Step")); stepBochsButton.setMaximumSize(new java.awt.Dimension(85, 26)); stepBochsButton.add(getJStep10MenuItem()); stepBochsButton.add(getJStep100MenuItem()); stepBochsButton.add(getJStepNMenuItem()); stepBochsButton.add(getJStepUntilCallOrJumpMenuItem()); stepBochsButton.add(getJStepUntilRetMenuItem()); stepBochsButton.add(getJStepUntilIRetMenuItem()); stepBochsButton.add(getJStepUntilMovMenuItem()); stepBochsButton.add(getJStepUntilIPBigChangeMenuItem()); stepBochsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { stepBochsButtonActionPerformed(evt); } }); } { nextButton = new JButton(); nextButton.setIcon(new ImageIcon( getClass().getClassLoader().getResource("com/peterbochs/icons/famfam_icons/step.png"))); nextButton.setText(MyLanguage.getString("Nexti")); nextButton.setToolTipText("c/c++ level step-in"); jToolBar1.add(nextButton); jToolBar1.add(getNextOverButton()); nextButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { nextButtonActionPerformed(evt); } }); } { jUpdateBochsButton = new JButton(); jToolBar1.add(jUpdateBochsButton); jToolBar1.add(getJExportToExcelButton()); jToolBar1.add(getJSettingButton()); jToolBar1.add(getJRegisterToggleButton()); jToolBar1.add(getJSourceLevelDebuggerButton()); jToolBar1.add(getJProfilerToggleButton()); jToolBar1.add(getJLogToggleButton()); jToolBar1.add(getJOSLogToggleButton()); jUpdateBochsButton.setEnabled(true); jUpdateBochsButton.setText(MyLanguage.getString("Update")); jUpdateBochsButton.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("com/peterbochs/icons/famfam_icons/arrow_refresh.png"))); jUpdateBochsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jUpdateBochsButtonActionPerformed(evt); } }); } } { jStatusPanel = new JPanel(); BorderLayout jStatusPanelLayout = new BorderLayout(); jStatusPanel.setLayout(jStatusPanelLayout); getContentPane().add(jStatusPanel, BorderLayout.SOUTH); getContentPane().add(getJMainPanel()); { jStatusProgressBar = new JProgressBar(); jStatusPanel.add(jStatusProgressBar, BorderLayout.WEST); jStatusPanel.add(getJPanel25(), BorderLayout.CENTER); } } { jMenuBar1 = new JMenuBar(); setJMenuBar(jMenuBar1); { jMenu3 = new JMenu(); jMenuBar1.add(jMenu3); jMenu3.setText(MyLanguage.getString("File")); { jSeparator2 = new JSeparator(); jMenu3.add(jSeparator2); } { exitMenuItem = new JMenuItem(); jMenu3.add(exitMenuItem); exitMenuItem.setText(MyLanguage.getString("Exit")); exitMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { exitMenuItemActionPerformed(evt); } }); } } { jMenu4 = new JMenu(); jMenuBar1.add(jMenu4); jMenuBar1.add(getJFontMenu()); jMenuBar1.add(getJMenu6()); jMenuBar1.add(getJSystemMenu()); jMenu4.setText(MyLanguage.getString("Bochs")); { startBochsMenuItem = new JMenuItem(); jMenu4.add(startBochsMenuItem); startBochsMenuItem.setText(MyLanguage.getString("Start_bochs")); startBochsMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { startBochsMenuItemActionPerformed(evt); } }); } { stopBochsMenuItem = new JMenuItem(); jMenu4.add(stopBochsMenuItem); stopBochsMenuItem.setText(MyLanguage.getString("Stop_bochs")); stopBochsMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { stopBochsMenuItemActionPerformed(evt); } }); } { jSeparator1 = new JSeparator(); jMenu4.add(jSeparator1); } { runBochsMenuItem = new JMenuItem(); jMenu4.add(runBochsMenuItem); runBochsMenuItem.setText(MyLanguage.getString("Run_bochs")); runBochsMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { runBochsMenuItemActionPerformed(evt); } }); } { pauseBochsMenuItem = new JMenuItem(); jMenu4.add(pauseBochsMenuItem); pauseBochsMenuItem.setText(MyLanguage.getString("Pause_bochs")); pauseBochsMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { pauseBochsMenuItemActionPerformed(evt); } }); } { jUpdateBochsStatusMenuItem = new JMenuItem(); jMenu4.add(jUpdateBochsStatusMenuItem); jUpdateBochsStatusMenuItem.setText(MyLanguage.getString("Update_bochs_status")); jUpdateBochsStatusMenuItem.setBounds(83, 86, 79, 20); jUpdateBochsStatusMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jUpdateBochsStatusMenuItemActionPerformed(evt); } }); } } { jMenu5 = new JMenu(); jMenuBar1.add(jMenu5); jMenu5.setText(MyLanguage.getString("Help")); { aboutUsMenuItem = new JMenuItem(); jMenu5.add(aboutUsMenuItem); jMenu5.add(getJHelpRequestMenuItem()); jMenu5.add(getJJVMMenuItem()); jMenu5.add(getShortcutHelpMenuItem()); jMenu5.add(getJLicenseMenuItem()); aboutUsMenuItem.setText(MyLanguage.getString("About_us")); aboutUsMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { aboutUsMenuItemActionPerformed(evt); } }); } } } if (Setting.getInstance().getWidth() == 0 || Setting.getInstance().getHeight() == 0) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); setSize(screenSize.width * 2 / 3, screenSize.height * 4 / 5); } else { setSize(Setting.getInstance().getWidth(), Setting.getInstance().getHeight()); } int x = Setting.getInstance().getX(); int y = Setting.getInstance().getY(); if (x <= 0 || y <= 0) { this.setLocationRelativeTo(null); } else { setLocation(x, y); } jSplitPane1.setDividerLocation(Setting.getInstance().getDivX()); jSplitPane2.setDividerLocation(Setting.getInstance().getDivY()); jOSDebugInformationPanel1.getjMainSplitPane() .setDividerLocation(Setting.getInstance().getOsDebugSplitPane_DividerLocation()); // pack(); initGlobalFontSetting(new Font(Setting.getInstance().getFontFamily(), Font.PLAIN, Setting.getInstance().getFontsize())); jInstrumentPanel.setThing(jStatusProgressBar, jStatusLabel); // prevent null jmenuitem getJInstructionPanelPopupMenu(); // end prevent null jmenuitem KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new KeyEventDispatcher() { public boolean dispatchKeyEvent(KeyEvent e) { if (e.getID() == KeyEvent.KEY_RELEASED) { int keycode = e.getKeyCode(); if (keycode == 112) { jTabbedPane3.setSelectedIndex(0); } else if (keycode == 113) { jTabbedPane3.setSelectedIndex(1); } else if (keycode == 114) { jTabbedPane3.setSelectedIndex(2); } else if (keycode == 115) { jTabbedPane3.setSelectedIndex(3); } else if (keycode == 116) { if (startBochsButton.isEnabled()) { startBochsButtonActionPerformed(null); } } else if (keycode == 117) { if (stopBochsButton.isEnabled()) { stopBochsButtonActionPerformed(null); } } else if (keycode == 118) { if (runBochsButton.isEnabled()) { runBochsButtonActionPerformed(null); } } else if (keycode == 119) { if (stepBochsButton.isEnabled()) { stepBochsButtonActionPerformed(null); } } else if (keycode == 120) { if (fastStepBochsButton.isEnabled()) { fastStepButtonActionPerformed(null); } } } // If the key should not be dispatched to the // focused component, set discardEvent to true boolean discardEvent = false; return discardEvent; } }); } catch (Exception e) { e.printStackTrace(); System.exit(ERROR); } }
From source file:de.codesourcery.jasm16.ide.ui.views.SourceCodeView.java
private final JPanel createPanel() { disableDocumentListener(); // necessary because setting colors on editor pane triggers document change listeners (is considered a style change...) try {/*from w w w .j ava 2 s . c o m*/ editorPane.setEditable(editable); editorPane.getDocument().addUndoableEditListener(undoListener); editorPane.setCaretColor(Color.WHITE); setupKeyBindings(editorPane); setColors(editorPane); editorScrollPane = new JScrollPane(editorPane); setColors(editorScrollPane); editorPane.addCaretListener(listener); editorPane.addMouseListener(mouseListener); editorPane.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { if ((e.getModifiersEx() & MouseEvent.CTRL_DOWN_MASK) != 0) // ctrl pressed { final ASTNode node = getASTNodeForLocation(e.getPoint()); if (node instanceof SymbolReferenceNode) { maybeUnderlineIdentifierAt(e.getPoint()); } else { clearUnderlineHighlight(); } } else if (compilationUnit != null) { String tooltipText = null; if (compilationUnit != null) { final ASTNode node = getASTNodeForLocation(e.getPoint()); if (node instanceof InvokeMacroNode) { tooltipText = ExpandMacrosPhase.expandInvocation((InvokeMacroNode) node, compilationUnit); if (tooltipText != null) { tooltipText = "<html>" + tooltipText.replace("\n", "<br>") + "</html>"; } } } if (!StringUtils.equals(editorPane.getToolTipText(), tooltipText)) { editorPane.setToolTipText(tooltipText); } } } }); editorPane.addMouseListener(popupListener); } finally { enableDocumentListener(); } EditorContainer.addEditorCloseKeyListener(editorPane, this); editorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); editorScrollPane.setPreferredSize(new Dimension(400, 600)); editorScrollPane.setMinimumSize(new Dimension(100, 100)); final AdjustmentListener adjustmentListener = new AdjustmentListener() { @Override public void adjustmentValueChanged(AdjustmentEvent e) { if (!e.getValueIsAdjusting()) { if (compilationUnit != null) { doHighlighting(compilationUnit, false); } } } }; editorScrollPane.getVerticalScrollBar().addAdjustmentListener(adjustmentListener); editorScrollPane.getHorizontalScrollBar().addAdjustmentListener(adjustmentListener); // button panel final JPanel topPanel = new JPanel(); final JToolBar toolbar = new JToolBar(); setColors(toolbar); cursorPosition.setSize(new Dimension(400, 15)); cursorPosition.setEditable(false); setColors(cursorPosition); /** * TOOLBAR * SOURCE * cursor position * status area */ topPanel.setLayout(new GridBagLayout()); GridBagConstraints cnstrs = constraints(0, 0, GridBagConstraints.HORIZONTAL); cnstrs.gridwidth = GridBagConstraints.REMAINDER; cnstrs.weighty = 0; topPanel.add(toolbar, cnstrs); cnstrs = constraints(0, 1, GridBagConstraints.BOTH); cnstrs.gridwidth = GridBagConstraints.REMAINDER; topPanel.add(editorScrollPane, cnstrs); cnstrs = constraints(0, 2, GridBagConstraints.HORIZONTAL); cnstrs.gridwidth = GridBagConstraints.REMAINDER; cnstrs.weighty = 0; topPanel.add(cursorPosition, cnstrs); cnstrs = constraints(0, 3, GridBagConstraints.HORIZONTAL); cnstrs.gridwidth = GridBagConstraints.REMAINDER; cnstrs.weighty = 0; // setup result panel final JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); setColors(panel); cnstrs = constraints(0, 0, true, true, GridBagConstraints.BOTH); panel.add(topPanel, cnstrs); return panel; }
From source file:com.peterbochs.instrument.InstrumentPanel.java
private JToolBar getJToolBar1() { if (jToolBar1 == null) { jToolBar1 = new JToolBar(); jToolBar1.add(getJSaveGraphButton()); jToolBar1.add(getJRefreshCallGraphButton()); jToolBar1.add(getJLayoutTreeButton()); jToolBar1.add(getJLayoutCircleButton()); jToolBar1.add(getJLayoutOrganicButton()); jToolBar1.add(getJLayoutHierarchicalButton()); jToolBar1.add(getJCallGraphZoomInButton()); jToolBar1.add(getJCallGraphScaleTextField()); jToolBar1.add(getJCallGraphZoomOutButton()); jToolBar1.add(getJLabel11());/*w w w.j av a 2 s . c o m*/ jToolBar1.add(getJTrackUnitComboBox()); jToolBar1.add(getJLabel12()); jToolBar1.add(getJTrackDistanceComboBox()); } return jToolBar1; }
From source file:com.peterbochs.PeterBochsDebugger.java
private JToolBar getJPanel13() { if (jPanel13 == null) { jPanel13 = new JToolBar(); FlowLayout jPanel13Layout = new FlowLayout(); jPanel13Layout.setAlignment(FlowLayout.LEFT); {// w ww. j ava2s . com jLabel3 = new JLabel(); jPanel13.add(jLabel3); jLabel3.setText(MyLanguage.getString("Pause_history")); } jPanel13.add(getJRadioButton1()); jPanel13.add(getJRadioButton2()); jPanel13.add(getJFPURadioButton()); jPanel13.add(getJMMXRadioButton()); jPanel13.add(getJButton1()); jPanel13.add(getJExportHistoryToExcelButton()); jPanel13.add(getJClearHistoryTableButton()); jPanel13.add(getJLabel2()); jPanel13.add(getJHistoryTableRepeatedLabel()); jPanel13.add(getJFilterHistoryTableTextField()); jPanel13.add(getJLabel9()); jPanel13.add(getJLabel8()); jPanel13.add(getJLabel7()); jPanel13.add(getJShowAfterwardSpinner()); } return jPanel13; }
From source file:com.peterbochs.PeterBochsDebugger.java
private JToolBar getJPanel19() { if (jPanel19 == null) { jPanel19 = new JToolBar(); FlowLayout jPanel19Layout = new FlowLayout(); jPanel19Layout.setAlignment(FlowLayout.LEFT); jPanel19.add(getJPagingGraphButton()); jPanel19.add(getJButton21x());//from w ww . java2 s .c o m jPanel19.add(getJButton20()); jPanel19.add(getJDumpPageDirectoryAddressTextField()); jPanel19.add(getJButton21()); jPanel19.add(getJHideIfAddressIsZeroCheckBox()); } return jPanel19; }
From source file:com.peterbochs.PeterBochsDebugger.java
private JToolBar getJToolBar2() { if (jToolBar2 == null) { jToolBar2 = new JToolBar(); jToolBar2.add(getJAutoRefreshPageTableGraphCheckBox()); jToolBar2.add(getJRefreshPageTableGraphButton()); }// w w w . ja v a 2 s . c o m return jToolBar2; }