Java Code Examples for org.openide.explorer.ExplorerManager#addPropertyChangeListener()
The following examples show how to use
org.openide.explorer.ExplorerManager#addPropertyChangeListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FormDesigner.java From netbeans with Apache License 2.0 | 6 votes |
public FormDesigner(FormEditor formEditor) { FormLoaderSettings settings = FormLoaderSettings.getInstance(); Color backgroundColor = settings.getFormDesignerBackgroundColor(); Color borderColor = settings.getFormDesignerBorderColor(); JPanel loadingPanel = new JPanel(); loadingPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 12, 12)); loadingPanel.setBackground(backgroundColor); JLabel loadingLbl = new JLabel(FormUtils.getBundleString("LBL_FormLoading")); // NOI18N loadingLbl.setOpaque(true); loadingLbl.setBorder(new LineBorder(borderColor, 4)); loadingLbl.setPreferredSize(new Dimension(408, 308)); loadingLbl.setHorizontalAlignment(SwingConstants.CENTER); loadingPanel.add(loadingLbl); canvasRoot = loadingPanel; this.formEditor = formEditor; explorerManager = new ExplorerManager(); explorerManager.addPropertyChangeListener(new NodeSelectionListener()); // Note: ComponentInspector does some updates on nodes selection as well. initLookup(); }
Example 2
Source File: DiffResultsView.java From netbeans with Apache License 2.0 | 6 votes |
@Override public void ancestorAdded(AncestorEvent event) { ExplorerManager em = ExplorerManager.find(treeView); em.addPropertyChangeListener(this); if (dividerSet) { if (lastDividerLoc != 0) { EventQueue.invokeLater(new Runnable() { @Override public void run () { diffView.setDividerLocation(lastDividerLoc); } }); } } else { EventQueue.invokeLater(new Runnable() { @Override public void run() { dividerSet = true; diffView.setDividerLocation(0.33); } }); } }
Example 3
Source File: AddDependencyPanel.java From netbeans with Apache License 2.0 | 6 votes |
public DMListPanel(MavenProject project) { this.project = project; btv = new BeanTreeView(); btv.setRootVisible(false); btv.setDefaultActionAllowed(true); //lv.setDefaultProcessor(this); manager = new ExplorerManager(); manager.addPropertyChangeListener(this); setLayout(new BorderLayout()); add(btv, BorderLayout.CENTER); addAncestorListener(this); AddDependencyPanel.this.artifactsLabel.setLabelFor(btv); // disable tab if DM section not defined RPofDMListPanel.post(this); }
Example 4
Source File: BookmarksView.java From netbeans with Apache License 2.0 | 6 votes |
BookmarksView() { // getActionMap().put("rename", SystemAction.get(RenameAction.class)); nodeTree = new BookmarksNodeTree(); explorerManager = new ExplorerManager(); explorerManager.setRootContext(nodeTree.rootNode()); ActionMap actionMap = getActionMap(); actionMap.put("delete", ExplorerUtils.actionDelete(explorerManager, false)); //NOI18N associateLookup(ExplorerUtils.createLookup(explorerManager, actionMap)); explorerManager.addPropertyChangeListener(this); // Ctrl+T will toggle the tree/table view InputMap inputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_T, KeyEvent.CTRL_DOWN_MASK), "toggle-view"); //NOI18N actionMap.put("toggle-view", new AbstractAction() { //NOI18N @Override public void actionPerformed(ActionEvent e) { setTreeViewVisible(!treeViewShowing); } }); setIcon(ImageUtilities.loadImage("org/netbeans/modules/editor/bookmarks/resources/bookmark_16.png")); // NOI18N }
Example 5
Source File: ResultPanelTree.java From netbeans with Apache License 2.0 | 6 votes |
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())); }
Example 6
Source File: WSDesignViewNavigatorContent.java From netbeans with Apache License 2.0 | 5 votes |
/** Creates a new instance of WSDesignViewNavigatorContent */ public WSDesignViewNavigatorContent() { setLayout(new BorderLayout()); explorerManager = new ExplorerManager(); treeView = new BeanTreeView(); explorerManager.addPropertyChangeListener(this); }
Example 7
Source File: AbstractXMLNavigatorContent.java From netbeans with Apache License 2.0 | 5 votes |
/** * */ public AbstractXMLNavigatorContent() { explorerManager = new ExplorerManager(); explorerManager.addPropertyChangeListener(this); treeView = new BeanTreeView(); //init empty panel setBackground(UIManager.getColor("Tree.textBackground")); emptyPanel = new JPanel(); emptyPanel.setBackground(UIManager.getColor("Tree.textBackground")); emptyPanel.setLayout(new BorderLayout()); msgLabel = new JLabel(); emptyPanel.add(msgLabel, BorderLayout.CENTER); }
Example 8
Source File: CategoryView.java From netbeans with Apache License 2.0 | 5 votes |
public CategoryView( CategoryModel categoryModel ) { this.categoryModel = categoryModel; // See #36315 manager = new ExplorerManager(); setLayout( new BorderLayout() ); Dimension size = new Dimension( 220, 4 ); btv = new BeanTreeView(); // Add the BeanTreeView btv.setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION ); btv.setPopupAllowed( false ); btv.setRootVisible( false ); btv.setDefaultActionAllowed( false ); btv.setMinimumSize( size ); btv.setPreferredSize( size ); btv.setMaximumSize( size ); btv.setDragSource (false); this.add( btv, BorderLayout.CENTER ); manager.setRootContext( createRootNode( categoryModel ) ); manager.addPropertyChangeListener( this ); categoryModel.addPropertyChangeListener( this ); btv.expandAll(); selectNode( categoryModel.getCurrentCategory() ); btv.getAccessibleContext().setAccessibleName(NbBundle.getMessage(CategoryView.class,"AN_CatgoryView")); btv.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CategoryView.class,"AD_CategoryView")); }
Example 9
Source File: SelectProjectPanel.java From netbeans with Apache License 2.0 | 5 votes |
public OpenListPanel(Project curProject) { this.curProject = curProject; lv = new ListView(); lv.setDefaultProcessor(this); lv.setPopupAllowed(false); lv.setTraversalAllowed(false); lv.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); manager = new ExplorerManager(); manager.addPropertyChangeListener(this); setLayout(new BorderLayout()); add(lv, BorderLayout.CENTER); RequestProcessor.getDefault().post(this); }
Example 10
Source File: AddDependencyPanel.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
private QueryPanel() { btv = new BeanTreeView(); btv.setRootVisible(false); btv.setDefaultActionAllowed(true); btv.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); manager = new ExplorerManager(); setLayout(new BorderLayout()); add(btv, BorderLayout.CENTER); defSearchC = AddDependencyPanel.this.searchField.getForeground(); manager.addPropertyChangeListener(this); AddDependencyPanel.this.resultsLabel.setLabelFor(btv); btv.getAccessibleContext().setAccessibleDescription(AddDependencyPanel.this.resultsLabel.getAccessibleContext().getAccessibleDescription()); resultsRootNode = new ResultsRootNode(); manager.setRootContext(resultsRootNode); }
Example 11
Source File: NewPluginPanel.java From netbeans with Apache License 2.0 | 5 votes |
/** Creates new form FindResultsPanel */ private QueryPanel(NewPluginPanel plugPanel) { this.pluginPanel = plugPanel; btv = new BeanTreeView(); btv.setRootVisible(false); btv.setDefaultActionAllowed(false); manager = new ExplorerManager(); manager.setRootContext(getNoResultsRoot()); setLayout(new BorderLayout()); add(btv, BorderLayout.CENTER); manager.addPropertyChangeListener(this); pluginPanel.lblPlugins.setLabelFor(btv); }
Example 12
Source File: AddDependencyPanel.java From netbeans with Apache License 2.0 | 5 votes |
public OpenListPanel(Project project) { this.project = project; btv = new BeanTreeView(); btv.setRootVisible(false); btv.setDefaultActionAllowed(true); manager = new ExplorerManager(); manager.addPropertyChangeListener(this); setLayout(new BorderLayout()); add(btv, BorderLayout.CENTER); RPofOpenListPanel.post(this); }
Example 13
Source File: AddDependencyPanel.java From netbeans with Apache License 2.0 | 5 votes |
private QueryPanel() { btv = new BeanTreeView(); btv.setRootVisible(false); btv.setDefaultActionAllowed(true); btv.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); manager = new ExplorerManager(); setLayout(new BorderLayout()); add(btv, BorderLayout.CENTER); defSearchC = AddDependencyPanel.this.searchField.getForeground(); manager.addPropertyChangeListener(this); AddDependencyPanel.this.resultsLabel.setLabelFor(btv); btv.getAccessibleContext().setAccessibleDescription(AddDependencyPanel.this.resultsLabel.getAccessibleContext().getAccessibleDescription()); resultsRootNode = new ResultsRootNode(); manager.setRootContext(resultsRootNode); }
Example 14
Source File: AddPropertyDialog.java From netbeans with Apache License 2.0 | 5 votes |
/** Creates new form AddPropertyDialog */ public AddPropertyDialog(NbMavenProjectImpl prj, String goalsText) { initComponents(); manager = new ExplorerManager(); //project can be null when invoked from Tools/Options project = prj; okbutton = new JButton(NbBundle.getMessage(AddPropertyDialog.class, "BTN_OK")); manager.setRootContext(Node.EMPTY); tpDesc.setEditorKit(new HTMLEditorKit()); tpDesc.putClientProperty( JTextPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE ); manager.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { Node[] nds = getExplorerManager().getSelectedNodes(); if (nds.length != 1) { okbutton.setEnabled(false); } else { PluginIndexManager.ParameterDetail plg = nds[0].getLookup().lookup(PluginIndexManager.ParameterDetail.class); if (plg != null) { okbutton.setEnabled(true); tpDesc.setText(plg.getHtmlDetails(false)); } else { okbutton.setEnabled(false); tpDesc.setText(""); } } } }); ((BeanTreeView)tvExpressions).setRootVisible(false); ((BeanTreeView)tvExpressions).setSelectionMode(ListSelectionModel.SINGLE_SELECTION); this.goalsText = goalsText; RequestProcessor.getDefault().post(new Loader()); }
Example 15
Source File: ClassPathFileChooser.java From netbeans with Apache License 2.0 | 4 votes |
/** * Creates a new ClassPathFileChooser. Can be used directly as a panel, * or getDialog can be called to get it wrapped in a Dialog. * @param fileInProject a source file from project sources (determines the * project's classpath) * @param filter a filter for files to be displayed * @param choosingFolder if true, the chooser only allows to select a folder, * and only source classpath is shown (i.e. not JARs on execution CP) * @param okCancelButtons defines whether the controls buttons should be shown * (typically true if using as a dialog and false if using as a panel) */ public ClassPathFileChooser(FileObject fileInProject, Filter filter, boolean choosingFolder, boolean okCancelButtons) { this.choosingFolder = choosingFolder; Listener listener = new Listener(); Node root = getRootNode(fileInProject, filter); explorerManager = new ExplorerManager(); explorerManager.setRootContext(root); try { explorerManager.setSelectedNodes (new Node[] { root }); } catch(PropertyVetoException ex) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex); } explorerManager.addPropertyChangeListener(listener); if (choosingFolder) { // add a button allowing to create a new folder newButton = new JButton(); Mnemonics.setLocalizedText(newButton, NbBundle.getMessage(ClassPathFileChooser.class, "CTL_CreateNewButton")); // NOI18N newButton.addActionListener(listener); newButton.setEnabled(false); newButton.setToolTipText(NbBundle.getMessage(ClassPathFileChooser.class, "CTL_CreateNewButtonHint")); // NOI18N } if (okCancelButtons) { okButton = new JButton(NbBundle.getMessage(ClassPathFileChooser.class, "CTL_OKButton")); // NOI18N okButton.addActionListener(listener); okButton.setEnabled(false); cancelButton = new JButton(NbBundle.getMessage(ClassPathFileChooser.class, "CTL_CancelButton")); // NOI18N } treeView = new BeanTreeView(); treeView.setPopupAllowed(false); treeView.setDefaultActionAllowed(true); treeView.setBorder((Border)UIManager.get("Nb.ScrollPane.border")); // NOI18N treeView.getAccessibleContext().setAccessibleName(NbBundle.getMessage(ClassPathFileChooser.class, "ACSN_FileSelectorTreeView")); // NOI18N treeView.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ClassPathFileChooser.class, "ACSD_FileSelectorTreeView")); // NOI18N this.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ClassPathFileChooser.class, "ACSD_FileSelectorPanel")); // NOI18N // label and text field with mnemonic JLabel label = new JLabel(); Mnemonics.setLocalizedText(label, NbBundle.getMessage(ClassPathFileChooser.class, choosingFolder ? "LBL_FolderName": "LBL_FileName")); // NOI18N fileNameTextField = new JTextField(); fileNameTextField.getDocument().addDocumentListener(listener); fileNameTextField.addActionListener(listener); label.setLabelFor(fileNameTextField); GroupLayout layout = new GroupLayout(this); setLayout(layout); layout.setAutoCreateGaps(true); GroupLayout.SequentialGroup sq = layout.createSequentialGroup() .addComponent(label).addComponent(fileNameTextField); if (!okCancelButtons && newButton != null) // add newButton next to the text field sq.addComponent(newButton); layout.setHorizontalGroup(layout.createParallelGroup() .addComponent(treeView, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(sq)); GroupLayout.ParallelGroup pq = layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(label).addComponent(fileNameTextField); if (!okCancelButtons && newButton != null) // add newButton next to the text field pq.addComponent(newButton); layout.setVerticalGroup(layout.createSequentialGroup() .addComponent(treeView, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(pq)); }
Example 16
Source File: ExplorerActionsImpl.java From netbeans with Apache License 2.0 | 4 votes |
ActionStateUpdater(ExplorerManager m) { timer = RP.create(this); weakL = WeakListeners.propertyChange(this, m); m.addPropertyChangeListener(weakL); }
Example 17
Source File: ContextView.java From netbeans with Apache License 2.0 | 4 votes |
/** * * @author Tim Boudreau * @author Marian Petras */ public ContextView(ResultModel resultModel, ExplorerManager explorerManager) { Border b = BorderFactory.createCompoundBorder( BorderFactory.createMatteBorder( //outside border 0, 0, 1, 0, UIManager.getColor("controlShadow")), //NOI18N BorderFactory.createEmptyBorder( //inside border 5, 5, 1, 5)); lblPath.setBorder(b); editorPane.setEditable(false); editorPane.getCaret().setBlinkRate(0); editorScroll = new JScrollPane(editorPane); editorScroll.setViewportBorder(BorderFactory.createEmptyBorder()); editorScroll.setBorder(BorderFactory.createEmptyBorder()); JPanel fileViewPanel = new JPanel(); fileViewPanel.setLayout(new BorderLayout()); fileViewPanel.add(lblPath, BorderLayout.NORTH); fileViewPanel.add(editorScroll, BorderLayout.CENTER); Box messagePanel = Box.createVerticalBox(); messagePanel.add(Box.createVerticalGlue()); messagePanel.add(lblMessage); messagePanel.add(Box.createVerticalGlue()); lblMessage.setAlignmentX(0.5f); lblMessage.setHorizontalAlignment(SwingConstants.CENTER); lblMessage.setEnabled(false); setLayout(cardLayout = new CardLayout()); add(fileViewPanel, FILE_VIEW); add(messagePanel, MESSAGE_VIEW); setResultModel(resultModel); this.explorerManager = explorerManager; explorerManager.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("selectedNodes")) { updateForSelection(); } } }); }
Example 18
Source File: HierarchyTopComponent.java From netbeans with Apache License 2.0 | 4 votes |
@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); }
Example 19
Source File: ProjectTab.java From netbeans with Apache License 2.0 | 4 votes |
public ProjectTab() { // See #36315 manager = new ExplorerManager(); ActionMap map = getActionMap(); map.put(DefaultEditorKit.copyAction, ExplorerUtils.actionCopy(manager)); map.put(DefaultEditorKit.cutAction, ExplorerUtils.actionCut(manager)); map.put(DefaultEditorKit.pasteAction, ExplorerUtils.actionPaste(manager)); map.put("delete", ExplorerUtils.actionDelete(manager, true)); initComponents(); btv = new ProjectTreeView(); // Add the BeanTreeView btv.setDragSource (true); btv.setRootVisible(false); add( btv, BorderLayout.CENTER ); OpenProjects.getDefault().addPropertyChangeListener(this); noProjectsLabel.addMouseListener(new LabelPopupDisplayer(noProjectsLabel)); noProjectsLabel.setHorizontalAlignment(SwingConstants.CENTER); noProjectsLabel.setEnabled(false); Color usualWindowBkg = UIManager.getColor("window"); // NOI18N if( null != usualWindowBkg ) { noProjectsLabel.setBackground(usualWindowBkg); noProjectsLabel.setOpaque(true); } else { noProjectsLabel.setOpaque(false); } associateLookup( ExplorerUtils.createLookup(manager, map) ); selectionTask = createSelectionTask(); Preferences nbPrefs = NbPreferences.forModule(SyncEditorWithViewsAction.class); synchronizeViews = nbPrefs.getBoolean(SyncEditorWithViewsAction.SYNC_ENABLED_PROP_NAME, false); nbPrefs.addPreferenceChangeListener(new NbPrefsListener()); nodeSelectionProjectPanel = new NodeSelectionProjectPanel(); ActualSelectionProject actualSelectionProject = new ActualSelectionProject(nodeSelectionProjectPanel); manager.addPropertyChangeListener(actualSelectionProject); btv.getViewport().addChangeListener(actualSelectionProject); add(nodeSelectionProjectPanel, BorderLayout.SOUTH); }
Example 20
Source File: BreadCrumbComponent.java From netbeans with Apache License 2.0 | 4 votes |
private void expand(int startX, final Node what) { if (what.getChildren().getNodesCount() == 0) return ; final ExplorerManager expandManager = new ExplorerManager(); class Expanded extends JPanel implements ExplorerManager.Provider { public Expanded(LayoutManager layout) { super(layout); } @Override public ExplorerManager getExplorerManager() { return expandManager; } } final JPanel expanded = new Expanded(new BorderLayout()); expanded.setBorder(new LineBorder(Color.BLACK, 1)); final ListView listView = new ListView() { { int nodesCount = what.getChildren().getNodesCount(); if (nodesCount >= MAX_ROWS_IN_POP_UP) { list.setVisibleRowCount(MAX_ROWS_IN_POP_UP); } else { list.setVisibleRowCount(nodesCount); NodeRenderer nr = new NodeRenderer(); int i = 0; int width = getPreferredSize().width; for (Node n : what.getChildren().getNodes()) { if (nr.getListCellRendererComponent(list, n, i, false, false).getPreferredSize().width > width) { Dimension pref = getPreferredSize(); pref.height += getHorizontalScrollBar().getPreferredSize().height; setPreferredSize(pref); break; } } } } }; listView.setPopupAllowed(false); expanded.add(listView, BorderLayout.CENTER); expandManager.setRootContext(what); Point place = new Point(startX, 0); SwingUtilities.convertPointToScreen(place, this); expanded.validate(); final Popup popup = PopupFactory.getSharedInstance().getPopup(this, expanded, place.x, place.y - expanded.getPreferredSize().height); final AWTEventListener multicastListener = new AWTEventListener() { @Override public void eventDispatched(AWTEvent event) { if (event instanceof MouseEvent && ((MouseEvent) event).getClickCount() > 0) { Object source = event.getSource(); while (source instanceof Component) { if (source == expanded) return ; //accept source = ((Component) source).getParent(); } popup.hide(); Toolkit.getDefaultToolkit().removeAWTEventListener(this); } } }; Toolkit.getDefaultToolkit().addAWTEventListener(multicastListener, AWTEvent.MOUSE_EVENT_MASK); expandManager.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName())) { Node[] selected = expandManager.getSelectedNodes(); if (selected.length == 1) { open(selected[0]); popup.hide(); Toolkit.getDefaultToolkit().removeAWTEventListener(multicastListener); } } } }); popup.show(); }