本文整理匯總了Java中javax.swing.JToolBar類的典型用法代碼示例。如果您正苦於以下問題:Java JToolBar類的具體用法?Java JToolBar怎麽用?Java JToolBar使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
JToolBar類屬於javax.swing包,在下文中一共展示了JToolBar類的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: updateStyle
import javax.swing.JToolBar; //導入依賴的package包/類
private void updateStyle(JToolBar c) {
SynthContext context = getContext(
c, Region.TOOL_BAR_CONTENT, null, ENABLED);
contentStyle = SynthLookAndFeel.updateStyle(context, this);
context.dispose();
context = getContext(c, Region.TOOL_BAR_DRAG_WINDOW, null, ENABLED);
dragWindowStyle = SynthLookAndFeel.updateStyle(context, this);
context.dispose();
context = getContext(c, ENABLED);
SynthStyle oldStyle = style;
style = SynthLookAndFeel.updateStyle(context, this);
if (oldStyle != style) {
handleIcon =
style.getIcon(context, "ToolBar.handleIcon");
if (oldStyle != null) {
uninstallKeyboardActions();
installKeyboardActions();
}
}
context.dispose();
}
示例3: 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;
}
示例4: getRTreeInPanel
import javax.swing.JToolBar; //導入依賴的package包/類
private JPanel getRTreeInPanel(String labelText, JTree tree) {
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
JToolBar toolBar = new JToolBar();
toolBar.setFloatable(false);
toolBar.setBorder(BorderFactory.createEtchedBorder());
reusableSwitch = new JButton(labelText);
reusableSwitch.setFont(new Font("Default", Font.BOLD, 12));
reusableSwitch.setContentAreaFilled(false);
toolBar.add(new javax.swing.Box.Filler(new java.awt.Dimension(10, 0),
new java.awt.Dimension(10, 0),
new java.awt.Dimension(10, 32767)));
toolBar.add(reusableSwitch);
toolBar.setPreferredSize(new java.awt.Dimension(toolBar.getPreferredSize().width, 30));
panel.add(toolBar, BorderLayout.NORTH);
panel.add(TreeSearch.installFor(tree), BorderLayout.CENTER);
return panel;
}
示例5: ReportEditorTest
import javax.swing.JToolBar; //導入依賴的package包/類
public ReportEditorTest() {
setSize(1200, 800);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
JPanel panel = new JPanel(new BorderLayout());
XMLDiagram diagram = new XMLDiagram();
ReportEditor editor = new ReportEditor(diagram);
setContentPane(panel);
JScrollPane pane = new JScrollPane(editor);
panel.add(pane, BorderLayout.CENTER);
JToolBar bar = new JToolBar();
panel.add(bar, BorderLayout.NORTH);
for (Action action : editor.getActions()) {
JButton button = bar.add(action);
button.setText((String) action.getValue(Action.ACTION_COMMAND_KEY));
}
}
示例6: getPreferredDepth
import javax.swing.JToolBar; //導入依賴的package包/類
/**
* Returns the largest preferred height or width (depending on orientation)
* of all of the associated toolbars.
*/
private int getPreferredDepth() {
int depth = 0;
final JToolBar[] toolbars = super.getToolBars();
for (final JToolBar toolbar : toolbars) {
final Dimension d = toolbar.getPreferredSize();
if (getOrientation() == ToolBarLayout.HORIZONTAL)
depth = Math.max(depth, d.height);
else
depth = Math.max(depth, d.width);
}
return depth;
}
示例7: ToolBarDemo2
import javax.swing.JToolBar; //導入依賴的package包/類
public ToolBarDemo2() {
super(new BorderLayout());
// Create the toolbar.
JToolBar toolBar = new JToolBar("Still draggable");
addButtons(toolBar);
toolBar.setFloatable(false);
toolBar.setRollover(true);
// Create the text area used for output. Request
// enough space for 5 rows and 30 columns.
textArea = new JTextArea(5, 30);
textArea.setEditable(false);
JScrollPane scrollPane = new JScrollPane(textArea);
// Lay out the main panel.
setPreferredSize(new Dimension(450, 130));
add(toolBar, BorderLayout.PAGE_START);
add(scrollPane, BorderLayout.CENTER);
}
示例8: 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);
}
示例9: ToolBarDemo
import javax.swing.JToolBar; //導入依賴的package包/類
public ToolBarDemo() {
super(new BorderLayout());
// Create the toolbar.
JToolBar toolBar = new JToolBar("Still draggable");
addButtons(toolBar);
// Create the text area used for output. Request
// enough space for 5 rows and 30 columns.
textArea = new JTextArea(5, 30);
textArea.setEditable(false);
JScrollPane scrollPane = new JScrollPane(textArea);
// Lay out the main panel.
setPreferredSize(new Dimension(450, 130));
add(toolBar, BorderLayout.PAGE_START);
add(scrollPane, BorderLayout.CENTER);
}
示例10: ResultPanelTree
import javax.swing.JToolBar; //導入依賴的package包/類
ResultPanelTree(ResultDisplayHandler displayHandler, StatisticsPanel statPanel) {
super(new BorderLayout());
treeView = new ResultTreeView();
treeView.getAccessibleContext().setAccessibleName(Bundle.ACSN_TestResults());
treeView.getAccessibleContext().setAccessibleDescription(Bundle.ACSD_TestResults());
treeView.setBorder(BorderFactory.createEtchedBorder());
// resultBar.setPassedPercentage(0.0f);
JToolBar toolBar = new JToolBar();
toolBar.setFloatable(false);
toolBar.add(resultBar);
toolBar.setBorder(BorderFactory.createEtchedBorder());
add(toolBar, BorderLayout.NORTH);
add(treeView, BorderLayout.CENTER);
explorerManager = new ExplorerManager();
explorerManager.setRootContext(rootNode = new RootNode(displayHandler.getSession(), filterMask));
explorerManager.addPropertyChangeListener(this);
initAccessibility();
this.displayHandler = displayHandler;
this.statPanel = statPanel;
displayHandler.setLookup(ExplorerUtils.createLookup(explorerManager, new ActionMap()));
}
示例11: components
import javax.swing.JToolBar; //導入依賴的package包/類
private static List<Component> components(Container aContainer) {
List<Component> l = new ArrayList();
for (int i = 0; i < aContainer.getComponentCount(); i++) {
Component c = aContainer.getComponent(i);
if (c instanceof JPanel || c instanceof JToolBar)
l.addAll(components((Container)c));
else if (c instanceof JScrollPane)
l.addAll(components((Container)((JScrollPane)c).getViewport()));
// else if (c instanceof JRootPane)
// l.addAll(components((Container)((JRootPane)c).getContentPane()));
else if (focusable(c)) l.add(c);
}
return l;
}
示例12: QualifierSourceSelectPanel
import javax.swing.JToolBar; //導入依賴的package包/類
public QualifierSourceSelectPanel(GUIFramework framework,
Qualifier qualifier, QualifierSource qualifierSource, SelectType selectType) {
super(new BorderLayout());
this.qualifierSource = qualifierSource;
view = new SelectableTableView(framework, qualifier) {
};
this.add(view.createComponent(), BorderLayout.CENTER);
view.setSelectType(selectType);
List<ElementSource> sources = qualifierSource.getElementSources();
List<Long> rows = new ArrayList<Long>(sources.size());
for (ElementSource source : sources) {
rows.add(source.getElement().getId());
}
view.selectRows(rows);
JToolBar toolBar = view.createToolBar();
this.add(toolBar, BorderLayout.NORTH);
toolBar.setFloatable(false);
}
示例13: createFilterToolBar
import javax.swing.JToolBar; //導入依賴的package包/類
private JToolBar createFilterToolBar() {
final FiltersDescriptor filtersDesc = FiltersDescriptor.getInstance();
// configure toolbar
final JToolBar toolbar = new NoBorderToolBar();
toolbar.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
toolbar.setFloatable(false);
//toolbar.setRollover(true);
toolbar.setBorderPainted(false);
toolbar.setOpaque(false);
if( "Aqua".equals(UIManager.getLookAndFeel().getID()) ) { //NOI18N
toolbar.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
}
createFilterToolBarUI(toolbar, filtersDesc);
filtersDesc.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
createFilterToolBarUI(toolbar, filtersDesc);
}
});
}
});
return toolbar;
}
示例14: addBrowseButton
import javax.swing.JToolBar; //導入依賴的package包/類
/**
* Adds the browse button to the panel
*
* @param gbc
* - the constraints used for this component
*
*/
private void addBrowseButton(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.WEST;
gbc.fill = GridBagConstraints.NONE;
gbc.gridx = 2;
gbc.gridy = 0;
gbc.weightx = 0;
gbc.weighty = 0;
browseButton = new ToolbarButton(null, false);
ImageUtilities imageUtilities = PluginWorkspaceProvider.getPluginWorkspace().getImageUtilities();
URL resource = getClass().getResource(ImageConstants.FILE_CHOOSER_ICON);
if (resource != null) {
ImageIcon icon = (ImageIcon) imageUtilities.loadIcon(resource);
browseButton.setIcon(icon);
}
browseButton.setToolTipText(translator.getTranslation(Tags.BROWSE_BUTTON_TOOLTIP));
JToolBar browswtoolbar = new JToolBar();
browswtoolbar.add(browseButton);
browswtoolbar.setFloatable(false);
browswtoolbar.setOpaque(false);
this.add(browswtoolbar, gbc);
}
示例15: TitledPanel
import javax.swing.JToolBar; //導入依賴的package包/類
/** Creates a label panel for a given inner component.
* @param name initial title of the component
* @param inner the inner component; non-{@code null}
* @param toolBar the optional tool bar; may be {@code null}
* @param scroll flag indicating if the inner component should be put inside a {@link JScrollPane}
*/
public TitledPanel(String name, JComponent inner, JToolBar toolBar,
boolean scroll) {
super(new BorderLayout(), false);
setBorder(null);
this.titleLabel = new JLabel();
this.titleLabel.setAlignmentX(LEFT_ALIGNMENT);
setName(name);
this.inner = inner;
this.labelPanelTop = Box.createVerticalBox();
this.labelPanelTop.add(this.titleLabel);
if (toolBar != null) {
toolBar.setAlignmentX(LEFT_ALIGNMENT);
this.labelPanelTop.add(toolBar);
}
add(this.labelPanelTop, BorderLayout.NORTH);
add(scroll ? new JScrollPane(inner) : inner, BorderLayout.CENTER);
}