JButton.setBounds(x,y,w,h) doesn't seem to work

前端 未结 2 1140
借酒劲吻你
借酒劲吻你 2021-01-20 14:56
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;

public class SimpleExample extends JFrame {

    public SimpleExample() {
         


        
2条回答
  •  我在风中等你
    2021-01-20 15:14

    As a good practice, you should not add the button directly to the JFrame. Instead, add a JPanel to the frame, set the panel's layout to null, and add the JButton to the JPanel.

提交回复
热议问题