當前位置: 首頁>>代碼示例>>Java>>正文


Java JToolBar.setPreferredSize方法代碼示例

本文整理匯總了Java中javax.swing.JToolBar.setPreferredSize方法的典型用法代碼示例。如果您正苦於以下問題:Java JToolBar.setPreferredSize方法的具體用法?Java JToolBar.setPreferredSize怎麽用?Java JToolBar.setPreferredSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JToolBar的用法示例。


在下文中一共展示了JToolBar.setPreferredSize方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getTreeInPanel

import javax.swing.JToolBar; //導入方法依賴的package包/類
private JPanel getTreeInPanel(String labelText, JTree tree) {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());

    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);
    toolBar.setBorder(BorderFactory.createEtchedBorder());
    JLabel label = new JLabel(labelText);
    label.setFont(new Font("Default", Font.BOLD, 12));
    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(label);
    toolBar.add(new javax.swing.Box.Filler(new java.awt.Dimension(0, 0),
            new java.awt.Dimension(0, 0),
            new java.awt.Dimension(32767, 32767)));
    toolBar.add(getPrevoiusTestCaseButton());

    toolBar.add(getEditTagButton());
    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,代碼行數:25,代碼來源:TestDesignUI.java

示例2: 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

示例3: getCompInPanel

import javax.swing.JToolBar; //導入方法依賴的package包/類
private JPanel getCompInPanel(String labelText, JComponent comp) {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());

    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);
    toolBar.setBorder(BorderFactory.createEtchedBorder());
    JLabel label = new JLabel(labelText);
    label.setFont(new Font("Default", Font.BOLD, 12));
    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(label);
    toolBar.setPreferredSize(new java.awt.Dimension(toolBar.getPreferredSize().width, 25));

    panel.add(toolBar, BorderLayout.NORTH);
    panel.add(comp, BorderLayout.CENTER);
    return panel;
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:20,代碼來源:TestExecutionUI.java

示例4: fixSize

import javax.swing.JToolBar; //導入方法依賴的package包/類
private void fixSize(JToolBar actionBar) {
    Insets ins = actionBar.getMargin();
    JButton dummy = new JButton();
    dummy.setBorderPainted(false);
    dummy.setOpaque(false);
    dummy.setText(null);
    dummy.setIcon(new Icon() {

 @Override
        public int getIconHeight() {
            return 16;
        }

 @Override
        public int getIconWidth() {
            return 16;
        }

        @SuppressWarnings(value = "empty-statement")
 @Override
        public void paintIcon(Component c, Graphics g, int x, int y) {
            ;
        }
    });
    actionBar.add(dummy);
    Dimension buttonPref = dummy.getPreferredSize();
    Dimension minDim = new Dimension(buttonPref.width + ins.left + ins.right, buttonPref.height + ins.top + ins.bottom);
    actionBar.setMinimumSize(minDim);
    actionBar.setPreferredSize(minDim);
    actionBar.remove(dummy);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:32,代碼來源:TerminalContainerCommon.java

示例5: getJToolBarNew

import javax.swing.JToolBar; //導入方法依賴的package包/類
/**
 * Returns a new empty JToolBar for the display of a TimeModel 
 * @return the new JToolBar
 */
private JToolBar getJToolBarNew() {
	JToolBar toolBar = new JToolBar("TimeModel-Display"); 
	toolBar.setPreferredSize(new Dimension(100, 28));
	toolBar.setFloatable(false);
	return toolBar;
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:11,代碼來源:AbstractDisplayAgent.java


注:本文中的javax.swing.JToolBar.setPreferredSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。