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

📄 picture.java

📁 一个简单的visio程序。
💻 JAVA
字号:
package HAB.object;

import java.awt.*;
import java.applet.*;
import java.net.*;

import HAB.HcBean.HpException;
import HAB.HcBean.HalcyonAppletBeanInterface;

public class Picture implements   
                        HAB.HcBean.HalcyonAppletBeanInterface,
						java.io.Serializable

{

   public Image  image;
   public String fileName = "";    // 9.18 Ligou.

   Object   Handle = null;
   int     Height = 0;
   int     Width = 0;
   Object   HPal = null;
   short    Type = 0;

   Class cla=null;
   public Picture(short b)
   {

   }

   public Picture(String str, Applet applet) throws HpException
   {
    String  file = str;
	URL url = applet.getDocumentBase();
	String protocol = url.getProtocol();
	String host     = url.getHost();
	int    port     = url.getPort();
	String path     = url.getFile();
	String newpath;
    String picturefilename;
	if (str == null)
	{
	  throw new HpException(80,"Invalid FileName");
	}
       
	int index = str.lastIndexOf('\\');
	if  (index == -1)
	{
	   index = str.lastIndexOf('/');
	}

	int length = str.length();

	if (index == -1)
	{
	  picturefilename = new String(str);
	}
	else if (index>=length-1)
	{
      picturefilename = "";	  
	}
	else
	{
	  picturefilename = str.substring(index+1,length); 
	}

	index = path.lastIndexOf('/');
	if (index == -1)
	{
	  newpath = new String(path);
	}
	else 
	{
	  newpath = path.substring(0,index);
	}

	newpath = newpath + '/' + picturefilename;

    URL newurl = null;
	try
	{
	  newurl = new URL(protocol,host,port,newpath);
	  image  = applet.getImage(newurl);
	}
	catch (Throwable ex)
	{
	  newurl = null;
	  image  = null;
	}

	if (image == null)
	{
	  throw new HpException(80,"Invalid FileName");
	}
   }

   public  Picture()
   {

   }

   public Object _getHandle()
   {

     return Handle;
   }

   public void _setHandle(Object s)
  {

  }

   public int _getHeight()
   {
		if(image==null)
			Height=0;
		else
      {
         Width = image.getWidth(null);
			Height= image.getHeight(null);
      }
		if(Height==-1)
			Height=0;
		return (int)(Height*26.458984375);
   }

   public void _setHeight(int s) throws HpException
   {
		 throw new HpException(438,"Object doesn't support the property or method");
   }

   public int _getWidth()
   {
		if(image==null)
			Width=0;
		else
      {
			Height= image.getHeight(null);
         Width = image.getWidth(null);
      }
		if(Width==-1)
			Width=0;
		return (int)(Width* 26.458984375);
   }

   public void _setWidth(int s)throws HpException
   {
      throw new HpException(438,"Object doesn't support the property or method");
   }

   public short _getType()
   {
      if (image == null)
         Type = 0;
      else
         Type = 1;
      return Type;
   }

   public void _setType(short s)throws HpException
   {
      if(s>3 || s<0)
         throw new HpException(3001,"Invalid argument");
      Type = s;
   }

  public Object _getHPal()
  {
      return HPal;
   }

   public void _setHPal(Object s)
   {
   }

  private static java.beans.BeanInfo bi = null;

  public java.beans.BeanInfo getBeanInfo()
  {
    if (bi == null)
	{
	  bi =(java.beans.BeanInfo) new HAB.object.PictureBeanInfo();
	}
    return bi;
  }

private void writeObject(java.io.ObjectOutputStream s)
				      throws java.io.IOException
    {
         s.defaultWriteObject();
    }

    private void readObject(java.io.ObjectInputStream s)
	                         throws java.lang.ClassNotFoundException,
		                            java.io.IOException
    {
        s.defaultReadObject();
    }
}

⌨️ 快捷键说明

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