java初學(xué)者
          所有生命,不管在哪里度過,都具有同樣價(jià)值
          posts - 7,  comments - 5,  trackbacks - 0
          import javax.swing.*;
          import java.awt.*;
          public class GridLayoutDemo extends JFrame{
          public GridLayoutDemo()
           {
          ?super("網(wǎng)格布局");
          ?this.setSize(600,300);
          ?this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          }
          public void setlayout(){
          ?FlowLayout layout = new FlowLayout();
          ?Container Contain = getContentPane();
          ?Contain.setLayout(layout);
          ?for(int i=1; i<6;i++)
          {
          ?JButton btn = new JButton("按鈕"+i);
          ?Contain.add(btn);
          ?}
          }
          public static void main(String []args )
          {
          ?GridLayoutDemo GridLay = new GridLayoutDemo();
          ?GridLay.setlayout();
          ?GridLay.show();
          }
          }
          posted @ 2006-12-21 20:04 悠揚(yáng)---靖寶華 閱讀(311) | 評(píng)論 (0)編輯 收藏

          /*class Rectangle
          {//實(shí)例變量
          ?private double width;//類成員的訪問控制,不允許對(duì)象通過點(diǎn)符號(hào),來直接訪問該變量,
          ?private double height;
          ?//方法
          ?public double Area()???????? //返回值類型 方法名字(){具體的實(shí)現(xiàn)語句;}
          ? {return width*height;} //求矩形面積
          ?public?double Perimeter()
          ? {return 2*(width+height);}//求矩形周長

          //構(gòu)造函數(shù)

          ? public Rectangle(double width,double height) //用于變量的賦初值,
          ?? {
          ?? this.width=width;
          ?? this.height=height;//this關(guān)鍵字用于構(gòu)造函數(shù)參數(shù)與實(shí)例變量名字相同時(shí)候.
          ?? }
          }

          public class RectangleDemo
          {
          ?public static void main(String [] args)
          ?{
          ??Rectangle rectangle1=new Rectangle(4,5); //矩形長寬賦值,
          ??System.out.println("矩形的面積是"+rectangle1.Area());
          ??System.out.println("矩形的面積是"+rectangle1.Perimeter());?
          ?}
          }*/

          posted @ 2006-10-20 21:02 悠揚(yáng)---靖寶華 閱讀(267) | 評(píng)論 (0)編輯 收藏

          <2006年10月>
          24252627282930
          1234567
          891011121314
          15161718192021
          22232425262728
          2930311234

          常用鏈接

          留言簿(1)

          隨筆檔案(7)

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 彰化县| 桃园市| 黄梅县| 石城县| 文水县| 恭城| 光泽县| 甘谷县| 澳门| 广丰县| 泰顺县| 仁怀市| 辽阳市| 长岭县| 临湘市| 宁陕县| 锦州市| 伊吾县| 英超| 孝义市| 江达县| 南郑县| 英德市| 胶州市| 宝应县| 西丰县| 永寿县| 岳阳市| 容城县| 柯坪县| 柘荣县| 洪雅县| 包头市| 宜昌市| 贵阳市| 台湾省| 读书| 泽州县| 淮北市| 开阳县| 广汉市|