java程序问题???

来源:百度知道 编辑:UC知道 时间:2024/06/07 09:47:24
import java.awt.*;
import java.awt.event.*;
public class welcomenYou
{
public static void main(String args [])
{
new FrameInOut();
}
}

class FrameInOut extends Frame implements ActionListener
{
Lable prompt;
TextField input,output;
Button btnn;
void FramInOut()
{
prompt=new Lable("please input your name");
input=new TextField(10);
output=new TextField(25);
btnn=new Button("class");
setLayout&nbs(new FlowLayout());
add(prompt);
add(input);
add(output);
add(btnn);
input.addActionListener(this);
btnn.addActionListener(this);
setSize(300.200);
show();
}
public void actionperformed(ActionEventt e)
{
if(e.getSource()==input)
output.sefText(input.getText()+"welcome you!");
else

import java.awt.*;
import java.awt.event.*;
public class welcomenYou {
public static void main(String args []){
new FrameInOut();
}
}

class FrameInOut extends Frame implements ActionListener {
Label prompt;
TextField input,output;
Button btnn;
FrameInOut(){
prompt=new Label("please input your name");
input=new TextField(10);
output=new TextField(25);
btnn=new Button("class");
setLayout(new FlowLayout());
add(prompt);
add(input);
add(output);
add(btnn);
btnn.addActionListener(this);
setSize(300,200);
show();
}
public void actionPerformed(ActionEvent e) {
if(e.getSource()==btnn)
output.setText(input.getTex