k made the applet but not the paint covers out my Text fields? do i override the paint? if so how?
import javax.swing.*;
import javax.swing.JOptionPane;
import java.awt.*;
import java.awt.event.*;
public class Assign6 extends JApplet implements ActionListener
{
JLabel answerLabel;
JTextField answerField;
public void init()
{
Container c = getContentPane();
c.setLayout (new FlowLayout());
answerLabel = new JLabel("Answer");
answerField = new JTextField(20);
answerField.setEditable(true);
answerField.addActionListener(this);
c.add(answerLabel);
c.add(answerField);
}
public int generateNumbers()
{
int x=0;
x = 1 + (int)(Math.random() * 10);
return x;
}
public void actionPerformed(ActionEvent e)
{
String correct = new String("Correct ");
int x = generateNumbers();
int y = generateNumbers();
showStatus("How much is " + x + " times " + y);
int answer;
answer = Integer.parseInt(answerField.getText());
int product = x*y;
if (product == answer){
showStatus("Very good!");
}
else
showStatus("No. Please try again.");
}
public void paint(Graphics g) {
}
}
{
}