|
|
From: jon@axis.com
Category: Category 1
Date: 29 Sep 1998
Time: 09:21:17
Remote Name: 193.13.178.10
Here is the fphover source code. It consists of 2 files : fphover.java and fphoverx fphover.java :
*************************** /* Decompiled by Mocha from fphover.class */ /* Originally compiled from fphover.java */
import java.applet.*; import java.awt.*; import java.lang.String; import java.awt.image.FilteredImageSource; import java.net.MalformedURLException; import java.net.URL;
public class fphover extends Applet { private String m_image; private String m_hoverImage; private Color m_bgColor; private Color m_color; private Color m_hoverColor; private String m_effectString; private String m_sound; private String m_hoverSound; private String m_url; private String m_target; private String m_text; private Color m_textColor; private String m_textAlign; private String m_textVAlign; private String m_font; private String m_fontStyle; private int m_fontSize; private final String PARAM_image = "image"; private final String PARAM_hoverImage = "hoverImage"; private final String PARAM_bgColor = "bgColor"; private final String PARAM_color = "color"; private final String PARAM_hoverColor = "hoverColor"; private final String PARAM_effect = "effect"; private final String PARAM_sound = "sound"; private final String PARAM_hoverSound = "hoverSound"; private final String PARAM_url = "url"; private final String PARAM_target = "target"; private final String PARAM_text = "text"; private final String PARAM_textColor = "textColor"; private final String PARAM_textAlign = "textAlign"; private final String PARAM_textVAlign = "textVAlign"; private final String PARAM_font = "font"; private final String PARAM_fontStyle = "fontStyle"; private final String PARAM_fontSize = "fontSize"; private int m_effect; private Image m_srcImage; private Image m_srcHoverImage; private AudioClip m_audio; private AudioClip m_hoverAudio; private URL m_docUrl; private int m_hover; private int m_textWidth; private boolean m_textMask; private Image m_textImage; private int m_iTextAlign; private int m_iTextVAlign; private int m_textImageWidth; private int m_textImageHeight; private boolean m_textImageError; private boolean m_srcImageError; private boolean m_srcHoverImageError; private boolean m_applyEffectWait; private FontMetrics m_fm; private static final int COLOR = 0; private static final int IMAGE = 1; private static final int EFFECT = 2; private int m_normalType; private int m_hoverType; private boolean m_noErase; private int m_w; private int m_h; private int m_x; private int m_y;
public boolean mouseMove(Event evt, int x, int y) { return true; }
public void stop() { }
public boolean mouseEnter(Event evt, int x, int y) { m_hover = 1; if (m_hoverAudio != null) m_hoverAudio.play(); showStatus(m_url); if (m_normalType != 1 || m_hoverType != 1 || !m_image.equals(m_hoverImage)) repaint(); return true; }
public boolean mouseExit(Event evt, int x, int y) { m_hover = 0; if (m_normalType != 1 || m_hoverType != 1 || !m_image.equals(m_hoverImage)) repaint(); return true; }
public void paint(Graphics g) { getXY(); if (m_hover != 0) { if (!m_srcHoverImageError) g.drawImage(m_srcHoverImage, 0, 0, this); if (m_effect == 5) { m_x += -1; m_y += -1; } if (m_effect == 6) { m_x++; m_y++; } } else if (!m_srcImageError) g.drawImage(m_srcImage, 0, 0, this); if (m_textMask) if (!m_textImageError) g.drawImage(m_textImage, m_x, m_y, this); g.setColor(m_textColor); g.drawString(m_text, m_x, m_y); }
public boolean mouseUp(Event evt, int x, int y) { if (!m_url.equalsIgnoreCase("") && m_docUrl != null) { if (m_target.equalsIgnoreCase("")) getAppletContext().showDocument(m_docUrl); else getAppletContext().showDocument(m_docUrl, m_target); } if (m_audio != null) m_audio.play(); return true; }
public String[][] getParameterInfo() { String info[][] = { { "image", "String", "Normal button image" }, { "hoverImage", "String", "Hover button image" }, { "bgColor", "int", "Background color" }, { "color", "int", "Normal color" }, { "hoverColor", "int", "Hover color" }, { "effect", "int", "Effect for hover image" }, { "sound", "String", "Sound Url" }, { "hoverSound", "String", "Hover sound Url" }, { "url", "String", "Url" }, { "target", "String", "Target frame" }, { "text", "String", "Text" }, { "textColor", "int", "Text color" }, { "textAlign", "String", "Text alignment" }, { "textVAlign", "String", "Text vertical alignment" }, { "font", "String", "Font" }, { "fontStyle", "String", "Font style" }, { "fontSize", "int", "Font size in points" } }; return info; }
public void destroy() { }
public fphover() { m_image = ""; m_hoverImage = ""; m_bgColor = Color.white; m_color = Color.white; m_hoverColor = Color.white; m_effectString = ""; m_sound = ""; m_hoverSound = ""; m_url = ""; m_target = ""; m_text = ""; m_textColor = Color.black; m_textAlign = "center"; m_textVAlign = "middle"; m_font = "Dialog"; m_fontStyle = "bold"; m_fontSize = 14; m_hoverType = 2; }
public void getXY() { m_w = size().width; m_h = size().height; m_x = 0; m_y = 0; if (m_textMask) { if (m_textImageWidth < 0 || m_textImageHeight < 0) return; if (m_iTextAlign == 0) m_x = (m_w - m_textImageWidth) / 2; else if (m_iTextAlign == 1) m_x = m_w - m_textImageWidth; if (m_iTextVAlign == 0) m_y = (m_h - m_textImageHeight) / 2; else if (m_iTextVAlign == 1) m_y = m_h - m_textImageHeight; } else { m_x = (m_w - m_textWidth) / 2; m_y = (m_h + m_fm.getAscent() - m_fm.getDescent()) / 2; } }
public void update(Graphics g) { if (!m_noErase) g.clearRect(0, 0, size().width, size().height); paint(g); }
public void start() { }
public String getAppletInfo() { return "Name: fphover\r\n" + "Author: Tom Blumer\r\n" + "Created with Microsoft Visual J++ Version 1.1"; }
public boolean mouseDown(Event evt, int x, int y) { return true; }
public void init() { MediaTracker tracker; int iw; int ih; int hiw; int hih; MediaTracker tracker2; MalformedURLException e; String param = getParameter("image"); if (param != null) m_image = param; if (!m_image.equalsIgnoreCase("")) m_normalType = 1; param = getParameter("hoverImage"); if (param != null) m_hoverImage = param; if (!m_hoverImage.equalsIgnoreCase("")) m_hoverType = 1; param = getParameter("bgColor"); if (param != null) { if (param.charAt(0) == 35) param = param.substring(1); m_bgColor = new Color(Integer.parseInt(param, 16)); } param = getParameter("color"); if (param != null) { if (param.charAt(0) == 35) param = param.substring(1); m_color = new Color(Integer.parseInt(param, 16)); } param = getParameter("hoverColor"); if (param != null) { if (param.charAt(0) == 35) param = param.substring(1); m_hoverColor = new Color(Integer.parseInt(param, 16)); } param = getParameter("effect"); if (param != null) m_effectString = param; m_effect = 2; if (m_effectString.equalsIgnoreCase("fill")) m_effect = 0; else if (m_effectString.equalsIgnoreCase("average")) m_effect = 1; else if (m_effectString.equalsIgnoreCase("glow")) m_effect = 2; else if (m_effectString.equalsIgnoreCase("reverseGlow")) m_effect = 3; else if (m_effectString.equalsIgnoreCase("lightglow")) m_effect = 4; else if (m_effectString.equalsIgnoreCase("bevelOut")) m_effect = 5; else if (m_effectString.equalsIgnoreCase("bevelIn")) m_effect = 6; param = getParameter("sound"); if (param != null) m_sound = param; param = getParameter("hoverSound"); if (param != null) m_hoverSound = param; param = getParameter("url"); if (param != null) m_url = param; param = getParameter("target"); if (param != null) m_target = param; param = getParameter("text"); if (param != null) m_text = param; param = getParameter("textColor"); if (param != null) { if (param.charAt(0) == 35) param = param.substring(1); m_textColor = new Color(Integer.parseInt(param, 16)); } param = getParameter("textAlign"); if (param != null) m_textAlign = param; m_iTextAlign = 0; if (m_textAlign.equalsIgnoreCase("left")) m_iTextAlign = -1; else if (m_textAlign.equalsIgnoreCase("right")) m_iTextAlign = 1; param = getParameter("textVAlign"); if (param != null) m_textVAlign = param; m_iTextVAlign = 0; if (m_textVAlign.equalsIgnoreCase("top")) m_iTextVAlign = -1; else if (m_textVAlign.equalsIgnoreCase("bottom")) m_iTextVAlign = 1; param = getParameter("font"); if (param != null) m_font = param; m_textMask = m_font.equalsIgnoreCase("") || m_font.equalsIgnoreCase("TextMask"); param = getParameter("fontStyle"); if (param != null) m_fontStyle = param; param = getParameter("fontSize"); if (param != null) m_fontSize = Integer.parseInt(param); setBackground(m_bgColor); tracker = new MediaTracker(this); if (m_textMask) { m_textImage = getImage(getDocumentBase(), m_text); tracker.addImage(m_textImage, 1); } else { int nStyle = 0; if (m_fontStyle.equalsIgnoreCase("bold")) nStyle = 1; if (m_fontStyle.equalsIgnoreCase("italic")) nStyle = 2; if (m_fontStyle.equalsIgnoreCase("bolditalic")) nStyle = 3; Font font = new Font(m_font, nStyle, m_fontSize); setFont(font); m_fm = getFontMetrics(font); m_textWidth = m_fm.stringWidth(m_text); } int w = size().width; int h = size().height; if (m_normalType == 1) { m_srcImage = getImage(getDocumentBase(), m_image); tracker.addImage(m_srcImage, 2); } else { m_srcImage = createImage(w, h); Graphics g = m_srcImage.getGraphics(); g.setColor(m_color); g.fillRect(0, 0, w, h); } if (m_hoverType == 1) { m_srcHoverImage = getImage(getDocumentBase(), m_hoverImage); tracker.addImage(m_srcHoverImage, 3); } try { tracker.waitForAll(); } catch(java.lang.InterruptedException e3){}
m_textImageError = tracker.isErrorID(1); m_srcImageError = tracker.isErrorID(2); m_srcHoverImageError = tracker.isErrorID(3);
iw = m_srcImage.getWidth(this); ih = m_srcImage.getHeight(this); hiw = iw; hih = ih; if (m_hoverType == 1) { hiw = m_srcHoverImage.getWidth(this); hih = m_srcHoverImage.getHeight(this); } if (m_textMask) { m_textImageWidth = m_textImage.getWidth(this); m_textImageHeight = m_textImage.getHeight(this); } tracker2 = new MediaTracker(this); m_applyEffectWait = false; if (m_textMask && m_textColor != Color.black && !m_textImageError) { m_textImage = applyEffect(m_textImage, 7, m_textColor); tracker2.addImage(m_textImage, 3); m_applyEffectWait = true; } if (m_hoverType == 2) { m_srcHoverImage = applyEffect(m_srcImage, m_effect, m_hoverColor); tracker2.addImage(m_srcHoverImage, 2); m_applyEffectWait = true; } /* if (!m_applyEffectWait) goto 1221 else 1211;*/ try { tracker2.waitForAll(); } catch(java.lang.InterruptedException e3){}
try { m_docUrl = new URL(getDocumentBase(), m_url); } catch(java.net.MalformedURLException e2){}
if (!m_sound.equalsIgnoreCase("")) m_audio = getAudioClip(getDocumentBase(), m_sound); if (!m_hoverSound.equalsIgnoreCase("")) m_hoverAudio = getAudioClip(getDocumentBase(), m_hoverSound); if (iw == hiw && ih == hih && iw > 0 && ih > 0) { m_noErase = true; Image imageTemp = createImage(iw, ih); Graphics gs = imageTemp.getGraphics(); gs.setColor(m_bgColor); gs.fillRect(0, 0, iw, ih); gs.drawImage(m_srcImage, 0, 0, null); m_srcImage = imageTemp; Image hoverImageTemp = createImage(iw, ih); Graphics gh = hoverImageTemp.getGraphics(); gh.setColor(m_bgColor); gh.fillRect(0, 0, iw, ih); gh.drawImage(m_srcHoverImage, 0, 0, null); m_srcHoverImage = hoverImageTemp; }
//{{REGISTER_LISTENERS SymMouse aSymMouse = new SymMouse(); this.addMouseListener(aSymMouse); SymKey aSymKey = new SymKey(); this.addKeyListener(aSymKey); //}} }
public boolean mouseDrag(Event evt, int x, int y) { return true; }
public Image applyEffect(Image srcImage, int effect, Color color) { int w = size().width; int h = size().height; java.awt.image.ImageFilter filter = new fphoverx(w, h, color, effect); java.awt.image.ImageProducer producer = new FilteredImageSource(srcImage.getSource(), filter); Image srcNewImage = createImage(producer); return srcNewImage; }
class SymMouse extends java.awt.event.MouseAdapter { public void mousePressed(java.awt.event.MouseEvent event) { Object object = event.getSource(); if (object == fphover.this) fphover_MousePressed(event); } }
void fphover_MousePressed(java.awt.event.MouseEvent event) { // to do: code goes here. }
class SymKey extends java.awt.event.KeyAdapter { public void keyPressed(java.awt.event.KeyEvent event) { Object object = event.getSource(); if (object == fphover.this) fphover_KeyPressed(event); } }
void fphover_KeyPressed(java.awt.event.KeyEvent event) { // to do: code goes here. } } ***************************************** fphoverx.java : ********************************** /* Decompiled by Mocha from fphover.class */ /* Originally compiled from fphover.java */
import java.applet.*; import java.awt.*; import java.lang.String; import java.awt.image.FilteredImageSource; import java.net.MalformedURLException; import java.net.URL;
public class fphover extends Applet { private String m_image; private String m_hoverImage; private Color m_bgColor; private Color m_color; private Color m_hoverColor; private String m_effectString; private String m_sound; private String m_hoverSound; private String m_url; private String m_target; private String m_text; private Color m_textColor; private String m_textAlign; private String m_textVAlign; private String m_font; private String m_fontStyle; private int m_fontSize; private final String PARAM_image = "image"; private final String PARAM_hoverImage = "hoverImage"; private final String PARAM_bgColor = "bgColor"; private final String PARAM_color = "color"; private final String PARAM_hoverColor = "hoverColor"; private final String PARAM_effect = "effect"; private final String PARAM_sound = "sound"; private final String PARAM_hoverSound = "hoverSound"; private final String PARAM_url = "url"; private final String PARAM_target = "target"; private final String PARAM_text = "text"; private final String PARAM_textColor = "textColor"; private final String PARAM_textAlign = "textAlign"; private final String PARAM_textVAlign = "textVAlign"; private final String PARAM_font = "font"; private final String PARAM_fontStyle = "fontStyle"; private final String PARAM_fontSize = "fontSize"; private int m_effect; private Image m_srcImage; private Image m_srcHoverImage; private AudioClip m_audio; private AudioClip m_hoverAudio; private URL m_docUrl; private int m_hover; private int m_textWidth; private boolean m_textMask; private Image m_textImage; private int m_iTextAlign; private int m_iTextVAlign; private int m_textImageWidth; private int m_textImageHeight; private boolean m_textImageError; private boolean m_srcImageError; private boolean m_srcHoverImageError; private boolean m_applyEffectWait; private FontMetrics m_fm; private static final int COLOR = 0; private static final int IMAGE = 1; private static final int EFFECT = 2; private int m_normalType; private int m_hoverType; private boolean m_noErase; private int m_w; private int m_h; private int m_x; private int m_y;
public boolean mouseMove(Event evt, int x, int y) { return true; }
public void stop() { }
public boolean mouseEnter(Event evt, int x, int y) { m_hover = 1; if (m_hoverAudio != null) m_hoverAudio.play(); showStatus(m_url); if (m_normalType != 1 || m_hoverType != 1 || !m_image.equals(m_hoverImage)) repaint(); return true; }
public boolean mouseExit(Event evt, int x, int y) { m_hover = 0; if (m_normalType != 1 || m_hoverType != 1 || !m_image.equals(m_hoverImage)) repaint(); return true; }
public void paint(Graphics g) { getXY(); if (m_hover != 0) { if (!m_srcHoverImageError) g.drawImage(m_srcHoverImage, 0, 0, this); if (m_effect == 5) { m_x += -1; m_y += -1; } if (m_effect == 6) { m_x++; m_y++; } } else if (!m_srcImageError) g.drawImage(m_srcImage, 0, 0, this); if (m_textMask) if (!m_textImageError) g.drawImage(m_textImage, m_x, m_y, this); g.setColor(m_textColor); g.drawString(m_text, m_x, m_y); }
public boolean mouseUp(Event evt, int x, int y) { if (!m_url.equalsIgnoreCase("") && m_docUrl != null) { if (m_target.equalsIgnoreCase("")) getAppletContext().showDocument(m_docUrl); else getAppletContext().showDocument(m_docUrl, m_target); } if (m_audio != null) m_audio.play(); return true; }
public String[][] getParameterInfo() { String info[][] = { { "image", "String", "Normal button image" }, { "hoverImage", "String", "Hover button image" }, { "bgColor", "int", "Background color" }, { "color", "int", "Normal color" }, { "hoverColor", "int", "Hover color" }, { "effect", "int", "Effect for hover image" }, { "sound", "String", "Sound Url" }, { "hoverSound", "String", "Hover sound Url" }, { "url", "String", "Url" }, { "target", "String", "Target frame" }, { "text", "String", "Text" }, { "textColor", "int", "Text color" }, { "textAlign", "String", "Text alignment" }, { "textVAlign", "String", "Text vertical alignment" }, { "font", "String", "Font" }, { "fontStyle", "String", "Font style" }, { "fontSize", "int", "Font size in points" } }; return info; }
public void destroy() { }
public fphover() { m_image = ""; m_hoverImage = ""; m_bgColor = Color.white; m_color = Color.white; m_hoverColor = Color.white; m_effectString = ""; m_sound = ""; m_hoverSound = ""; m_url = ""; m_target = ""; m_text = ""; m_textColor = Color.black; m_textAlign = "center"; m_textVAlign = "middle"; m_font = "Dialog"; m_fontStyle = "bold"; m_fontSize = 14; m_hoverType = 2; }
public void getXY() { m_w = size().width; m_h = size().height; m_x = 0; m_y = 0; if (m_textMask) { if (m_textImageWidth < 0 || m_textImageHeight < 0) return; if (m_iTextAlign == 0) m_x = (m_w - m_textImageWidth) / 2; else if (m_iTextAlign == 1) m_x = m_w - m_textImageWidth; if (m_iTextVAlign == 0) m_y = (m_h - m_textImageHeight) / 2; else if (m_iTextVAlign == 1) m_y = m_h - m_textImageHeight; } else { m_x = (m_w - m_textWidth) / 2; m_y = (m_h + m_fm.getAscent() - m_fm.getDescent()) / 2; } }
public void update(Graphics g) { if (!m_noErase) g.clearRect(0, 0, size().width, size().height); paint(g); }
public void start() { }
public String getAppletInfo() { return "Name: fphover\r\n" + "Author: Tom Blumer\r\n" + "Created with Microsoft Visual J++ Version 1.1"; }
public boolean mouseDown(Event evt, int x, int y) { return true; }
public void init() { MediaTracker tracker; int iw; int ih; int hiw; int hih; MediaTracker tracker2; MalformedURLException e; String param = getParameter("image"); if (param != null) m_image = param; if (!m_image.equalsIgnoreCase("")) m_normalType = 1; param = getParameter("hoverImage"); if (param != null) m_hoverImage = param; if (!m_hoverImage.equalsIgnoreCase("")) m_hoverType = 1; param = getParameter("bgColor"); if (param != null) { if (param.charAt(0) == 35) param = param.substring(1); m_bgColor = new Color(Integer.parseInt(param, 16)); } param = getParameter("color"); if (param != null) { if (param.charAt(0) == 35) param = param.substring(1); m_color = new Color(Integer.parseInt(param, 16)); } param = getParameter("hoverColor"); if (param != null) { if (param.charAt(0) == 35) param = param.substring(1); m_hoverColor = new Color(Integer.parseInt(param, 16)); } param = getParameter("effect"); if (param != null) m_effectString = param; m_effect = 2; if (m_effectString.equalsIgnoreCase("fill")) m_effect = 0; else if (m_effectString.equalsIgnoreCase("average")) m_effect = 1; else if (m_effectString.equalsIgnoreCase("glow")) m_effect = 2; else if (m_effectString.equalsIgnoreCase("reverseGlow")) m_effect = 3; else if (m_effectString.equalsIgnoreCase("lightglow")) m_effect = 4; else if (m_effectString.equalsIgnoreCase("bevelOut")) m_effect = 5; else if (m_effectString.equalsIgnoreCase("bevelIn")) m_effect = 6; param = getParameter("sound"); if (param != null) m_sound = param; param = getParameter("hoverSound"); if (param != null) m_hoverSound = param; param = getParameter("url"); if (param != null) m_url = param; param = getParameter("target"); if (param != null) m_target = param; param = getParameter("text"); if (param != null) m_text = param; param = getParameter("textColor"); if (param != null) { if (param.charAt(0) == 35) param = param.substring(1); m_textColor = new Color(Integer.parseInt(param, 16)); } param = getParameter("textAlign"); if (param != null) m_textAlign = param; m_iTextAlign = 0; if (m_textAlign.equalsIgnoreCase("left")) m_iTextAlign = -1; else if (m_textAlign.equalsIgnoreCase("right")) m_iTextAlign = 1; param = getParameter("textVAlign"); if (param != null) m_textVAlign = param; m_iTextVAlign = 0; if (m_textVAlign.equalsIgnoreCase("top")) m_iTextVAlign = -1; else if (m_textVAlign.equalsIgnoreCase("bottom")) m_iTextVAlign = 1; param = getParameter("font"); if (param != null) m_font = param; m_textMask = m_font.equalsIgnoreCase("") || m_font.equalsIgnoreCase("TextMask"); param = getParameter("fontStyle"); if (param != null) m_fontStyle = param; param = getParameter("fontSize"); if (param != null) m_fontSize = Integer.parseInt(param); setBackground(m_bgColor); tracker = new MediaTracker(this); if (m_textMask) { m_textImage = getImage(getDocumentBase(), m_text); tracker.addImage(m_textImage, 1); } else { int nStyle = 0; if (m_fontStyle.equalsIgnoreCase("bold")) nStyle = 1; if (m_fontStyle.equalsIgnoreCase("italic")) nStyle = 2; if (m_fontStyle.equalsIgnoreCase("bolditalic")) nStyle = 3; Font font = new Font(m_font, nStyle, m_fontSize); setFont(font); m_fm = getFontMetrics(font); m_textWidth = m_fm.stringWidth(m_text); } int w = size().width; int h = size().height; if (m_normalType == 1) { m_srcImage = getImage(getDocumentBase(), m_image); tracker.addImage(m_srcImage, 2); } else { m_srcImage = createImage(w, h); Graphics g = m_srcImage.getGraphics(); g.setColor(m_color); g.fillRect(0, 0, w, h); } if (m_hoverType == 1) { m_srcHoverImage = getImage(getDocumentBase(), m_hoverImage); tracker.addImage(m_srcHoverImage, 3); } try { tracker.waitForAll(); } catch(java.lang.InterruptedException e3){}
m_textImageError = tracker.isErrorID(1); m_srcImageError = tracker.isErrorID(2); m_srcHoverImageError = tracker.isErrorID(3);
iw = m_srcImage.getWidth(this); ih = m_srcImage.getHeight(this); hiw = iw; hih = ih; if (m_hoverType == 1) { hiw = m_srcHoverImage.getWidth(this); hih = m_srcHoverImage.getHeight(this); } if (m_textMask) { m_textImageWidth = m_textImage.getWidth(this); m_textImageHeight = m_textImage.getHeight(this); } tracker2 = new MediaTracker(this); m_applyEffectWait = false; if (m_textMask && m_textColor != Color.black && !m_textImageError) { m_textImage = applyEffect(m_textImage, 7, m_textColor); tracker2.addImage(m_textImage, 3); m_applyEffectWait = true; } if (m_hoverType == 2) { m_srcHoverImage = applyEffect(m_srcImage, m_effect, m_hoverColor); tracker2.addImage(m_srcHoverImage, 2); m_applyEffectWait = true; } /* if (!m_applyEffectWait) goto 1221 else 1211;*/ try { tracker2.waitForAll(); } catch(java.lang.InterruptedException e3){}
try { m_docUrl = new URL(getDocumentBase(), m_url); } catch(java.net.MalformedURLException e2){}
if (!m_sound.equalsIgnoreCase("")) m_audio = getAudioClip(getDocumentBase(), m_sound); if (!m_hoverSound.equalsIgnoreCase("")) m_hoverAudio = getAudioClip(getDocumentBase(), m_hoverSound); if (iw == hiw && ih == hih && iw > 0 && ih > 0) { m_noErase = true; Image imageTemp = createImage(iw, ih); Graphics gs = imageTemp.getGraphics(); gs.setColor(m_bgColor); gs.fillRect(0, 0, iw, ih); gs.drawImage(m_srcImage, 0, 0, null); m_srcImage = imageTemp; Image hoverImageTemp = createImage(iw, ih); Graphics gh = hoverImageTemp.getGraphics(); gh.setColor(m_bgColor); gh.fillRect(0, 0, iw, ih); gh.drawImage(m_srcHoverImage, 0, 0, null); m_srcHoverImage = hoverImageTemp; }
//{{REGISTER_LISTENERS SymMouse aSymMouse = new SymMouse(); this.addMouseListener(aSymMouse); SymKey aSymKey = new SymKey(); this.addKeyListener(aSymKey); //}} }
public boolean mouseDrag(Event evt, int x, int y) { return true; }
public Image applyEffect(Image srcImage, int effect, Color color) { int w = size().width; int h = size().height; java.awt.image.ImageFilter filter = new fphoverx(w, h, color, effect); java.awt.image.ImageProducer producer = new FilteredImageSource(srcImage.getSource(), filter); Image srcNewImage = createImage(producer); return srcNewImage; }
class SymMouse extends java.awt.event.MouseAdapter { public void mousePressed(java.awt.event.MouseEvent event) { Object object = event.getSource(); if (object == fphover.this) fphover_MousePressed(event); } }
void fphover_MousePressed(java.awt.event.MouseEvent event) { // to do: code goes here. }
class SymKey extends java.awt.event.KeyAdapter { public void keyPressed(java.awt.event.KeyEvent event) { Object object = event.getSource(); if (object == fphover.this) fphover_KeyPressed(event); } }
void fphover_KeyPressed(java.awt.event.KeyEvent event) { // to do: code goes here. } } ****************************************´ /* Decompiled by Mocha from fphoverx.class */ /* Originally compiled from fphover.java */
import java.awt.Color; import java.awt.image.RGBImageFilter;
class fphoverx extends RGBImageFilter { private int m_w; private int m_h; private int m_xc; private int m_yc; private int m_dmax; private int m_r; private int m_g; private int m_b; private int m_effect; private int m_bevelSize;
public fphoverx(int w, int h, Color color, int effect) { canFilterIndexColorModel = false; m_w = w; m_h = h; m_xc = w / 2; m_yc = h / 2; m_dmax = m_xc * m_xc + m_yc * m_yc; m_r = color.getRed(); m_g = color.getGreen(); m_b = color.getBlue(); m_effect = effect; m_bevelSize = (w < h) ? (w / 12) : (h / 12); if (m_bevelSize < 2) m_bevelSize = 2; }
public int filterRGB(int x, int y, int rgb) { int r; int g; int b; int d = (x - m_xc) * (x - m_xc) + (y - m_yc) * (y - m_yc); r = (rgb & 16711680) >> 16; g = (rgb & 65280) >> 8; b = rgb & 255; switch (m_effect) { case 0: r = m_r; g = m_g; b = m_b; break;
case 1: r = r + m_r >> 1; g = g + m_g >> 1; b = b + m_b >> 1; break;
case 2: r = m_r + (r - m_r) * d / m_dmax; g = m_g + (g - m_g) * d / m_dmax; b = m_b + (b - m_b) * d / m_dmax; break;
case 3: r += (m_r - r) * d / m_dmax; g += (m_g - g) * d / m_dmax; b += (m_b - b) * d / m_dmax; break;
case 4: r = r + 255 - (255 - r) * d / m_dmax >> 1; g = g + 255 - (255 - g) * d / m_dmax >> 1; b = b + 255 - (255 - b) * d / m_dmax >> 1; break;
case 5: case 6: if (x < m_bevelSize || m_w - 1 - x < m_bevelSize || y < m_bevelSize || m_h - 1 - y < m_bevelSize) { Color color = new Color(r, g, b); boolean topLeft = false; if (x < m_bevelSize && x + y <= m_h) topLeft = true; else if (y < m_bevelSize && x + y <= m_w) topLeft = true; if (topLeft && m_effect == 5 || !topLeft && m_effect == 6) color = color.brighter(); else color = color.darker(); r = color.getRed(); g = color.getGreen(); b = color.getBlue(); } break;
case 7: if (r == 0 && g == 0 && b == 0) { r = m_r; g = m_g; b = m_b; } break; } return rgb & -16777216 | r << 16 | g << 8 | b; } }
Sadly, neither Web Developer's Journal, Markland Communities, Inc., Paige Turner nor anyone else associated with sponsoring these discussion groups can in any way be held responsible for any advice given here. The great unwashed masses of the public Internet hang out here and freely offer advice to all who seek it and some who don't. Take any advice received here with the proverbial grain of salt.Last changed: November 04, 1998 |
|
|
Discuss Subscribe Search |