Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 为什么在Swing designer中GUI看起来不同,以及它何时';她在跑步吗?_Java_Eclipse_Swing - Fatal编程技术网

Java 为什么在Swing designer中GUI看起来不同,以及它何时';她在跑步吗?

Java 为什么在Swing designer中GUI看起来不同,以及它何时';她在跑步吗?,java,eclipse,swing,Java,Eclipse,Swing,首先,感谢您的阅读。我正在学习如何使用Swing designer和一些关于Swing的东西。对不起,我的菜鸟问题 在designer中: 运行时: 我试图在Swing designer中绘制GUI。但在跑步时一切都变了。左侧按钮的位置和大小已发生严重变化。是因为系统分辨率吗?谢谢你的帮助 package GUI; public class FlowerFrame { private JFrame frame; private JTextField textField; private J

首先,感谢您的阅读。我正在学习如何使用Swing designer和一些关于Swing的东西。对不起,我的菜鸟问题

在designer中:

运行时:

我试图在Swing designer中绘制GUI。但在跑步时一切都变了。左侧按钮的位置和大小已发生严重变化。是因为系统分辨率吗?谢谢你的帮助

package GUI;
public class FlowerFrame {

private JFrame frame;
private JTextField textField;
private JTextField textField_1;
private JTextField textField_2;

/**
 * Launch the application.
 */
public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                FlowerFrame window = new FlowerFrame();
                window.frame.setVisible(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

/**
 * Create the application.
 */
public FlowerFrame() {
    initialize();
}

/**
 * Initialize the contents of the frame.
 */
private void initialize() {
    frame = new JFrame("销售统计");
    frame.setBounds(100, 100, 824, 497);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -74, 0, 0, 0, 0, 0};
    gridBagLayout.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    frame.getContentPane().setLayout(gridBagLayout);

    JButton button = new JButton("\u663E\u793A\u5E93\u5B58");
    GridBagConstraints gbc_button = new GridBagConstraints();
    gbc_button.fill = GridBagConstraints.HORIZONTAL;
    gbc_button.insets = new Insets(0, 0, 5, 5);
    gbc_button.gridx = 2;
    gbc_button.gridy = 1;
    frame.getContentPane().add(button, gbc_button);

    JButton button_1 = new JButton("\u9500\u552E\u56FE\u8868");
    GridBagConstraints gbc_button_1 = new GridBagConstraints();
    gbc_button_1.fill = GridBagConstraints.HORIZONTAL;
    gbc_button_1.insets = new Insets(0, 0, 5, 5);
    gbc_button_1.gridx = 8;
    gbc_button_1.gridy = 1;
    frame.getContentPane().add(button_1, gbc_button_1);

    JButton button_2 = new JButton("\u4FDD\u5B58\u5E76\u9000\u51FA");
    GridBagConstraints gbc_button_2 = new GridBagConstraints();
    gbc_button_2.fill = GridBagConstraints.HORIZONTAL;
    gbc_button_2.insets = new Insets(0, 0, 5, 5);
    gbc_button_2.gridx = 13;
    gbc_button_2.gridy = 1;
    frame.getContentPane().add(button_2, gbc_button_2);

    JTextArea textArea = new JTextArea();
    GridBagConstraints gbc_textArea = new GridBagConstraints();
    gbc_textArea.gridheight = 8;
    gbc_textArea.gridwidth = 14;
    gbc_textArea.insets = new Insets(0, 0, 5, 5);
    gbc_textArea.fill = GridBagConstraints.BOTH;
    gbc_textArea.gridx = 2;
    gbc_textArea.gridy = 2;
    frame.getContentPane().add(textArea, gbc_textArea);

    JButton button_3 = new JButton("\u63D0\u4EA4");
    GridBagConstraints gbc_button_3 = new GridBagConstraints();
    gbc_button_3.fill = GridBagConstraints.HORIZONTAL;
    gbc_button_3.insets = new Insets(0, 0, 5, 5);
    gbc_button_3.gridx = 2;
    gbc_button_3.gridy = 11;
    frame.getContentPane().add(button_3, gbc_button_3);

    JLabel label = new JLabel("\u552E\u8D27\u5458");
    GridBagConstraints gbc_label = new GridBagConstraints();
    gbc_label.insets = new Insets(0, 0, 5, 5);
    gbc_label.gridx = 8;
    gbc_label.gridy = 11;
    frame.getContentPane().add(label, gbc_label);

    textField = new JTextField();
    GridBagConstraints gbc_textField = new GridBagConstraints();
    gbc_textField.gridwidth = 6;
    gbc_textField.insets = new Insets(0, 0, 5, 5);
    gbc_textField.fill = GridBagConstraints.HORIZONTAL;
    gbc_textField.gridx = 10;
    gbc_textField.gridy = 11;
    frame.getContentPane().add(textField, gbc_textField);
    textField.setColumns(10);

    JLabel label_1 = new JLabel("\u5546\u54C1\u7F16\u53F7");
    GridBagConstraints gbc_label_1 = new GridBagConstraints();
    gbc_label_1.insets = new Insets(0, 0, 5, 5);
    gbc_label_1.gridx = 8;
    gbc_label_1.gridy = 12;
    frame.getContentPane().add(label_1, gbc_label_1);

    textField_1 = new JTextField();
    GridBagConstraints gbc_textField_1 = new GridBagConstraints();
    gbc_textField_1.gridwidth = 6;
    gbc_textField_1.insets = new Insets(0, 0, 5, 5);
    gbc_textField_1.fill = GridBagConstraints.HORIZONTAL;
    gbc_textField_1.gridx = 10;
    gbc_textField_1.gridy = 12;
    frame.getContentPane().add(textField_1, gbc_textField_1);
    textField_1.setColumns(10);

    JButton button_4 = new JButton("\u6E05\u7A7A");
    GridBagConstraints gbc_button_4 = new GridBagConstraints();
    gbc_button_4.fill = GridBagConstraints.HORIZONTAL;
    gbc_button_4.insets = new Insets(0, 0, 5, 5);
    gbc_button_4.gridx = 2;
    gbc_button_4.gridy = 13;
    frame.getContentPane().add(button_4, gbc_button_4);

    JLabel label_2 = new JLabel("\u6570\u91CF");
    GridBagConstraints gbc_label_2 = new GridBagConstraints();
    gbc_label_2.insets = new Insets(0, 0, 5, 5);
    gbc_label_2.gridx = 8;
    gbc_label_2.gridy = 13;
    frame.getContentPane().add(label_2, gbc_label_2);

    textField_2 = new JTextField();
    GridBagConstraints gbc_textField_2 = new GridBagConstraints();
    gbc_textField_2.gridwidth = 6;
    gbc_textField_2.insets = new Insets(0, 0, 5, 5);
    gbc_textField_2.fill = GridBagConstraints.HORIZONTAL;
    gbc_textField_2.gridx = 10;
    gbc_textField_2.gridy = 13;
    frame.getContentPane().add(textField_2, gbc_textField_2);
    textField_2.setColumns(10);
}

}

我想你会想看看的