2011-03-11

2011/03/11

不堪使用
待哪天真的不小心有空再行修改





import javax.swing.*;               
import java.awt.*;
import java.awt.event.*;  // 要處理事件必須 import 此套件
   
public abstract class Work2 extends MenuItem
                        implements ActionListener{
   
        /**
         * @param args
         */
        //int act = 0;     // 用來記錄按鈕被次數的變數
        int SizeW = 500;
        int SizeH = 500;
   
         

public static void main(String[] args) {
              //Work2 test = new Work2();
    JFrame frame = new JFrame("Check Box Frame");
    JCheckBox chk = new JCheckBox("This is the Check Box");
frame.add(chk);
                      frame.setVisible(true);
                      frame.setSize(150,220);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);



         
   
      //    用建構方法來建立元件、將元件加入視窗、顯示視窗
    //      public Work2() {
       //     setTitle("Listener 示範");    // 設定視窗標題
       //     JButton mybutton = new JButton("換個標題");
   
            // 通知按鈕物件:本物件要當傾聽者
       //     mybutton.addActionListener(this);
   
       //     getContentPane().add(mybutton);
       //     setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       //     setSize(SizeW,SizeH);
       //     setVisible(true);
          }
   
       //   public void actionPerformed(ActionEvent e) {
       //       SizeW = (int) (SizeW * 0.8);
       //       SizeH = (int) (SizeH * 0.8);
       //       setSize(SizeW,SizeH);
     //     }
   
    }

沒有留言:

張貼留言