Java——不弹起的按钮组件:JToggleButton

Java——不弹起的按钮组件:JToggleButton

import java.awt.GridLayout;

import javax.swing.JFrame;
import javax.swing.JToggleButton; //=================================================
// File Name : JToggleButton_demo
//------------------------------------------------------------------------------
// Author : Common //主类
//Function : JToggleButton_demo
public class JToggleButton_demo { public static void main(String[] args) {
// TODO 自动生成的方法存根
JFrame f = new JFrame("Swing窗口"); //实例化窗体对象
JToggleButton but1 = new JToggleButton("已选中",true);
JToggleButton but2 = new JToggleButton("未选中");
JToggleButton but3 = new JToggleButton("按我");
f.setLayout(new GridLayout(3,1)); //设置排版样式
f.add(but1);
f.add(but2);
f.add(but3);
f.setSize(440, 320); //设置窗体
f.setLocation(300,200); //设置显示位置
f.setVisible(true);
} }
上一篇:LeetCode OJ:Trapping Rain Water


下一篇:浩顺AC671指纹考勤机二次开发(demo)