Input: Combo
import javax.swing.*;
class combo{
public static void main( String[] args){
String [] pilihan={"pilihan 1","pilihan 2 "," pilihan 3 "," pilihan 4 "};
JComboBox cb=new JComboBox(pilihan);
JFrame frame= new JFrame ();
frame.setSize(180,200);
cb.setBounds(10,10,150,25);
frame.add(cb);
frame.setLayout(null);
frame.setVisible( true);
}
}
Output :
Input : checkBox
import javax.swing.*;
class checkBox{
public static void main (String[]args){
JCheckBox c1=new JCheckBox("pilihan 1");
JFrame frame=new JFrame();
frame.setSize(200,200);
c1.setBounds(50,50,150,25);
frame.add(c1);
frame.setLayout(null);
frame.setVisible(true);
}
}
Output:
Tidak ada komentar:
Posting Komentar