Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7040373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:54:38+00:00 2026-05-28T01:54:38+00:00

On one of projects that I’m working on, we decided to change our presentation

  • 0

On one of projects that I’m working on, we decided to change our presentation of some data. Now we are using Netbeans ListView, and works great so far. But now we want to change/expand ListView to works like accordion. We can expand ListView to looks like accordion, but if we add buttons or text inputs to each cell/row we can’t attach actionListener to that button. It seems like that ListView listeners are always on top of swing components.

Does anyone have any suggestions how to create accordion with using Netbeans Explorer API?

We could create custom Swing component which acts like that, actually there already exists one on the web. If we create one, we need to connect Lookup with our custom Swing component to works properly with Netbeans APIs. We want to do this only if there are no other options.
Googling for such component which uses Netbeans APIs didn’t give any useful results.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:54:39+00:00Added an answer on May 28, 2026 at 1:54 am

    Taken from Toni Epples blog

    Take note that:

    • This uses JXTaskPane
    • This is an example is not dynamic

    code example

    public class TaskPaneView extends JScrollPane {
    
        private transient ExplorerManager manager;
        // create a taskpanecontainer
        JXTaskPaneContainer taskpanecontainer = new JXTaskPaneContainer();
        /** Listener to nearly everything */
        transient Listener managerListener;
        /** weak variation of the listener for property change on the explorer manager */
        transient PropertyChangeListener wlpc;
    
        /** True, if the selection listener is attached. */
        transient boolean listenerActive;
    
        // UI Settings:
        Font labelFont = new Font("Segoe UI", Font.BOLD, 14);
        Painter backgroundPainter = new MattePainter(Color.white);
    
        public TaskPaneView() {
            setViewportView(taskpanecontainer);
        }
    
        public void setBackground(Painter background) {
            this.backgroundPainter = background;
        }
    
        public void setLabelFont(Font labelFont) {
            this.labelFont = labelFont;
        }
    
        @Override
        public void addNotify() {
            super.addNotify();
            ExplorerManager em = ExplorerManager.find(this);
            if (em != manager) {
                if (manager != null) {
                    manager.removePropertyChangeListener(wlpc);
                }
                manager = em;
                manager.addPropertyChangeListener(wlpc = WeakListeners.propertyChange(managerListener, manager));
                Node root = manager.getExploredContext();
                setRootNode(root);
            } else {
                // bugfix #23509, the listener were removed --> add it again
                if (!listenerActive && (manager != null)) {
                    manager.addPropertyChangeListener(wlpc = WeakListeners.propertyChange(managerListener, manager));
                }
            }
        }
    
        /** Removes listeners.
         */
        @Override
        public void removeNotify() {
            super.removeNotify();
            listenerActive = false;
            // bugfix #23509, remove useless listeners
            if (manager != null) {
                manager.removePropertyChangeListener(wlpc);
            }
        }
    
        private void setRootNode(Node root) {
            //throw new UnsupportedOperationException("Not yet implemented");
            taskpanecontainer.removeAll();
    
            System.out.println("root node set " + root);
            Node[] children = root.getChildren().getNodes();
            for (int i = 0; i < children.length; i++) {
                Node node = children[i];
                JXTaskPane taskPane = new JXTaskPane();
                taskPane.setName(node.getName());
                taskPane.setCollapsed(true);
                taskPane.setTitle(node.getDisplayName());
                taskPane.setIcon(new ImageIcon(node.getIcon(BeanInfo.ICON_COLOR_16x16)));
                Action [] actions = node.getActions(true);
                for (int j = 0; j < actions.length; j++) {
                    Action action = actions[j];
                    taskPane.add(action);
                }
                taskpanecontainer.add(taskPane);
            }
        }
    
        private final class Listener implements PropertyChangeListener {
    
            public void propertyChange(PropertyChangeEvent evt) {
    
                if (ExplorerManager.PROP_EXPLORED_CONTEXT.equals(evt.getPropertyName())) {
                    setRootNode(manager.getExploredContext());
                    return;
                }
            }
        }
    }
    

    Example image

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In one of my projects, I have some classes that represent entities that cannot
i have done some learning on struts based on one project that i got.Now
I ran FxCop on one of the projects that I am working on and
I have a development log for one of my projects that is now a
I'm working on one of my first projects that will span more than one
I have a handful of projects that all use one project for the data
I have two projects that contain extension methods. One project is implemented using C#
I have a file in one of our projects that defines a variable that
There is a lot of code in one of our projects that looks like
I've got several android projects that share one of my library projects. I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.