List of usage examples for javax.swing JToolBar addSeparator
public void addSeparator()
From source file:org.photovault.swingui.BrowserWindow.java
/** Create the toolbar for this browser window. *///from w ww . jav a2 s .c o m protected JToolBar createToolbar() { JToolBar tb = new JToolBar(); JButton importBtn = new JButton(importAction); importBtn.setText(""); JButton indexBtn = new JButton(viewCtrl.getActionAdapter("new_ext_vol")); indexBtn.setText(""); JButton updateBtn = new JButton(viewCtrl.getActionAdapter("update_indexed_dirs")); updateBtn.setText(""); JButton exportBtn = new JButton(viewPane.getExportSelectedAction()); exportBtn.setText(""); JButton deleteBtn = new JButton(viewPane.getDeleteSelectedAction()); deleteBtn.setText(""); JButton rotCWBtn = new JButton(viewCtrl.getActionAdapter("rotate_cw")); rotCWBtn.setText(""); JButton rotCCWBtn = new JButton(viewCtrl.getActionAdapter("rotate_ccw")); rotCCWBtn.setText(""); JButton rot180Btn = new JButton(viewCtrl.getActionAdapter("rotate_180")); rot180Btn.setText(""); JButton cropBtn = new JButton(previewPane.getCropAction()); cropBtn.setText(""); JButton colorsBtn = new JButton(viewPane.getEditSelectionColorsAction()); colorsBtn.setText(""); JButton nextBtn = new JButton(viewPane.getSelectNextAction()); nextBtn.setText(""); JButton prevBtn = new JButton(viewPane.getSelectPreviousAction()); prevBtn.setText(""); JButton previewRightBtn = new JButton(getActionAdapter("view_preview_right")); previewRightBtn.setText(""); JButton previewTopBtn = new JButton(getActionAdapter("view_preview_top")); previewTopBtn.setText(""); JButton previewNoneBtn = new JButton(getActionAdapter("view_no_preview")); previewNoneBtn.setText(""); ZoomComboBox zoomCombo = new ZoomComboBox(previewPane); tb.add(importBtn); tb.add(indexBtn); tb.add(updateBtn); tb.add(exportBtn); tb.add(deleteBtn); tb.addSeparator(); tb.add(prevBtn); tb.add(nextBtn); tb.add(previewRightBtn); tb.add(previewTopBtn); tb.add(previewNoneBtn); tb.add(zoomCombo); tb.addSeparator(); tb.add(rotCWBtn); tb.add(rotCCWBtn); tb.add(rot180Btn); tb.add(cropBtn); tb.add(colorsBtn); return tb; }
From source file:org.richie.codeGen.ui.GenAndPreviewUI.java
public JSplitPane getCenterPanel() { JToolBar logToolBar = new JToolBar(); logToolBar.setFloatable(false);/*from w ww .ja v a2 s . com*/ clearLogBtn = new JButton(""); clearLogBtn.setIcon(new ImageIcon(ClassLoader.getSystemResource("resources/images/clear.gif"))); clearLogBtn.addActionListener(this); clearLogBtn.addActionListener(this); logToolBar.add(clearLogBtn); logToolBar.addSeparator(); JPanel logPanel = new JPanel(); logPanel.setLayout(new BorderLayout()); JScrollPane textPanel = new JScrollPane(); logTextArea = new JTextArea(); logTextArea.setMinimumSize(new Dimension(1, 1)); textPanel.setViewportView(logTextArea); logPanel.add(logToolBar, BorderLayout.NORTH); logPanel.add(textPanel, BorderLayout.CENTER); split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, getTemplatePanel(), logPanel); split.setContinuousLayout(false); split.setOneTouchExpandable(true); split.setDividerLocation(400); return split; }
From source file:org.rimudb.editor.RimuDBEditor.java
/** * Create and return a toolbar./*from w w w .ja v a 2s.co m*/ */ protected JToolBar createToolbar() { log.debug("createToolbar()"); JToolBar toolbar = new JToolBar(); // Open openBtn = new ToolbarButton(new OpenDescriptorAction(this, loadIcon("/images/famfamfam/folder.png")), "Open Table Descriptor"); openBtn.setText("Open"); openBtn.setName("openBtn"); toolbar.add(openBtn); // Save saveBtn = new ToolbarButton(new SaveDescriptorAction(this, loadIcon("/images/famfamfam/disk.png")), "Save Table Descriptor"); saveBtn.setText("Save"); saveBtn.setName("saveBtn"); toolbar.add(saveBtn); // A space // toolbar.add(Box.createHorizontalStrut(5)); // Clear clearBtn = new ToolbarButton(new ClearTableAction(this, loadIcon("/images/famfamfam/bin_closed.png")), "Clear"); clearBtn.setText("Clear"); clearBtn.setName("clearBtn"); toolbar.add(clearBtn); // Save as // saveAsBtn = new ToolbarButton(new SaveAsDescriptorAction(this, loadIcon("/images/sun/SaveAs24.gif")), "Save Table Descriptor as"); // saveAsBtn.setName("saveAsBtn"); // toolbar.add(saveAsBtn); // A space toolbar.addSeparator(); // Import from a database importBtn = new ToolbarButton(new ImportAction(this, loadIcon("/images/famfamfam/database_go.png")), "Import from database"); importBtn.setText("Import"); importBtn.setName("importBtn"); importBtn.setEnabled(false); toolbar.add(importBtn); // A space toolbar.add(Box.createHorizontalStrut(5)); // Create classes createBtn = new ToolbarButton( new GenerateJavaAction(this, loadIcon("/images/famfamfam/page_white_cup.png")), "Create classes"); createBtn.setText("Create"); createBtn.setName("createBtn"); toolbar.add(createBtn); // Finish up the tool bar toolbar.add(Box.createHorizontalGlue()); toolbar.setFloatable(false); return toolbar; }
From source file:org.rivalry.swingui.RivalryUI.java
/** * @return a new tool bar.//from w w w .j a v a2 s.c o m */ private JToolBar createToolBar() { final JButton openButton = createButton("Open24.gif", "Open a rivalry data file", "Open...", createOpenActionListener()); final JButton bestPlaceButton = createButton("PalmTree24.png", "Load best place data", "Best Places", createBestPlaceActionListener()); final JButton boardgameButton = createButton("Boardgame24.png", "Load board game data", "Boardgames", createBoardgameActionListener()); final JButton dogButton = createButton("Dog24.png", "Load dog breed data", "Dog Breeds", createDogBreedActionListener()); final JButton mysteryAwardButton = createButton("MysteryBook24.png", "Load mystery book award data", "Mystery Book Awards", createMysteryAwardActionListener()); final JButton skillDemandButton = createButton("Brain24.png", "Load skill demand data", "Skill Demand", createSkillDemandActionListener()); final JButton stockButton = createButton("Money24.png", "Load stock data", "Stocks", createStockActionListener()); final JButton aboutButton = createButton("About24.gif", "View information about this application.", "About", createAboutActionListener()); final JToolBar answer = new JToolBar("Rivalry Tool Bar"); answer.add(openButton); answer.addSeparator(); answer.add(bestPlaceButton); answer.add(boardgameButton); answer.add(dogButton); answer.add(mysteryAwardButton); answer.add(skillDemandButton); answer.add(stockButton); answer.addSeparator(); answer.add(aboutButton); return answer; }
From source file:org.yccheok.jstock.gui.IndicatorPanel.java
private void addCreationButtonsTo(JToolBar tb, final DrawingEditor editor) { // AttributeKeys for the entitie sets HashMap<AttributeKey, Object> attributes; ResourceBundleUtil labels = ResourceBundleUtil.getBundle("org.yccheok.jstock.data.Labels"); ResourceBundleUtil drawLabels = ResourceBundleUtil.getBundle("org.jhotdraw.draw.Labels"); //ToolBarButtonFactory.addSelectionToolTo(tb, editor); ButtonFactory.addSelectionToolTo(tb, editor, createDrawingActions(editor), createSelectionActions(editor)); tb.addSeparator(); attributes = new HashMap<AttributeKey, Object>(); attributes.put(AttributeKeys.FILL_COLOR, Color.white); attributes.put(AttributeKeys.STROKE_COLOR, Color.black); attributes.put(AttributeKeys.TEXT_COLOR, Color.black); ButtonFactory.addToolTo(tb, editor,/* w w w .j a va 2s .c o m*/ new OperatorFigureCreationTool("org.yccheok.jstock.gui.analysis.LogicalOperatorFigure", attributes), "createLogical", labels); ButtonFactory.addToolTo(tb, editor, new OperatorFigureCreationTool( "org.yccheok.jstock.gui.analysis.EqualityOperatorFigure", attributes), "createEquality", labels); ButtonFactory.addToolTo(tb, editor, new OperatorFigureCreationTool("org.yccheok.jstock.gui.analysis.ArithmeticOperatorFigure", attributes), "createArithmetic", labels); ButtonFactory.addToolTo(tb, editor, new OperatorFigureCreationTool( "org.yccheok.jstock.gui.analysis.FunctionOperatorFigure", attributes), "createFunction", labels); ButtonFactory .addToolTo(tb, editor, new OperatorFigureCreationTool( "org.yccheok.jstock.gui.analysis.DoubleConstantOperatorFigure", attributes), "createDoubleConstant", labels); tb.addSeparator(); ButtonFactory .addToolTo(tb, editor, new OperatorFigureCreationTool( "org.yccheok.jstock.gui.analysis.StockRelativeHistoryOperatorFigure", attributes), "createStockRelativeHistory", labels); ButtonFactory.addToolTo(tb, editor, new OperatorFigureCreationTool("org.yccheok.jstock.gui.analysis.StockHistoryOperatorFigure", attributes), "createStockHistory", labels); ButtonFactory.addToolTo(tb, editor, new OperatorFigureCreationTool("org.yccheok.jstock.gui.analysis.StockOperatorFigure", attributes), "createStock", labels); tb.addSeparator(); //ButtonFactory.addToolTo(tb, editor, new OperatorFigureCreationTool("org.yccheok.jstock.gui.analysis.DiodeOperatorFigure", attributes), "createDiode", labels); ButtonFactory.addToolTo(tb, editor, new OperatorFigureCreationTool("org.yccheok.jstock.gui.analysis.SinkOperatorFigure", attributes), "createSink", labels); tb.addSeparator(); attributes = new HashMap<AttributeKey, Object>(); attributes.put(AttributeKeys.STROKE_COLOR, Color.black); attributes.put(AttributeKeys.TEXT_COLOR, Color.black); attributes.put(AttributeKeys.FONT_BOLD, true); attributes.put(AttributeKeys.FILL_COLOR, new Color(255, 204, 0)); ButtonFactory.addToolTo(tb, editor, new TextAreaCreationTool(new TextAreaFigure(), attributes), "edit.createText", drawLabels); }
From source file:savant.view.variation.swing.VariationModule.java
public VariationModule(VariationController vc) { super(new GridBagLayout()); controller = vc;/*www . ja va 2 s . c o m*/ // Toolbar shared by all panels. JToolBar tools = new JToolBar(); tools.setFloatable(false); rangeField = new JTextField(); rangeField.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { String text = rangeField.getText(); try { Bookmark bm = new Bookmark(text, controller.getReference(), controller.getVisibleRange()); controller.setLocation(bm.getReference(), (Range) bm.getRange()); } catch (ParseException x) { DialogUtils.displayMessage(String.format("Unable to parse \"%s\" as a location.", text)); } } }); tools.add(rangeField); tools.addSeparator(); JButton zoomInButton = new JButton(); zoomInButton.setIcon(SavantIconFactory.getInstance().getIcon(SavantIconFactory.StandardIcon.ZOOMIN)); zoomInButton.setBorderPainted(false); zoomInButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { controller.zoomIn(); } }); tools.add(zoomInButton); JButton zoomOutButton = new JButton(); zoomOutButton.setIcon(SavantIconFactory.getInstance().getIcon(SavantIconFactory.StandardIcon.ZOOMOUT)); zoomOutButton.setBorderPainted(false); zoomOutButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { controller.zoomOut(); } }); tools.add(zoomOutButton); tools.addSeparator(); JButton controlsButton = new JButton("Controls"); controlsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (controller.getTracks().length > 0) { new CaseControlDialog(controller).setVisible(true); frequencyPlot.repaint(); } else { Toolkit.getDefaultToolkit().beep(); } } }); tools.add(controlsButton); tabs = new JTabbedPane(); table = new RecordTable(new VariantTableModel(null)); table.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent me) { if (me.getClickCount() == 2) { controller.navigateToRecord(controller.getData().get(table.getSelectedRow())); } } }); tabs.addTab("Table", new JScrollPane(table)); map = new VariantMap(controller); map.addMouseWheelListener(wheelListener); LocationController.getInstance().addListener(new Listener<LocationChangedEvent>() { @Override public void handleEvent(LocationChangedEvent event) { map.repaint(); } }); JPanel mapPanel = populatePanel(map); tabs.addTab("Map", mapPanel); frequencyPlot = new AlleleFrequencyPlot(controller); frequencyPlot.addMouseWheelListener(wheelListener); JPanel frequencyPanel = populatePanel(frequencyPlot); tabs.addTab("Allele Frequency", frequencyPanel); JPanel ldPanel = new JPanel(); ldPanel.setLayout(new GridBagLayout()); ActionListener redrawForcer = new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { ldPlot.repaint(); } }; JRadioButton dPrimeButton = new JRadioButton("D\u2032", true); dPrimeButton.setActionCommand("true"); dPrimeButton.addActionListener(redrawForcer); JRadioButton rSquaredButton = new JRadioButton("r\u00B2", false); rSquaredButton.setActionCommand("false"); rSquaredButton.addActionListener(redrawForcer); methodGroup = new ButtonGroup(); JPanel methodPanel = new JPanel(); methodPanel.setBorder(BorderFactory.createTitledBorder("Calculation Method")); methodPanel.add(dPrimeButton); methodGroup.add(dPrimeButton); methodPanel.add(rSquaredButton); methodGroup.add(rSquaredButton); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 1.0; gbc.weighty = 0.0; ldPanel.add(methodPanel, gbc); ldPlot = new LDPlot(controller); JPanel lowerLDPanel = populatePanel(ldPlot); gbc.weighty = 1.0; ldPanel.add(lowerLDPanel, gbc); tabs.addTab("LD Plot", ldPanel); gbc.weighty = 0.0; add(tools, gbc); // Create the informative cards, but don't use them. messageLabel = new JLabel(); messageLabel.setFont(MESSAGE_FONT); messagePanel = populatePanel(messageLabel); progressPanel = new ProgressPanel(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { controller.cancelDataRequests(); } }); showCard(tabs, null); }
From source file:simplesqlformatter.formatter.SQLFormatterEditor.java
private void createFileMenu(JMenuBar menuBar, JToolBar toolBar) { final JMenu menuFile = new JMenu("File"); final GuiAction newFile = new GuiAction("New", "/icons/file_new.gif"); newFile.setShortcutKey(KeyStroke.getKeyStroke("control N")); newFile.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent actionevent) { clear();//from w w w.j ava2 s .c o m } }); menuFile.add(newFile); toolBar.add(newFile); final GuiAction openFile = new GuiAction("Open", "/icons/file_open.gif"); openFile.setShortcutKey(KeyStroke.getKeyStroke("control O")); openFile.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent actionevent) { openFile(); } }); menuFile.add(openFile); toolBar.add(openFile); final GuiAction saveFile = new GuiAction("Save", "/icons/file_save.gif"); saveFile.setShortcutKey(KeyStroke.getKeyStroke("control S")); saveFile.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent actionevent) { saveFile(); } }); menuFile.add(saveFile); toolBar.add(saveFile); menuFile.addSeparator(); toolBar.addSeparator(); final ExitAction exit = new ExitAction(this, "Exit"); exit.setShortcutKey(KeyStroke.getKeyStroke("control Q")); menuFile.add(exit); menuBar.add(menuFile); }
From source file:xtrememp.PlaylistManager.java
private void initComponents() { JToolBar toolBar = new JToolBar(); toolBar.setFloatable(false);/*from ww w . j a v a2s.com*/ openPlaylistButton = new JButton(Utilities.DOCUMENT_OPEN_ICON); openPlaylistButton.setToolTipText(tr("MainFrame.PlaylistManager.OpenPlaylist")); openPlaylistButton.addActionListener(this); toolBar.add(openPlaylistButton); savePlaylistButton = new JButton(Utilities.DOCUMENT_SAVE_ICON); savePlaylistButton.setToolTipText(tr("MainFrame.PlaylistManager.SavePlaylist")); savePlaylistButton.addActionListener(this); toolBar.add(savePlaylistButton); toolBar.addSeparator(); addToPlaylistButton = new JButton(Utilities.LIST_ADD_ICON); addToPlaylistButton.setToolTipText(tr("MainFrame.PlaylistManager.AddToPlaylist")); addToPlaylistButton.addActionListener(this); toolBar.add(addToPlaylistButton); remFromPlaylistButton = new JButton(Utilities.LIST_REMOVE_ICON); remFromPlaylistButton.setToolTipText(tr("MainFrame.PlaylistManager.RemoveFromPlaylist")); remFromPlaylistButton.addActionListener(this); remFromPlaylistButton.setEnabled(false); toolBar.add(remFromPlaylistButton); clearPlaylistButton = new JButton(Utilities.EDIT_CLEAR_ICON); clearPlaylistButton.setToolTipText(tr("MainFrame.PlaylistManager.ClearPlaylist")); clearPlaylistButton.addActionListener(this); clearPlaylistButton.setEnabled(false); toolBar.add(clearPlaylistButton); toolBar.addSeparator(); moveUpButton = new JButton(Utilities.GO_UP_ICON); moveUpButton.setToolTipText(tr("MainFrame.PlaylistManager.MoveUp")); moveUpButton.addActionListener(this); moveUpButton.setEnabled(false); toolBar.add(moveUpButton); moveDownButton = new JButton(Utilities.GO_DOWN_ICON); moveDownButton.setToolTipText(tr("MainFrame.PlaylistManager.MoveDown")); moveDownButton.addActionListener(this); moveDownButton.setEnabled(false); toolBar.add(moveDownButton); toolBar.addSeparator(); mediaInfoButton = new JButton(Utilities.MEDIA_INFO_ICON); mediaInfoButton.setToolTipText(tr("MainFrame.PlaylistManager.MediaInfo")); mediaInfoButton.addActionListener(this); mediaInfoButton.setEnabled(false); toolBar.add(mediaInfoButton); toolBar.add(Box.createHorizontalGlue()); searchTextField = new SearchTextField(15); searchTextField.setMaximumSize(new Dimension(120, searchTextField.getPreferredSize().height)); searchTextField.getTextField().getDocument().addDocumentListener(new SearchFilterListener()); toolBar.add(searchTextField); toolBar.add(Box.createHorizontalStrut(6)); this.add(toolBar, BorderLayout.NORTH); playlistTable = new JTable(playlistTableModel, playlistTableColumnModel); playlistTable.setDefaultRenderer(String.class, new PlaylistCellRenderer()); playlistTable.setActionMap(null); playlistTable.getTableHeader().addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent ev) { if (SwingUtilities.isRightMouseButton(ev) || (MouseInfo.getNumberOfButtons() == 1 && ev.isControlDown())) { playlistTableColumnModel.getPopupMenu().show(playlistTable.getTableHeader(), ev.getX(), ev.getY()); return; } int clickedColumn = playlistTableColumnModel.getColumnIndexAtX(ev.getX()); PlaylistTableColumn playlistColumn = playlistTableColumnModel.getColumn(clickedColumn); playlistTableColumnModel.resetAll(playlistColumn.getModelIndex()); playlistColumn.setSortOrderUp(!playlistColumn.isSortOrderUp()); playlistTableModel.sort(playlistColumn.getComparator()); colorizeRow(); } }); playlistTable.setFillsViewportHeight(true); playlistTable.setShowGrid(false); playlistTable.setRowSelectionAllowed(true); playlistTable.setColumnSelectionAllowed(false); playlistTable.setDragEnabled(false); playlistTable.setFont(playlistTable.getFont().deriveFont(Font.BOLD)); playlistTable.setIntercellSpacing(new Dimension(0, 0)); playlistTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); playlistTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent ev) { int selectedRow = playlistTable.rowAtPoint(ev.getPoint()); if (SwingUtilities.isLeftMouseButton(ev) && ev.getClickCount() == 2) { if (selectedRow != -1) { playlist.setCursorPosition(selectedRow); controlListener.acOpenAndPlay(); } } } }); playlistTable.getSelectionModel().addListSelectionListener(this); playlistTable.getColumnModel().getSelectionModel().addListSelectionListener(this); playlistTable.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { // View Media Info if (e.getKeyCode() == KeyEvent.VK_I && e.getModifiers() == KeyEvent.CTRL_MASK) { viewMediaInfo(); } // Select all else if (e.getKeyCode() == KeyEvent.VK_A && e.getModifiers() == KeyEvent.CTRL_MASK) { playlistTable.selectAll(); } else if (e.getKeyCode() == KeyEvent.VK_UP) { // Move selected track(s) up if (e.getModifiers() == KeyEvent.ALT_MASK) { moveUp(); } // Select previous track else { if (playlistTable.getSelectedRow() > 0) { int previousRowIndex = playlistTable.getSelectedRow() - 1; playlistTable.clearSelection(); playlistTable.addRowSelectionInterval(previousRowIndex, previousRowIndex); makeRowVisible(previousRowIndex); } } } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { // Move selected track(s) down if (e.getModifiers() == KeyEvent.ALT_MASK) { moveDown(); } // Select next track else { if (playlistTable.getSelectedRow() < playlistTable.getRowCount() - 1) { int nextRowIndex = playlistTable.getSelectedRow() + 1; playlistTable.clearSelection(); playlistTable.addRowSelectionInterval(nextRowIndex, nextRowIndex); makeRowVisible(nextRowIndex); } } } // Play selected track else if (e.getKeyCode() == KeyEvent.VK_ENTER) { int selectedRow = playlistTable.getSelectedRow(); if (selectedRow != -1) { playlist.setCursorPosition(selectedRow); controlListener.acOpenAndPlay(); } } // Add new tracks else if (e.getKeyCode() == KeyEvent.VK_INSERT) { addFilesDialog(false); } // Delete selected tracks else if (e.getKeyCode() == KeyEvent.VK_DELETE) { remove(); } } }); XtremeMP.getInstance().getMainFrame().setDropTarget(new DropTarget(playlistTable, this)); JScrollPane ptScrollPane = new JScrollPane(playlistTable); ptScrollPane.setActionMap(null); this.add(ptScrollPane, BorderLayout.CENTER); }