Ceriwis  

Go Back   Ceriwis > HOBI > Komputer & Teknologi > Programming

Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman.

Reply
 
Thread Tools
  #1  
Old 20th November 2011
Badguy13 Badguy13 is offline
Ceriwiser
 
Join Date: Nov 2011
Posts: 399
Rep Power: 14
Badguy13 mempunyai hidup yang Normal
Default Add Action Listener

agan2 smua.....mnta bantuannya dong.....

aku mau tambah Action Listener di tiap2 tombolnya.....



ni progie yang dah aku buat......mohon bantuannya.....THx



import java.awt.*;

import javax.swing.*;

import java.awt.event.*;



public class TAI extends JFrame

{

JLabel tanya1,simpul;

JTextField kesimpulan;

JButton tombol,tombol1,tombol2;

JRadioButton radio1,radio2,radio3;

Container contentArea;



public TAI()

{

setTitle("Pertanyaan untuk menyimpulkan prosentase polusi udara di Kota Semarang");

setSize(500,300);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

makeComponent();

makeLayout();

}

public void makeComponent()

{

tanya1=new JLabel("Apakah pola makan anda terlampau banyak?");

simpul=new JLabel("Kesimpulan");

kesimpulan=new JTextField ("Anda Menderita Diabetes Melitus");

kesimpulan.setEditable(false);

}



public void makeLayout()

{

contentArea=getContentPane();

contentArea.setLayout(new BoxLayout(contentArea,BoxLayout.Y_AXIS));

JPanel panel1=new JPanel();

panel1.add(new Button("ya"));

panel1.add(new Button("tidak"));

panel1.add(new Button("ragu2"));



JPanel panel2=new JPanel(new FlowLayout(FlowLayout.LEFT));

panel2.add(simpul);

panel2.add(kesimpulan);





contentArea.add(tanya1);

contentArea.add(panel1);

contentArea.add(panel2);





}

public static void main(String[]args)

{

TAI layout=new TAI();

layout.setVisible(true);

}

}



Terkait:
    Reply With Quote
    Reply


    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off


     


    All times are GMT +7. The time now is 08:56 PM.


    no new posts