我是编程新手,我需要帮助。如何在Java中实现功能按钮?在这里检查测试代码:
import java.awt.BorderLayout;
import javax.swing.DefaultButtonModel;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
public class test {
test(){
JFrame frame = new JFrame("Flow Layout");
JButton button;
button = new JButton("button 1");
frame.add(button);
frame.setLayout(new FlowLayout());
frame.setSize(300,300);
frame.setVisible(true);
}
public static void main(String[] args) {
new test();
}
}
慕妹3242003
相关分类