error "cannot find simbol method parseInt();
biasanya dlm application boleh guna, tukar kepada double pun xjadi gak..
minta tolong yer...
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
import javax.swing.*;
public class GUI2 extends JApplet implements ActionListener
{
private JTextField xfield,yfield,answer;
private JLabel x,y,nilai;
private JPanel area1;
private int j=0, k=0;
String xS,yS;
public void init()
{
Container pane=getContentPane();//create workspace
pane.setBackground(Color.white);//set workspace background color
pane.setLayout(new BorderLayout());//set layout ti border layout
area1=new JPanel();//create new panel
area1.setLayout(new GridLayout(3,2));//set gridlayout in panel
x=new JLabel("Masukkan Integer 1 : ");//create label
area1.add(x);//add label in panel
xfield=new JTextField(5);//create text field
area1.add(xfield);//add text field in panel
y=new JLabel("Masukkan Integer 2 : ");
area1.add(y);
yfield=new JTextField(5);
area1.add(yfield);
nilai=new JLabel("Hasil Tambah Integer : ");
area1.add(nilai);
answer=new JTextField("0",SwingConstants.CENTER);//create label & set it to center
answer.addActionListener(this);
area1.add(answer);
pane.add(area1, "Center");//add panel in workspace
}
public void actionPerformed(ActionEvent e)
{
int j=0,k=0;
String xS=xfield.getText();
j=Integer.parseInt();
String yS=yfield.getText();
k=Integer.parseInt();
int ans=j+k;
answer.setText(answer.getText() +ans);
biasanya dlm application boleh guna, tukar kepada double pun xjadi gak..
minta tolong yer...
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
import javax.swing.*;
public class GUI2 extends JApplet implements ActionListener
{
private JTextField xfield,yfield,answer;
private JLabel x,y,nilai;
private JPanel area1;
private int j=0, k=0;
String xS,yS;
public void init()
{
Container pane=getContentPane();//create workspace
pane.setBackground(Color.white);//set workspace background color
pane.setLayout(new BorderLayout());//set layout ti border layout
area1=new JPanel();//create new panel
area1.setLayout(new GridLayout(3,2));//set gridlayout in panel
x=new JLabel("Masukkan Integer 1 : ");//create label
area1.add(x);//add label in panel
xfield=new JTextField(5);//create text field
area1.add(xfield);//add text field in panel
y=new JLabel("Masukkan Integer 2 : ");
area1.add(y);
yfield=new JTextField(5);
area1.add(yfield);
nilai=new JLabel("Hasil Tambah Integer : ");
area1.add(nilai);
answer=new JTextField("0",SwingConstants.CENTER);//create label & set it to center
answer.addActionListener(this);
area1.add(answer);
pane.add(area1, "Center");//add panel in workspace
}
public void actionPerformed(ActionEvent e)
{
int j=0,k=0;
String xS=xfield.getText();
j=Integer.parseInt();
String yS=yfield.getText();
k=Integer.parseInt();
int ans=j+k;
answer.setText(answer.getText() +ans);