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

📄 splashscreen.java

📁 手机无线网络纸牌游戏源代码。非常适合学习使用
💻 JAVA
字号:
// SplashScreen.java
//
// Copyright (c) 2000-2001 Symbian Ltd. All rights reserved

package com.symbian.devnet.whist.awt;

import java.awt.*;
import com.symbian.devnet.quartz.awt.*;

/** 
 * The SplashScreen class displays an image on the device screen as the
 * application is loading.  It shows the user that something is happening
 * and prevents them from getting too impatient. This is especially 
 * important for large applications which may take some time to load.
 * represents a way of presenting visual feedback to the user.
 * @author Symbian Devnet
 */
public class SplashScreen extends Window
{
	/** A <code>Label</code> for the <code>Panel</code> */
	private Label status = new Label("              ", Label.CENTER);
	/** An <code>ImagePanel</code> */
	private ImagePanel iPanel = new ImagePanel();
	 
	/** 
	 * Constructor initialising the Splash Screen
	 * @param parent the owning <code>Frame</code> of this Window.
  	 */
	public SplashScreen(Whist parent)
	{
		  super(parent);
		  setLayout(new BorderLayout());
		  add(status, "North");
		  status.setForeground(Color.red);
		  status.setBackground(Color.black);
		  iPanel.setBackground(Color.white);
		  iPanel.setBounds(getBounds());
		  add(iPanel, "Center");
		  pack();
	}
	
	/**
	 * Displays the SplashScreen.
	 */
	void display()
	{
	  repaint();
	  setVisible(true);
	}
	
	/**
	 * Sets the status of the SplashScreen.
	 * @param text Text to display on SplashScreen status.
	 */
	void setStatus(String text)
	{
		status.setText(text);
	}

	/**
	 * Un-displays the SplashScreen and destroys its resources.
	 */
	void unDisplay()
	{
	  iPanel.destroy();
	  iPanel = null;
	  dispose();
	  System.gc();
	}

	/**
	 * The ImagePanel class acts as the container of the displayable Image.
	 */
	class ImagePanel extends Panel 
	{
		/** Reference to image to display */
		private Image image;

		/**
		 * sets up imagePanel and adds the image of the specified name to it.
		 * @param imageName Image to add.
		 */
		ImagePanel()
		{
			Toolkit kit = Toolkit.getDefaultToolkit();
			image = kit.getImage("startup.gif");
			MediaTracker tracker = new MediaTracker(this);
			tracker.addImage(image,0);
			try
			{
			 tracker.waitForAll();
			}
			catch (InterruptedException ie){}
		}
	    /** 
		 * Paints the image on ImagePanel 
		 * @param g an instance of a <code>Graphics</code> class
		 */
		public void paint(Graphics g)
		{
		   g.drawImage(image,0,0,this);
		}

		/** Unallocate the image */
		private void destroy()
		{
			image = null;
		}
	}
}
  

⌨️ 快捷键说明

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