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

📄 progressbar.java

📁 该系统是B/S结构的
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   ProgressBar.java

package paintchat.viewer;

import java.awt.*;
import java.awt.event.MouseEvent;
import java.lang.reflect.Method;

public class ProgressBar extends Canvas
{

    private int minimize;
    private int maximize;
    private int orientation;
    private int seek;
    private Color color_bar;
    private Color color_frame;
    private Object listener;
    private Object method;
    public static final int HORIZONTAL = 0;
    public static final int VERTICAL = 1;
    public static final int FIRST = 0;
    public static final int MOVE = 1;
    public static final int FINISH = 2;

    public ProgressBar()
    {
        minimize = 0;
        maximize = 0;
        orientation = 0;
        seek = 0;
        color_bar = new Color(0x505078);
        color_frame = Color.black;
        enableEvents(48L);
    }

    public ProgressBar(int i, int j, int k, int l)
    {
        minimize = 0;
        maximize = 0;
        orientation = 0;
        seek = 0;
        color_bar = new Color(0x505078);
        color_frame = Color.black;
        enableEvents(48L);
        inits(i, j, k, l);
    }

    public void addListener(Object obj)
    {
        try
        {
            listener = obj;
            method = obj.getClass().getMethod("actionScroll", new Class[] {
                Integer.TYPE, Integer.TYPE
            });
        }
        catch(Exception _ex)
        {
            listener = null;
            method = null;
        }
    }

    public void inits(int i, int j, int k, int l)
    {
        minimize = i;
        maximize = j;
        seek = k;
        orientation = l;
    }

    public void m_paint(Graphics g)
    {
        try
        {
            boolean flag = g != null;
            if(g == null)
                g = getGraphics();
            Dimension dimension = getSize();
            int i = orientation != 0 ? dimension.height - 2 : dimension.width - 2;
            double d = (double)i / (double)(maximize - minimize);
            g.setColor(color_frame);
            g.drawRect(0, 0, dimension.width - 1, dimension.height - 1);
            int j = (int)((double)seek * d);
            g.setColor(color_bar);
            if(orientation == 0)
                g.fillRect(1, 1, j, dimension.height);
            else
                g.fillRect(1, 1, dimension.width - 2, j);
            g.setColor(getBackground());
            if(orientation == 0)
                g.fillRect(1 + j, 1, dimension.width - 2 - j, dimension.height - 2);
            else
                g.fillRect(1, 1 + j, dimension.width - 2, dimension.height - 2 - j);
            if(flag)
                g.dispose();
        }
        catch(Throwable throwable)
        {
            throwable.printStackTrace();
        }
    }

    public void paint(Graphics g)
    {
        m_paint(g);
    }

    protected void processEvent(AWTEvent awtevent)
    {
        try
        {
            if(!(awtevent instanceof MouseEvent))
                return;
            MouseEvent mouseevent = (MouseEvent)awtevent;
            switch(mouseevent.getID())
            {
            case 501: 
                updateValue(mouseevent.getPoint(), 0);
                break;

            case 506: 
                updateValue(mouseevent.getPoint(), 1);
                break;

            case 502: 
                updateValue(mouseevent.getPoint(), 2);
                break;
            }
        }
        catch(Throwable _ex) { }
    }

    private void send(int i)
    {
        if(listener == null)
            return;
        try
        {
            ((Method)method).invoke(listener, new Object[] {
                new Integer(i), new Integer(seek)
            });
        }
        catch(Throwable throwable)
        {
            throwable.printStackTrace();
        }
    }

    public void setMax(int i)
    {
        maximize = i;
        m_paint(null);
    }

    public void setMin(int i)
    {
        minimize = i;
        m_paint(null);
    }

    public void setValue(int i)
    {
        seek = i >= minimize ? i <= maximize ? i : maximize : minimize;
        m_paint(null);
    }

    public void update(Graphics g)
    {
        paint(g);
    }

    private void updateValue(Point point, int i)
    {
        Dimension dimension = getSize();
        int j = orientation != 0 ? dimension.height - 2 : dimension.width - 2;
        double d = (double)j / (double)(maximize - minimize);
        int k = (orientation != 0 ? point.y : point.x) - 1;
        setValue((int)((double)k / d));
        send(i);
    }
}

⌨️ 快捷键说明

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