Hitesh P Patel

Greenhorn
+ Follow
since May 23, 2012
Merit badge: grant badges
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 Hitesh P Patel

Which file you are trying to upload ?
If you are talking about code then use code tags to submit your code.
10 years ago

vamsi naki wrote:when the button is clicked



How you are getting Button in frame without adding it to container ?
10 years ago

by appropriate layout manager you mean which one


It depends on your design to choose the appropriate layout

can you give me an example


Read the section from the Swing tutorial on How to Use Various Layout Managers
10 years ago
Add gbc.weighty = 1; to the cityField, constraints.anchor = GridBagConstraints.NORTHWEST and add panel to BorderLayout.WEST
Addition/Changes made to your code are commented
10 years ago
Its better solution then calling the routine twice.
10 years ago

1) looks like showInternalMessageDialog inherits the L & F of its parent.
it needs a parent (try null as parent) whereas the showMessageDialog doesn't.



It show Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: JOptionPane: parentComponent does not have a valid parent

2) you'd need to dig into the source codes of both to see what's different.
simple fix is to add the earlier line
Message = ValidateForm();
after the optionPane. having it the second time will only handle the focus request.



It works that ways and already tried before posting code for help.
It will not be good programming to call the routine twice for focus, but for temporary solution i will go with it until I find any solution.
10 years ago
Yes it true, but there is two thing.
First : look of message dialog using showMessageDialog and showInternalMessageDialog is different.
Second : I want to know why its not working. I tried but cant figure out the problem, so i posted the same here to get help.
10 years ago
I have JFrame, which contain JInternalFrame. JInternalFrame contains 3 labels, 3 textfield and 2 buton.
When user after entering details in textfield click OK, if any of the textfield is left blank a message is displayed and focus should return to that textfield.
When JOptionPane.showMessageDialog is used it works perfect, it display message and focus return to empty textfield.
The problem is when using JOptionPane.showInternalMessageDialog it display message and focus remain on OK button.

Please help and let me know what i am missing in the code.

10 years ago