您现在的位置:计算机技术学习网 > 技术中心 > WEB编程 > JSP >

开源代码:JSplashWindow

来源:网络 责任编辑:栏目编辑 发表时间:2013-07-01 03:10 点击:

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

    相关新闻>>

      发表评论
      请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
      用户名: 验证码:点击我更换图片
      最新评论 更多>>

      推荐热点

      • JSP与Servlet
      • 自己动手写MiniBBS系列(基本篇)之用户登录
      • JSP取当前日期
      • JDBC 入门(一)
      • 打开一个jsp页面默认查询所有数据,调用action
      • 使用JSP标签库验证用户的输入(2)完
      • WIN98/2000下的jsp服务器
      • 自定义JSP标签(tag)浅议
      • Struts学习傻瓜式入门篇
      网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
      Copyright © 2008-2015 计算机技术学习交流网. 版权所有

      豫ICP备11007008号-1