程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> JSP編程 >> 關於JSP >> 開源代碼:JSplashWindow

開源代碼:JSplashWindow

編輯:關於JSP

package nicholas.swing;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/**
 * <p>Title: jsp(SUN企業級應用的首選)lashWindow</p>
 * <p>Description: start up window</p>
 * <p>Copyright: Copyright (c) 2005</p>
 * <p>Company: ColinSoft</p>
 * @author Nicholas Lin
 * @version beta
 */
 
public class jsp(SUN企業級應用的首選)lashWindow extends JWindow {
 
 private static jsp(SUN企業級應用的首選)lashWindow csw;
 private Image image;
 private String user;
 private String lab;
 private int x1 = 155;
 private int y1 = 220;
 private int x2 = 250;
 private int y2 = 235;
 private DisposeAdapter da;
 
 /**
  *constructor
  */ 
    private jsp(SUN企業級應用的首選)lashWindow(String u, String filename) {

  setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
  ImageIcon icon = new ImageIcon(getClass().getResource(filename));
  image = icon.getImage();
  user = "";
  user = u;
  setAlwaysOnTop(true);

  setSize(icon.getIconWidth(),icon.getIconHeight());
  Dimension screen = getToolkit().getScreenSize();
  setLocation((screen.width-getSize().width)/2, (screen.height-getSize().height)/2);
  this.setVisible(true);
    }
   
    /**
     *set close on click
     *use as about dialog
     */
    public void setCloseOnClick(boolean b) {
     if(b) {
      if(da==null)
       da = new DisposeAdapter();
      addMouseListener(da);
     } else if(da!=null) {
      this.removeMouseListener(da);
     }
    }
   
    /**
     *set the place where user name will be show
     */
    public void setUserLocation(int x,int y) {
     x1 = x;
     y1 = y;
    }
   
    /**
     *set the place where status will be show
     */
    public void setStatusLocation(int x,int y) {
     x2 = x;
     y2 = y;
    }
 
 /**
  *paint
  */
 public void paint(Graphics g) {
  g.drawImage(image,0,0,this);
  g.drawString(user,x1,y1);
  if(lab!=null)
   g.drawString(lab,x2,y2);
 }
   
    /**
     *set the status text
     */
    public void setText(String lab) {
     this.lab = lab;
     repaint();
    }
   
    /**
     *inner class
     *to close the JWindow on click

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved