CollapsiblePanel setting focus to a JTextArea

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

CollapsiblePanel setting focus to a JTextArea

Postby NeoGeek83 » Wed Aug 13, 2008 7:46 am

I have a set of Collapsible Panels which when expanded I want to have the focus set to a text input area. What is the best way to go about doing this?
NeoGeek83
 
Posts: 3
Joined: Wed Aug 13, 2008 7:34 am

Re: CollapsiblePanel setting focus to a JTextArea

Postby JIDE Support » Wed Aug 13, 2008 7:58 am

I guess you can use CollapsiblePaneListener to listen to COLLAPSIBLE_PANE_EXPANDED event and call requestFocus on the text field.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: CollapsiblePanel setting focus to a JTextArea

Postby NeoGeek83 » Wed Aug 20, 2008 3:49 pm

Could you give me an example of how one would go about doing that?
NeoGeek83
 
Posts: 3
Joined: Wed Aug 13, 2008 7:34 am

Re: CollapsiblePanel setting focus to a JTextArea

Postby JIDE Support » Wed Aug 20, 2008 5:14 pm

I thought it should be easy enough to do based on my description above. Here is an example assuming the textArea is a JTextArea in the CollapsiblePane called pane. Now if you expand the CollapsiblePane, the textArea should get focus.

Code: Select all
        pane.addCollapsiblePaneListener(new CollapsiblePaneAdapter() {
            public void paneExpanded(CollapsiblePaneEvent event) {
                textArea.requestFocus();
            }
        });
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: CollapsiblePanel setting focus to a JTextArea

Postby NeoGeek83 » Thu Aug 21, 2008 6:45 am

I'm brand new to Java, and just now learning about how event and listeners are handled. I'm used to C++. Thanks for the help, I've got it now.
NeoGeek83
 
Posts: 3
Joined: Wed Aug 13, 2008 7:34 am

Re: CollapsiblePanel setting focus to a JTextArea

Postby JIDE Support » Thu Aug 21, 2008 7:22 am

I see. Not sure about you but we found many users thought they can learn JIDE directly without learning Swing but that's not correct. JIDE is built on top of Swing and uses Swing extensively. If you already knew Swing, you will find JIDE APIs a lot easier to understand because we follow Swing design patterns and naming convention everywhere in JIDE. But if you don't know Swing at all and/or from MFC/.NET side, you will find the API is not easy to understand and get used to. That's why we suggest people to learn Swing first, or at least learn Swing and JIDE the same time. FYI.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 66 guests