⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guiwelcome.java

📁 简易的具有GPS导航功能的程序。仅有四个点
💻 JAVA
字号:

import java.awt.*;
import java.io.IOException;
import javax.swing.*;

public class GUIWelcome extends JFrame {
	public static final int WIDTH = 380;
    public static final int HEIGHT = 450;
    Thread splashThread = null;
    private JProgressBar progress;
    private Container content;
    GUIWelcome() {
		setTitle("欢迎进入^=^");
		setSize(WIDTH, HEIGHT);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		int screenWidth = screenSize.width;
		int screenHeight = screenSize.height;
		Dimension frameSize = getSize();
		int x = (screenWidth - frameSize.width) / 2;
		int y = (screenHeight - frameSize.height) / 2;
		setLocation(x, y);
		setResizable(false);
		content = getContentPane();
		content.setLayout(new BorderLayout());

		JPanel southPanel = new JPanel(new FlowLayout());
		progress = new JProgressBar(1, 100);
		progress.setStringPainted(true);
		progress.setString("程序载入中...");
		progress.setBorderPainted(false);
		progress.setBackground(Color.red);
		southPanel.add(progress, BorderLayout.SOUTH);
		content.add(southPanel, BorderLayout.SOUTH);

		JPanel panel2 = new JPanel(new GridLayout(2, 1));
		JLabel label1 = new JLabel("   欢迎进入GPS导航系统...");
		label1.setForeground(Color.gray);
		label1.setFont(new Font("楷体", Font.BOLD, 20));
		panel2.add(label1);
		JLabel label2 = new JLabel("             Welcome ~~");
		label2.setForeground(Color.gray);
		label2.setFont(new Font("楷体", Font.BOLD, 20));
		panel2.add(label2);
		content.add(panel2, BorderLayout.NORTH);
        JPanel panel1 = new JPanel();
		JLabel label3 = new JLabel("");
		JLabel label4 = new JLabel("");
		ImageIcon icon2 = new ImageIcon("E:\\图片\\ni.jpg");
		ImageIcon icon3 = new ImageIcon("E:\\图片\\wo.jpg");
		label3.setIcon(icon2);
		label4.setIcon(icon3);
		panel1.add(label3);
		panel1.add(label4);
		panel1.setBackground(Color.green);
		content.add(panel1, BorderLayout.CENTER);
		
	}

	/*
	 * public void start1() { splashThread = new Thread(); splashThread.start();
	 *  }
	 */
	public class ThreadedIo extends Thread {

		public void run() {
			try {
				for (int i = 0; i < 150; i++) {
					Thread.sleep(10);
					progress.setValue(i + 1);
				}
				
				 GUI Main = new GUI();
				 Main.setVisible(true);
			} catch (Exception ex) {
				ex.printStackTrace();
			}
			dispose();	 
		}
		
	}

	public static void main(String[] args) {
		GUIWelcome frame = new GUIWelcome();
		frame.setVisible(true);
	    GUIWelcome.ThreadedIo a=frame.new ThreadedIo();
		a.start();
		
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -