Convert Java to Java Applet

Im having difficult to convert these code to java appplet
[code]
package testing2;
import javax.swing.*;
import java.awt.*;




public class Testing2 extends JFrame {

private JButton Butang1,Butang2,Butang3;
private JTextField answer;
private JTextArea area;
private JCheckBox checkButton;
private JSlider scroll;

public Testing2(){
Container contentPane = getContentPane();

setSize(600, 400);
setTitle("");
setLocation(30, 40);

contentPane.setLayout(null);
contentPane.setBackground(Color.white);

Butang1 = new JButton("Butang A");
Butang1.setBounds(150, 20, 95, 30);
contentPane.add(Butang1);


Butang2 = new JButton("Butang B ");
Butang2.setBounds(250, 20, 95, 30);
contentPane.add(Butang2);


Butang3 = new JButton("Butang C");
Butang3.setBounds(350, 20, 95, 30);
contentPane.add(Butang3);

answer = new JTextField();
answer.setBounds(20, 60, 150, 20);
contentPane.add(answer);

answer = new JTextField();
answer.setBounds(20, 80, 150, 20);
contentPane.add(answer);

answer = new JTextField();
answer.setBounds(20, 100, 150, 20);
contentPane.add(answer);


checkButton = new JCheckBox("cbox 1",false);
checkButton.setBounds(200, 60, 80, 30);
contentPane.add(checkButton);

checkButton = new JCheckBox("cbox 2",false);
checkButton.setBounds(300, 60, 80, 30);
contentPane.add(checkButton);

checkButton = new JCheckBox("cbox 3",false);
checkButton.setBounds(400, 60, 80, 30);
contentPane.add(checkButton);

checkButton = new JCheckBox("cbox 4",false);
checkButton.setBounds(500, 60, 80, 30);
contentPane.add(checkButton);


scroll = new JSlider();
scroll.setBounds(20, 120, 550,50);
scroll.setValue(0);
scroll.setMaximum(10);
scroll.setMinimum(0);
scroll.setMajorTickSpacing(2);
scroll.setPaintTicks(rootPaneCheckingEnabled);
scroll.setPaintLabels(rootPaneCheckingEnabled);
scroll.setVisible(true);
contentPane.add(scroll);


scroll = new JSlider();
scroll.setBounds(20, 180, 550,50);
scroll.setValue(0);
scroll.setMaximum(20);
scroll.setMinimum(0);
scroll.setMajorTickSpacing(5);
scroll.setPaintTicks(rootPaneCheckingEnabled);
scroll.setPaintLabels(rootPaneCheckingEnabled);
scroll.setVisible(true);
contentPane.add(scroll);

scroll = new JSlider();
scroll.setBounds(20, 240, 550,50);
scroll.setValue(0);
scroll.setMaximum(5);
scroll.setMinimum(0);
scroll.setMajorTickSpacing(1);
scroll.setPaintTicks(rootPaneCheckingEnabled);
scroll.setPaintLabels(rootPaneCheckingEnabled);
scroll.setVisible(true);
contentPane.add(scroll);


area = new JTextArea();
area.setBounds(20,300, 550, 20);
area.setBorder(BorderFactory.createLineBorder(Color.black));
area.setEditable(false);
contentPane.add(area);

}
public static void main(String[] args) {
// TODO code application logic here


Testing2 mybuttondemo = new Testing2();
mybuttondemo.setVisible(true);
}

}


[/code]

im using this to make it to java applet

[code]





</HTML
[/code]

but the problem is there is no box, radio button appear in the web browser. do i need some certain code to appear all the things?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories