stoopid
yet another "stoopid" panning marquee applet.
downloadable project file is contained within a compressed archive (zip) to be more "security software/hardware friendly" as these archives are often less scrutinized (which is hilarious) while executable binaries are most scrutinized, often blocked outright by software/application firewalls for example.
if you know how much time it'll take to get to ih-635, as indicated in the picture below, then your browser doesn't support java. so sorry!
however, if you've no idea what i'm talking about then press on, press on adventurer!
during the latter 1990s, panning marquee applets were all the rage on the world wide web. it was during this time that i started my own panning marquee applet project, stoopid. (which is mostly based off the multithreaded panning marquee applet example found in the book that came with my copy of visual j++, learn java now.) it has since undergone numerous periodical rewrites with its most recent rewrite likely being its last. this applet has long since become obsolete. 350+ lines of compiled java code is now equivalent to just a couple lines of interpreted html and javascript.
stoopid is a highly customizable panning marquee applet. nearly all aspects of it can be modified (some of which can be done on-the-fly):
- the marquee text (like... duh?)
- the marquee text font
- the marquee text font size (in points)
- the marquee text font color
- the marquee background color
- the marquee text font color on "mouse over"/"hover"
- the marquee text scroll speed (in frames per second)
- the browser statusbar text on "mouse over"/"hover"
- the url to navigate to on mouse click
- the frame in which to load the aforementioned url
while this panning marquee applet doesn't support images it can be scripted. it's also double buffered so it doesn't "blink".
don't take my word for it, try it out!
don't read on expecting something along the lines of step-by-step instructions, let alone any instructions, on how to use java applets with html, let alone how to use stoopid with html. if you have to ask, you'll never know (until you learn how-to… which would be somewhere other than here). peter rabbit would be wise to stay out of mr. mcgregor's garden.
stoopid_functionsstoopid functions
- about()
- returns information about the applet.
- setString(String s)
- sets the value for the parameter StoopidString. (e.g. document.stoopid.setString('Visit nerpter77.com now!').)
- getString()
- gets the value for the parameter StoopidString.
- setStatus(String s)
- sets the value for the parameter StoopidStatus. (e.g. document.stoopid.setStatus('Click to visit nerpter77.com now!').)
- getStatus()
- gets the value for the parameter StoopidStatus.
- setURL(String s)
- sets the value for the parameter StoopidURL. (e.g. document.stoopid.setURL('http://nerpter77.com/').)
- getURL()
- gets the value for the parameter StoopidURL.
- setTarget(String s)
- sets the value for the parameter StoopidTarget. (e.g. document.stoopid.setTarget('_self').)
- getTarget()
- gets the value for the parameter StoopidTarget.
stoopid_parametersstoopid parameters
- StoopidString
- text of panning marquee. (e.g. Waffles?.)
- StoopidFont
- typeface of panning marquee text. (e.g. Verdana.)
- StoopidSize
- point size of panning marquee text typeface. (e.g. 18.)
- StoopidFGColorR
- red value of panning marquee text. (e.g. 0.)
- StoopidFGColorG
- green value of panning marquee text. (e.g. 0.)
- StoopidFGColorB
- blue value of panning marquee text. (e.g. 0.)
- StoopidBGColorR
- red value of panning marquee background. (e.g. 255.)
- StoopidBGColorG
- green value of panning marquee background. (e.g. 128.)
- StoopidBGColorB
- blue value of panning marquee background. (e.g. 0.)
- StoopidHColorR
- red value of panning marquee mouse hover text. (e.g. 255.)
- StoopidHColorG
- green value of panning marquee mouse hover text. (e.g. 255.)
- StoopidHColorB
- blue value of panning marquee mouse hover text. (e.g. 0.)
- StoopidFPS
- speed of panning marquee text in seconds. (e.g. 60.)
- StoopidStatus
- browser statusbar text on panning marquee mouse hover. (e.g. Goes well with syrup!.)
- StoopidURL
- hyperlink for panning marquee mouse click. (e.g. http://www.google.com/.)
- StoopidTarget
- target of panning marquee hyperlink. (e.g. _blank.)
stoopid_downloadstoopid download
i wrote this in visual j++ 1.1.
- stoopid.zip (4.12 kilobytes; archive contains md5 checksum of included binary file)
- stoopid.
md5 checksum: db57d2b09e0e31fc11e5787363974dc7
- stoopid.java
-
stoopid source. this source code isn't commented. i don't like to comment. if you know how to code, especially in java, it's straight forward enough to not warrant code comments.
/*
* Stoopid.java
*
* Yet another "stoopid" panning marquee applet.
*
* (C)MMXI Ickis <ickis@nerpter77.com>. Permission to use, copy, modify, and
* distribute this software and its documentation for non-commercial purposes
* and without fee is hereby granted.
*
*/
import java.applet.Applet;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Event;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Image;
import java.net.URL;
import java.net.MalformedURLException;
public class Stoopid extends Applet implements Runnable
{
private Thread m_Stoopid = null;
private int m_StoopidSize = 12;
private int m_StoopidOffset;
private int m_StoopidVOffset;
private int m_StoopidMax;
private int m_StoopidMin;
private int m_StoopidFGColorR = 0;
private int m_StoopidFGColorG = 0;
private int m_StoopidFGColorB = 0;
private int m_StoopidBGColorR = 255;
private int m_StoopidBGColorG = 255;
private int m_StoopidBGColorB = 255;
private int m_StoopidHColorR = 255;
private int m_StoopidHColorG = 0;
private int m_StoopidHColorB = 0;
private long m_StoopidFPS = 75;
private boolean m_MouseOver = false;
private boolean m_Scrolling = true;
private boolean m_Suspend = false;
private String m_StoopidStatus = "Click for more information <http://nerpter77.com/java/stoopid.html>.";
private String m_StoopidString = "Yet another \"stoopid\" panning marquee applet.";
private String m_StoopidURL = "http://nerpter77.com/java/stoopid.html";
private String m_StoopidTarget = "_blank";
private String m_StoopidFont = "Arial";
private final String PARAM_StoopidString = "StoopidString";
private final String PARAM_StoopidFont = "StoopidFont";
private final String PARAM_StoopidSize = "StoopidSize";
private final String PARAM_StoopidFGColorR = "StoopidFGColorR";
private final String PARAM_StoopidFGColorG = "StoopidFGColorG";
private final String PARAM_StoopidFGColorB = "StoopidFGColorB";
private final String PARAM_StoopidBGColorR = "StoopidBGColorR";
private final String PARAM_StoopidBGColorG = "StoopidBGColorG";
private final String PARAM_StoopidBGColorB = "StoopidBGColorB";
private final String PARAM_StoopidHColorR = "StoopidHColorR";
private final String PARAM_StoopidHColorG = "StoopidHColorG";
private final String PARAM_StoopidHColorB = "StoopidHColorB";
private final String PARAM_StoopidFPS = "StoopidFPS";
private final String PARAM_StoopidStatus = "StoopidStatus";
private final String PARAM_StoopidURL = "StoopidURL";
private final String PARAM_StoopidTarget = "StoopidTarget";
private Image m_image;
private Graphics m_g;
Dimension m_dimImage;
public String about()
{
return "Stoopid\n\nYet another \"stoopid\" panning marquee applet.\n\n(C)MMXI Ickis <ickis@nerpter77.com>.";
}
public void setString(String s)
{
Font m_Font = new Font(m_StoopidFont,Font.PLAIN,m_StoopidSize);
setFont(m_Font);
FontMetrics fm = getFontMetrics(m_Font);
m_StoopidString = s;
m_StoopidMin = -fm.stringWidth(m_StoopidString);
m_StoopidMax = size().width;
m_StoopidOffset = m_StoopidMax;
m_StoopidVOffset = fm.getHeight();
if (m_Suspend == true) repaint();
}
public String getString()
{
return m_StoopidString;
}
public void setStatus(String s)
{
m_StoopidStatus = s;
}
public String getStatus()
{
return m_StoopidStatus;
}
public void setURL(String s)
{
m_StoopidURL = s;
}
public String getURL()
{
return m_StoopidURL;
}
public void setTarget(String s)
{
m_StoopidTarget = s;
}
public String getTarget()
{
return m_StoopidTarget;
}
public void init()
{
String param;
param = getParameter(PARAM_StoopidString);
if (param != null) m_StoopidString = param;
param = getParameter(PARAM_StoopidFont);
if (param != null) m_StoopidFont = param;
param = getParameter(PARAM_StoopidSize);
if (param != null) m_StoopidSize = Integer.parseInt(param);
param = getParameter(PARAM_StoopidFGColorR);
if (param != null) m_StoopidFGColorR = Integer.parseInt(param);
param = getParameter(PARAM_StoopidFGColorG);
if (param != null) m_StoopidFGColorG = Integer.parseInt(param);
param = getParameter(PARAM_StoopidFGColorB);
if (param != null) m_StoopidFGColorB = Integer.parseInt(param);
param = getParameter(PARAM_StoopidBGColorR);
if (param != null) m_StoopidBGColorR = Integer.parseInt(param);
param = getParameter(PARAM_StoopidBGColorG);
if (param != null) m_StoopidBGColorG = Integer.parseInt(param);
param = getParameter(PARAM_StoopidBGColorB);
if (param != null) m_StoopidBGColorB = Integer.parseInt(param);
param = getParameter(PARAM_StoopidHColorR);
if (param != null) m_StoopidHColorR = Integer.parseInt(param);
param = getParameter(PARAM_StoopidHColorG);
if (param != null) m_StoopidHColorG = Integer.parseInt(param);
param = getParameter(PARAM_StoopidHColorB);
if (param != null) m_StoopidHColorB = Integer.parseInt(param);
param = getParameter(PARAM_StoopidFPS);
if (param != null) m_StoopidFPS = Integer.parseInt(param);
param = getParameter(PARAM_StoopidStatus);
if (param != null) m_StoopidStatus = param;
param = getParameter(PARAM_StoopidURL);
if (param != null) m_StoopidURL = param;
param = getParameter(PARAM_StoopidTarget);
if (param != null) m_StoopidTarget = param;
Font m_Font = new Font(m_StoopidFont,Font.PLAIN,m_StoopidSize);
setFont(m_Font);
FontMetrics fm = getFontMetrics(m_Font);
m_StoopidMin = -fm.stringWidth(m_StoopidString);
m_StoopidMax = size().width;
m_StoopidOffset = m_StoopidMax;
m_StoopidVOffset = fm.getHeight();
m_MouseOver = false;
if (m_StoopidFPS == 0)
{
m_Scrolling = false;
}
else
{
m_Scrolling = true;
}
}
public void paint(Graphics g)
{
if (m_image != null)
{
g.drawImage(m_image,0,0,null);
}
else
{
int m_StoopidVertOffset = size().height;
m_StoopidVertOffset = (m_StoopidVertOffset - m_StoopidVOffset) / 2;
g.drawString("Loading...",0,m_StoopidVertOffset + m_StoopidSize);
}
}
public void update(Graphics g)
{
Color colFG = getForeground();
Color colBG = getBackground();
m_dimImage = new Dimension(size().width,size().height);
m_image = createImage(size().width,size().height);
m_g = m_image.getGraphics();
m_g.setColor(colBG);
m_g.fillRect(0,0,size().width,size().height);
m_g.setColor(colFG);
paintMarquee(m_g);
paint(g);
}
public void paintMarquee(Graphics g)
{
int m_StoopidVertOffset = size().height;
m_StoopidVertOffset = (m_StoopidVertOffset - m_StoopidVOffset) / 2;
setBackground(new Color(m_StoopidBGColorR,m_StoopidBGColorG,m_StoopidBGColorB));
if (m_MouseOver == true)
{
g.setColor(new Color(m_StoopidHColorR,m_StoopidHColorG,m_StoopidHColorB));
}
else
{
g.setColor(new Color(m_StoopidFGColorR,m_StoopidFGColorG,m_StoopidFGColorB));
}
if (m_Scrolling == true)
{
g.drawString(m_StoopidString,m_StoopidOffset,m_StoopidVertOffset + m_StoopidSize);
if (m_Suspend != true) m_StoopidOffset--;
if (m_StoopidOffset < m_StoopidMin) m_StoopidOffset = m_StoopidMax;
}
else
{
g.drawString(m_StoopidString,0,m_StoopidVertOffset + m_StoopidSize);
}
}
public void start()
{
if (m_Scrolling == true)
{
if (m_Stoopid == null)
{
m_Stoopid = new Thread(this);
m_Stoopid.start();
}
}
}
public void stop()
{
if (m_Scrolling == true)
{
if (m_Stoopid != null)
{
m_Stoopid.stop();
m_Stoopid = null;
}
}
}
public void run()
{
if (m_Scrolling == true)
{
while (true)
{
long m_StoopidSleepValue = 1000 / m_StoopidFPS;
try
{
repaint();
Thread.sleep(m_StoopidSleepValue);
}
catch (InterruptedException e)
{
stop();
}
}
}
}
public void suspend()
{
if (m_Scrolling == true)
{
if (m_Stoopid != null)
{
m_Suspend = true;
m_Stoopid.stop();
m_Stoopid = null;
}
else
{
m_Suspend = false;
m_Stoopid = new Thread(this);
m_Stoopid.start();
}
}
}
public boolean mouseDown(Event evt, int x, int y)
{
if (m_StoopidURL.length() > 0)
{
try
{
URL u = new URL(m_StoopidURL);
getAppletContext().showDocument(u, m_StoopidTarget);
}
catch (MalformedURLException e)
{
showStatus("Cannot connect to: \"" + m_StoopidURL + "\".");
}
}
return true;
}
public boolean mouseUp(Event evt, int x, int y)
{
return true;
}
public boolean mouseEnter(Event evt, int x, int y)
{
if (m_Suspend == false) m_Stoopid.stop();
if (m_StoopidStatus.length() > 0)
{
showStatus(m_StoopidStatus);
}
else
{
showStatus(null);
}
m_MouseOver = true;
repaint();
return true;
}
public boolean mouseExit(Event evt, int x, int y)
{
if (m_Suspend == false)
{
m_Stoopid = new Thread(this);
m_Stoopid.start();
}
showStatus(null);
m_MouseOver = false;
repaint();
return true;
}
public boolean mouseMove(Event evt, int x, int y)
{
if (m_StoopidStatus.length() > 0)
{
showStatus(m_StoopidStatus);
}
else
{
showStatus(null);
}
return true;
}
}
alternative download available.
|