so i now awt is the old version. which is Applet
swing is the new version which is JApplet.
code at bottom, is it normal to mix awt and swing? for ex i am using continer which is awt. and let say i dont want to mix awt with swing so is there a way to use continer in swing??
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.JApplet;
import javax.swing.JCheckBox;
import javax.swing.JList;
public class j_01_FLOW_06 extends JApplet implements ActionListener
{
JCheckBox f = new JCheckBox("f");
JCheckBox g = new JCheckBox("g");
JCheckBox cb_computer = new JCheckBox("Computer");
String s_value[]={"white sox","red sox","mets","cordianls","blue jays"};
JList l_list = new JList(s_value);
Container c;
FlowLayout flow = new FlowLayout();
public void init()
{
c = getContentPane();
c.setLayout(flow);
c.add(f);
c.add(g);
c.add(cb_computer);
c.add(l_list);
cb_ikhlas.addActionListener(this);
cb_ahmed.addActionListener(this);
cb_computer.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
boolean selected = cb_ikhlas.isSelected();
if(selected == true) //if check box is selected
{
Object[] string = f.getSelectedObjects();
System.out.println(string);
}
}
}