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

📄 jtsystem.java

📁 用java写的jt-jpeg。jt表示java time package
💻 JAVA
字号:
/*
 |
 | JTSystem.java
 |
 | JTSystem class
 | James Shin Young
 |
 | Created:  January 1, 1998
 |
 | Copyright (c) 1998 by James Shin Young and the Regents
 | of the University of California.  All rights reserved.
 |
 | Permission to use, copy, modify, and distribute this software
 | and its documentation for NON-COMMERCIAL purposes and without
 | fee is hereby granted provided that this copyright notice
 | appears in all copies.
 |
 */

package jcp;
import java.awt.Frame;
import java.awt.event.*;

/**
 *  Some "globals" for the JavaTime package. Error message handing, etc.
 *  @author James Shin Young
 */

public class JTSystem
{

///////////////////////////////////////////////////////////////////////////////
//* Private static fields

    private static JTSystemConsole console = null;

    private static boolean WRITE_TO_CONSOLE = false;

///////////////////////////////////////////////////////////////////////////////
//* Public static methods

    public static void error(String mesg, Object obj) {
        System.err.println("Error: "+mesg+" -- "+obj.toString());
    }

    public static void error(String mesg) {
        if (WRITE_TO_CONSOLE == false) {
            System.err.println("Error: "+mesg);
        } else {
            console.println("Error: "+mesg);
        }
    }

    public static void println(String mesg) {
        if (WRITE_TO_CONSOLE == false) {
            System.out.println(mesg);
        } else {
            console.println(mesg);
        }
    }

    public static void print(String mesg) {
        if (WRITE_TO_CONSOLE == false) {
            System.err.print(mesg);
        } else {
            console.print(mesg);
        }
    }

    public static Frame getConsole() {
        if (console == null) {
            console = new JTSystemConsole();
            WRITE_TO_CONSOLE = true;
        }
        return (Frame)console;
    }
}

class JTSystemConsole extends Frame
{

    java.awt.TextArea textArea;

    public JTSystemConsole()
    {
        textArea = new java.awt.TextArea();
        add(textArea);
        setTitle("JavaTime Console");
        setSize(400,200);

        addWindowListener(new MyWindowAdapter());
    }


    public JTSystemConsole(String title)
    {
        this();
        setTitle(title);
        addWindowListener(new MyWindowAdapter());
    }


    public void print(String string) {
        textArea.append(string);
    }


    public void println(String string) {
        textArea.append(string+"\n");
    }


    final class MyWindowAdapter extends java.awt.event.WindowAdapter {
        public void windowClosing(WindowEvent e) {
            setVisible(false);
        }
    }

}

⌨️ 快捷键说明

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