this is an applet for a white board with an append button on it, when you press it what ever you have typed in one box should show up in the second box, but it doesn't. Have the program doing everything but that.
import javax.swing.*;
import java.awt.*;
import java.awt.event. *;
public class WhiteBoard extends JApplet //start of applet
{
private static int WIDTH = 550;
private static int HEIGHT = 350;
private int row = 10;
private int col = 20;
private JLabel headingL;
private JTextField lineTF;
private JTextArea whiteBoardTA;
private JButton exitB, appendB;
public void init()
{
Container pane = getContentPane( );
headingL = new JLabel("Welcome to White Board");
lineTF = new JTextField(20);
whiteBoardTA = new JTextArea(row,c ol);
appendB = new JButton("Append ");
pane.setLayout( null);
headingL.setLoc ation(50, 20);
lineTF.setLocat ion(20, 100);
whiteBoardTA.se tLocation(320, 50);
appendB.setLoca tion(230, 100);
exitB.setLocati on(230, 250);
headingL.setSiz e(200, 30);
lineTF.setSize( 200, 30);
whiteBoardTA.se tSize(200, 200);
appendB.setSize (80, 30);
exitB.setSize(8 0, 30);
pane.add(headin gL);
pane.add(lineTF );
pane.add(whiteB oardTA);
pane.add(append B);
pane.add(exitB) ;
} //end of the constructor
public void actionPerformed (ActionEvent e) //thinking this is the problem area
{
if(e.getActionC ommand().equals ("Append"))
whiteBoardTA.ap pend(lineTF.get Text());
}
}
import javax.swing.*;
import java.awt.*;
import java.awt.event. *;
public class WhiteBoard extends JApplet //start of applet
{
private static int WIDTH = 550;
private static int HEIGHT = 350;
private int row = 10;
private int col = 20;
private JLabel headingL;
private JTextField lineTF;
private JTextArea whiteBoardTA;
private JButton exitB, appendB;
public void init()
{
Container pane = getContentPane( );
headingL = new JLabel("Welcome to White Board");
lineTF = new JTextField(20);
whiteBoardTA = new JTextArea(row,c ol);
appendB = new JButton("Append ");
pane.setLayout( null);
headingL.setLoc ation(50, 20);
lineTF.setLocat ion(20, 100);
whiteBoardTA.se tLocation(320, 50);
appendB.setLoca tion(230, 100);
exitB.setLocati on(230, 250);
headingL.setSiz e(200, 30);
lineTF.setSize( 200, 30);
whiteBoardTA.se tSize(200, 200);
appendB.setSize (80, 30);
exitB.setSize(8 0, 30);
pane.add(headin gL);
pane.add(lineTF );
pane.add(whiteB oardTA);
pane.add(append B);
pane.add(exitB) ;
} //end of the constructor
public void actionPerformed (ActionEvent e) //thinking this is the problem area
{
if(e.getActionC ommand().equals ("Append"))
whiteBoardTA.ap pend(lineTF.get Text());
}
}
Comment