Thread View: comp.lang.java.help
6 messages
6 total messages
Started by GaZ
Sat, 27 Apr 2002 15:02
Copying Text from one text box to another
Author: GaZ
Date: Sat, 27 Apr 2002 15:02
Date: Sat, 27 Apr 2002 15:02
7 lines
1832 bytes
1832 bytes
Can someone tell me how to create an applet with two text boxes. one text box contains text in it already and by pressing a button it copies the text to the other text box. Regards GaZ
Re: Copying Text from one text box to another
Author: Laurence V
Date: Sat, 27 Apr 2002 15:17
Date: Sat, 27 Apr 2002 15:17
17 lines
2161 bytes
2161 bytes
On Sun, 28 Apr 2002 01:02:46 +1000, "GaZ" <x_gazar_x@hotmail.com> wrote: >Can someone tell me how to create an applet with two text boxes. one text >box contains text in it already and by pressing a button it copies the text >to the other text box. Check out the Java Tutorial, which tackles the basics that you need to know FIRST before you can tackle your particular problem. Java Tutorial is to be found on Sun's Java site java.sun.com L. --- World-on-a-Disc, Interactive Map-Driven CD-ROMs Bursting with Photographs. http://www.worldonadisc.com
Re: Copying Text from one text box to another
Author: Sum Ting Wong
Date: Sat, 27 Apr 2002 18:14
Date: Sat, 27 Apr 2002 18:14
20 lines
2494 bytes
2494 bytes
"GaZ" <x_gazar_x@hotmail.com> wrote in message news:3ccabd92$0$17268$afc38c87@news.optusnet.com.au... > Can someone tell me how to create an applet with two text boxes. one text > box contains text in it already and by pressing a button it copies the text > to the other text box. > > Regards > > GaZ erm.. so you left your uni project till the last minute, and thought to solve it by crossposting to 500 newsgroups.. ;) you need to look up things like: Button.actionPerformed() TextField.getText() TextField.setText()
Re: Copying Text from one text box to another
Author: GaZ
Date: Sun, 28 Apr 2002 01:39
Date: Sun, 28 Apr 2002 01:39
33 lines
2648 bytes
2648 bytes
Well actually i didnt leave it to the last minute as its due at the end of May, i just thought i would test out the newsgroup system and see what type of help is out there. BTW thanks for your help, i will try it out and let you know GaZ "Sum Ting Wong" <charred@hotmail.com> wrote in message news:1019931188.442475@dyfi... > > "GaZ" <x_gazar_x@hotmail.com> wrote in message > news:3ccabd92$0$17268$afc38c87@news.optusnet.com.au... > > Can someone tell me how to create an applet with two text boxes. one text > > box contains text in it already and by pressing a button it copies the > text > > to the other text box. > > > > Regards > > > > GaZ > > erm.. so you left your uni project till the last minute, and thought to > solve it by crossposting to 500 newsgroups.. ;) > > you need to look up things like: > > Button.actionPerformed() > TextField.getText() > TextField.setText() > >
Re: Copying Text from one text box to another
Author: GaZ
Date: Sun, 28 Apr 2002 03:24
Date: Sun, 28 Apr 2002 03:24
44 lines
2678 bytes
2678 bytes
Thanx mate i worked it out
String temp = TextField1.getText()
if (e.getSource() == Copy)
{
TextField2.setText(temp);
}
That was too easy, do you know any usefull java sites whre i can look up
usefull info?
i am new to java and just need a push in the right direction
regards
GaZ
"Sum Ting Wong" <charred@hotmail.com> wrote in message
news:1019931188.442475@dyfi...
>
> "GaZ" <x_gazar_x@hotmail.com> wrote in message
> news:3ccabd92$0$17268$afc38c87@news.optusnet.com.au...
> > Can someone tell me how to create an applet with two text boxes. one
text
> > box contains text in it already and by pressing a button it copies the
> text
> > to the other text box.
> >
> > Regards
> >
> > GaZ
>
> erm.. so you left your uni project till the last minute, and thought to
> solve it by crossposting to 500 newsgroups.. ;)
>
> you need to look up things like:
>
> Button.actionPerformed()
> TextField.getText()
> TextField.setText()
>
>
Re: Copying Text from one text box to another
Author: Billy Tam
Date: Sun, 28 Apr 2002 15:58
Date: Sun, 28 Apr 2002 15:58
49 lines
3025 bytes
3025 bytes
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
public class CopyText extends Applet implements ActionListener
{
private int WIDTH = 300;
private int HEIGHT = 50;
private Label inputLabel, outputLabel;
private TextField inputText, outputText;
private Panel leftPanel, rightPanel;
public void init ()
{
inputLabel = new Label ( "Input" );
outputLabel = new Label ( "Output " );
inputText = new TextField ( 5 );
outputText = new TextField ( 5 );
inputText.addActionListener ( this );
leftPanel = new Panel ();
rightPanel = new Panel ();
leftPanel.setLayout ( new FlowLayout ());
rightPanel.setLayout ( new FlowLayout ());
leftPanel.add ( inputLabel );
leftPanel.add ( inputText );
rightPanel.add ( outputLabel );
rightPanel.add ( outputText );
this.add ( leftPanel );
this.add ( rightPanel );
setBackground ( Color.white );
setSize ( WIDTH, HEIGHT );
}
public void actionPerformed ( ActionEvent event )
{
outputText.setText ( inputText.getText ());
}
}
-Bill
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads