Search in sources :

Example 21 with JToolBar

use of javax.swing.JToolBar in project processdash by dtuma.

the class HierarchyEditor method buildToolBar.

private JToolBar buildToolBar() {
    JToolBar result = new JToolBar();
    result.setFloatable(false);
    result.setMargin(new Insets(0, 0, 0, 0));
    addToolbarButton(result, cutAction);
    addToolbarButton(result, pasteAction);
    result.addSeparator();
    addToolbarButton(result, moveUpAction);
    addToolbarButton(result, moveDownAction);
    result.addSeparator();
    addToolbarButton(result, addNodeAboveAction);
    addToolbarButton(result, addNodeBelowAction);
    addToolbarButton(result, addNodeChildAction);
    return result;
}
Also used : Insets(java.awt.Insets) JToolBar(javax.swing.JToolBar)

Example 22 with JToolBar

use of javax.swing.JToolBar in project processdash by dtuma.

the class WBSTabPanel method makeToolBar.

/** Create and install the tool bar component. */
private void makeToolBar() {
    toolBar = new JToolBar();
    toolBar.setFloatable(false);
    toolBar.setMargin(new Insets(0, 0, 0, 0));
    addToolbarButton(undoList.getUndoAction());
    addToolbarButton(undoList.getRedoAction());
    Action[] editingActions = wbsTable.getEditingActions();
    for (int i = 0; i < editingActions.length; i++) if (editingActions[i].getValue(Action.SMALL_ICON) != null)
        addToolbarButton(editingActions[i]);
    addToolbarButton(findAction = new WBSFindAction(this));
    addToolbarButton(wbsTable.FILTER_ACTION);
    wbsTable.FILTER_ACTION.setWbsTabPanel(this);
    addToolbarButton(wbsTable.TOGGLE_ENTER_BEHAVIOR_ACTION);
    // add the tool bar to the panel
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = c.gridy = 0;
    c.weightx = c.weighty = 1.0;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.insets.left = 10;
    c.insets.right = c.insets.bottom = c.insets.top = 0;
    add(toolBar);
    setLayer(toolBar, 0);
    layout.setConstraints(toolBar, c);
}
Also used : CustomColumnsAction(teamdash.wbs.columns.CustomColumnsAction) AbstractAction(javax.swing.AbstractAction) Action(javax.swing.Action) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) JToolBar(javax.swing.JToolBar)

Example 23 with JToolBar

use of javax.swing.JToolBar in project processdash by dtuma.

the class WorkflowEditor method buildToolbar.

private void buildToolbar(Action... actions) {
    toolBar = new JToolBar();
    toolBar.setFloatable(false);
    toolBar.setMargin(new Insets(0, 0, 0, 0));
    addToolbarButton(undoList.getUndoAction());
    addToolbarButton(undoList.getRedoAction());
    table.tweakClipboardActions(resources, IconFactory.getCopyWorkflowIcon(), IconFactory.getPasteWorkflowIcon());
    addToolbarButtons(table.getEditingActions());
    addToolbarButtons(actions);
    toolBar.addSeparator();
    if (isEditable(teamProject) == false) {
        IMPORT.setEnabled(false);
        IMPORT_ORG.setEnabled(false);
    }
    TeamProcess teamProcess = teamProject.getTeamProcess();
    if (WorkflowLibraryEditor.orgAssetsAreAvailable(teamProcess))
        addToolbarButton(IMPORT_ORG);
    addToolbarButton(IMPORT);
    addToolbarButton(EXPORT);
}
Also used : Insets(java.awt.Insets) JToolBar(javax.swing.JToolBar)

Example 24 with JToolBar

use of javax.swing.JToolBar in project processdash by dtuma.

the class MilestonesEditor method buildToolbar.

private void buildToolbar() {
    toolBar = new JToolBar();
    toolBar.setFloatable(false);
    toolBar.setMargin(new Insets(0, 0, 0, 0));
    addToolbarButton(undoList.getUndoAction());
    addToolbarButton(undoList.getRedoAction());
    table.tweakClipboardActions(resources, IconFactory.getCopyMilestoneIcon(), IconFactory.getPasteMilestoneIcon());
    addToolbarButton(table.CUT_ACTION);
    addToolbarButton(table.COPY_ACTION);
    addToolbarButton(table.PASTE_ACTION);
    addToolbarButton(table.MOVEUP_ACTION);
    addToolbarButton(table.MOVEDOWN_ACTION);
    addToolbarButton(table.DELETE_ACTION);
    toolBar.addSeparator();
    addToolbarButton(new SortMilestonesAction());
}
Also used : Insets(java.awt.Insets) JToolBar(javax.swing.JToolBar)

Example 25 with JToolBar

use of javax.swing.JToolBar in project JMRI by JMRI.

the class UserInterface method createWindow.

protected void createWindow() {
    panel = new JPanel();
    panel.setLayout(new GridBagLayout());
    GridBagConstraints con = new GridBagConstraints();
    getContentPane().add(panel);
    con.fill = GridBagConstraints.NONE;
    con.weightx = 0.5;
    con.weighty = 0;
    JLabel label = new JLabel(MessageFormat.format(rb.getString("LabelAdvertising"), new Object[] { DeviceServer.getWiTVersion() }));
    con.gridx = 0;
    con.gridy = 0;
    con.gridwidth = 2;
    panel.add(label, con);
    con.gridx = 0;
    con.gridy = 1;
    con.gridwidth = 2;
    panel.add(portLabel, con);
    con.gridy = 2;
    panel.add(manualPortLabel, con);
    numConnected = new JLabel(rb.getString("LabelClients") + " " + deviceList.size());
    con.weightx = 0;
    con.gridx = 2;
    con.gridy = 2;
    con.ipadx = 5;
    con.gridwidth = 1;
    panel.add(numConnected, con);
    JPanel rgsPanel = new JPanel();
    rgsPanel.add(new JLabel(rb.getString("RosterGroupLabel")));
    rgsPanel.add(rosterGroupSelector);
    rgsPanel.setToolTipText(rb.getString("RosterGroupToolTip"));
    JToolBar withrottleToolBar = new JToolBar();
    withrottleToolBar.setFloatable(false);
    withrottleToolBar.add(new StopAllButton());
    withrottleToolBar.add(new LargePowerManagerButton());
    withrottleToolBar.add(rgsPanel);
    con.weightx = 0.5;
    con.ipadx = 0;
    con.gridx = 1;
    con.gridy = 3;
    con.gridwidth = 2;
    panel.add(withrottleToolBar, con);
    /*
         JLabel vLabel = new JLabel("v"+DeviceServer.getWiTVersion());
         con.weightx = 0;
         con.gridx = 2;
         con.gridy = 3;
         panel.add(vLabel, con);
         */
    JLabel icon;
    java.net.URL imageURL = FileUtil.findURL("resources/IconForWiThrottle.gif");
    if (imageURL != null) {
        ImageIcon image = new ImageIcon(imageURL);
        icon = new JLabel(image);
        con.weightx = 0.5;
        con.gridx = 2;
        con.gridy = 0;
        con.ipady = 5;
        con.gridheight = 2;
        panel.add(icon, con);
    }
    //  Add a list of connected devices and the address they are set to.
    withrottlesListModel = new WiThrottlesListModel(deviceList);
    withrottlesList = new JTable(withrottlesListModel);
    withrottlesList.setPreferredScrollableViewportSize(new Dimension(300, 80));
    withrottlesList.setRowHeight(20);
    scrollTable = new JScrollPane(withrottlesList);
    con.gridx = 0;
    con.gridy = 4;
    con.weighty = 1.0;
    con.ipadx = 10;
    con.ipady = 10;
    con.gridheight = 3;
    con.gridwidth = GridBagConstraints.REMAINDER;
    con.fill = GridBagConstraints.BOTH;
    panel.add(scrollTable, con);
    //  Create the menu to use with WiThrottle window. Has to be before pack() for Windows.
    buildMenu();
    //  Set window size & location
    this.setTitle("WiThrottle");
    this.pack();
    this.setResizable(true);
    Rectangle screenRect = new Rectangle(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds());
    //  Centers on top edge of screen
    this.setLocation((screenRect.width / 2) - (this.getWidth() / 2), 0);
    this.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
    setVisible(true);
    setMinimumSize(getSize());
    rosterGroupSelector.addActionListener(new ActionListener() {

        @SuppressWarnings("unchecked")
        @Override
        public void actionPerformed(ActionEvent e) {
            userPreferences.addComboBoxLastSelection(rosterGroupSelectorPreferencesName, (String) ((JComboBox<String>) e.getSource()).getSelectedItem());
            //              Send new selected roster group to all devices
            for (DeviceServer device : deviceList) {
                device.sendPacketToDevice(device.sendRoster());
            }
        }
    });
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) GridBagConstraints(java.awt.GridBagConstraints) LargePowerManagerButton(jmri.jmrit.throttle.LargePowerManagerButton) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) Rectangle(java.awt.Rectangle) JLabel(javax.swing.JLabel) JToolBar(javax.swing.JToolBar) Dimension(java.awt.Dimension) ActionListener(java.awt.event.ActionListener) JTable(javax.swing.JTable) StopAllButton(jmri.jmrit.throttle.StopAllButton)

Aggregations

JToolBar (javax.swing.JToolBar)124 JButton (javax.swing.JButton)51 BorderLayout (java.awt.BorderLayout)45 JPanel (javax.swing.JPanel)37 JScrollPane (javax.swing.JScrollPane)30 Dimension (java.awt.Dimension)25 Insets (java.awt.Insets)25 ActionEvent (java.awt.event.ActionEvent)24 JLabel (javax.swing.JLabel)23 ActionListener (java.awt.event.ActionListener)19 ImageIcon (javax.swing.ImageIcon)17 Component (java.awt.Component)14 JSplitPane (javax.swing.JSplitPane)14 JTable (javax.swing.JTable)14 JTextField (javax.swing.JTextField)14 JPopupMenu (javax.swing.JPopupMenu)13 JToggleButton (javax.swing.JToggleButton)12 GridBagConstraints (java.awt.GridBagConstraints)10 GridBagLayout (java.awt.GridBagLayout)10 JComponent (javax.swing.JComponent)10