Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/382.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.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 当我点击我的复选框时,一个单独的可编辑的框架会打开,我该怎么做?_Java_Arrays_Checkbox_Frames - Fatal编程技术网

Java 当我点击我的复选框时,一个单独的可编辑的框架会打开,我该怎么做?

Java 当我点击我的复选框时,一个单独的可编辑的框架会打开,我该怎么做?,java,arrays,checkbox,frames,Java,Arrays,Checkbox,Frames,我目前正在使用Java。我已经做了复选框,我想知道如何做,这样当点击复选框时,它会打开一个单独的框架,可以根据我的需要进行修改和编辑。我听说一组框架/组件可以工作。任何帮助/解决方案都将不胜感激。如果我理解您的问题,您必须为您的复选框实现一个侦听器。 在听众的身体里,应该有这样的东西: //1. Create the frame. JFrame frame = new JFrame("FrameDemo"); //2. Optional: What happens when the f

我目前正在使用Java。我已经做了复选框,我想知道如何做,这样当点击复选框时,它会打开一个单独的框架,可以根据我的需要进行修改和编辑。我听说一组框架/组件可以工作。任何帮助/解决方案都将不胜感激。

如果我理解您的问题,您必须为您的复选框实现一个侦听器。 在听众的身体里,应该有这样的东西:

    //1. Create the frame.
JFrame frame = new JFrame("FrameDemo");

//2. Optional: What happens when the frame closes?
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

//3. Create components and put them in the frame.
//...create emptyLabel...
frame.getContentPane().add(emptyLabel, BorderLayout.CENTER);

//4. Size the frame.
frame.pack();

//5. Show it.
frame.setVisible(true);
第一点和第五点是最重要的

如果您不知道如何为复选框创建和注册侦听器,请尝试访问以下网站:


我希望这条建议对您有所帮助。

告诉我们您认为解决方案是什么。从它的声音,你需要一个听众为你的复选框。