当前位置: 首页>>代码示例>>Java>>正文


Java JToolBar类代码示例

本文整理汇总了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);
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:20,代码来源:HelpDialog.java

示例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();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:SynthToolBarUI.java

示例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;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:20,代码来源:GraphEditorTab.java

示例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;
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:22,代码来源:TestDesignUI.java

示例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));
    }

}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:22,代码来源:ReportEditorTest.java

示例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;
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:20,代码来源:DockReader.java

示例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);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:21,代码来源:ToolBarDemo2.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:HierarchyTopComponent.java

示例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);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:ToolBarDemo.java

示例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()));
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:ResultPanelTree.java

示例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;
        }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ProfilerPopup.java

示例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);
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:23,代码来源:QualifierSourceSelectPanel.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:InfoPanel.java

示例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);
}
 
开发者ID:oxygenxml,项目名称:oxygen-git-plugin,代码行数:31,代码来源:WorkingCopySelectionPanel.java

示例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);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:24,代码来源:TitledPanel.java


注:本文中的javax.swing.JToolBar类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。