<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ~~~ package draw.a3; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class Test extends JFrame implements ActionListener { Wdmb3 mb=null; JButton an1,an2; public static void main(String[] args) { Test lx=new Test(); } public Test() { mb=new Wdmb3(); an1=new JButton("紅色"); an2=new JButton("藍色"); Jtz jt1=new Jtz(); this.add(an1,BorderLayout.NORTH); this.add(an2,BorderLayout.SOUTH); mb.setBackground(Color.yellow); this.add(mb); an1.addActionListener(this);//this為本類中的監聽 an1.addActionListener(jt1);//為創建的監聽類中的監聽 an1.setActionCommand("111");//區別按鈕 an2.addActionListener(this); an2.addActionListener(jt1); an2.setActionCommand("222"); this.setSize(300,260); this.setLocation(300,280); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); } public void actionPerformed(ActionEvent e) { System.out.println("按鈕起作用了"); /*if(e.getActionCommand().equals("111")) { //System.out.println("紅色紅色"); mb.setBackground(Color.red); } else if(e.getActionCommand().equals("222")) {//System.out.println("藍色藍色"); mb.setBackground(Color.blue); }*/ } } class Wdmb3 extends JPanel { public void paint(Graphics g) { super.paint(g); } } class Jtz implements ActionListener { public void actionPerformed(ActionEvent aa) { if(aa.getActionCommand().equals("111")) { System.out.println("監聽者在監聽,知道你按下的是紅色按鈕"); } else if(aa.getActionCommand().equals("222")) { System.out.println("監聽者在監聽,知道你按下的是藍色按鈕"); } } } ~~~ 分別點擊兩個按鈕的結果 ![](https://box.kancloud.cn/2d550966225520e789c7539209369fa5_744x514.png)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看