List of usage examples for javax.swing JToolBar JToolBar
public JToolBar(String name)
name
. From source file:com.googlecode.blaisemath.app.MenuConfig.java
/** * Build a menu from a given map entry with key the menu name, and value a list * or map that determines the menu items. * @param name menu name/*from w ww. j a v a2s. c o m*/ * @param items content of menu * @param am string/action mapping * @return menu */ static JToolBar createToolBar(String name, List items, Map<String, Action> am) { JToolBar tb = new JToolBar(name); for (Object it : items) { boolean used = false; for (MenuConfigElement el : MenuConfigElement.values()) { if (el.appliesTo(it)) { el.addToolbarItem(tb, it, am); used = true; break; } } if (!used) { LOG.log(Level.WARNING, "Invalid toolbar item:{0}", it); } } return tb; }
From source file:org.ash.gui.MainFrame.java
/** * Jb init.//from w w w. j a va 2 s .c om * * @throws Exception the exception */ private void jbInit() throws Exception { /** set layout */ this.setLayout(new BorderLayout()); this.tabsMain = new JTabbedPane(); this.model = new Model(); this.splitPaneMain = new JSplitPane(); this.statusBar = new StatusBar(); this.jButtonSettings.setMnemonic(Options.getInstance().getResource("settingsMain.mnemonic").charAt(0)); this.jButtonSettings.setText(Options.getInstance().getResource("settingsMain.text")); this.jButtonSettings.setPreferredSize(new Dimension(100, 30)); this.jButtonSettings.addActionListener(this); this.jButtonThumbnail.setMnemonic(Options.getInstance().getResource("ThumbnailMain.mnemonic").charAt(0)); this.jButtonThumbnail.setText(Options.getInstance().getResource("ThumbnailMain.text")); this.jButtonThumbnail.setPreferredSize(new Dimension(100, 30)); this.jButtonThumbnail.addActionListener(this); /** Button panel fot buttons */ this.buttonPanel = new JToolBar("PanelButton"); this.buttonPanel.setFloatable(false); this.buttonPanel.setBorder(new EtchedBorder()); /** Layout of buttons */ this.buttonPanel.add(Box.createRigidArea(new Dimension(20, 0))); this.buttonPanel.add(this.jButtonSettings); this.buttonPanel.add(Box.createRigidArea(new Dimension(10, 0))); //this.buttonPanel.add(this.jButtonThumbnail); //this.buttonPanel.add(Box.createRigidArea(new Dimension(10, 0))); //this.buttonPanel.add(this.jButtonDetail); //this.buttonPanel.add(Box.createRigidArea(new Dimension(10, 0))); //this.buttonPanel.add(this.spinerRangeWindowLabel); //this.buttonPanel.add(Box.createRigidArea(new Dimension(5, 0))); //this.buttonPanel.add(this.spinerRangeWindow); //this.buttonPanel.add(Box.createRigidArea(new Dimension(this.getWidth()-250, 0))); this.mainPanel = new JPanel(); this.mainPanel.setLayout(new BorderLayout()); this.mainPanel.setVisible(true); this.settingsDialog = new Settings(this); this.settingsDialog.setLocation(buttonPanel.getX() + 100, buttonPanel.getY() + 50); this.settingsDialog.setVisible(false); }
From source file:org.pgptool.gui.ui.mainframe.MainFrameView.java
private void initToolBar() { toolbar = new JToolBar("Main actions"); toolbar.setRollover(false);/* w w w . j a va 2s. c o m*/ toolbar.add(new JButton(actionEncrypt)); toolbar.add(new JButton(actionEncryptText)); toolbar.addSeparator(); toolbar.add(new JButton(actionDecrypt)); toolbar.add(new JButton(actionDecryptText)); toolbar.add(new JButton(actionHistory)); toolbar.addSeparator(); toolbar.add(new JButton(actionKeyring)); }
From source file:org.ash.history.detail.DetailsPanelH.java
/** * Initialize DetailFrame//from w w w. j a va 2 s .co m */ private void initialize() { this.setLayout(new BorderLayout()); JSplitPane splitPaneMainDetail = new JSplitPane(); this.cpuRadioButton.setText(Options.getInstance().getResource("cpuLabel.text")); this.cpuRadioButton.addItemListener(new SelectItemListenerRadioButton()); this.setFont(this.cpuRadioButton); this.schedulerRadioButton.setText(Options.getInstance().getResource("schedulerLabel.text")); this.schedulerRadioButton.addItemListener(new SelectItemListenerRadioButton()); this.setFont(this.schedulerRadioButton); this.userIORadioButton.setText(Options.getInstance().getResource("userIOLabel.text")); this.userIORadioButton.addItemListener(new SelectItemListenerRadioButton()); this.setFont(this.userIORadioButton); this.systemIORadioButton.setText(Options.getInstance().getResource("systemIOLabel.text")); this.systemIORadioButton.addItemListener(new SelectItemListenerRadioButton()); this.setFont(this.systemIORadioButton); this.concurrencyRadioButton.setText(Options.getInstance().getResource("concurrencyLabel.text")); this.concurrencyRadioButton.addItemListener(new SelectItemListenerRadioButton()); this.setFont(this.concurrencyRadioButton); this.applicationRadioButton.setText(Options.getInstance().getResource("applicationsLabel.text")); this.applicationRadioButton.addItemListener(new SelectItemListenerRadioButton()); this.setFont(this.applicationRadioButton); this.commitRadioButton.setText(Options.getInstance().getResource("commitLabel.text")); this.commitRadioButton.addItemListener(new SelectItemListenerRadioButton()); this.setFont(this.commitRadioButton); this.configurationRadioButton.setText(Options.getInstance().getResource("configurationLabel.text")); this.configurationRadioButton.addItemListener(new SelectItemListenerRadioButton()); this.setFont(this.configurationRadioButton); this.administrativeRadioButton.setText(Options.getInstance().getResource("administrativeLabel.text")); this.administrativeRadioButton.addItemListener(new SelectItemListenerRadioButton()); this.setFont(this.administrativeRadioButton); this.networkRadioButton.setText(Options.getInstance().getResource("networkLabel.text")); this.networkRadioButton.addItemListener(new SelectItemListenerRadioButton()); this.setFont(this.networkRadioButton); this.queuningRadioButton.setText(Options.getInstance().getResource("queueningLabel.text")); this.queuningRadioButton.addItemListener(new SelectItemListenerRadioButton()); this.setFont(this.queuningRadioButton); this.clusterRadioButton.setText(Options.getInstance().getResource("clusterLabel.text")); this.clusterRadioButton.addItemListener(new SelectItemListenerRadioButton()); this.setFont(this.clusterRadioButton); this.otherRadioButton.setText(Options.getInstance().getResource("otherLabel.text")); this.otherRadioButton.addItemListener(new SelectItemListenerRadioButton()); this.setFont(this.otherRadioButton); this.buttonGroup.add(cpuRadioButton); this.buttonGroup.add(schedulerRadioButton); this.buttonGroup.add(userIORadioButton); this.buttonGroup.add(systemIORadioButton); this.buttonGroup.add(concurrencyRadioButton); this.buttonGroup.add(applicationRadioButton); this.buttonGroup.add(commitRadioButton); this.buttonGroup.add(configurationRadioButton); this.buttonGroup.add(administrativeRadioButton); this.buttonGroup.add(networkRadioButton); this.buttonGroup.add(queuningRadioButton); this.buttonGroup.add(clusterRadioButton); this.buttonGroup.add(otherRadioButton); /** Button panel fot buttons */ this.buttonPanel = new JToolBar("PanelButton"); this.buttonPanel.setFloatable(false); this.buttonPanel.setBorder(new EtchedBorder()); this.buttonPanel.add(this.cpuRadioButton); this.buttonPanel.add(this.schedulerRadioButton); this.buttonPanel.add(this.userIORadioButton); this.buttonPanel.add(this.systemIORadioButton); this.buttonPanel.add(this.concurrencyRadioButton); this.buttonPanel.add(this.applicationRadioButton); this.buttonPanel.add(this.commitRadioButton); this.buttonPanel.add(this.configurationRadioButton); this.buttonPanel.add(this.administrativeRadioButton); this.buttonPanel.add(this.networkRadioButton); this.buttonPanel.add(this.queuningRadioButton); this.buttonPanel.add(this.clusterRadioButton); this.buttonPanel.add(this.otherRadioButton); splitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT); splitPaneMainDetail.add(new JPanel(), "top"); splitPaneMainDetail.add(new JPanel(), "bottom"); splitPaneMainDetail.setDividerLocation(230); splitPaneMainDetail.setOneTouchExpandable(true); this.mainPanel = new JPanel(); this.mainPanel.setLayout(new BorderLayout()); this.mainPanel.setVisible(true); this.mainPanel.add(splitPaneMainDetail, BorderLayout.CENTER); this.add(this.buttonPanel, BorderLayout.NORTH); this.add(this.mainPanel, BorderLayout.CENTER); }
From source file:com.mgmtp.jfunk.core.ui.JFunkFrame.java
private void buildToolBar() { // Toolbar for the first line JToolBar toolBarFirstLine = new JToolBar("Toolbar"); toolBarFirstLine.setRequestFocusEnabled(false); toolBarFirstLine.setFloatable(false); toolBarFirstLine.add(fileOpenScriptsAction); toolBarFirstLine.add(toolsRunAction); toolBarFirstLine.addSeparator();//from w ww. j a v a2 s . c om // Build component jFunk property files jFunkPropertyFilesModel = new PropertiesComboBoxModel("config", "jfunk", PROPS_SUFFIX, null, true); jFunkPropertyFilesComboBox = new JComboBox(jFunkPropertyFilesModel); jFunkPropertyFilesComboBox.setBorder(BorderFactory.createTitledBorder("jFunk configuration")); // Multi-line tooltip jFunkPropertyFilesComboBox .setToolTipText("<html>List of jFunk property files containing listener and modules" + "<br>Location: all files in directory 'config'</br></html>"); toolBarFirstLine.add(jFunkPropertyFilesComboBox); // Build component testsystems testSystemsModel = new PropertiesComboBoxModel("config/system", null, PROPS_SUFFIX, "baseurl", false); testSystemsComboBox = new JComboBox(testSystemsModel); testSystemsComboBox.setBorder(BorderFactory.createTitledBorder("Test system")); // Multi-line tooltip testSystemsComboBox.setToolTipText( "<html>List of test systems" + "<br>Defined by all files in directory 'config/system'</br></html>"); testSystemsComboBox.setSelectedItem(0); toolBarFirstLine.add(testSystemsComboBox); // Toolbar for the second line JToolBar toolBarSecondLine = new JToolBar(); toolBarSecondLine.setRequestFocusEnabled(false); toolBarSecondLine.setFloatable(false); // Build component mail configuration mailConfigurationsModel = new PropertiesComboBoxModel(PATH_TO_MAIL_CONFIG_FILES, null, PROPS_SUFFIX, null, false); mailConfigurationsComboBox = new JComboBox(mailConfigurationsModel); mailConfigurationsComboBox.setBorder(BorderFactory.createTitledBorder("Mail configuration")); // Multi-line tooltip mailConfigurationsComboBox.setToolTipText("<html>List of mail configurations" + "<br>Defined by all files in directory 'config/email_accounts'</br></html>"); toolBarSecondLine.add(mailConfigurationsComboBox); // Build component thread count threadCountComboBox = new JComboBox(createNumberArray(30)); threadCountComboBox.setBorder(BorderFactory.createTitledBorder("Threads")); threadCountComboBox.setToolTipText( "Number of threads which will be used for the execution of the selected script files"); toolBarSecondLine.add(threadCountComboBox); // Build component parallel parallelComboBox = new JComboBox(new String[] { "yes", "no" }); parallelComboBox.setSelectedIndex(1); parallelComboBox.setBorder(BorderFactory.createTitledBorder("Parallel?")); parallelComboBox.setToolTipText("If set to 'yes', a single script will be executed " + "multiple times using the specified number of threads"); toolBarSecondLine.add(parallelComboBox); jPanelUtilities = new JPanel(); jPanelUtilities.setLayout(new BorderLayout()); jPanelUtilities.add(toolBarFirstLine, BorderLayout.NORTH); jPanelUtilities.add(toolBarSecondLine, BorderLayout.CENTER); }
From source file:net.sf.jabref.EntryEditor.java
/** * Create toolbar for entry editor.//from www. j a v a2 s . c o m */ private void setupToolBar() { JToolBar tlb = new JToolBar(JToolBar.VERTICAL); CloseAction closeAction = new CloseAction(); ; StoreFieldAction storeFieldAction = new StoreFieldAction(); DeleteAction deleteAction = new DeleteAction(); UndoAction undoAction = new UndoAction(); RedoAction redoAction = new RedoAction(); tlb.setBorder(null); tlb.setRollover(true); tlb.setMargin(new Insets(0, 0, 0, 2)); tlb.setFloatable(false); tlb.addSeparator(); tlb.add(deleteAction); tlb.addSeparator(); tlb.add(prevEntryAction); tlb.add(nextEntryAction); tlb.addSeparator(); tlb.add(helpAction); for (Component comp : tlb.getComponents()) { ((JComponent) comp).setOpaque(false); } // The toolbar carries all the key bindings that are valid for the whole window. ActionMap am = tlb.getActionMap(); InputMap im = tlb.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); im.put(prefs.getKey("Close entry editor"), "close"); am.put("close", closeAction); im.put(prefs.getKey("Entry editor, store field"), "store"); am.put("store", storeFieldAction); im.put(prefs.getKey("Entry editor, previous entry"), "prev"); am.put("prev", prevEntryAction); im.put(prefs.getKey("Entry editor, next entry"), "next"); am.put("next", nextEntryAction); im.put(prefs.getKey("Undo"), "undo"); am.put("undo", undoAction); im.put(prefs.getKey("Redo"), "redo"); am.put("redo", redoAction); im.put(prefs.getKey("Help"), "help"); am.put("help", helpAction); // Add actions (and thus buttons) JButton closeBut = new JButton(closeAction); closeBut.setText(null); closeBut.setBorder(null); // Create type-label TypeLabel typeLabel = new TypeLabel(entry.getType().getName()); JPanel leftPan = new JPanel(); leftPan.setLayout(new BorderLayout()); leftPan.add(closeBut, BorderLayout.NORTH); leftPan.add(typeLabel, BorderLayout.CENTER); leftPan.add(tlb, BorderLayout.SOUTH); add(leftPan, BorderLayout.WEST); }
From source file:bio.gcat.gui.BDATool.java
public BDATool() { super("BDA Tool - " + AnalysisTool.NAME); setIconImage(getImage("bda")); setMinimumSize(new Dimension(660, 400)); setPreferredSize(new Dimension(1020, 400)); setSize(getPreferredSize());//from w w w.j av a 2s. c o m setLocationByPlatform(true); setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); menubar = new JMenuBar(); menu = new JMenu[4]; menubar.add(menu[0] = new JMenu("File")); menubar.add(menu[1] = new JMenu("Edit")); menubar.add(menu[2] = new JMenu("Window")); menubar.add(menu[3] = new JMenu("Help")); setJMenuBar(menubar); menu[0].add(createMenuItem("Open...", "folder-horizontal-open", KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK), ACTION_OPEN, this)); menu[0].add(createMenuItem("Save As...", "disk--arrow", KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK), ACTION_SAVE_AS, this)); menu[0].add(createSeparator()); menu[0].add(createMenuItem("Close Window", "cross", ACTION_CLOSE, this)); menu[1].add(createMenuText("Binary Dichotomic Algorithm:")); menu[1].add(createMenuItem("Add", KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_DOWN_MASK), ACTION_BDA_ADD, this)); menu[1].add(createMenuItem("Edit...", KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_DOWN_MASK), ACTION_BDA_EDIT, this)); menu[1].add( createMenuItem("Remove", KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), ACTION_BDA_REMOVE, this)); menu[1].add(createMenuItem("Clear", ACTION_BDAS_CLEAR, this)); menu[1].add(seperateMenuItem(createMenuItem("Move Up", KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.CTRL_DOWN_MASK), ACTION_BDA_MOVE_UP, this))); menu[1].add(createMenuItem("Move Down", KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.CTRL_DOWN_MASK), ACTION_BDA_MOVE_DOWN, this)); menu[2].add(createMenuItem("Preferences", ACTION_PREFERENCES, this)); menu[3].add(createMenuItem("About BDA Tool", "bda", ACTION_ABOUT, this)); for (String action : new String[] { ACTION_BDA_EDIT, ACTION_BDA_REMOVE, ACTION_BDAS_CLEAR, ACTION_BDA_MOVE_UP, ACTION_BDA_MOVE_DOWN }) getMenuItem(menubar, action).setEnabled(false); getMenuItem(menubar, ACTION_PREFERENCES).setEnabled(false); registerKeyStroke(getRootPane(), KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "remove", new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (bdaPanel.table.hasFocus()) removeBinaryDichotomicAlgorithm(); } }); toolbar = new JToolBar[1]; toolbar[0] = new JToolBar("File"); toolbar[0].add(createToolbarButton("Open File", "folder-horizontal-open", ACTION_OPEN, this)); toolbar[0].add(createToolbarButton("Save As File", "disk--arrow", ACTION_SAVE_AS, this)); toolbars = new JPanel(new FlowLayout(FlowLayout.LEADING)); for (JToolBar toolbar : toolbar) toolbars.add(toolbar); add(toolbars, BorderLayout.NORTH); add(createSplitPane(JSplitPane.HORIZONTAL_SPLIT, false, true, 360, 0.195, new JScrollPane(bdaPanel = new BinaryDichotomicAlgorithmPanel()), new JScrollPane(tablePanel = new JPanel(new BorderLayout()))), BorderLayout.CENTER); add(bottom = new JPanel(new FlowLayout(FlowLayout.RIGHT)), BorderLayout.SOUTH); status = new JLabel(); status.setBorder(new EmptyBorder(0, 5, 0, 5)); status.setHorizontalAlignment(JLabel.RIGHT); bottom.add(status); ((ListTableModel<?>) bdaPanel.table.getModel()).addListDataListener(this); bdaPanel.table.getSelectionModel().addListSelectionListener(this); revalidateGeneticCodeTable(); }
From source file:com.employee.scheduler.common.swingui.SolverAndPersistenceFrame.java
private JComponent createToolBar() { JToolBar toolBar = new JToolBar("File operations"); toolBar.setFloatable(false);//w ww . j av a 2s.c o m importAction = new ImportAction(); importAction.setEnabled(solutionBusiness.hasImporter()); toolBar.add(new JButton(importAction)); openAction = new OpenAction(); openAction.setEnabled(true); toolBar.add(new JButton(openAction)); saveAction = new SaveAction(); saveAction.setEnabled(false); toolBar.add(new JButton(saveAction)); exportAction = new ExportAction(); exportAction.setEnabled(false); toolBar.add(new JButton(exportAction)); toolBar.addSeparator(); progressBar = new JProgressBar(0, 100); progressBar.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE)); toolBar.add(progressBar); toolBar.addSeparator(); solveAction = new SolveAction(); solveAction.setEnabled(false); solveButton = new JButton(solveAction); terminateSolvingEarlyAction = new TerminateSolvingEarlyAction(); terminateSolvingEarlyAction.setEnabled(false); terminateSolvingEarlyButton = new JButton(terminateSolvingEarlyAction); terminateSolvingEarlyButton.setVisible(false); toolBar.add(solveButton, "solveAction"); toolBar.add(terminateSolvingEarlyButton, "terminateSolvingEarlyAction"); solveButton.setMinimumSize(terminateSolvingEarlyButton.getMinimumSize()); solveButton.setPreferredSize(terminateSolvingEarlyButton.getPreferredSize()); return toolBar; }
From source file:livecanvas.mesheditor.MeshEditor.java
private JToolBar createTools() { JToolBar toolbar = new JToolBar(JToolBar.VERTICAL); ButtonGroup toolsBg = new ButtonGroup(); JToggleButton toolsButton;// w w w .ja v a2 s . com toolbar.add(toolsButton = Utils.createToolBarToggleButton("Brush", new ImageIcon(clazz.getResource("res/brush.png")), ButtonType.ICON_ONLY, TOOLS_BRUSH, "Brush", toolsBg, this)); toolsButton.setSelected(true); toolbar.add(toolsButton = Utils.createToolBarToggleButton("Pen", new ImageIcon(clazz.getResource("res/pen.png")), ButtonType.ICON_ONLY, TOOLS_PEN, "Pen", toolsBg, this)); toolbar.add(toolsButton = Utils.createToolBarToggleButton("MagicWand", new ImageIcon(clazz.getResource("res/wand.png")), ButtonType.ICON_ONLY, TOOLS_MAGICWAND, "Magic Wand", toolsBg, this)); toolbar.add(toolsButton = Utils.createToolBarToggleButton("SetControlPoints", new ImageIcon(clazz.getResource("res/set_controls.png")), ButtonType.ICON_ONLY, TOOLS_SETCONTROLPOINTS, "Set Control Points", toolsBg, this)); toolbar.add(toolsButton = Utils.createToolBarToggleButton("Pointer", new ImageIcon(clazz.getResource("res/pointer.png")), ButtonType.ICON_ONLY, TOOLS_POINTER, "Pointer", toolsBg, this)); toolbar.add(toolsButton = Utils.createToolBarToggleButton("PanZoom", new ImageIcon(clazz.getResource("res/panzoom.png")), ButtonType.ICON_ONLY, TOOLS_PANZOOM, "Pan or Zoom Canvas", toolsBg, this)); // toolsButton.setSelected(true); return toolbar; }
From source file:de.ailis.xadrian.frames.MainFrame.java
/** * Creates the tool bar.// ww w . jav a 2s. c o m */ private void createToolBar() { final JToolBar toolBar = new JToolBar(SwingConstants.HORIZONTAL); toolBar.setFloatable(false); toolBar.setRollover(true); toolBar.add(this.exitAction); toolBar.addSeparator(); toolBar.add(this.newAction); toolBar.add(this.openAction); toolBar.add(this.closeAction); toolBar.add(this.saveAction); toolBar.add(this.printAction); toolBar.addSeparator(); toolBar.add(this.addFactoryAction); toolBar.add(this.changeSectorAction); toolBar.add(this.changeSunsAction); toolBar.add(this.changePricesAction); final JToggleButton btn = new JToggleButton(this.toggleBaseComplexAction); btn.setHideActionText(true); toolBar.add(btn); add(toolBar, BorderLayout.NORTH); installStatusHandler(toolBar); }