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

📄 painterform.java

📁 一个简单的visio程序。
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    return vect;
    }

    private void addcontrol(Controlslist con , Vector vect){
    if(check(con,vect)){
        vect.addElement(con.wrap);
    }
    if (con.childCtrls != null && con.childCtrls.size() > 0) {
        for(int i = 0; i<con.childCtrls.size();i++) {
            Controlslist sub = (Controlslist)(con.childCtrls.elementAt(i));
            addcontrol(sub,vect);
        }
    }

    }

    private boolean check(Controlslist con,Vector vect){
    if(con.className.equals("VB.CommonDialog") ||
        con.className.equals("VB.Shape") || con.className.equals("VB.Line"))
    return false;
    String className0 = con.className;
    String name0 = con.wrap.getName();
    for(int i = 1;i<vect.size();i++){
        Wrapper wrap = (Wrapper)vect.elementAt(i);
        String className1 = wrap.getControl().className;
        String name1 = wrap.getName();
        if(className0.equals(className1)&&name0.equals(name1))
        return false;
    }return true;
    }

    //--------ActionListener ------------------------------------------
    public void actionPerformed(ActionEvent evnet) {
    }

    //-------Item changed event----------------------------------------
    public void itemStateChanged(ItemEvent event) {
    }

    //-------Focus event----------------------------------------
    public void focusGained(FocusEvent event) {
           gainedFoucs = true;
    }

    public void focusLost(FocusEvent event) {
           gainedFoucs = false;
    }
    //-------Component event-------------------------------------
    private Wrapper getWrapper(Component child) {
        Wrapper   wrap  = null;
        if (child instanceof PainterForm) {
            wrap = topWrapper;
        } else {
            wrap = findWrapper(child);
        }
        return wrap;
    }//end of getWrapper.

    public void componentHidden(ComponentEvent event) {
    }

    public void componentMoved(ComponentEvent event) {
		if (setProp) {
            setProp = false;
            return;
        }
		Component child = event.getComponent();
        Wrapper wrap = getWrapper(child);

		if (wrap != null) {
		    MainConsole.wasChanged = true;
			Point p = child.getLocation();
            wrap.setPropValue(p);
            if(!(child == this)){
                wrap.setActive(true);
            }
        }
    }

    public void componentResized(ComponentEvent event) {
		if (setProp) {
            setProp = false;
            return;
        }
        Component child = event.getComponent();
        Wrapper wrap = getWrapper(child);
		if (wrap != null) {
		    MainConsole.wasChanged = true;
            Dimension ds = child.getSize();
            wrap.setPropValue(ds);
            if(!(child == this)){
                wrap.setActive(true);
            }
        }
    }

    public void componentShown(ComponentEvent event) {
    }

    //-------Mouse event ----------------------------------------
    public void mouseClicked(MouseEvent event) {
    }//end of mouseClicked.

    public void mouseEntered(MouseEvent event) {
    }//end of mouseEntered.

    public void mouseExited(MouseEvent event) {
    }//end of mouseExited.

    public void mousePressed(MouseEvent event) {
           requestFocus();
    }//mousePressed.

    public void myRequestFocus() {
           if (! gainedFoucs) {
               requestFocus();
           }
    }//end of myRequestFocus.

    public void mouseReleased(MouseEvent event) {
    }//mouseReleased.

    public void mouseDragged(MouseEvent event) {
           Component comp = event.getComponent();
    }//end of mouseDragged.

    public void mouseMoved(MouseEvent event) {
    }//end of mouseMoved.

    //--------key event -------------------------------------------
    public void keyPressed(KeyEvent event) {
    }

    public void keyReleased(KeyEvent event) {
    }

    public void keyTyped(KeyEvent event) {
    }

   /**
    *properties changes methods.
   **/
    public java.beans.BeanInfo getBeanInfo() {
		if (formBean ==null) {
			formBean = (java.beans.BeanInfo)(new PainterFormBeanInfo());
		}
		return formBean;
	}

    public void setBackColor(int newColor) {
    	setBackground(Util.updateColor(newColor));
    	repaint();
    }

    public int getBackColor() {
         return Util.convert_color(getBackground());
    }

    public void setForeColor(int newColor) {
    	setForeground(Util.updateColor(newColor));
    	repaint();
    }

    public int getForeColor() {
        return Util.convert_color(getForeground());
    }

    public void setTag(String t){
    	String old = tag;
    	tag = t;
    }

    public String getTag(){
    	return tag;
    }

    public void setfont(font f) {
		ft = f;
    }

	public font getfont() {
		return ft;
	}

    public String getCaption() {
        return "Form1";
    }

    public void setAutoreDraw(boolean b){
        this.autoredraw = b;
    }

    public boolean getAutoreDraw(){
        return this.autoredraw;
    }

    public void setBorderStyle(short bss){
        this.borderstyle = bss;
    }

    public short getBorderStyle() {
        return this.borderstyle;
    }

    public void setClipControls(boolean cc){
        this.clipcontrols = cc;
    }

    public boolean getClipControls(){
        return this.clipcontrols;
    }

    public void setControlBox(boolean cb){
        this.controlbox = cb;
    }

    public boolean getControlBox() {
        return this.controlbox;
    }

    public void setDrawMode(short dm){
        this.drawmode = dm;
    }

    public short getDrawMode() {
        return this.drawmode;
    }

    public void setDrawStyle(short ds) {
        this.drawstyle = ds;
    }

    public short getDrawStyle() {
        return this.drawstyle;
    }

    public void setDrawWidth(short dw){
        this.drawwidth = dw;
    }

    public short getDrawWidth() {
        return this.drawwidth;
    }

    public void setEnabled(boolean e) {
        this.enabled = e;
    }

    public boolean isEnabled() {
        return this.enabled;    // don't use getEnabled.
    }

    public void setFillColor(int col) {
    	fillcolor = Util.updateColor(col);
    }

    public int getFillColor() {
        return Util.convert_color( this.fillcolor);
    }

    public void setFillStyle(short fs) {
    	fillstyle = fs;
    }

    public short getFillStyle() {
        return this.fillstyle;
    }

    public void setKeyPreview(boolean kr){
        this.keypreview = kr;
    }

    public boolean getKeyPreview() {
        return this.keypreview;
    }

    Image imagePicture = null;
    public void setPicture(String p) {
        imagePicture = null;
        if (p == null || p == "") {
            this.picture = null;
       } else {
            try {
            imagePicture = Util.getPicture(p);
            } catch (Exception e) {}
            this.picture = p;
        }
        repaint();
    }   // end of setPicture.

    public String getPicture() {
        return this.picture;
    }

    public void setScaleHeight(float sh) throws Exception{
		if(sh == 0) throw new Exception("Invalid property value");
        this.scaleheight = sh;
    }

    public float getScaleHeight() {
        return this.scaleheight;
    }

    public void setScaleMode(short sm) {
        this.scalemode = sm;
    }

    public short getScaleMode() {
        return this.scalemode;
    }

    public void setScaleTop(float st) {
        this.scaletop = st;
    }

    public float getScaleTop() {
        return this.scaletop;
    }

    public void setScaleLeft(float sl) {
        this.scaleleft = sl;
    }

    public float getScaleLeft() {
        return this.scaleleft;
    }

    public void setScaleWidth(float sw) throws Exception{
		if(sw == 0) throw new Exception("Invalid property value");
        this.scalewidth = sw;
    }

    public float getScaleWidth() {
        return this.scalewidth;
    }

    public void setMousePointer(short nmm) {
        mousepointer = nmm;
    }

    public short getMousePointer() {
        return this.mousepointer;
    }

    public void setName(String nm){
        this.name = nm;
    }

    public String getName() {
        return this.name;
    }

    public void setVIsible(boolean v) {
		boolean old = visible;
		visible = v;
    }

    public boolean getVIsible() {
		return visible;
    }

    public void setAppearance(short obj) {
        if (obj==0) {
			setBackground(java.awt.SystemColor.window);
		} else {
			setBackground(java.awt.SystemColor.control);
		}
	    repaint();
        appearance = obj;
    }

    public short getAppearance() {
        return appearance;
    }

	public void setStartUpPosition(short s){
		startupposition = s;
	}

	public short getStartUpPosition(){
		return startupposition;
	}

	public void setMoveable(boolean b){
		moveable = b;
	}

	public boolean getMoveable(){
		return moveable;
	}

    public void setTop(float top) { this.top = top;}
    public float getTop() {return top;}

    public void setLeft(float left) { this.left = left;}
    public float getLeft() { return left;}

    public void setWidth(int width) { this.frmWidth = (float)width;}
    public int getWidth() {return (int)frmWidth;}

    public void setHeight(int height) { this.frmHeight = (float)height;}
    public int getHeight() {return (int)frmHeight;}

    public void setClientHeight(float height) { this.clientHeight = height;}
    public float getClientHeight() { return clientHeight;}

    public void setClientLeft(float left) { this.clientLeft = left;}
    public float getClientLeft() { return clientLeft;}

    public void setClientTop(float top) { this.clientTop = top;}
    public float getClientTop() { return clientTop;}

    public void setClientWidth(float width) { this.clientWidth = width;}
    public float getClientWidth() { return clientWidth;}

    // end set location and size property.

    /*
    *end of properties changes methods.
    */

    /*================Form Property Initialize.=============*/
    private boolean     autoredraw      = false;
    private short       appearance      = 1; //"1 - 3D";
    private short       borderstyle     = 2; //"2 - Sizable";
    private boolean     clipcontrols    = true;
    private boolean     controlbox      = true;
    private short       drawmode        = 13; //"13 - Copy Pen";
    private short       drawstyle       = 0; //"0 - Solid";
    private short       drawwidth       = 1;
    private boolean     enabled         = true;
    private Color       fillcolor       = Color.black;
    private short       fillstyle       = 1; //"1 - Transparent";
    ///
    //private Picture     icon;
    private boolean     keypreview      = false;
    private short       mousepointer    = 0; //"0 - Default";
    private String      name            = "Form1";
    private String      picture         = null;

    private float       scaleheight     = 4095;
    private float       scaleleft       = 0;
    private short       scalemode       = 1; //"1 - Twip";
    private float       scaletop        = 0;
    private float       scalewidth      = 6630;

    private String      tag             = null;
    private boolean     visible         = true;
    private boolean     moveable        = true;
    private short       startupposition = 3;

    ///
    private float       top             = 0;
    private float       left            = 0;
    private float       frmWidth       = 100;
    private float       frmHeight      = 100;
    private float       clientHeight    =   150;
    private float       clientLeft      =   150;
    private float       clientTop       =   0;
    private float       clientWidth     =   0;

    ///

    private font ft = new font("Ms Sans Serif",(short)Font.PLAIN, 11);

    /*=====================Properties End=========================*/


    public static int width  = 300;
    public static int height = 300;
    
	//-----variable------------------------------------------------
    private  boolean            winmin          = false;
    public   PainterForm        instance;
    public   Wrapper            topWrapper;
    public   Wrapper            focusWrapper;
    private  Wrapper            nextFocus;
    //---mouse action variable----------------------------------------
    public  transient int     gridWidth = 0;
    public  transient int     gridHeight= 0;
    public  transient int     gridw = 0;
    public  transient int     gridh = 0;
    private transient boolean gridOfForm;

    private transient int     formWidth = 0;
    private transient int     formHeight= 0;

    private  transient Color  oldColorOfBack;
    private  transient Color  oldColorOfFore;

    private int  LET = getInsets().left;
    private int  TP  = getInsets().top;
    public  int  TOP = 0;

    private transient    boolean     isContainer = false;
    private transient    boolean     isPicture   = true;
    public  transient    Container   pContainer;

    public String       diskFileName;
    public String       className;

    //about codeEdit.
    public Component    currentComponent;
    public boolean      isAddControl  =  false;
    public Text[]       general;

    public  boolean     setFocus = false;   
    public  boolean     setProp  = false;   

    private java.beans.BeanInfo formBean =null;
    public  boolean gainedFoucs = false;
}

⌨️ 快捷键说明

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