Forums Register Login

how to set focus to password field in swings

+Pie Number of slices to send: Send
Hi


I have tried this.But still my password field is not getting the focus.
My class extends Jdialog.When i open it,i should get the cursor in this password field.
Please reply
+Pie Number of slices to send: Send
add a componentListener to oldPasswordField, and in componentShown put
oldPasswordField.requestFocusInWindow()
+Pie Number of slices to send: Send
After setVisible(true), you should use passowrField.requestFocusInWindow().




if your dialog is modal then the above doesn't work!! in such a case you must use this.


[ July 03, 2007: Message edited by: Pavan Kumar Mankala ]
+Pie Number of slices to send: Send
how to add a component listener?
I have tried with this, but still didn't get.
oldPasswordField.setRequestFocusEnabled(true);
oldPasswordField.requestFocus();
oldPasswordField.requestFocusInWindow();
+Pie Number of slices to send: Send
+Pie Number of slices to send: Send
Hi
This is my code.....
I need to set the cursor for oldpassword field while opening this window.
How can I get it?
+Pie Number of slices to send: Send
where (in the 400+ lines of posted code) have you tried adding a componentListener?
+Pie Number of slices to send: Send
I haven't create this code.just i am enhancing it.
I know basics of java alone.
I am new to MVC architecture.
Can you help me to set the focus in oldpassword field?
+Pie Number of slices to send: Send
> Can you help me to set the focus in oldpassword field?

I've already posted what to do, and a link that has examples of how to do it,
what problem do you still have?
We've gotta get close enough to that helmet to pull the choke on it's engine and flood his mind! Or, we could just read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 4300 times.
Similar Threads
JTextField Focus issue
focus() function
Focus Lost problem
how to focus input field in jsp without using javascript
regarding focus in swing
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 04:39:24.