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


Java JTree.addTreeExpansionListener方法代码示例

本文整理汇总了Java中javax.swing.JTree.addTreeExpansionListener方法的典型用法代码示例。如果您正苦于以下问题:Java JTree.addTreeExpansionListener方法的具体用法?Java JTree.addTreeExpansionListener怎么用?Java JTree.addTreeExpansionListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JTree的用法示例。


在下文中一共展示了JTree.addTreeExpansionListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: subscribeActual

import javax.swing.JTree; //导入方法依赖的package包/类
@Override
protected void subscribeActual(Observer<? super TreeExpansionEvent> observer) {
    JTree w = widget;

    TreeExpansionEventConsumer aec = new TreeExpansionEventConsumer(observer, w);
    observer.onSubscribe(aec);

    w.addTreeExpansionListener(aec);
    if (aec.get() == null) {
        aec.onDispose(w);
    }
}
 
开发者ID:akarnokd,项目名称:RxJava2Swing,代码行数:13,代码来源:TreeExpansionEventObservable.java

示例2: PackageBrowser

import javax.swing.JTree; //导入方法依赖的package包/类
public PackageBrowser(JFrame frame, String title, boolean modal) {
  super(MainFrame.mainFrame,title, modal);

addWindowListener(WindowDisposer.getDisposer());
  addKeyListener(WindowDisposer.getDisposer()); 		

  ActionEventHandler actionEventH = new ActionEventHandler();
  LibComboActionEvnetHandler libComboHandler = new LibComboActionEvnetHandler();
  PackageListSelectionEventHandler packageListSelectionEventH = new PackageListSelectionEventHandler();
  ClassListSelectionEventHandler classListSelectionEventH = new ClassListSelectionEventHandler();
  TreeExpansionEventHandler treeExpansionEventH = new TreeExpansionEventHandler();

  tabbedPane = new JTabbedPane();

  //List view tab
  libListRenderer = new LibComboCellRenderer();
  packageListRenderer = new PackageListCellRenderer();
  classListRenderer = new ClassListCellRenderer();

  libraryCombo = new JComboBox();
  libraryCombo.setRenderer(libListRenderer);
  libraryCombo.addActionListener(libComboHandler);

  packageList = new JList();
  packageList.setCellRenderer(packageListRenderer);
  packageList.addListSelectionListener(packageListSelectionEventH);

  classList = new JList();
  classList.setCellRenderer(classListRenderer);
  classList.addListSelectionListener(classListSelectionEventH);

  listViewTab = new ListViewPanel(libraryCombo, packageList, classList);

  tabbedPane.addTab("ListView", listViewTab);
  tabbedPane.setTabPlacement(SwingConstants.TOP);
  tabbedPane.setSelectedIndex(0);

  tree = new JTree();
  tree.putClientProperty("JTree.lineStyle", "Angled");
  tree.addTreeExpansionListener(treeExpansionEventH);

  treeRenderer = new PackageBrowserTreeCellRenderer();
  tree.setCellRenderer(treeRenderer);

  //Tree view tab
  treeViewTab = new TreeViewPanel(tree);
  treeViewTab.setPackageBrowser(this);
  tabbedPane.addTab("TreeView", treeViewTab);

  //buttons panel
  selectBtn = new JButton("Select");
  selectBtn.setActionCommand("Select");
  selectBtn.addActionListener(actionEventH);
  selectBtn.setEnabled(true);

  cancelBtn = new JButton("Close");
  cancelBtn.setActionCommand("Close");
  cancelBtn.addActionListener(actionEventH);

  btnP = new JPanel();
  FlowLayout btnL = new FlowLayout();
  btnP.setLayout(btnL);

  btnP.add(selectBtn);
  btnP.add(cancelBtn);

  setFirstData();

  getContentPane().add(tabbedPane, BorderLayout.CENTER);
  getContentPane().add(btnP, BorderLayout.SOUTH);
  getContentPane().add(new JPanel(),BorderLayout.WEST);
  getContentPane().add(new JPanel(),BorderLayout.EAST);

  setSize(250,480);
  setLocation(150, 150);
  this.setResizable(false);
}
 
开发者ID:FJplant,项目名称:AntIDE,代码行数:78,代码来源:PackageBrowser.java


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