
编写一个JAVA应用程序
有两个文本框和一个按钮的应用程序,在一个文本框输入一个字符串按回车键或者单击按钮,另一个文本框都显示字符串中每个字符在Unicode表中的顺序位置,大哥哥姐姐们,真的求你...
有两个文本框和一个按钮的应用程序,在一个文本框输入一个字符串按回车键或者单击按钮,另一个文本框都显示字符串中每个字符在Unicode表中的顺序位置,大哥哥姐姐们,真的求你们了,不要复制粘贴,没分了,要不是也不会这样,好人一生平安
跪求哥哥姐姐帮忙,求求你们了 展开
跪求哥哥姐姐帮忙,求求你们了 展开
2个回答
展开全部
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class Text_Two_andJButton extends JFrame{
JTextField one;
JTextField two;
public Text_Two_andJButton(){
setSize(200,150);
setVisible(true);
one = new JTextField(15);
two = new JTextField(15);
JButton button = new JButton("确定");
JPanel jp = new JPanel();
Container c = this.getContentPane();
c.add(jp);
jp.add(one);
jp.add(two);
jp.add(button);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
String s = one.getText();
char[] a = s.toCharArray();
String str = "";
for (int i = 0; i < a.length; i++) {
str = str +(a[i]+0+" ");
}
two.setText(str);
}
});
}
public static void main(String[] args) {
new Text_Two_andJButton();
}
}
有图有真相,只能帮到你这里了!
追问
亲,这是你自己写的吗
追答
绝对原版
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询