textarea display question
bugns_at_msn.com
Date: 01/29/05
- Previous message: Adam Maass: "Re: What's the diff PrintWriter vs. OutputStreamWriter ?"
- Next in thread: hilz: "Re: textarea display question"
- Reply: hilz: "Re: textarea display question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 28 Jan 2005 23:51:27 -0800
hi
im writing an applet with text area built in it
My question is: how do i capture what is input from the textfield and
display it in the textarea field?
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class Gridntextarea extends Applet implements ActionListener {
int input1, input2,input3;
Label l1,l2,l3;
TextField t1,t2,t3;
Button btn;
TextArea textarea;
public void init() {
Panel p = new Panel( );
Panel p1 = new Panel( );
l1= new Label("Enter the number for multiplication: ");
l2=new Label("Enter the start of Table:: ");
l3=new Label("Enter the end of Table: ");
t1=new TextField(10) ;
t2=new TextField(10) ;
t3=new TextField(10) ;
btn=new Button("Calculate Amount: ");
textarea = new TextArea("The multiplication table for " +input1 +"
from " +input2 +" till " +input3 + " is as follows:",10, 10 );
p.setLayout( new GridLayout(3,2,5,5) );
p.add(l1);
p.add(t1);
p.add(l2);
p.add(t2);
p.add(l3);
p.add(t3);
p1.setLayout( new BorderLayout(5,5));
p1.add( "North", p);
p1.add( "Center", btn);
p1.add( "South", textarea);
add( p1);
btn.addActionListener(this);
}
public void actionPerformed (ActionEvent event){
input1=Integer.parseInt(t1.getText());
input2=Integer.parseInt(t2.getText());
input3=Integer.parseInt(t3.getText());
}
public void paint(Graphics g) {
}
}
I am stuck here
I would like to display input1, input2,input3 in the textarea field.
Thank you
- Previous message: Adam Maass: "Re: What's the diff PrintWriter vs. OutputStreamWriter ?"
- Next in thread: hilz: "Re: textarea display question"
- Reply: hilz: "Re: textarea display question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]