Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.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
User interface 得到错误的flowLayout_User Interface - Fatal编程技术网

User interface 得到错误的flowLayout

User interface 得到错误的flowLayout,user-interface,User Interface,可能我的流程布局有问题,这将是错误的。我怎样才能修好它?请帮帮我 该错误似乎无法解析符号类FlowLayout import java.io.*; import javax.swing.*; public class qwe extends JFrame { private JButton but; private JLabel lab; private JTextField tex; public qwe() { lab = n

可能我的流程布局有问题,这将是错误的。我怎样才能修好它?请帮帮我

该错误似乎无法解析符号类FlowLayout

    import java.io.*;
import javax.swing.*;
public class qwe extends JFrame
{
    private JButton but;
    private JLabel lab;
    private JTextField tex;

    public qwe()
    {
        lab = new JLabel("I am a label");
        add(lab);

        tex = new JTextField(15);
        add(tex);

        but = new JButton("Click me!");
        add(but);
    }

    public static void main(String args [])
    {
        qwe gui = new qwe();
        gui.setLayout(new FlowLayout());
        gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        gui.setSize(200,125);
        gui.setVisible(true);
    }
}

您需要导入FlowLayout类
导入java.awt.FlowLayout

我还有一个建议:
仔细观察编程逻辑。您必须设置qwe框架的布局,然后向其中添加其他组件

很可能在类路径中未设置FlowLayout类。@SasiKathimanda我需要做什么?是否确实要扩展JFrame??为什么不创建新的JFrame呢。