By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,557 Members | 1,164 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,557 IT Pros & Developers. It's quick & easy.

Applet question

P: 23
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,col);

appendB = new JButton("Append");

pane.setLayout(null);

headingL.setLocation(50, 20);
lineTF.setLocation(20, 100);
whiteBoardTA.setLocation(320, 50);
appendB.setLocation(230, 100);
exitB.setLocation(230, 250);

headingL.setSize(200, 30);
lineTF.setSize(200, 30);
whiteBoardTA.setSize(200, 200);
appendB.setSize(80, 30);
exitB.setSize(80, 30);

pane.add(headingL);
pane.add(lineTF);
pane.add(whiteBoardTA);
pane.add(appendB);
pane.add(exitB);

} //end of the constructor

public void actionPerformed(ActionEvent e) //thinking this is the problem area
{
if(e.getActionCommand().equals("Append"))
whiteBoardTA.append(lineTF.getText());

}
}
Jan 26 '07 #1
Share this Question
Share on Google+
2 Replies


P: 23
Never mind I have got it figured out.
Jan 27 '07 #2

10K+
P: 13,264
Never mind I have got it figured out.
Good. Now next time juat remember those code tags when posting code.
Jan 29 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.