package softlife;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JWindow;
import org.omg.CORBA.SystemException;
/************************
**********Helloframe用途********
**********程序欢迎界面
* @author zhengang*****
*
*/
class Helloframe implements Runnable {
Thread hellothread=null;
{
//定义窗口
JFrame helloframe =new JFrame("欢迎界面");
helloframe.setBounds(300, 300, 500, 500);
helloframe.setVisible(true);
}
public void start(){
hellothread=new Thread(this);
hellothread.start();
}
public void run() {
try{
Thread.sleep(3000);
}catch(Exception ex){
ex.printStackTrace();
}
//MainFram mainfram=new MainFram(); //这里新建窗体,怎么将原窗体隐藏,在这里隐藏。
}
public static void main(String[] args){
Helloframe hellofram=new Helloframe();
hellofram.start();
}
}
------解决思路----------------------
package Rili;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
class Helloframe implements Runnable {
Thread hellothread = null;
JFrame helloframe;
{
// 定义窗口
helloframe = new JFrame("欢迎界面");
helloframe.setBounds(300, 300, 500, 500);
helloframe.setVisible(true);
}
public void start() {
hellothread = new Thread(this);
hellothread.start();
}
public void run() {
try {
Thread.sleep(3000);
} catch (Exception ex) {
ex.printStackTrace();
}
MainFram mainfram=new MainFram(); //这里新建窗体,怎么将原窗体隐藏,在这里隐藏。
helloframe.setVisible(false);
}
public static void main(String[] args) {
Helloframe hellofram = new Helloframe();
hellofram.start();
}
}