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


Java JPanel.addHierarchyListener方法代碼示例

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


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

示例1: initComponents

import javax.swing.JPanel; //導入方法依賴的package包/類
private void initComponents() {
    setLayout(new BorderLayout());

    final JPanel staticFieldsBrowserPanel = classesController.getStaticFieldsBrowserController().getPanel();
    staticFieldsBrowserPanel.setPreferredSize(new Dimension(250, 500));
    staticFieldsBrowserPanel.setVisible(false);

    contentsSplit = new JExtendedSplitPane(JSplitPane.HORIZONTAL_SPLIT,
                                           classesController.getClassesListController().getPanel(), staticFieldsBrowserPanel);
    contentsSplit.setResizeWeight(1d);

    final JPanel legendPanel = new LegendPanel(false);
    legendPanel.setVisible(false);

    tweakSplitPaneUI(contentsSplit);

    add(contentsSplit, BorderLayout.CENTER);
    add(legendPanel, BorderLayout.SOUTH);

    staticFieldsBrowserPanel.addHierarchyListener(new HierarchyListener() {
            public void hierarchyChanged(HierarchyEvent e) {
                if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
                    legendPanel.setVisible(staticFieldsBrowserPanel.isShowing());
                }
            }
        });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:28,代碼來源:ClassesControllerUI.java

示例2: initComponents

import javax.swing.JPanel; //導入方法依賴的package包/類
private void initComponents() {
    JPanel fieldsBrowserPanel = instancesController.getFieldsBrowserController().getPanel();
    JPanel referencesBrowserPanel = instancesController.getReferencesBrowserController().getPanel();
    JPanel instancesListPanel = instancesController.getInstancesListController().getPanel();

    browsersSplit = new JExtendedSplitPane(JSplitPane.VERTICAL_SPLIT, fieldsBrowserPanel, referencesBrowserPanel);
    tweakSplitPaneUI(browsersSplit);
    browsersSplit.setResizeWeight(0.5d);

    contentsSplit = new JExtendedSplitPane(JSplitPane.HORIZONTAL_SPLIT, instancesListPanel, browsersSplit);
    tweakSplitPaneUI(contentsSplit);
    contentsSplit.setDividerLocation(instancesListPanel.getPreferredSize().width);

    JPanel classPresenterPanel = instancesController.getClassPresenterPanel();
    classPresenterPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 3, 0,
                                                                                                     getBackground()),
                                                                     classPresenterPanel.getBorder()));

    legendPanel = new LegendPanel(true);

    dataPanel = new JPanel(new BorderLayout());
    dataPanel.setOpaque(false);
    dataPanel.add(classPresenterPanel, BorderLayout.NORTH);
    dataPanel.add(contentsSplit, BorderLayout.CENTER);
    dataPanel.add(legendPanel, BorderLayout.SOUTH);

    noDataPanel = new JPanel(new BorderLayout());
    noDataPanel.setBorder(BorderFactory.createLoweredBevelBorder());

    HTMLTextArea hintArea = new HTMLTextArea() {
        protected void showURL(URL url) {
            instancesController.getHeapFragmentWalker().switchToClassesView();
        }
    };

    hintArea.setBorder(BorderFactory.createEmptyBorder(10, 8, 8, 8));

    String classesRes = Icons.getResource(LanguageIcons.CLASS);
    String hintText = Bundle.InstancesControllerUI_NoClassDefinedMsg(
                        "<a href='#'><img border='0' align='bottom' src='nbresloc:/" + classesRes + "'></a>"); // NOI18N
    hintArea.setText(hintText);
    noDataPanel.add(hintArea, BorderLayout.CENTER);

    contents = new CardLayout();
    setLayout(contents);
    add(noDataPanel, NO_DATA);
    add(dataPanel, DATA);

    LegendUpdater legendUpdater = new LegendUpdater();
    fieldsBrowserPanel.addHierarchyListener(legendUpdater);
    referencesBrowserPanel.addHierarchyListener(legendUpdater);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:53,代碼來源:InstancesControllerUI.java


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