home *** CD-ROM | disk | FTP | other *** search
Wrap
import java.applet.Applet; import java.applet.AudioClip; import java.awt.Color; import java.awt.Component; import java.awt.Frame; import java.awt.Graphics; import java.awt.Image; import java.awt.MediaTracker; import java.net.MalformedURLException; import java.net.URL; import java.util.Date; import java.util.Random; class common { static int soundOff; static int whichStep; static Color[] theColors = new Color[13]; static String teststring; static boolean inAd; int clientX; int clientY; int clientW; int clientH; int whichBase; String background; String bgcolor; AudioClip[] hideSound; int numHideSound; String[] hideSoundName = new String[50]; int delayLoadAudio = 100; String target; Applet m_parent; int bState; String action = "URL"; int releaseLevel; int TheShareware = 2; int TheAdware = 1; int TheDemo; String Name; int showAd = 1000; int showAdCount; // $FF: renamed from: wb int int field_0; // $FF: renamed from: hb int int field_1; // $FF: renamed from: w int int field_2; // $FF: renamed from: h int int field_3; String mmmm; Graphics gBufBK; Image bufBK; boolean bBackgroundOK = false; Color colForeground; String colForegroundName = "STATIC"; Color colBackground; String colBackgroundName; Color fixCaptionColor; String fixCaptionColorName = "STATIC"; Image imgBackground; // $FF: renamed from: rr java.util.Random Random field_4; // $FF: renamed from: dd java.util.Date static Date field_5 = new Date(); int disableLevel = 2; static String myAd = "GO Coolshare!! You will explore COOL: Free Java applets, the best screen savers in the world, Cool resource to build your web pages, date through the Web, and more!! Go http://www.aimnet.com/~markqian to get them!!"; static String myAddress = "http://www.coolshare.com"; String whatWare = "evaluateShareware"; String homeURL; URL uhomeURL; String TheStatus; String aboutMe = "Go http://www.coolshare.com to get COOL shareware, applets, and more COOL stuff!!"; MediaTracker tracker; public common(Applet _parent) { this.m_parent = _parent; theColors[0] = Color.black; theColors[1] = Color.blue; theColors[2] = Color.cyan; theColors[3] = Color.darkGray; theColors[4] = Color.gray; theColors[5] = Color.green; theColors[6] = Color.lightGray; theColors[7] = Color.magenta; theColors[8] = Color.orange; theColors[9] = Color.pink; theColors[10] = Color.red; theColors[11] = Color.white; theColors[12] = Color.yellow; this.field_4 = new Random(); this.field_4.setSeed((long)(field_5.getMinutes() * field_5.getSeconds())); } public void turnSoundOff(int action) { soundOff = action; } public void doSound(int which) { if (soundOff != 1 && which <= this.numHideSound && which >= 1) { if (this.hideSound[which] != null) { this.hideSound[which].play(); } else { System.out.println("hideSound[" + which + "]=null"); } } } public void drawButtonBorder(int bState, Graphics g, int w, int h, int wb, int hb) { int[] tri_x = new int[6]; int[] tri_y = new int[6]; if (bState == 0) { g.setColor(Color.white); } else { g.setColor(Color.darkGray); } tri_x[0] = 0; tri_y[0] = 0; tri_x[1] = 0; tri_y[1] = h; tri_x[2] = wb; tri_y[2] = h - hb; tri_x[3] = wb; tri_y[3] = hb; tri_x[4] = w - wb; tri_y[4] = hb; tri_x[5] = w; tri_y[5] = 0; g.fillPolygon(tri_x, tri_y, 6); if (bState == 1) { g.setColor(Color.white); } else { g.setColor(Color.darkGray); } g.drawPolygon(tri_x, tri_y, 6); if (bState == 0) { g.setColor(Color.darkGray); } else { g.setColor(Color.white); } g.fillRect(wb, hb, w, h); g.setColor(Color.lightGray); g.fillRect(wb, hb, w - 2 * wb, h - 2 * hb); g.drawLine(0, 0, wb, hb); if (bState == 0) { g.setColor(Color.darkGray); } else { g.setColor(Color.white); } tri_x[0] = w; tri_y[0] = h; tri_x[1] = 0; tri_y[1] = h; tri_x[2] = wb; tri_y[2] = h - hb; tri_x[3] = w - wb; tri_y[3] = h - hb; tri_x[4] = w - wb; tri_y[4] = hb; tri_x[5] = w; tri_y[5] = 0; g.fillPolygon(tri_x, tri_y, 6); g.drawLine(0, 0, wb, hb); if (bState == 1) { g.setColor(Color.darkGray); } else { g.setColor(Color.white); } g.drawPolygon(tri_x, tri_y, 6); if (bState == 0) { g.setColor(Color.white); } else { g.setColor(Color.darkGray); } g.drawLine(w - wb, h - hb, w, h); g.setColor(Color.lightGray); tri_x[0] = wb; tri_y[0] = hb; tri_x[1] = w - wb; tri_y[1] = hb; tri_x[2] = w - wb; tri_y[2] = h - hb; tri_x[3] = wb; tri_y[3] = h - hb; g.fillPolygon(tri_x, tri_y, 4); } Color getColorFromParam(String szParam, Color col_default) { int offset = 0; String szColor; if ((szColor = this.m_parent.getParameter(szParam)) != null && !szColor.equals("")) { if (szColor.startsWith("#")) { offset = 1; } int Red; int Blue; int Green; try { Red = Integer.parseInt(szColor.substring(offset, 2 + offset), 16); Green = Integer.parseInt(szColor.substring(2 + offset, 4 + offset), 16); Blue = Integer.parseInt(szColor.substring(4 + offset, 6 + offset), 16); } catch (Exception var8) { System.out.println("parseInt failed: szParam=" + szColor); return col_default; } return new Color(Red, Green, Blue); } else { return col_default; } } public void iniCommon() { Date dd = new Date(); this.field_4.setSeed((long)(dd.getMinutes() * dd.getSeconds())); String at = this.m_parent.getParameter("whatWare"); this.whatWare = at != null ? at : "evaluateShareware"; if (!this.whatWare.equalsIgnoreCase("evaluateShareware") && !this.whatWare.equalsIgnoreCase("AdWare")) { this.whatWare = "evaluateShareware"; } if (this.releaseLevel == this.TheShareware) { this.disableLevel = 0; } else if (this.whatWare.equalsIgnoreCase("AdWare")) { this.disableLevel = 1; } else if ((dd.getHours() < 7 || dd.getHours() > 18) && this.releaseLevel <= this.TheShareware && this.releaseLevel >= this.TheAdware) { this.disableLevel = 0; } else { this.disableLevel = 2; } this.tracker = new MediaTracker(this.m_parent); at = this.m_parent.getParameter("action"); this.action = at != null ? at : "URL"; this.target = this.m_parent.getParameter("target"); if (!this.action.equalsIgnoreCase("URL") && !this.action.equalsIgnoreCase("SoundSwitch")) { this.action = "URL"; } at = this.m_parent.getParameter("nice"); if (at != null) { this.showAd *= 2; } at = this.m_parent.getParameter("status_text"); if (this.disableLevel > 0) { this.TheStatus = this.aboutMe; } at = this.m_parent.getParameter("on_click"); if (this.disableLevel == 2) { this.homeURL = myAddress; } else { this.homeURL = at != null ? at : myAddress; } try { this.uhomeURL = new URL(this.homeURL); } catch (MalformedURLException var4) { this.uhomeURL = null; } at = this.m_parent.getParameter("delayLoadAudio"); this.delayLoadAudio = at == null ? 100 : Integer.valueOf(at); at = this.m_parent.getParameter("whichBase"); this.whichBase = at == null ? 0 : Integer.valueOf(at); int i = 0; do { ++i; this.hideSoundName[i] = this.m_parent.getParameter("hideSound" + i); } while(this.hideSoundName[i] != null); this.numHideSound = i - 1; if (this.numHideSound > 0) { this.hideSound = new AudioClip[this.numHideSound + 1]; for(int var13 = 1; var13 <= this.numHideSound; ++var13) { this.hideSound[var13] = null; } } at = this.m_parent.getParameter("borderWidth"); this.field_0 = at == null ? 0 : Integer.valueOf(at); at = this.m_parent.getParameter("borderHeight"); this.field_1 = at == null ? 0 : Integer.valueOf(at); if (this.m_parent.size().width > 0 && this.m_parent.size().height > 0) { this.clientW = this.m_parent.size().width - 2 * this.field_0; this.clientH = this.m_parent.size().height - 2 * this.field_1; this.clientX = this.field_0; this.clientY = this.field_1; this.bufBK = this.m_parent.createImage(this.m_parent.size().width, this.m_parent.size().height); this.gBufBK = this.bufBK.getGraphics(); } else { this.clientW = 0; } this.setColors("bgcolor"); this.setColors("fgcolor"); this.background = this.m_parent.getParameter("background"); if (this.background != null && !this.background.equals("")) { if (this.whichBase == 0) { this.imgBackground = this.m_parent.getImage(this.m_parent.getDocumentBase(), this.background); } else { this.imgBackground = this.m_parent.getImage(this.m_parent.getCodeBase(), this.background); } } if (this.imgBackground != null) { this.bBackgroundOK = true; this.tracker.addImage(this.imgBackground, 0); } } public void loadHideSound() { if (this.numHideSound > 0) { for(int i = 1; i <= this.numHideSound; ++i) { if (this.whichBase == 0) { this.hideSound[i] = this.m_parent.getAudioClip(this.m_parent.getDocumentBase(), this.hideSoundName[i]); } else { this.hideSound[i] = this.m_parent.getAudioClip(this.m_parent.getCodeBase(), this.hideSoundName[i]); } } } } public void maintainBK() { int iBackWidth = 0; int iBackHeight = 0; if (this.bBackgroundOK && this.imgBackground != null) { if ((iBackWidth = this.imgBackground.getWidth(this.m_parent)) > 0 && (iBackHeight = this.imgBackground.getHeight(this.m_parent)) > 0) { for(int bx = 0; bx < this.bufBK.getWidth(this.m_parent); bx += iBackWidth) { for(int by = 0; by < this.bufBK.getHeight(this.m_parent); by += iBackHeight) { this.gBufBK.drawImage(this.imgBackground, bx, by, this.m_parent); } } return; } } else { Color cc; if (this.colBackgroundName.equalsIgnoreCase("vary")) { Date dd = new Date(); this.field_4.setSeed((long)(dd.getMinutes() * dd.getSeconds())); float tt = this.field_4.nextFloat(); cc = theColors[(int)(tt * 12.0F)]; } else { cc = this.colBackground; } this.gBufBK.setColor(cc); this.gBufBK.fillRect(0, 0, this.bufBK.getWidth(this.m_parent), this.bufBK.getHeight(this.m_parent)); } } public Color getTheColor(String ColorName, int which) { if (ColorName.equalsIgnoreCase("vary")) { return theColors[(int)(this.field_4.nextFloat() * 12.0F)]; } else if (which == 0) { return this.colForeground; } else { return which == 1 ? this.colBackground : this.fixCaptionColor; } } public void setColors(String what) { String at = null; at = this.m_parent.getParameter(what); if (what.equalsIgnoreCase("fgcolor")) { if (at != null && at.equalsIgnoreCase("null")) { at = null; } this.colForegroundName = at != null ? at : "STATIC"; if (!this.colForegroundName.equalsIgnoreCase("STATIC") && !this.colForegroundName.equalsIgnoreCase("vary")) { this.colForeground = this.getColorFromParam("fgcolor", Color.black); return; } } else if (what.equalsIgnoreCase("bgcolor")) { if (at != null && (at.equalsIgnoreCase("null") || at.equalsIgnoreCase(""))) { at = null; } this.bgcolor = at; this.colBackgroundName = at != null ? at : "STATIC"; if (!this.colBackgroundName.equalsIgnoreCase("STATIC") && !this.colBackgroundName.equalsIgnoreCase("vary")) { this.colBackground = this.getColorFromParam(what, Color.pink); return; } } else if (what.equalsIgnoreCase("fixCaptionColor")) { if (at != null && at.equalsIgnoreCase("null")) { at = null; } this.fixCaptionColorName = at != null ? at : "STATIC"; if (!this.fixCaptionColorName.equalsIgnoreCase("STATIC") && !this.fixCaptionColorName.equalsIgnoreCase("vary")) { this.fixCaptionColor = this.getColorFromParam(what, Color.black); } } } public void setTheCursor(int whatCursor) { Object frame; for(frame = this.m_parent.getParent(); !(frame instanceof Frame); frame = ((Component)frame).getParent()) { } ((Frame)frame).setCursor(whatCursor); } }