📄 thre1.java
字号:
/*
* Thre1.java
*
* Created on August 1, 2008, 4:00 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package NewGUI;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
/**
*
* @author mekala
*/
class Thre1 extends Frame implements ActionListener, WindowListener, Runnable
{
public void run() {
System.out.println("Thread called");
run1();
}
public void run1() {
System.out.println("Thread called");
try
{
Button b1;
TextField t1;
Label l1;
setLayout(new FlowLayout());
l1=new Label("Enter Name");
t1=new TextField(20);
b1=new Button("Add");
add(l1);
add(t1);
add(b1);
b1.addActionListener(this);
setSize(300,300);
t1.setText("idle..");
l1.setVisible(true);
t1.setVisible(true);
t1.setEditable(true);
t1.setEnabled(true);
t1.setCursor(new Cursor(1));
setVisible(true);
// close();
addWindowListener(this);
for(int i=1;i<3;i++)
{
for(int j=0;j<100;j++)
{
for(int k=0;k<100;k++)
{
System.out.println("I: "+i);System.out.println("J: "+j);System.out.println("K: "+k);
if(i==2 && j==99 && k==99)
{ //System.exit(0);
close();
System.out.println("text:"+t1.getText());
break;
}
}
}
}
}
catch(Exception e)
{
System.out.println("Exception:"+e);
//t1.setText(e.getMessage());
}
}
public void close()
{
setVisible(false);
}
public void actionPerformed(ActionEvent e) {
}
public void windowOpened(WindowEvent e) {
}
public void windowClosing(WindowEvent e) {
System.exit(0);
}
public void windowClosed(WindowEvent e) {
}
public void windowIconified(WindowEvent e) {
}
public void windowDeiconified(WindowEvent e) {
}
public void windowActivated(WindowEvent e) {
}
public void windowDeactivated(WindowEvent e) {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -