Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > J2EE
|
J2EE General J2EE (Java 2 Enterprise Edition) discussions. Questions not specific to EE will be redirected elsewhere.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the J2EE section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 21st, 2005, 04:28 PM
Registered User
 
Join Date: Aug 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default applet parameters

i run the applet but all i get is a message saying that the applet has started but it doesnt run

import java.applet.*;
import java.awt.*;
/*

<applet code="AppletParameters" width = 300 height=300>
<param name="background" value="0xffffff">
<param name="foreground" value="0x000000">
<param name="message" value="Testing Applet
  Parameters">
  </applet>

*/

public class AppletParameters extends Applet {

    public void paint(Graphics g) {
        String background = getParameter("background");
        String foreground = getParameter("foreground");
        String message = getParameter("message");
        setBackground(Color.decode(background));
        setForeground(Color.decode(foreground));
        Font font = getFont();
        FontMetrics fm = getFontMetrics(font);
        Dimension d = getSize();
        int x = (d.width - fm.stringWidth(message))/2;
        int y = d.height/2;
        g.drawString(message, x, y);
    }
}






Similar Threads
Thread Thread Starter Forum Replies Last Post
need help in applet splashsvp Java Basics 1 March 4th, 2007 08:47 AM
Calling Applet !!! dpkbahuguna Classic ASP Basics 0 December 25th, 2006 02:23 AM
an applet for newbies freezotic BOOK: Beginning Java 2 2 June 7th, 2004 09:22 PM
Signed Applet example? EhobaX Java GUI 1 January 6th, 2004 06:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.