home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Dimension;
- import java.awt.Event;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.Label;
- import java.awt.LayoutManager;
- import java.awt.MediaTracker;
- import java.awt.Panel;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.util.NoSuchElementException;
- import java.util.StringTokenizer;
-
- public class JAVATabR extends Applet implements Runnable {
- String sDefMO = "1st JAVA Navigator[Tab], (c)1997-1999 AUSCOMP - World Wide (www.auscomp.com)";
- String sCopyright = "AUSCOMP (www.auscomp.com)";
- int xSwitch = 4;
- String sLoading = "1st JAVA Navigator V5.0";
- Thread thJAVATab;
- String[] aHref;
- String[] aFrame;
- String[] aHref2;
- String[] aFrame2;
- String[] aMsg;
- String[] tempString;
- String sText = "";
- String sHref = "";
- String sFrame = "";
- String sHref2 = "";
- String sFrame2 = "";
- String sMsg = "";
- String sMsgOld = "";
- int iLoading;
- int iTabCnt;
- int oldx;
- int iTabDefault = 999;
- int iBGRed = 255;
- int iFGRed;
- int iBHRed;
- int iFHRed = 255;
- int iBGGreen = 255;
- int iFGGreen;
- int iBHGreen;
- int iFHGreen = 255;
- int iBGBlue = 255;
- int iFGBlue;
- int iBHBlue;
- int iFHBlue;
- Font fFont = new Font("Dialog", 0, 12);
- private boolean bCopyright = false;
- private boolean allLoaded = false;
- Image imgBG;
- // $FF: renamed from: g1 java.awt.Graphics
- Graphics field_0;
- boolean fAuscomp = true;
- String sMOUSEOVERSOUND = "none";
- String sMOUSECLICKSOUND = "none";
- int oldTabPanel = -1;
- TabPanel tabPanel1;
- Label label1;
-
- void tabPanel1_MouseMove(Event event) {
- try {
- if (!this.sMOUSEOVERSOUND.equals("none")) {
- ((Applet)this).play(((Applet)this).getCodeBase(), this.sMOUSEOVERSOUND);
- }
- } catch (Exception var3) {
- }
-
- int x = 0;
-
- try {
- x = this.tabPanel1.setTabLabelColor(event);
- if (x == 999 && this.oldx != 999) {
- this.tabPanel1.setMOLabelColor(this.tabPanel1.getMOColor(), x);
- this.sMsg = this.sDefMO;
- } else {
- this.sMsg = this.aMsg[x];
- }
-
- this.oldx = x;
- this.sMsg = this.sMsg.trim();
- if (this.sMsg != this.sMsgOld) {
- if (this.sMsg.toLowerCase().equals("none")) {
- ((Applet)this).showStatus(" ");
- } else {
- ((Applet)this).showStatus(this.sMsg);
- }
-
- this.sMsgOld = this.sMsg;
- return;
- }
- } catch (ArrayIndexOutOfBoundsException var4) {
- }
-
- }
-
- void tabPanel1_MouseUp(Event event) {
- try {
- if (!this.sMOUSECLICKSOUND.equals("none")) {
- ((Applet)this).play(((Applet)this).getCodeBase(), this.sMOUSECLICKSOUND);
- }
- } catch (Exception var6) {
- }
-
- try {
- int iTabIx = this.tabPanel1.getCurrentPanelNdx();
- this.sHref = this.aHref[iTabIx];
- this.sFrame = this.aFrame[iTabIx];
- this.sHref2 = this.aHref2[iTabIx];
- this.sFrame2 = this.aFrame2[iTabIx];
- this.sHref = this.sHref.trim();
- this.sFrame = this.sFrame.trim();
- this.sHref2 = this.sHref2.trim();
- this.sFrame2 = this.sFrame2.trim();
- if (!this.sHref.toLowerCase().equals("none")) {
- try {
- ((Applet)this).getAppletContext().showDocument(new URL(((Applet)this).getCodeBase(), this.sHref), this.sFrame);
- } catch (MalformedURLException var4) {
- }
- }
-
- if (!this.sHref2.toLowerCase().equals("none")) {
- try {
- ((Applet)this).getAppletContext().showDocument(new URL(((Applet)this).getCodeBase(), this.sHref2), this.sFrame2);
- return;
- } catch (MalformedURLException var3) {
- return;
- }
- }
- } catch (Exception var5) {
- }
-
- }
-
- public void start() {
- this.field_0 = ((Component)this).getGraphics();
- this.paint(this.field_0);
- this.thJAVATab = new Thread(this);
- this.thJAVATab.start();
- }
-
- public void stop() {
- this.thJAVATab.stop();
- this.thJAVATab = null;
- }
-
- public void paint(Graphics g) {
- ++this.iLoading;
- g.drawString(this.sLoading, 10, 15);
- g.drawString("Loading resource No." + this.iLoading + " - Please wait", 10, 35);
- }
-
- public void run() {
- if (!this.allLoaded) {
- this.constructTab();
- this.tabPanel1.show(true);
- if (this.iTabDefault < 999) {
- this.tabPanel1.setCurrentPanelNdx(this.iTabDefault);
- this.tabPanel1_MouseUp((Event)null);
- return;
- }
-
- this.tabPanel1.setCurrentPanelNdx(0);
- }
-
- }
-
- public void init() {
- super.init();
- ((Container)this).setLayout((LayoutManager)null);
- ((Panel)this).addNotify();
- this.tabPanel1 = new TabPanel();
- this.tabPanel1.setLayout((LayoutManager)null);
- switch (this.xSwitch) {
- case 0:
- this.sLoading = "1st JAVA Tab - Evaluation Copy";
- return;
- case 1:
- this.sLoading = "1st JAVA Tab - Registered";
- return;
- case 2:
- this.sLoading = "1st JAVA Tab";
- return;
- case 3:
- this.sLoading = "1st JAVA Navigator[Tab] - Evaluation Copy";
- return;
- case 4:
- this.sLoading = "1st JAVA Navigator[Tab] - Registered";
- default:
- }
- }
-
- private void constructTab() {
- String strBG = "";
-
- try {
- strBG = ((Applet)this).getParameter("COPYRIGHT");
- if (strBG.indexOf(this.sCopyright) > 0) {
- this.bCopyright = true;
- } else {
- this.bCopyright = false;
- }
- } catch (Exception var20) {
- }
-
- try {
- this.sMOUSEOVERSOUND = "none";
- strBG = ((Applet)this).getParameter("MOUSEOVERSOUND");
- if (strBG != null) {
- this.sMOUSEOVERSOUND = strBG;
- }
- } catch (Exception var19) {
- }
-
- try {
- this.sMOUSECLICKSOUND = "none";
- strBG = ((Applet)this).getParameter("MOUSECLICKSOUND");
- if (strBG != null) {
- this.sMOUSECLICKSOUND = strBG;
- }
- } catch (Exception var18) {
- }
-
- try {
- strBG = ((Applet)this).getParameter("TAB_BG");
- if (strBG == null) {
- this.iBGRed = 192;
- this.iBGGreen = 192;
- this.iBGBlue = 192;
- } else {
- this.iBGRed = this.getCOLOR(0, "TAB_BG", strBG);
- this.iBGGreen = this.getCOLOR(1, "TAB_BG", strBG);
- this.iBGBlue = this.getCOLOR(2, "TAB_BG", strBG);
- }
- } catch (Exception var17) {
- }
-
- Dimension s = ((Component)this).size();
- this.tabPanel1.reshape(0, 0, s.width, s.height);
- this.tabPanel1.setBackground(new Color(this.iBGRed, this.iBGGreen, this.iBGBlue));
-
- try {
- strBG = ((Applet)this).getParameter("TAB_FG");
- if (strBG == null) {
- this.iBGRed = 0;
- this.iBGGreen = 0;
- this.iBGBlue = 0;
- } else {
- this.iBGRed = this.getCOLOR(0, "TAB_FG", strBG);
- this.iBGGreen = this.getCOLOR(1, "TAB_FG", strBG);
- this.iBGBlue = this.getCOLOR(2, "TAB_FG", strBG);
- }
- } catch (Exception var16) {
- }
-
- this.tabPanel1.setLabelColor(new Color(this.iBGRed, this.iBGGreen, this.iBGBlue));
- ((Component)this).setForeground(new Color(this.iBGRed, this.iBGGreen, this.iBGBlue));
-
- try {
- strBG = ((Applet)this).getParameter("TAB_DEFAULT");
- if (strBG == null) {
- this.iTabDefault = 999;
- } else {
- this.iTabDefault = Integer.parseInt(strBG);
- }
- } catch (Exception var15) {
- }
-
- try {
- strBG = ((Applet)this).getParameter("TABONBOTTOM");
- if (strBG == null) {
- this.tabPanel1.setTabsOnBottom(false);
- } else {
- this.tabPanel1.setTabsOnBottom(true);
- if (strBG.toLowerCase().equals("no")) {
- this.tabPanel1.setTabsOnBottom(false);
- }
- }
- } catch (Exception var14) {
- }
-
- try {
- strBG = ((Applet)this).getParameter("TAB_FONT");
- String fName = "";
- String fStyle = "";
- String fSize = "";
- int iStyle = 0;
- if (strBG != null) {
- StringTokenizer parser = new StringTokenizer(strBG, ";");
-
- try {
- fName = parser.nextToken();
- fStyle = parser.nextToken();
- fSize = parser.nextToken();
- if (fStyle.trim().toLowerCase().equals("bold")) {
- iStyle = 1;
- }
-
- if (fStyle.trim().toLowerCase().equals("italic")) {
- iStyle = 2;
- }
-
- this.fFont = new Font(fName, iStyle, Integer.parseInt(fSize.trim()));
- } catch (NoSuchElementException var11) {
- System.out.println(strBG + " Parameter Error(1)");
- } catch (Exception var12) {
- System.out.println(strBG + " Parameter Error(2)");
- }
- }
-
- this.tabPanel1.setFont(this.fFont);
- } catch (Exception var13) {
- }
-
- try {
- strBG = ((Applet)this).getParameter("TAB_MOUSEOVER");
- if (strBG == null) {
- this.iBGRed = 255;
- this.iBGGreen = 0;
- this.iBGBlue = 0;
- } else {
- this.iBGRed = this.getCOLOR(0, "TAB_MOUSEOVER", strBG);
- this.iBGGreen = this.getCOLOR(1, "TAB_MOUSEOVER", strBG);
- this.iBGBlue = this.getCOLOR(2, "TAB_MOUSEOVER", strBG);
- }
-
- this.tabPanel1.setMOColor(new Color(this.iBGRed, this.iBGGreen, this.iBGBlue));
- } catch (Exception var10) {
- }
-
- try {
- this.imgBG = null;
- strBG = ((Applet)this).getParameter("TAB_BG_IMAGE");
- if (strBG != null) {
- this.imgBG = ((Applet)this).getImage(((Applet)this).getCodeBase(), strBG);
- MediaTracker m = new MediaTracker(this);
-
- try {
- m.addImage(this.imgBG, 0);
- m.waitForAll();
- } catch (InterruptedException var8) {
- return;
- }
-
- if (this.imgBG.getHeight(this) > 0) {
- this.tabPanel1.setBGImage(this.imgBG);
- }
- }
- } catch (Exception var9) {
- }
-
- ((Container)this).add(this.tabPanel1);
- this.tabPanel1.show(false);
-
- int i;
- for(i = 0; ((Applet)this).getParameter("TAB" + i) != null; ++i) {
- }
-
- this.iTabCnt = i + 1;
- this.tempString = new String[this.iTabCnt];
- this.aHref = new String[this.iTabCnt];
- this.aFrame = new String[this.iTabCnt];
- this.aHref2 = new String[this.iTabCnt];
- this.aFrame2 = new String[this.iTabCnt];
- this.aMsg = new String[this.iTabCnt];
-
- for(int var34 = 0; ((Applet)this).getParameter("TAB" + var34) != null; ++var34) {
- this.workParam(((Applet)this).getParameter("TAB" + var34), var34);
- this.tabPanel1.add(this.label1);
- if (var34 == 0 && (this.xSwitch == 0 || this.xSwitch == 3)) {
- this.tabPanel1.add(this.label1);
- }
- }
-
- if (!this.bCopyright) {
- this.tempString[0] = "Copyright parameter missing";
- this.aMsg[0] = "Copyright applet parameter missing in the HTML code.";
- }
-
- this.tabPanel1.setPanelLabels(this.tempString);
- this.tabPanel1.show();
- this.allLoaded = true;
- }
-
- public boolean handleEvent(Event event) {
- if (event.target == this.tabPanel1 && event.id == 502) {
- this.tabPanel1_MouseUp(event);
- return true;
- } else if (this.oldTabPanel != this.tabPanel1.getCurrentPanelNdx() && event.target == this.tabPanel1 && event.id == 503) {
- this.tabPanel1_MouseMove(event);
- this.oldTabPanel = this.tabPanel1.getCurrentPanelNdx();
- return true;
- } else {
- return super.handleEvent(event);
- }
- }
-
- private int getCOLOR(int iColor, String sWhat, String sPBG) {
- int iRed = 255;
- int iBlue = 255;
- int iGreen = 255;
- StringTokenizer parser = new StringTokenizer(sPBG, ",");
-
- try {
- String sRed = parser.nextToken();
- String sGreen = parser.nextToken();
- String sBlue = parser.nextToken();
- iRed = Integer.parseInt(sRed);
- iGreen = Integer.parseInt(sGreen);
- iBlue = Integer.parseInt(sBlue);
- } catch (NoSuchElementException var11) {
- System.out.println(sWhat + " Parameter Error(1)");
- } catch (Exception var12) {
- System.out.println(sWhat + " Parameter Error(2)");
- }
-
- switch (iColor) {
- case 0:
- return iRed;
- case 1:
- return iGreen;
- case 2:
- return iBlue;
- default:
- return 255;
- }
- }
-
- private void workParam(String sItem, int iTCnt) {
- this.sHref = "None";
- this.sFrame = "None";
- this.sHref2 = "None";
- this.sFrame2 = "None";
- this.sMsg = "None";
- if (sItem.substring(0, 3).equals("***")) {
- this.sHref = "None";
- this.sFrame = "None";
- this.sHref2 = "None";
- this.sFrame2 = "None";
- this.sMsg = "None";
- } else {
- StringTokenizer parser = new StringTokenizer(sItem, ";");
- int iCnt = parser.countTokens() - 4;
- if (iCnt != 0 && iCnt != 2) {
- System.out.println("*** Warning in parameter '" + sItem + "' - Item count is ( " + parser.countTokens() + " ) instead of ( 6 ) *** ");
- }
-
- try {
- this.sText = parser.nextToken();
- this.sHref = parser.nextToken();
- this.sFrame = parser.nextToken();
- this.sMsg = parser.nextToken();
- this.sHref2 = parser.nextToken();
- this.sFrame2 = parser.nextToken();
- } catch (NoSuchElementException var6) {
- } catch (Exception var7) {
- System.out.println(sItem + " Parameter Error(3)");
- }
-
- if (iTCnt == 0 && (this.xSwitch == 0 || this.xSwitch == 3)) {
- this.tempString[iTCnt] = "Evaluation Copy";
- this.aHref[iTCnt] = "http://www.auscomp.com";
- this.aFrame[iTCnt] = "_blank";
- this.aHref2[iTCnt] = "None";
- this.aFrame2[iTCnt] = "None";
- this.aMsg[iTCnt] = this.sDefMO;
- }
-
- if (iTCnt == 0 && this.xSwitch == 2) {
- try {
- this.fAuscomp = false;
- if (((Applet)this).getCodeBase().equals(new URL("http://10.0.0.2/JTab/"))) {
- this.fAuscomp = true;
- } else {
- if (((Applet)this).getCodeBase().equals(new URL("http://www.auscomp.com/JTab/"))) {
- this.fAuscomp = true;
- }
-
- if (((Applet)this).getCodeBase().equals(new URL("http://www.auscomp.com.au/JTab/"))) {
- this.fAuscomp = true;
- }
- }
- } catch (MalformedURLException var5) {
- }
-
- if (!this.fAuscomp) {
- this.tempString[iTCnt] = "Illegal copy of 1st JAVA Tab";
- this.aHref[iTCnt] = "http://www.auscomp.com";
- this.aFrame[iTCnt] = "_blank";
- this.aHref2[iTCnt] = "None";
- this.aFrame2[iTCnt] = "None";
- this.aMsg[iTCnt] = "Non registered copy of 1st JAVA Tab (c) 1998 Auscomp (www.auscomp.com)";
- this.tabPanel1.add(this.label1);
- }
- }
-
- if (this.xSwitch == 0 || this.xSwitch == 3) {
- ++iTCnt;
- }
-
- if (this.xSwitch == 2 && !this.fAuscomp) {
- ++iTCnt;
- }
-
- this.tempString[iTCnt] = this.sText;
- this.aHref[iTCnt] = this.sHref;
- this.aFrame[iTCnt] = this.sFrame;
- this.aHref2[iTCnt] = this.sHref2;
- this.aFrame2[iTCnt] = this.sFrame2;
- this.aMsg[iTCnt] = this.sMsg;
- }
- }
- }
-