2019年8月27日 星期二

[Java程式]_Ch15.2_設計新的容器元件



歡迎訂閱頻道:杜仲教學YouTube
https://www.youtube.com/channel/UCElwt6s8Ea_V-gnu9sZZT5g?sub_confirmation=1
杜仲教學部落格:
https://derekcctu.blogspot.com/

1 則留言:

  1. import java.awt.Button;
    import java.awt.Color;
    import java.awt.Frame;
    import java.awt.Label;

    public class MyFrame extends Frame{
    Label lb=new Label();
    Button btn1=new Button();
    Button btn2=new Button("綠色");
    Button btn3=new Button("藍色");
    Button btn4=new Button("離開");

    public MyFrame(int x,int y,int w,int h,String name){
    setVisible(true);
    setBackground(Color.ORANGE);
    setSize(w,h);
    setLocation(x,y);
    setTitle(name);
    setLayout(null);

    lb.setText("新竹認證");
    lb.setAlignment(Label.CENTER);
    lb.setBackground(Color.YELLOW);
    lb.setLocation(50, 50);
    lb.setSize(200, 50);
    btn1.setLabel("紅色");
    btn1.setLocation(50, 50+50+10);
    btn1.setSize(50, 30);
    btn2.setBounds(50+50, 110, 50, 30);
    btn3.setBounds(50+50+50, 110, 50, 30);
    btn4.setBounds(50+50+50+50, 110, 50, 30);

    add(btn4);
    add(btn3);
    add(btn2);
    add(btn1);
    add(lb);
    }
    public void getBTNName(){
    String b1=btn1.getLabel();
    String b2=btn2.getLabel();
    String b3=btn3.getLabel();
    String b4=btn4.getLabel();
    lb.setText(b1+b2+b3+b4);
    }
    }

    回覆刪除

Ether.fi Cash Card 一張所有人必備的加密貨幣信用卡   [Ether.fi Cash Card] : https://www.ether.fi/app/cash/sign-up?ref_code=d27f8523 ------國際交易所------ [Bitg...