use of javax.swing.JToolBar in project com.revolsys.open by revolsys.
the class BackgroundTaskTableModel method newPanel.
public static TablePanel newPanel() {
final BaseJTable table = newTaskTable();
final TablePanel panel = new TablePanel(table);
final BackgroundTaskTableModel model = table.getTableModel();
final JToolBar toolBar = panel.getToolBar();
addCountLabel(toolBar, model, "Pending", "pendingCount", WebColors.Pink, WebColors.DarkRed);
addCountLabel(toolBar, model, "Running", "runningCount", WebColors.Ivory, WebColors.DarkOrange);
addCountLabel(toolBar, model, "Done", "doneCount", WebColors.HoneyDew, WebColors.Green);
return panel;
}
use of javax.swing.JToolBar in project mdw-designer by CenturyLinkCloud.
the class ProcessInstancePage method createToolBar.
public void createToolBar() {
toolbar = new JToolBar();
add(toolbar, BorderLayout.NORTH);
if (frame.getStartPage() != null) {
backButton = createToolButton("back", "back.gif", "Back to last page", Constants.BACK, this);
createToolButton("Save", "save.gif", SAVE_AS_JPEG, Constants.ACTION_SAVE, this);
createToolButton("Variables", "variable.jpg", "variables", Constants.ACTION_DOCVIEW, this);
} else {
backButton = createToolButton("back", "back.gif", "Back to last page", Constants.BACK, this);
createToolButton("Process Definition", "process.jpg", "process definition", Constants.ACTION_FLOWVIEW, this);
if (!frame.dao.noDatabase())
createToolButton("ProcessInstance", "table24.gif", "All Process Instance for this process", Constants.VIEW_ALL_PROCESS_INSTANCE, this);
createToolButton("Save", "save.gif", SAVE_AS_JPEG, Constants.ACTION_SAVE, this);
createToolButton("Variables", "variable.jpg", "variables", Constants.ACTION_DOCVIEW, this);
createToolButton("Send message", "start.gif", "Send message", Constants.ACTION_START, this);
createToolButton("Remove", "delete.gif", "remove instance from menu", Constants.ACTION_DELETE, this);
// AK..added 02/25/2011
createToolButton("Logout", "logout.gif", "Log out", Constants.ACTION_LOGOUT, this);
String[] actions = { Constants.ACTION_PROCLIST, Constants.ACTION_PACKAGE, ACTION_SCRIPT, ACTION_TESTING };
addCommonToolButtons(actions);
}
zoomWidget = createToolDropdown(Graph.zoomLevelNames, ACTION_ZOOM, this, 3, 60);
}
use of javax.swing.JToolBar in project gate-core by GateNLP.
the class DocumentEditor method initViews.
protected void initViews() {
viewsInited = true;
// start building the UI
setLayout(new BorderLayout());
JProgressBar progressBar = new JProgressBar();
progressBar.setStringPainted(true);
progressBar.setMaximumSize(new Dimension(Integer.MAX_VALUE, progressBar.getPreferredSize().height));
add(progressBar, BorderLayout.CENTER);
progressBar.setString("Building views");
progressBar.setValue(10);
// create the skeleton UI
topSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, null, null);
topSplit.setResizeWeight(0.3);
topSplit.setContinuousLayout(true);
topSplit.setOneTouchExpandable(true);
bottomSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topSplit, null);
bottomSplit.setResizeWeight(0.7);
bottomSplit.setContinuousLayout(true);
bottomSplit.setOneTouchExpandable(true);
horizontalSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, bottomSplit, null);
horizontalSplit.setResizeWeight(0.7);
horizontalSplit.setContinuousLayout(true);
horizontalSplit.setOneTouchExpandable(true);
// create the bars
topBar = new JToolBar(JToolBar.HORIZONTAL);
topBar.setFloatable(false);
add(topBar, BorderLayout.NORTH);
progressBar.setValue(40);
centralViews = new ArrayList<DocumentView>();
verticalViews = new ArrayList<DocumentView>();
horizontalViews = new ArrayList<DocumentView>();
// parse all Creole resources and look for document views
Set<String> vrSet = Gate.getCreoleRegister().getVrTypes();
List<ResourceData> viewTypes = new ArrayList<ResourceData>();
for (String vr : vrSet) {
ResourceData rData = Gate.getCreoleRegister().get(vr);
try {
if (DocumentView.class.isAssignableFrom(rData.getResourceClass())) {
viewTypes.add(rData);
}
} catch (ClassNotFoundException cnfe) {
cnfe.printStackTrace();
}
}
// sort view types by label
Collections.sort(viewTypes, new Comparator<ResourceData>() {
@Override
public int compare(ResourceData rd1, ResourceData rd2) {
return rd1.getName().compareTo(rd2.getName());
}
});
for (ResourceData viewType : viewTypes) {
try {
// create the resource
DocumentView aView = (DocumentView) Factory.createResource(viewType.getClassName());
aView.setTarget(document);
aView.setOwner(this);
// add the view
addView(aView, viewType.getName());
} catch (ResourceInstantiationException rie) {
rie.printStackTrace();
}
}
// select the main central view only
if (centralViews.size() > 0)
setCentralView(0);
// populate the main VIEW
remove(progressBar);
add(horizontalSplit, BorderLayout.CENTER);
searchAction = new SearchAction();
JButton searchButton = new JButton(searchAction);
searchButton.setMargin(new Insets(0, 0, 0, 0));
topBar.add(Box.createHorizontalStrut(5));
topBar.add(searchButton);
// add a key binding for the search function
getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke("control F"), "Search in text");
getActionMap().put("Search in text", searchAction);
// create menu that contains several options for the document editor
final OptionsMap config = Gate.getUserConfig();
final JPopupMenu optionsMenu = new JPopupMenu("Options menu");
final JMenuItem saveCurrentLayoutMenuItem = new JMenuItem(new AbstractAction("Save Current Layout") {
@Override
public void actionPerformed(ActionEvent evt) {
saveSettings();
}
});
optionsMenu.add(saveCurrentLayoutMenuItem);
final JCheckBoxMenuItem restoreLayoutAutomaticallyMenuItem = new JCheckBoxMenuItem("Restore Layout Automatically");
restoreLayoutAutomaticallyMenuItem.setSelected(Gate.getUserConfig().getBoolean(DocumentEditor.class.getName() + ".restoreLayoutAutomatically"));
restoreLayoutAutomaticallyMenuItem.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
// whenever the user checks/unchecks, update the config
config.put(DocumentEditor.class.getName() + ".restoreLayoutAutomatically", restoreLayoutAutomaticallyMenuItem.isSelected());
}
});
optionsMenu.add(restoreLayoutAutomaticallyMenuItem);
final JCheckBoxMenuItem readOnly = new JCheckBoxMenuItem("Read-only");
readOnly.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
config.put(GateConstants.DOCEDIT_READ_ONLY, readOnly.isSelected());
setEditable(!readOnly.isSelected());
}
});
readOnly.setSelected(config.getBoolean(GateConstants.DOCEDIT_READ_ONLY));
optionsMenu.addSeparator();
optionsMenu.add(readOnly);
// right to left orientation
final JCheckBoxMenuItem rightToLeftOrientation = new JCheckBoxMenuItem("Right To Left Orientation");
rightToLeftOrientation.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
config.put(GateConstants.DOC_RTOL_ORIENTATION, rightToLeftOrientation.isSelected());
setRightToLeftOrientation(rightToLeftOrientation.isSelected());
}
});
optionsMenu.addSeparator();
optionsMenu.add(rightToLeftOrientation);
ButtonGroup buttonGroup = new ButtonGroup();
final JRadioButtonMenuItem insertAppend = new JRadioButtonMenuItem("Insert Append");
buttonGroup.add(insertAppend);
insertAppend.setSelected(config.getBoolean(GateConstants.DOCEDIT_INSERT_APPEND));
insertAppend.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
config.put(GateConstants.DOCEDIT_INSERT_APPEND, insertAppend.isSelected());
}
});
optionsMenu.addSeparator();
optionsMenu.add(insertAppend);
final JRadioButtonMenuItem insertPrepend = new JRadioButtonMenuItem("Insert Prepend");
buttonGroup.add(insertPrepend);
insertPrepend.setSelected(config.getBoolean(GateConstants.DOCEDIT_INSERT_PREPEND));
insertPrepend.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
config.put(GateConstants.DOCEDIT_INSERT_PREPEND, insertPrepend.isSelected());
}
});
optionsMenu.add(insertPrepend);
// if none set then set the default one
if (!(insertAppend.isSelected() || insertPrepend.isSelected())) {
insertAppend.setSelected(true);
}
JMenuButton menuButton = new JMenuButton(optionsMenu);
menuButton.setIcon(MainFrame.getIcon("expanded"));
menuButton.setToolTipText("Options for the document editor");
// icon is not centred
menuButton.setMargin(new Insets(0, 0, 0, 1));
topBar.add(Box.createHorizontalGlue());
topBar.add(menuButton);
// when the editor is shown restore views if layout saving is enable
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (Gate.getUserConfig().getBoolean(DocumentEditor.class.getName() + ".restoreLayoutAutomatically")) {
restoreSettings();
}
}
});
validate();
}
use of javax.swing.JToolBar in project keystore-explorer by kaikramer.
the class KseFrame method initToolBar.
private void initToolBar() {
jbNew = new JButton();
jbNew.setAction(newAction);
jbNew.setText(null);
PlatformUtil.setMnemonic(jbNew, 0);
jbNew.setFocusable(false);
jbNew.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent evt) {
setStatusBarText((String) newAction.getValue(Action.LONG_DESCRIPTION));
}
@Override
public void mouseExited(MouseEvent evt) {
setDefaultStatusBarText();
}
});
jbOpen = new JButton();
jbOpen.setAction(openAction);
jbOpen.setText(null);
PlatformUtil.setMnemonic(jbOpen, 0);
jbOpen.setFocusable(false);
jbOpen.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent evt) {
setStatusBarText((String) openAction.getValue(Action.LONG_DESCRIPTION));
}
@Override
public void mouseExited(MouseEvent evt) {
setDefaultStatusBarText();
}
});
jbSave = new JButton();
jbSave.setAction(saveAction);
jbSave.setText(null);
PlatformUtil.setMnemonic(jbSave, 0);
jbSave.setFocusable(false);
jbSave.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent evt) {
setStatusBarText((String) saveAction.getValue(Action.LONG_DESCRIPTION));
}
@Override
public void mouseExited(MouseEvent evt) {
setDefaultStatusBarText();
}
});
jbUndo = new JButton();
jbUndo.setAction(undoAction);
jbUndo.setText(null);
PlatformUtil.setMnemonic(jbUndo, 0);
// Ensure text is not displayed when
jbUndo.setHideActionText(true);
// changed dynamically
// later on action
jbUndo.setFocusable(false);
jbUndo.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent evt) {
setStatusBarText((String) undoAction.getValue(Action.LONG_DESCRIPTION));
}
@Override
public void mouseExited(MouseEvent evt) {
setDefaultStatusBarText();
}
});
jbRedo = new JButton();
jbRedo.setAction(redoAction);
jbRedo.setText(null);
PlatformUtil.setMnemonic(jbRedo, 0);
// Ensure text is not displayed when
jbRedo.setHideActionText(true);
// changed dynamically
// later on action
jbRedo.setFocusable(false);
jbRedo.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent evt) {
setStatusBarText((String) redoAction.getValue(Action.LONG_DESCRIPTION));
}
@Override
public void mouseExited(MouseEvent evt) {
setDefaultStatusBarText();
}
});
jbCut = new JButton();
jbCut.setAction(cutAction);
jbCut.setText(null);
PlatformUtil.setMnemonic(jbCut, 0);
jbCut.setFocusable(false);
jbCut.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent evt) {
setStatusBarText((String) cutAction.getValue(Action.LONG_DESCRIPTION));
}
@Override
public void mouseExited(MouseEvent evt) {
setDefaultStatusBarText();
}
});
jbCopy = new JButton();
jbCopy.setAction(copyAction);
jbCopy.setText(null);
PlatformUtil.setMnemonic(jbCopy, 0);
jbCopy.setFocusable(false);
jbCopy.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent evt) {
setStatusBarText((String) copyAction.getValue(Action.LONG_DESCRIPTION));
}
@Override
public void mouseExited(MouseEvent evt) {
setDefaultStatusBarText();
}
});
jbPaste = new JButton();
jbPaste.setAction(pasteAction);
jbPaste.setText(null);
PlatformUtil.setMnemonic(jbPaste, 0);
jbPaste.setFocusable(false);
jbPaste.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent evt) {
setStatusBarText((String) pasteAction.getValue(Action.LONG_DESCRIPTION));
}
@Override
public void mouseExited(MouseEvent evt) {
setDefaultStatusBarText();
}
});
jbGenerateKeyPair = new JButton();
jbGenerateKeyPair.setAction(generateKeyPairAction);
jbGenerateKeyPair.setText(null);
PlatformUtil.setMnemonic(jbGenerateKeyPair, 0);
jbGenerateKeyPair.setFocusable(false);
jbGenerateKeyPair.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent evt) {
setStatusBarText((String) generateKeyPairAction.getValue(Action.LONG_DESCRIPTION));
}
@Override
public void mouseExited(MouseEvent evt) {
setDefaultStatusBarText();
}
});
jbGenerateSecretKey = new JButton();
jbGenerateSecretKey.setAction(generateSecretKeyAction);
jbGenerateSecretKey.setText(null);
PlatformUtil.setMnemonic(jbGenerateSecretKey, 0);
jbGenerateSecretKey.setFocusable(false);
jbGenerateSecretKey.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent evt) {
setStatusBarText((String) generateSecretKeyAction.getValue(Action.LONG_DESCRIPTION));
}
@Override
public void mouseExited(MouseEvent evt) {
setDefaultStatusBarText();
}
});
jbImportTrustedCertificate = new JButton();
jbImportTrustedCertificate.setAction(importTrustedCertificateAction);
jbImportTrustedCertificate.setText(null);
PlatformUtil.setMnemonic(jbImportTrustedCertificate, 0);
jbImportTrustedCertificate.setFocusable(false);
jbImportTrustedCertificate.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent evt) {
setStatusBarText((String) importTrustedCertificateAction.getValue(Action.LONG_DESCRIPTION));
}
@Override
public void mouseExited(MouseEvent evt) {
setDefaultStatusBarText();
}
});
jbImportKeyPair = new JButton();
jbImportKeyPair.setAction(importKeyPairAction);
jbImportKeyPair.setText(null);
PlatformUtil.setMnemonic(jbImportKeyPair, 0);
jbImportKeyPair.setFocusable(false);
jbImportKeyPair.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent evt) {
setStatusBarText((String) importKeyPairAction.getValue(Action.LONG_DESCRIPTION));
}
@Override
public void mouseExited(MouseEvent evt) {
setDefaultStatusBarText();
}
});
jbSetPassword = new JButton();
jbSetPassword.setAction(setPasswordAction);
jbSetPassword.setText(null);
PlatformUtil.setMnemonic(jbSetPassword, 0);
jbSetPassword.setFocusable(false);
jbSetPassword.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent evt) {
setStatusBarText((String) setPasswordAction.getValue(Action.LONG_DESCRIPTION));
}
@Override
public void mouseExited(MouseEvent evt) {
setDefaultStatusBarText();
}
});
jbProperties = new JButton();
jbProperties.setAction(propertiesAction);
jbProperties.setText(null);
PlatformUtil.setMnemonic(jbProperties, 0);
jbProperties.setFocusable(false);
jbProperties.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent evt) {
setStatusBarText((String) propertiesAction.getValue(Action.LONG_DESCRIPTION));
}
@Override
public void mouseExited(MouseEvent evt) {
setDefaultStatusBarText();
}
});
jbExamineFile = new JButton();
jbExamineFile.setAction(examineFileAction);
jbExamineFile.setText(null);
PlatformUtil.setMnemonic(jbExamineFile, 0);
jbExamineFile.setFocusable(false);
jbExamineFile.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent evt) {
setStatusBarText((String) examineFileAction.getValue(Action.LONG_DESCRIPTION));
}
@Override
public void mouseExited(MouseEvent evt) {
setDefaultStatusBarText();
}
});
jbExamineClipboard = new JButton();
jbExamineClipboard.setAction(examineClipboardAction);
jbExamineClipboard.setText(null);
PlatformUtil.setMnemonic(jbExamineClipboard, 0);
jbExamineClipboard.setFocusable(false);
jbExamineClipboard.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent evt) {
setStatusBarText((String) examineClipboardAction.getValue(Action.LONG_DESCRIPTION));
}
@Override
public void mouseExited(MouseEvent evt) {
setDefaultStatusBarText();
}
});
jbExamineSsl = new JButton();
jbExamineSsl.setAction(examineSslAction);
jbExamineSsl.setText(null);
PlatformUtil.setMnemonic(jbExamineSsl, 0);
jbExamineSsl.setFocusable(false);
jbExamineSsl.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent evt) {
setStatusBarText((String) examineSslAction.getValue(Action.LONG_DESCRIPTION));
}
@Override
public void mouseExited(MouseEvent evt) {
setDefaultStatusBarText();
}
});
jbHelp = new JButton();
jbHelp.setAction(helpAction);
jbHelp.setText(null);
PlatformUtil.setMnemonic(jbHelp, 0);
jbHelp.setFocusable(false);
jbHelp.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent evt) {
setStatusBarText((String) helpAction.getValue(Action.LONG_DESCRIPTION));
}
@Override
public void mouseExited(MouseEvent evt) {
setDefaultStatusBarText();
}
});
jtbToolBar = new JToolBar();
// from the main view
if (LnfUtil.usingWindowsLnf()) {
jtbToolBar.setBorder(new MatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY));
}
jtbToolBar.setFloatable(false);
jtbToolBar.setRollover(true);
jtbToolBar.setName(KSE.getApplicationName());
jtbToolBar.add(jbNew);
jtbToolBar.add(jbOpen);
jtbToolBar.add(jbSave);
jtbToolBar.addSeparator();
jtbToolBar.add(jbUndo);
jtbToolBar.add(jbRedo);
jtbToolBar.addSeparator();
jtbToolBar.add(jbCut);
jtbToolBar.add(jbCopy);
jtbToolBar.add(jbPaste);
jtbToolBar.addSeparator();
jtbToolBar.add(jbGenerateKeyPair);
jtbToolBar.add(jbGenerateSecretKey);
jtbToolBar.add(jbImportTrustedCertificate);
jtbToolBar.add(jbImportKeyPair);
jtbToolBar.add(jbSetPassword);
jtbToolBar.add(jbProperties);
jtbToolBar.addSeparator();
jtbToolBar.add(jbExamineFile);
jtbToolBar.add(jbExamineClipboard);
jtbToolBar.add(jbExamineSsl);
jtbToolBar.addSeparator();
jtbToolBar.add(jbHelp);
jtbToolBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH);
if (applicationSettings.getShowToolBar()) {
frame.getContentPane().add(jtbToolBar, BorderLayout.NORTH);
}
}
use of javax.swing.JToolBar in project energy3d by concord-consortium.
the class MainPanel method getAppToolbar.
public JToolBar getAppToolbar() {
if (appToolbar == null) {
appToolbar = new JToolBar();
appToolbar.setFloatable(false);
appToolbar.add(getSelectButton());
appToolbar.add(getZoomButton());
appToolbar.add(getSpinViewButton());
appToolbar.add(getPreviewButton());
appToolbar.add(getNoteButton());
appToolbar.addSeparator();
appToolbar.add(getAnnotationButton());
appToolbar.add(getResizeButton());
appToolbar.add(getRotateButton());
appToolbar.addSeparator();
appToolbar.add(getFoundationButton());
appToolbar.add(getWallButton());
appToolbar.add(getWindowButton());
appToolbar.add(getRoofButton());
appToolbar.add(getRoofArrowButton());
appToolbar.add(getMiscButton());
appToolbar.add(getMiscArrowButton());
appToolbar.add(getTreeButton());
appToolbar.add(getTreeArrowButton());
appToolbar.add(getSolarButton());
appToolbar.add(getSolaArrowButton());
appToolbar.addSeparator();
appToolbar.add(getShadowButton());
appToolbar.add(getHeliodonButton());
appToolbar.add(getSunAnimationButton());
appToolbar.add(getEnergyButton());
final ButtonGroup bg = new ButtonGroup();
bg.add(selectButton);
bg.add(zoomButton);
bg.add(resizeButton);
bg.add(foundationButton);
bg.add(wallButton);
bg.add(windowButton);
bg.add(roofButton);
bg.add(solarButton);
bg.add(treeButton);
bg.add(miscButton);
}
return appToolbar;
}
Aggregations