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


Java JComboBox.setMinimumSize方法代碼示例

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


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

示例1: HierarchyTopComponent

import javax.swing.JComboBox; //導入方法依賴的package包/類
@NbBundle.Messages({
    "TXT_NonActiveContent=<No View Available - Refresh Manually>",
    "TXT_InspectHierarchyHistory=<empty>",
    "TOOLTIP_RefreshContent=Refresh for entity under cursor",
    "TOOLTIP_OpenJDoc=Open Javadoc Window",
    "TOOLTIP_ViewHierarchyType=Hierachy View Type",
    "TOOLTIP_InspectHierarchyHistory=Inspect Hierarchy History"
})
public HierarchyTopComponent() {
    history = HistorySupport.getInstnace(this.getClass());
    jdocFinder = SelectJavadocTask.create(this);
    jdocTask = RP.create(jdocFinder);
    explorerManager = new ExplorerManager();
    rootChildren = new RootChildren();
    filters = new HierarchyFilters();
    explorerManager.setRootContext(Nodes.rootNode(rootChildren, filters));
    selectedNodes  = new InstanceContent();
    lookup = new AbstractLookup(selectedNodes);
    explorerManager.addPropertyChangeListener(this);
    initComponents();
    setName(Bundle.CTL_HierarchyTopComponent());
    setToolTipText(Bundle.HINT_HierarchyTopComponent());        
    viewTypeCombo = new JComboBox(new DefaultComboBoxModel(ViewType.values()));
    viewTypeCombo.setMinimumSize(new Dimension(MIN_TYPE_WIDTH,COMBO_HEIGHT));
    viewTypeCombo.addActionListener(this);
    viewTypeCombo.setToolTipText(Bundle.TOOLTIP_ViewHierarchyType());
    historyCombo = new JComboBox(HistorySupport.createModel(history, Bundle.TXT_InspectHierarchyHistory()));
    historyCombo.setMinimumSize(new Dimension(MIN_HISTORY_WIDTH,COMBO_HEIGHT));
    historyCombo.setRenderer(HistorySupport.createRenderer(history));
    historyCombo.addActionListener(this);
    historyCombo.setEnabled(false);
    historyCombo.getModel().addListDataListener(this);
    historyCombo.setToolTipText(Bundle.TOOLTIP_InspectHierarchyHistory());
    refreshButton = new JButton(ImageUtilities.loadImageIcon(REFRESH_ICON, true));
    refreshButton.addActionListener(this);
    refreshButton.setToolTipText(Bundle.TOOLTIP_RefreshContent());
    jdocButton = new JButton(ImageUtilities.loadImageIcon(JDOC_ICON, true));
    jdocButton.addActionListener(this);
    jdocButton.setToolTipText(Bundle.TOOLTIP_OpenJDoc());
    final Box upperToolBar = new MainToolBar(
        constrainedComponent(viewTypeCombo, GridBagConstraints.HORIZONTAL, 1.0, new Insets(0,0,0,0)),
        constrainedComponent(historyCombo, GridBagConstraints.HORIZONTAL, 1.5, new Insets(0,3,0,0)),
        constrainedComponent(refreshButton, GridBagConstraints.NONE, 0.0, new Insets(0,3,0,0)),
        constrainedComponent(jdocButton, GridBagConstraints.NONE, 0.0, new Insets(0,3,0,3)));
    add(decorateAsUpperPanel(upperToolBar), BorderLayout.NORTH);
    contentView = new JPanel();
    contentView.setLayout(new CardLayout());
    JPanel nonActiveContent = Utils.updateBackground(new JPanel());
    nonActiveContent.setLayout(new BorderLayout());
    nonActiveInfo = new JLabel(Bundle.TXT_NonActiveContent());
    nonActiveInfo.setEnabled(false);
    nonActiveInfo.setHorizontalAlignment(SwingConstants.CENTER);
    nonActiveContent.add(nonActiveInfo, BorderLayout.CENTER);
    btw = createBeanTreeView();
    contentView.add(nonActiveContent, NON_ACTIVE_CONTENT);
    contentView.add(btw, ACTIVE_CONTENT);
    add(contentView,BorderLayout.CENTER);
    lowerToolBar = new TapPanel();
    lowerToolBar.setOrientation(TapPanel.DOWN);
    final JComponent lowerButtons = filters.getComponent();
    lowerButtons.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 0));
    lowerToolBar.add(lowerButtons);
    final boolean expanded = NbPreferences.forModule(HierarchyTopComponent.class).
            getBoolean(PROP_LOWER_TOOLBAR_EXPANDED, true); //NOI18N
    lowerToolBar.setExpanded(expanded);
    lowerToolBar.addPropertyChangeListener(this);
    add(Utils.updateBackground(lowerToolBar), BorderLayout.SOUTH);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:69,代碼來源:HierarchyTopComponent.java


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