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;
}
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);
}
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);
}
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());
}
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());
}
}
});
}
Aggregations