java初學(xué)者
          所有生命,不管在哪里度過(guò),都具有同樣價(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)---靖寶華 閱讀(305) | 評(píng)論 (0)編輯 收藏

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

          //構(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); //矩形長(zhǎng)寬賦值,
          ??System.out.println("矩形的面積是"+rectangle1.Area());
          ??System.out.println("矩形的面積是"+rectangle1.Perimeter());?
          ?}
          }*/

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

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

          常用鏈接

          留言簿(1)

          隨筆檔案(7)

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 广昌县| 凤阳县| 武夷山市| 库车县| 北流市| 临夏县| 如皋市| 偃师市| 德安县| 嘉定区| 辽阳市| 吕梁市| 囊谦县| 盐源县| 大连市| 景泰县| 商丘市| 海林市| 谢通门县| 莒南县| 府谷县| 孙吴县| 甘德县| 侯马市| 恩施市| 巴中市| 南平市| 绥江县| 克东县| 三明市| 昌邑市| 丰都县| 图片| 娱乐| 香河县| 门头沟区| 鄂托克前旗| 荔浦县| 松滋市| 宁化县| 东光县|