急!!!!!!谁能给个java 小程序代码
急需一个java程序代码越小越好(但得说的过去)题材不限还有啊最好要自己写的......老师很厉害的....帮帮忙啊...
急需一个 java 程序代码 越小越好(但得说的过去) 题材不限 还有啊 最好要自己写的......老师很厉害的.... 帮帮忙 啊
展开
展开全部
import java.awt.*;
import java.awt.event.*;
public class TestTextField {
public static void main (String[] args) {
new Frame1();
}
}
class Frame1 extends Frame {
Frame1() {
Monitor1 m = new Monitor1();
TextField t1 = new TextField();
t1.setEchoChar ('*');
add (t1);
t1.addActionListener (m);
setLocation (400,400);
pack();
setVisible(true);
}
}
class Monitor1 implements ActionListener {
public void actionPerformed(ActionEvent e) {
TextField t1 = (TextField)e.getSource();
System.out.println (t1.getText());
t1.setText ("");
}
}
import java.awt.event.*;
public class TestTextField {
public static void main (String[] args) {
new Frame1();
}
}
class Frame1 extends Frame {
Frame1() {
Monitor1 m = new Monitor1();
TextField t1 = new TextField();
t1.setEchoChar ('*');
add (t1);
t1.addActionListener (m);
setLocation (400,400);
pack();
setVisible(true);
}
}
class Monitor1 implements ActionListener {
public void actionPerformed(ActionEvent e) {
TextField t1 = (TextField)e.getSource();
System.out.println (t1.getText());
t1.setText ("");
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询