本文整理匯總了Java中javax.swing.JToolBar.add方法的典型用法代碼示例。如果您正苦於以下問題:Java JToolBar.add方法的具體用法?Java JToolBar.add怎麽用?Java JToolBar.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JToolBar
的用法示例。
在下文中一共展示了JToolBar.add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createToolBar
import javax.swing.JToolBar; //導入方法依賴的package包/類
JToolBar createToolBar() {
JToolBar toolbar = new JToolBar();
next = new JButton(XDMIconMap.getIcon("NEXT_ICON"));
XDMToolBarButtonUI btnUI = new XDMToolBarButtonUI();
next.setUI(btnUI);
next.addActionListener(this);
next.setRolloverIcon(XDMIconMap.getIcon("NEXT_R_ICON"));
next.setContentAreaFilled(false);
next.setFocusPainted(false);
back = new JButton(XDMIconMap.getIcon("BACK_ICON"));
back.setUI(btnUI);
back.setContentAreaFilled(false);
back.setFocusPainted(false);
back.addActionListener(this);
back.setRolloverIcon(XDMIconMap.getIcon("BACK_R_ICON"));
toolbar.add(back);
toolbar.add(next);
return toolbar;// add(toolbar, BorderLayout.NORTH);
}
示例2: addSwitchViewButton
import javax.swing.JToolBar; //導入方法依賴的package包/類
/**
* Adds the switchView button the the panel
*
* @param gbc
* - the constraints used for this component
*/
private void addSwitchViewButton(GridBagConstraints gbc) {
gbc.insets = new Insets(UIConstants.COMPONENT_TOP_PADDING, UIConstants.COMPONENT_LEFT_PADDING,
UIConstants.COMPONENT_BOTTOM_PADDING, UIConstants.COMPONENT_RIGHT_PADDING);
gbc.anchor = GridBagConstraints.EAST;
gbc.fill = GridBagConstraints.NONE;
gbc.gridx = 2;
gbc.gridy = 0;
gbc.weightx = 0;
gbc.weighty = 0;
JToolBar toolbar = new JToolBar();
switchViewButton = new ToolbarButton(null, false);
switchViewButton.setToolTipText(translator.getTranslation(Tags.CHANGE_TREE_VIEW_BUTTON_TOOLTIP));
URL resource = currentViewMode == ResourcesViewMode.FLAT_VIEW
? getClass().getResource(ImageConstants.TREE_VIEW)
: getClass().getResource(ImageConstants.TABLE_VIEW);
if (resource != null) {
ImageIcon icon = (ImageIcon) imageUtilities.loadIcon(resource);
switchViewButton.setIcon(icon);
}
toolbar.add(switchViewButton);
toolbar.setFloatable(false);
toolbar.setOpaque(false);
this.add(toolbar, gbc);
}
示例3: getListPanel
import javax.swing.JToolBar; //導入方法依賴的package包/類
/** Lazily creates and returns the panel containing the list of configuration names. */
private JPanel getListPanel() {
if (this.listPanel == null) {
JToolBar listToolbar = new JToolBar();
listToolbar.setFloatable(false);
listToolbar.add(getNewAction());
listToolbar.add(getCopyAction());
listToolbar.add(getDeleteAction());
this.listPanel = new JPanel(new BorderLayout());
this.listPanel.setPreferredSize(new Dimension(200, 400));
this.listPanel.setBorder(createLineBorder());
this.listPanel.add(listToolbar, BorderLayout.NORTH);
JScrollPane listScrollPanel = new JScrollPane(getConfigList());
listScrollPanel.setBorder(null);
this.listPanel.add(listScrollPanel);
}
return this.listPanel;
}
示例4: createToolBar
import javax.swing.JToolBar; //導入方法依賴的package包/類
@Override
protected JToolBar createToolBar() {
JToolBar result = super.createToolBar();
result.addSeparator();
result.add(getJGraph().getModeButton(EDIT_MODE));
result.add(getJGraph().getModeButton(PREVIEW_MODE));
result.addSeparator();
result.add(getUndoAction());
result.add(getRedoAction());
result.addSeparator();
result.add(getCopyAction());
result.add(getPasteAction());
result.add(getCutAction());
result.add(getDeleteAction());
result.addSeparator();
result.add(getSnapToGridButton());
processToolBar(result);
return result;
}
示例5: MainToolBar
import javax.swing.JToolBar; //導入方法依賴的package包/類
MainToolBar(@NonNull final Pair<JComponent,GridBagConstraints>... components) {
super(BoxLayout.X_AXIS);
setBorder(BorderFactory.createEmptyBorder(1, 2, 1, 5));
final JToolBar toolbar = new NoBorderToolBar(JToolBar.HORIZONTAL);
toolbar.setFloatable(false);
toolbar.setRollover(true);
toolbar.setBorderPainted(false);
toolbar.setBorder(BorderFactory.createEmptyBorder());
toolbar.setOpaque(false);
toolbar.setFocusable(false);
toolbar.setLayout(new GridBagLayout());
for (Pair<JComponent,GridBagConstraints> p : components) {
toolbar.add(p.first(),p.second());
}
add (toolbar);
}
示例6: createToolBar
import javax.swing.JToolBar; //導入方法依賴的package包/類
private void createToolBar() {
searchBar = new JToolBar();
searchBar.setFloatable(false);
searchBar.setLayout(new BoxLayout(searchBar, BoxLayout.X_AXIS));
searchBar.setBorder(BorderFactory.createEtchedBorder());
JLabel searchLabel = new JLabel(Utils.getIconByResourceName("/ui/resources/search"));
searchField = new JTextField();
searchField.setActionCommand("SearchField");
searchField.addActionListener(this);
searchBar.add(searchLabel);
searchBar.add(new javax.swing.Box.Filler(new java.awt.Dimension(5, 0),
new java.awt.Dimension(5, 0),
new java.awt.Dimension(5, 32767)));
searchBar.add(searchField);
}
示例7: createFilterToolBarUI
import javax.swing.JToolBar; //導入方法依賴的package包/類
private void createFilterToolBarUI(JToolBar toolbar, FiltersDescriptor filtersDesc) {
toolbar.removeAll();
// create toggle buttons
int filterCount = filtersDesc.getFilterCount();
ArrayList<JToggleButton> toggles = new ArrayList<JToggleButton>(filterCount);
JToggleButton toggleButton = null;
for (int i = 0; i < filterCount; i++) {
toggleButton = createToggle(filtersDesc, i);
toggles.add(toggleButton);
}
// add toggle buttons
for (int i = 0; i < toggles.size(); i++) {
JToggleButton curToggle = toggles.get(i);
curToggle.addActionListener(new ToggleButtonActionListener(i));
toolbar.add(curToggle);
if (i != toggles.size() - 1) {
toolbar.addSeparator(new Dimension(3, 0));
}
}
}
示例8: SearchFieldDemo
import javax.swing.JToolBar; //導入方法依賴的package包/類
public SearchFieldDemo() {
super("MuLaViTo SearchBar Demo");
search = new AbstractSearchField() {
@Override
protected void search(Pattern pat) {
List<Integer> find = new ArrayList<Integer>();
for (int i = 0; i < list.getModel().getSize(); i++)
if (pat.matcher(list.getModel().getElementAt(i).toString())
.find())
find.add(i);
list.setSelectedIndices(toInt(find));
}
private int[] toInt(List<Integer> value) {
int[] ret = new int[value.size()];
for (int i = 0; i < value.size(); i++)
ret[i] = value.get(i);
return ret;
}
};
JToolBar toolbar = new JToolBar();
JButton btn = new JButton("About");
btn.setActionCommand("about");
btn.addActionListener(this);
toolbar.add(btn);
toolbar.add(Box.createHorizontalGlue());
toolbar.add(search);
getToolBarPane().add(toolbar);
}
示例9: initToolBar
import javax.swing.JToolBar; //導入方法依賴的package包/類
/**
* Initialize toolbar.
*/
private void initToolBar() {
toolbar = new JToolBar(JToolBar.VERTICAL);
toolbar.setFloatable(false);
add(toolbar, BorderLayout.WEST);
JButton button = makeButton("save", SAVE, "Save", "Save");
toolbar.add(button);
button = makeButton("print", PRINT, "Print", "Print");
toolbar.add(button);
}
示例10: createListToolBar
import javax.swing.JToolBar; //導入方法依賴的package包/類
/**
* Creates a tool bar for the list panel.
* @param separation width of the separator on the tool bar;
* if negative, the default separator is used
*/
protected JToolBar createListToolBar(int separation) {
JToolBar result = Options.createToolBar();
result.add(getNewAction());
result.add(getEditAction());
if (separation >= 0) {
result.addSeparator(new Dimension(separation, 0));
} else {
result.addSeparator();
}
result.add(getCopyAction());
result.add(getDeleteAction());
result.add(getRenameAction());
if (separation >= 0) {
result.addSeparator(new Dimension(separation, 0));
} else {
result.addSeparator();
}
ResourceKind kind = getResourceKind();
if (kind.isEnableable()) {
result.add(getEnableButton());
if (getResourceKind() == ResourceKind.HOST || getResourceKind() == ResourceKind.TYPE
|| getResourceKind() == ResourceKind.PROLOG
|| getResourceKind() == ResourceKind.CONTROL) {
result.add(getEnableUniqueAction());
}
}
if (kind == ResourceKind.GROOVY) {
result.add(getActions().getExecGroovyAction());
}
return result;
}
示例11: installDefaults
import javax.swing.JToolBar; //導入方法依賴的package包/類
public void installDefaults (AbstractButton b) {
super.installDefaults(b);
if(!defaults_initialized) {
hiddenToggle = new JToggleButton();
hiddenToggle.setText("");
JToolBar bar = new JToolBar();
bar.setRollover(true);
bar.add(hiddenToggle);
defaults_initialized = true;
}
}
示例12: installDefaults
import javax.swing.JToolBar; //導入方法依賴的package包/類
@Override
public void installDefaults (AbstractButton b) {
super.installDefaults(b);
if(!defaults_initialized) {
hiddenToggle = new JToggleButton();
hiddenToggle.setText("");
JToolBar bar = new JToolBar();
bar.add(hiddenToggle);
defaults_initialized = true;
}
}
示例13: createToolBar
import javax.swing.JToolBar; //導入方法依賴的package包/類
public JToolBar createToolBar() {
JToolBar bar = new JToolBar();
JComboBox zoom = createZoomComboBox();
for (Action action : getFileActions()) {
if (action == null)
bar.addSeparator();
else
bar.add(action).setFocusable(false);
}
bar.addSeparator();
JToggleButton grid = new JToggleButton(layoutGridAction);
grid.setText(null);
grid.setFocusable(false);
JToggleButton col = new JToggleButton(layoutColAction);
col.setText(null);
col.setFocusable(false);
ButtonGroup bg = new ButtonGroup();
bg.add(col);
bg.add(grid);
bar.add(grid);
bar.add(col);
bar.addSeparator();
JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
panel.add(zoom);
bar.add(panel);
return bar;
}
示例14: createToolBar
import javax.swing.JToolBar; //導入方法依賴的package包/類
/** Creates a tool bar for the label tree. */
public JToolBar createToolBar() {
JToolBar result = Options.createToolBar();
result.add(getShowSubtypesButton());
result.add(getShowSupertypesButton());
result.addSeparator();
result.add(getShowAllLabelsButton());
result.add(getCollapseAllButton());
// put the sub- and supertype buttons in a button group
ButtonGroup modeButtonGroup = new ButtonGroup();
modeButtonGroup.add(getShowSubtypesButton());
modeButtonGroup.add(getShowSupertypesButton());
return result;
}
示例15: createToolbar
import javax.swing.JToolBar; //導入方法依賴的package包/類
/**
*/
private JComponent createToolbar() {
createShowButtons();
createNextPrevFailureButtons();
createRerunButtons();
createOptionButtons();
String testingFramework = Manager.getInstance().getTestingFramework();
JToolBar toolbar = new ToolbarWithOverflow(SwingConstants.VERTICAL);
toolbar.add(rerunButton);
toolbar.add(rerunFailedButton);
toolbar.add(new JToolBar.Separator());
toolbar.add(btnShowPassed);
if(testingFramework.equals(Manager.TESTNG_TF)) {
toolbar.add(btnShowPassedWithErrors);
}
toolbar.add(btnShowFailed);
toolbar.add(btnShowError);
toolbar.add(btnShowAborted);
// if(testingFramework.equals(Manager.TESTNG_TF) || testingFramework.equals(Manager.JUNIT_TF)) {
// toolbar.add(btnShowIgnored);
// }
toolbar.add(btnShowSkipped);
toolbar.add(new JToolBar.Separator());
toolbar.add(previousFailure);
toolbar.add(nextFailure);
toolbar.add(new JToolBar.Separator());
toolbar.add(btnAlwaysOpenTRW);
toolbar.add(btnAlwaysOpenNewTab);
toolbar.setFocusable(false);
toolbar.setRollover(true);
toolbar.setFloatable(false);
return toolbar;
}