编写程序包括一个标签、一个文本框和一个按钮,当用户单击按钮时,程序把文本框中的内容复制到标签中
来源:互联网 发布:测试fps的软件 编辑:程序博客网 时间:2024/05/22 02:21
import java.awt.*;
import java.awt.event.*;
public class CopyStringToLabel extends Frame implements ActionListener
{
private Label label = new Label();
private TextField output = new TextField();
private Button copy = new Button("Copy");
private class WindowCloser extends WindowAdapter
{
public void windowClosing(WindowEvent we)
{ System.exit(0);}
}
public CopyStringToLabel ()
{
super("Copy a String To Label");
setup();
copy.addActionListener(this);
addWindowListener(new WindowCloser());
{
if(e.getSource() == copy)
label.setText(output.getText());
{
Panel textGrid = new Panel();
textGrid.setLayout(new GridLayout(2,1));
textGrid.add(label);
textGrid.add(output);
setLayout(new BorderLayout());
add("Center",textGrid);
add("South",copy);
pack();
setVisible(true);
}
public static void main(String[] args) {
CopyStringToLabel cop = new CopyStringToLabel();
}
}
import java.awt.event.*;
public class CopyStringToLabel extends Frame implements ActionListener
{
private Label label = new Label();
private TextField output = new TextField();
private Button copy = new Button("Copy");
private class WindowCloser extends WindowAdapter
{
public void windowClosing(WindowEvent we)
{ System.exit(0);}
}
public CopyStringToLabel ()
{
super("Copy a String To Label");
setup();
copy.addActionListener(this);
addWindowListener(new WindowCloser());
}
{
if(e.getSource() == copy)
label.setText(output.getText());
}
{
Panel textGrid = new Panel();
textGrid.setLayout(new GridLayout(2,1));
textGrid.add(label);
textGrid.add(output);
setLayout(new BorderLayout());
add("Center",textGrid);
add("South",copy);
pack();
setVisible(true);
}
public static void main(String[] args) {
CopyStringToLabel cop = new CopyStringToLabel();
}
}
0 0
- 编写程序包括一个标签、一个文本框和一个按钮,当用户单击按钮时,程序把文本框中的内容复制到标签中
- 编写程序包括一个标签、一个文本框和一个按钮,当用户单击按钮时,程序把文本框中的内容复制到标签中
- 在ashx文件中输出html中的文本框和按钮,并且当单击按钮时,输出文本框中的文字到网页上,同时文本框中的内容保持不变。
- 在ashx文件中输出html中的文本框和按钮,并且当单击按钮时,输出文本框中的文字到网页上,同时文本框中的内容对峙不变。
- 表单,放着一个文本框和一个按钮,单击按钮,表单的标题改为文本框中的内容+你好
- 窗体标题为“我文本框实验”;窗体上一个标签,内容如图;窗体上有一个文本框,文本框只能输入0至9这十种数字,且最多输入8个数字;单击结束按钮程序即可结束。
- 一个输入框input,一个按钮input,点按钮时把文本框中的内容打开
- C#--第11周实验--任务3--设计一个窗体,窗体上有两个文本框,一个按钮,2个单选按钮--实现单击按钮后,根据单选按钮,将对应文本框中内容显示在标签。
- 创建有一个文本框和三个按钮的小程序 当按下每个按钮时 使不同的文字显示在文本框中
- 1,编写程序,当用户在文本框中输入内容之后,单机不同的按钮,能够把文半框中的内容粘贴到文本区中。“重置”按钮实现将文本框和文本区中的内容清空。界面上的文本区只能显示内容,不能让用户输入文本。运行结果
- 窗体上有两个文本框:一个文本框中最多输入字符6个;一个文本框中输入任何内容都显示*号。再添加一个按钮、2个单选按钮。实现单击按钮后,根据单选按钮,将对应文本框中内容显示在标签
- 第12周实验 1.编写一个应用程序,要求编写一个Panel的子类MyPanel,MyPanel中有一个文本框和一个按钮,要求MyPanel的实例作为其按钮的ActionEvent事件的监视器,当单击鼠
- java十二周实验.编写一个应用程序,要求编写一个Panel的子类MyPanel,MyPanel中有一个文本框和一个按钮,要求MyPanel的实例作为其按钮的ActionEvent事件的监视器,当单击
- 利用Java Swing技术设计一个鼠标点击速度比赛游戏程序。程序显示一个按钮和一个文本框,用户点击按钮,文本框显示鼠标点击次数。
- 。窗体上有一个文本框(多行、且带有垂直滚动条)、一个标签(字体颜色红色、字号16)、一个按钮(该按钮被单击时,实现将文本框中选择文本复制至标签。
- 表单,放着一个文本框和一个按钮,单击按钮,文本框隐藏
- 在窗体上放置一个标签、一个按钮、一个fontDialog控件。标签内容改为“烟台大学”。实现功能:1)程序运行时,单击打开字体对话框按钮,可选择字体,并以所选字体作为标签字体。
- 设计一个窗口,窗口中包含有一个文本框,一个标签,两个按钮,当按下“文本一”按纽时,使得“Hello java!”显示在文本框中,按下“文本二”按纽时,使得“你好 Java!” 显示在文本框中(要求两个
- Hadoop 的安全机制
- 提高企业it信息化建设
- 软中断&tasklet&工作队列
- 如何从MySQL官方Yum仓库安装MySQL5.6
- java50题----04因式分解
- 编写程序包括一个标签、一个文本框和一个按钮,当用户单击按钮时,程序把文本框中的内容复制到标签中
- hdu 4824 Disk Schedule(双调欧几里得旅行商问题)
- 数据结构排序算法之交换排序
- JVM致命错误日志(hs_err_pid.log)
- 初始化servlet
- 2014年5月21日测试
- Visual Studio 2013 Update 2(官网+百度网盘)免费下载
- CRZ Tide brand Breakfast Tide clothes Innocently tell!-Cheap Oakley Sunglasses Outlet Red Frame Colo
- HTML标签号