Nothing to do, write a swing interface, after running to see when the click button, the middle of the text will appear a text around the small box, which is the button to get the focus of the logo, I feel a word: ugly! How to get rid of it? Almighty degree Niang tell me, set the button of the setfocuspainted to false, I tried a bit, sure enough, the following will code to share to everyone, you can set the attributes of that sentence, to see the effect before and after.
Importjava.awt.event.ActionEvent;ImportJava.awt.event.ActionListener;ImportJavax.swing.JButton;ImportJavax.swing.JFrame; Public classSwingdemo { Public Static voidMain (string[] args) {//TODO Auto-generated method stubsJFrame JFrame =NewJFrame ("Demo"); JButton Button=NewJButton ("JB"); Button.addactionlistener (NewActionListener () {@Override Public voidactionperformed (ActionEvent e) {System.out.println ("Click JB"); } }); //Remove the focus frame around the button textButton.setfocuspainted (false); Jframe.getcontentpane (). Add (button); Jframe.setdefaultcloseoperation (Jframe.exit_on_close); Jframe.setbounds (100, 100, 200, 136); Jframe.setvisible (true); }}
Java Swing removes the focus frame around the button text