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

📄 viewer.java

📁 该系统是B/S结构的
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
// 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:   Viewer.java

package paintchat.viewer;

import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.beans.Beans;
import java.io.*;
import java.net.URL;
import java.util.EventObject;
import java.util.Vector;
import java.util.zip.*;
import paintchat.MgLine;
import paintchat.PProperties;
import paintchat.util.PTool;
import paintchat.util.ServerStub;

// Referenced classes of package paintchat.viewer:
//            ProgressBar

public class Viewer extends Applet
    implements ActionListener, AdjustmentListener, Runnable
{

    private volatile boolean live;
    private volatile boolean live_draw;
    private volatile boolean live_load;
    private Vector lines;
    private Thread t_draw;
    private Thread t_load;
    private int i_off[][];
    private int image_x;
    private int image_y;
    private Canvas display;
    protected Image image;
    private Graphics offscreen;
    private int speed;
    private volatile int seek;
    private volatile int seek_need;
    File file_last;
    private Button ivjbu_cut_end;
    private Button ivjbu_play;
    private Button ivjbu_stop;
    private Button ivjcut_first;
    private ScrollPane ivjScroll;
    private Scrollbar ivjSpeed;
    private Label ivjLabel6;
    private Label ivjlabel_speed;
    private Panel ivjPanel_Button;
    private Panel ivjpanel_progress;
    private ProgressBar ivjProgress;
    private Button ivjClear;
    private Label ivjlabel_progress;
    private Button ivjbu_load;
    private Button ivjbu_save;
    private Label ivjLabel1;

    public void action_load()
    {
        try
        {
            stopLoad();
            playLoad();
        }
        catch(Throwable throwable)
        {
            throwable.printStackTrace();
        }
    }

    public synchronized void action_save()
    {
        try
        {
            FileDialog filedialog = new FileDialog(PTool.getPFrame(), "please select write file", 1);
            if(file_last != null)
            {
                filedialog.setDirectory(file_last.getParent());
                filedialog.setFile(file_last.getName());
            }
            filedialog.show();
            String s = filedialog.getFile();
            String s1 = filedialog.getDirectory();
            if(s == null || s.equals("null") || s1 == null || s1.equals("null"))
                return;
            File file = new File(s1, s);
            file_last = file;
            ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(10000);
            synchronized(lines)
            {
                GZIPOutputStream gzipoutputstream = new GZIPOutputStream(new FileOutputStream(file), 0x186a0);
                int i = lines.size();
                for(int j = 0; j < i; j++)
                {
                    MgLine mgline = (MgLine)lines.elementAt(j);
                    if(mgline != null && mgline.head != 104 && mgline.head != 101 && mgline.head != -1)
                    {
                        bytearrayoutputstream.reset();
                        mgline.getData(bytearrayoutputstream);
                        bytearrayoutputstream.writeTo(gzipoutputstream);
                    }
                }

                gzipoutputstream.flush();
                gzipoutputstream.close();
            }
        }
        catch(IOException ioexception)
        {
            ioexception.printStackTrace();
        }
    }

    public void actionPerformed(ActionEvent actionevent)
    {
        if(actionevent.getSource() == getbu_play())
            connEtoC2(actionevent);
        if(actionevent.getSource() == getbu_stop())
            connEtoC3(actionevent);
        if(actionevent.getSource() == getcut_first())
            connEtoC4(actionevent);
        if(actionevent.getSource() == getbu_cut_end())
            connEtoC6(actionevent);
        if(actionevent.getSource() == getClear())
            connEtoC7(actionevent);
        if(actionevent.getSource() == getbu_load())
            connEtoC8(actionevent);
        if(actionevent.getSource() == getbu_save())
            connEtoC9(actionevent);
    }

    public void actionScroll(int i, int j)
    {
        stopAnimation();
        seek_need = j;
        updateProgress();
        if(i == 2)
            playAnimation();
    }

    public void adjustmentValueChanged(AdjustmentEvent adjustmentevent)
    {
        if(adjustmentevent.getSource() == getSpeed())
            connEtoC1(adjustmentevent);
    }

    public synchronized void clear()
    {
        int i = 0xffffff;
        int j = i_off[0].length;
        for(int k = 0; k < j; k++)
            i_off[0][k] = i;

        System.arraycopy(i_off[0], 0, i_off[1], 0, j);
        offscreen.setColor(new Color(i));
        offscreen.fillRect(0, 0, image_x, image_y);
        display.repaint();
    }

    public void clear_all()
    {
        stopLoad();
        stopAnimation();
        clear();
        lines.removeAllElements();
        seek = 0;
        seek_need = 0;
        ivjProgress.setValue(0);
        ivjProgress.setMax(0);
        updateProgress();
    }

    private void connEtoC1(AdjustmentEvent adjustmentevent)
    {
        try
        {
            updateSpeed(adjustmentevent);
        }
        catch(Throwable throwable)
        {
            handleException(throwable);
        }
    }

    private void connEtoC2(ActionEvent actionevent)
    {
        try
        {
            playAnimation();
        }
        catch(Throwable throwable)
        {
            handleException(throwable);
        }
    }

    private void connEtoC3(ActionEvent actionevent)
    {
        try
        {
            stopAnimation();
        }
        catch(Throwable throwable)
        {
            handleException(throwable);
        }
    }

    private void connEtoC4(ActionEvent actionevent)
    {
        try
        {
            cut_first();
        }
        catch(Throwable throwable)
        {
            handleException(throwable);
        }
    }

    private void connEtoC5()
    {
        try
        {
            viewer_Init();
        }
        catch(Throwable throwable)
        {
            handleException(throwable);
        }
    }

    private void connEtoC6(ActionEvent actionevent)
    {
        try
        {
            cut_end();
        }
        catch(Throwable throwable)
        {
            handleException(throwable);
        }
    }

    private void connEtoC7(ActionEvent actionevent)
    {
        try
        {
            clear_all();
        }
        catch(Throwable throwable)
        {
            handleException(throwable);
        }
    }

    private void connEtoC8(ActionEvent actionevent)
    {
        try
        {
            action_load();
        }
        catch(Throwable throwable)
        {
            handleException(throwable);
        }
    }

    private void connEtoC9(ActionEvent actionevent)
    {
        try
        {
            action_save();
        }
        catch(Throwable throwable)
        {
            handleException(throwable);
        }
    }

    public void cut_end()
    {
        stopAnimation();
        synchronized(lines)
        {
            int i = lines.size();
            for(int j = seek; j < i; j++)
                lines.removeElementAt(seek);

            seek_need = seek;
            ivjProgress.setMax(seek);
        }
        updateValues();
    }

    public synchronized void cut_first()
    {
        stopAnimation();
        synchronized(lines)
        {
            for(int i = 0; i < seek; i++)
                lines.removeElementAt(0);

            clear();
            seek_need = lines.size();
            ivjProgress.setMax(seek_need);
            ivjProgress.setValue(0);
            seek = 0;
        }
        updateValues();
    }

    public void destroy()
    {
        if(!live)
            return;
        live = false;
        try
        {
            stopAnimation();
            stopLoad();
            offscreen.dispose();
            image.flush();
        }
        catch(Throwable _ex) { }
    }

    public String getAppletInfo()
    {
        return "paintchat.viewer.Viewer は VisualAge for Java を使用して作成されました。";
    }

    private Button getbu_cut_end()
    {
        if(ivjbu_cut_end == null)
            try
            {
                ivjbu_cut_end = new Button();
                ivjbu_cut_end.setName("bu_cut_end");
                ivjbu_cut_end.setLabel("Cut(End)");
            }
            catch(Throwable throwable)
            {
                handleException(throwable);
            }
        return ivjbu_cut_end;
    }

    private Button getbu_load()
    {
        if(ivjbu_load == null)
            try
            {
                ivjbu_load = new Button();
                ivjbu_load.setName("bu_load");
                ivjbu_load.setActionCommand("Load");
                ivjbu_load.setLabel("Load");
            }
            catch(Throwable throwable)
            {
                handleException(throwable);
            }
        return ivjbu_load;
    }

    private Button getbu_play()
    {
        if(ivjbu_play == null)
            try
            {
                ivjbu_play = new Button();
                ivjbu_play.setName("bu_play");
                ivjbu_play.setLabel("Play");
            }
            catch(Throwable throwable)
            {
                handleException(throwable);
            }
        return ivjbu_play;
    }

    private Button getbu_save()
    {
        if(ivjbu_save == null)
            try
            {
                ivjbu_save = new Button();
                ivjbu_save.setName("bu_save");
                ivjbu_save.setActionCommand("Save");
                ivjbu_save.setLabel("Save");
            }
            catch(Throwable throwable)
            {
                handleException(throwable);
            }
        return ivjbu_save;
    }

    private Button getbu_stop()
    {
        if(ivjbu_stop == null)
            try
            {
                ivjbu_stop = new Button();
                ivjbu_stop.setName("bu_stop");
                ivjbu_stop.setLabel("Stop");
            }
            catch(Throwable throwable)
            {
                handleException(throwable);
            }
        return ivjbu_stop;
    }

    private Button getClear()
    {
        if(ivjClear == null)
            try
            {
                ivjClear = new Button();
                ivjClear.setName("Clear");
                ivjClear.setActionCommand("Clear");
                ivjClear.setLabel("Clear");
            }
            catch(Throwable throwable)
            {
                handleException(throwable);
            }
        return ivjClear;
    }

    private Button getcut_first()
    {
        if(ivjcut_first == null)
            try
            {
                ivjcut_first = new Button();
                ivjcut_first.setName("cut_first");
                ivjcut_first.setLabel("Cut(First)");
            }
            catch(Throwable throwable)
            {
                handleException(throwable);
            }
        return ivjcut_first;
    }

    private Label getlabel_progress()
    {
        if(ivjlabel_progress == null)
            try
            {
                ivjlabel_progress = new Label();
                ivjlabel_progress.setName("label_progress");
                ivjlabel_progress.setText("0/0");
            }
            catch(Throwable throwable)
            {
                handleException(throwable);
            }
        return ivjlabel_progress;
    }

    private Label getlabel_speed()
    {
        if(ivjlabel_speed == null)
            try
            {
                ivjlabel_speed = new Label();
                ivjlabel_speed.setName("label_speed");
                ivjlabel_speed.setAlignment(0);
                ivjlabel_speed.setText("Speed[10]");
            }
            catch(Throwable throwable)
            {
                handleException(throwable);
            }
        return ivjlabel_speed;
    }

    private Label getLabel1()
    {
        if(ivjLabel1 == null)
            try
            {
                ivjLabel1 = new Label();
                ivjLabel1.setName("Label1");
                ivjLabel1.setText("");
            }
            catch(Throwable throwable)
            {
                handleException(throwable);
            }
        return ivjLabel1;
    }

    private Label getLabel6()
    {
        if(ivjLabel6 == null)
            try
            {
                ivjLabel6 = new Label();
                ivjLabel6.setName("Label6");
                ivjLabel6.setText("");
            }
            catch(Throwable throwable)
            {
                handleException(throwable);
            }
        return ivjLabel6;
    }

    private Panel getPanel_Button()
    {
        if(ivjPanel_Button == null)
            try
            {
                ivjPanel_Button = new Panel();
                ivjPanel_Button.setName("Panel_Button");
                ivjPanel_Button.setLayout(new FlowLayout());
                getPanel_Button().add(getbu_play(), getbu_play().getName());
                ivjPanel_Button.add(getbu_stop());
                getPanel_Button().add(getLabel1(), getLabel1().getName());
                getPanel_Button().add(getbu_load(), getbu_load().getName());
                getPanel_Button().add(getbu_save(), getbu_save().getName());
                getPanel_Button().add(getLabel6(), getLabel6().getName());
                ivjPanel_Button.add(getcut_first());

⌨️ 快捷键说明

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