home *** CD-ROM | disk | FTP | other *** search
Java Source | 2017-09-21 | 4.7 KB | 154 lines |
- /*
- *
- * NTT-24P (JAVA Beta2)
- *
- * Nextage Y.Nakano
- * 1996/01/08
- *
- */
- import java.io.InputStream;
- import java.awt.*;
- import java.net.*;
-
- public class Ntt_24p extends java.applet.Applet implements Runnable {
- Thread kicker = null;
- Image imBack;
- Graphics offBack;
- Image imBase;
- Ntt_24pSTRINGS imStr[];
- boolean first = true;
- int swNum = -1;
-
- /* x1 x2 y1 y2 table-index */
- int mouseAria[][] = {{156,163,154,163, 0},
- {146,152,166,176, 0},
- {114,164, 98,127, 1},
- {136,180,127,148, 1},
- {202,278,202,238, 1},
- {229,338,202,329, 1},
- {194,202,148,167, 2},
- {149,158,161,166, 3},
- {176,185,149,154, 4},
- {200,206,172,180, 4},
- {159,171,164,172, 5},
- {174,188,165,172, 6},
- {156,183,172,191, 6},
- {215,240,106,170, 7},
- {143,188,205,228, 8},
- {999,999,999,999, 9}};
-
- public void init() {
- String lang = getParameter("lang");
-
- imBack = createImage(size().width, size().height);
- offBack = imBack.getGraphics();
-
- if (lang.equals("jp")) { /* jp=japanese */
- imBase = getImage(getDocumentBase(), "images/back_j.gif");
- }
- else { /* us=english */
- imBase = getImage(getDocumentBase(), "images/back_e.gif");
- }
-
- imStr = new Ntt_24pSTRINGS[9];
- imStr[0] = new Ntt_24pSTRINGS( 13, 43,"1",lang,this); /* TC&R */
- imStr[1] = new Ntt_24pSTRINGS(135, 10,"2",lang,this); /* soler */
- imStr[2] = new Ntt_24pSTRINGS(194, 53,"3",lang,this); /* clock */
- imStr[3] = new Ntt_24pSTRINGS( 18,132,"4",lang,this); /* sencer */
- imStr[4] = new Ntt_24pSTRINGS(176,112,"5",lang,this); /* surasuter */
- imStr[5] = new Ntt_24pSTRINGS( 15,165,"6",lang,this); /* Ka tower */
- imStr[6] = new Ntt_24pSTRINGS( 9,174,"7",lang,this); /* Ka antena */
- imStr[7] = new Ntt_24pSTRINGS(228,135,"8",lang,this); /* Ku/S */
- imStr[8] = new Ntt_24pSTRINGS( 90,210,"9",lang,this); /* C/S */
- }
-
- public void run() {
- Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
- while (kicker != null) {
- repaint();
- try { Thread.sleep(20); }
- catch (InterruptedException e) { return; }
- }
- }
-
- public void paint(Graphics g) {
- update(g);
- }
- public void update(Graphics g) {
- offBack.drawImage(imBase,0,0,this);
- if (first) {
- if (chkImg()) {
- first = false;
- }
- }
- if (swNum != -1 && first == false) {
- imStr[swNum].drawImageItem(offBack, this);
- }
- g.drawImage(imBack,0,0,this);
- if (first) {
- g.setColor(Color.white);
- g.drawString("Loading...",0,20);
- }
- }
-
- boolean chkImg() {
- for (int i = 0; i < 9; i++) {
- if (imStr[i].chkImage(this) == false) {
- return false;
- }
- }
- return true;
- }
-
- public void start() {
- if (kicker == null) {
- kicker = new Thread(this);
- kicker.start();
- }
- }
- public void stop() {
- kicker = null;
- }
-
- public boolean mouseMove(java.awt.Event evt, int x, int y) {
- for (int i = 0; mouseAria[i][0] != 999; i++) {
- if (x >= mouseAria[i][0] && x <= mouseAria[i][1] &&
- y >= mouseAria[i][2] && y <= mouseAria[i][3]) {
- swNum = mouseAria[i][4];
- return true;
- }
- }
- swNum = -1;
- return true;
- }
- }
-
- class Ntt_24pSTRINGS {
- int setX,setY;
- Image img;
-
- Ntt_24pSTRINGS(int x, int y, String im_name, String lang, Ntt_24p parent) {
- setX = x;
- setY = y;
- if (lang.equals("jp")) { /* jp=japanese */
- img = parent.getImage(parent.getDocumentBase(),
- "images/" + im_name + "_j.gif");
- }
- else { /* us=english */
- img = parent.getImage(parent.getDocumentBase(),
- "images/" + im_name + "_e.gif");
- }
- }
-
- boolean chkImage(Ntt_24p parent) {
- if (parent.prepareImage(img, parent) == false) {
- return false;
- }
- return true;
- }
-
- void drawImageItem(Graphics OS, Ntt_24p parent) {
- OS.drawImage(img, setX, setY, parent);
- }
- }
-