當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。