0

How to unfocus a jtextfield?

I have jdialog which contains one jtextfield(for search feature) and one jtable made in netbeans but its initially focus on jtextfield .How can I unfocus the jtextfield from the start? Can someone help me!

22nd May 2023, 12:37 PM
Totski
Totski - avatar
4 Réponses
22nd May 2023, 12:44 PM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - avatar
+ 1
This from Sakshi (less active) link doesn't help? Use requestFocusInWindow() to set focus on some other component rather then your JTextfield first. But i'd suggest not to alter the native focus system, rather setText(String s) on the JTextField after initComponents() call in the constructor (assumed to be in netbeans). Further optional reading: How to Use the Focus Subsystem Do you try nextFocusableComponent property in NetBeans property editor for your JMenuItem I fixed it, I used ur code twice, on startup, and when I click on the Jmenuitem, thanks
22nd May 2023, 1:15 PM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Totski The link is working, I checked it, if the link is not working from your side then google it you can easily get that answer
22nd May 2023, 1:24 PM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - avatar
0
I dont see any solution from the link you provided sir. Pls help me
22nd May 2023, 1:07 PM
Totski
Totski - avatar