Linux教程網
Java使用JToggleButton:
- package com.han;
-
- import java.awt.Container;
- import java.awt.FlowLayout;
-
- import javax.swing.JFrame;
- import javax.swing.JToggleButton;
-
- /**
- * 使用JToggleButton
- * @author HAN
- *
- */
- public class JToggleButton_1 extends JFrame {
-
- /**
- *
- */
- private static final long serialVersionUID = -4145861896939853662L;
-
- public JToggleButton_1() {
- // TODO Auto-generated constructor stub
- JToggleButton toggleButton = new JToggleButton("JToggleButton");
- Container container = getContentPane();
- container.setLayout(new FlowLayout());
- container.add(toggleButton);
- }
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- JToggleButton_1 frame = new JToggleButton_1();
- frame.setTitle("JToggleButton");
- frame.setVisible(true);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.setBounds(0, 0, 300, 100);
- }
-
- }
Copyright ©
Linux教程網 All Rights Reserved