Bharti Poorey

Greenhorn
+ Follow
since Sep 09, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Bharti Poorey

Hi,

I have cleared SCJP5 with 90%

Haven't received the certificate yet.. can any body tell me how much time it takes usually?

Thanks,
- Bharti Poorey
14 years ago
Its a very simple application having two panels.
15 years ago
Have tried that first with only panels.. but that didn't work.
15 years ago
It has a JButton component.

There are two JPanels on a frame,
Panel1 having Button1 as its child.
Panel2 having Button2 as its child.

I tried to print some statements on focus events like
"Panel1 gain Focus" and "Panel1 lost Focus"
For button :
"Button1 gain Focus" and "Button1 lost focus"

When I switch focus from Button1(Which is in Panel1) to Button2( of Panel2)
I expect it will print :
Panel1 lost Focus
Button1 lost focus

But it prints:
Button1 lost focus

Does it mean only JButton responded to FocusLost , not the JPanel ?
15 years ago
Yep.. this will work for my applicatio. Thanks Maneesh.

Just a query.. whether JPanel respond to focus events?
As I tried with a small application to check the focus gain and focus lost, but it didn't work.

Is it mean that the Focus events are not implemented for JPanel in the same way they are implemented for JButton and JTextField component??
15 years ago
Yes.. definitely I can use the FocusGain event for tree and other panel.

But the drawback with this approach is, if in future I add any other panel/component to the frame, I need to perform the same FocusGain check for that also.

Is it not possible that on focuslost of panel, it save the data irrespective of who ever gained the focus??
15 years ago
Hi Maneesh, thanks for your reply.

The structure is.. in a frame I have a Jtree on the left side, and on clicking on the tree node, the corrosponding panel is displayed on the right side where user can provide inputs. There is one more panel at the bottom of frame which has some buttons.

Here I can not use Selection listener to the tree as I want to save the panel changes either on clicking on the tree node or when the user clicks on the buttons provided at the bottom inside a ButtonPanel.
15 years ago
Hi Campbell,

Thanks for pointing out this, have corrected my name.
15 years ago
Hi,

I am creating an application which has a JTree and each treenode has a associated JPanel.

I want to perform certain actions when the JPanel losses focus(when another treenode got clicked), I tried it with creating small program but the JPanel is not responding to either FocusGain or FocusLost.

Any suggestion/idea..How to detect FocusLost on JPanel?
15 years ago