1, the JButton size of the setting button.setpreferredsize (New Dimension (30,30)); //(30,30) is the size of the button you want to set 2. Transparent setting for JButtonbutton.setcontentareafilled (false);3. Set the border of the button to remove the JButtonbutton.setborderpainted (false);4, the setting of JButton add iconinstantiate an Icon object imageicon image = new ImageIcon (Icons[i]), instantiates a button object, and the Settings button displays a picture of JButton buttons = new JButton (image); --or Button.seticon (new ImageIcon (GetClass () getresource ("Qq.png")); //qq.png is the picture you want to add5. Make the button change with the pattern on the button Butten.setmargin (New Insets (0,0,0,0)); 6, set up the convex button, many other swing can also use this methodButten.setborder (Borderfactory.createraisedbevelborder ()); 7, set the concave button, many other swing can also use this method   button.setborder ( Borderfactory.createloweredbevelborder ()); 8, set the foreground and background color of the button   button. SetFont (New Java.awt.Font ("XXFarEastFont-Xingkai", 1, 15));   button.setbackground (Color.green); 9, change the style of the button Uimanager.setlookandfeel ("Com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
JButton Common settings in Java