不知道是放在哪儿用了??但是基本就是这样的 如果还有其他的需求
可以稍微修改下就可以了
import java.applet.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class jj extends Applet //implements ActionListener { JLabel l1; JLabel l2; JTextField t1; JTextField t2; JButton button;
public void init() { resize(1000,70); l1=new JLabel("请输入单词:"); t1=new JTextField(10); l1=new JLabel("大写的单词为:"); t2=new JTextField(10); button=new JButton("大写");
l1.setFont(new Font("宋体",Font.BOLD,30)); l1.setForeground(Color.green); t1.setFont(new Font("宋体",Font.BOLD,30)); t1.setForeground(Color.black); t2.setFont(new Font("宋体",Font.BOLD,30)); t2.setForeground(Color.blue); button.setFont(new Font("宋体",Font.BOLD,30)); button.setForeground(Color.black); l2.setFont(new Font("宋体",Font.BOLD,30)); l2.setForeground(Color.red);
// btn.addActionListener(this);
this.add(l1); this.add(t1); this.add(button); this.add(l2); this.add(t2); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(e.getSource()==button) { String str=t1.getText().toUpperCase(); t2.setText(str); } } }); }
}
测试结果
湖南百纵科技有限公司是一家具有ISP ICP 电信增值许可证的正规公司,多年不断转型探索现已颇具规模,公司成立于2009年 通过多年经营积累目前已独具一格,公司主要经营有国内高防服务器,香港服务器,美国服务器,站群服务器,东南亚服务器租用,国内香港美国云服务器,以及全球专线业务!活动方案:主营:1、美国CN2云服务器,美国VPS,美国高防云主机,美国独立服务器,美国站群服务器,美国母机。2、香港C...
spinservers怎么样?spinservers大硬盘服务器。Spinservers刚刚在美国圣何塞机房补货120台独立服务器,CPU都是双E5系列,64-512GB DDR4内存,超大SSD或NVMe存储,数量有限,机器都是预部署好的,下单即可上架,无需人工干预,有需要的朋友抓紧下单哦。Spinservers是Majestic Hosting Solutions,LLC旗下站点,主营美国独立...
pigyun怎么样?PIGYun成立于2019年,2021是PIGYun为用户提供稳定服务的第三年,期待我们携手共进、互利共赢。PIGYun为您提供:香港CN2线路、韩国CN2线路、美西CUVIP-9929线路优质IaaS服务。月付另有通用循环优惠码:PIGYun,获取8折循环优惠(永久有效)。目前,PIGYun提供的香港cn2云服务器仅29元/月起;韩国cn2云服务器仅22元/月起;美国CUVI...