i have written source code for scrolling text messages from right to left using applets,but the requirement is that the text should be scrolled from bottom of the page and it has start from corner of window applet.Please,can anyone suggest me on how to do this.
final static int MAX_SIZE = 100; final static Cursor HAND = new Cursor(Cursor.HAND_CURSOR); final static Cursor DEFAULT = new Cursor(Cursor.DEFAULT_CURSOR);
boolean isMoving; int xx; // text location int ntext; // number of text int text_width; // text width int width; // applet width int height; // applet height int delay; // time delay int fontsize; // size of font int mouse_x; // mouse x coordinate int mouse_y; // mouse y coordinate int selected; // selected caption
String fontstyle = getParameter("fontstyle"); if (fontstyle == null || fontstyle.equals("plain")) font = new Font(fontface, Font.PLAIN, fontsize); else if (fontstyle.equals("bold")) font = new Font(fontface, Font.BOLD, fontsize); else font = new Font(fontface, Font.ITALIC, fontsize);
public void init() { isMoving = true; runner = new Thread(this); width = getSize().width; height = getSize().height; s = new String[MAX_SIZE]; url = new String[MAX_SIZE]; target = new String[MAX_SIZE];
/*========================= * Paint and Update Method *=========================*/
public void paint(Graphics g) { int c = 0; int i = xx; int h = (height + fontsize)/2 ; selected = 1; boolean f = false;
while (s[c] != null && i < width) { int w = fm.stringWidth(s[c]); offscr.setColor(fgcolor); if (mouse_x >= i && mouse_x <= i + w && mouse_y <= h && mouse_y >= h - fontsize) { offscr.setColor(accolor); offscr.drawLine(i, h , i + w, h ); f = true; selected = c; } offscr.drawString(s[c], i, h);
i += w + 80; if (++c >= ntext) c = 0; } if (f) setCursor(HAND); else setCursor(DEFAULT);