473,394 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

being driven crazy, applet style...:-(

I have no idea why this won't work, and it is driving me up the wall. I just
started applets, and I made an html file and a java file, the java file
compiles fine, and the html file displays the proper sized background in my
browser, yet no drawing elements show up on it!

HTML file:

<HTML>
<applet code = ClassGradesGraph.class width = 500 height = 500>
</applet>
</HTML>

JAVA file:

import java.awt.*;
import java.applet.Applet;

public class ClassGradesGraph extends Applet
{
private int x1 = 10;
private int y1 = 300;
//upper left corner of bar

private int x2 = 100;
private int y2 = 500;
//lower right corner of bar

public void paint(Graphics g)
{
g.setColor(Color.green);
g.fillRect(0, 0, 500, 500);
}//end method

}//end class ClassGradesGraph

Any ideas here would be greatly appreciated! I know that the html works ok,
as when I use different widths and heights it shows it appropriately. I have
tried numerous drawing methods to get ANYTHING to show up, but no go.

Tucker

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.788 / Virus Database: 533 - Release Date: 01/11/2004
Jul 17 '05 #1
2 1414
sorry, first post had wrong numbers in fillRect()...this is what i meant....
"Tucker" <bi***********@yahoo.com> wrote in message
news:WFjjd.140208$Pl.103868@pd7tw1no...
I have no idea why this won't work, and it is driving me up the wall. I
just started applets, and I made an html file and a java file, the java
file compiles fine, and the html file displays the proper sized background
in my browser, yet no drawing elements show up on it!

HTML file:

<HTML>
<applet code = ClassGradesGraph.class width = 500 height = 500>
</applet>
</HTML>

JAVA file:

import java.awt.*;
import java.applet.Applet;

public class ClassGradesGraph extends Applet
{
private int x1 = 10;
private int y1 = 300;
//upper left corner of bar

private int x2 = 100;
private int y2 = 500;
//lower right corner of bar

public void paint(Graphics g)
{
g.setColor(Color.green);
g.fillRect(x1, y1, x2, y2);
}//end method

}//end class ClassGradesGraph

Any ideas here would be greatly appreciated! I know that the html works
ok, as when I use different widths and heights it shows it appropriately.
I have tried numerous drawing methods to get ANYTHING to show up, but no
go.

Tucker

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.788 / Virus Database: 533 - Release Date: 01/11/2004

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.788 / Virus Database: 533 - Release Date: 01/11/2004
Jul 17 '05 #2
"Tucker" <bi***********@yahoo.com> wrote in
news:USjjd.140408$Pl.106041@pd7tw1no:
sorry, first post had wrong numbers in fillRect()...this is what i
meant....
"Tucker" <bi***********@yahoo.com> wrote in message
news:WFjjd.140208$Pl.103868@pd7tw1no...
I have no idea why this won't work, and it is driving me up the wall. I
just started applets, and I made an html file and a java file, the java
file compiles fine, and the html file displays the proper sized
background in my browser, yet no drawing elements show up on it! <snip> g.fillRect(x1, y1, x2, y2);

<snip>

Note that Graphics.fillRect is defined as (x, y, width, height), not by the
corners.
However, this does not explain why you see nothing. You should see a green
rectangle with the bottom cropped off becuase the height extends below the
area reserved for the applet.

Have you tried the appletviewer?

--
Ian Shef 805/F6 * These are my personal opinions
Raytheon Company * and not those of my employer.
PO Box 11337 *
Tucson, AZ 85734-1337 *
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Cathey | last post by:
My web page displays live images of size (640X380) using applet. On Click of a button I need to display (320X240) in the same place. How do I write a JavaScipt for this. Thanks Karthey ...
2
by: George Hester | last post by:
I have an applet which is a cube each face if which is a link. I have a floating <DIV> element which when the mouse is over the applet it pops up showing the text of all the links in the applet....
3
by: Jacques Chaurette | last post by:
Hello all , thanks in advance for any help. While looking for a solution to how to replace the grey box while an applet loads, a search of Google got me an article by Glenn s. Peffers that claims to...
3
by: Jordan Gomila | last post by:
Hi, I wish to get the pixels os an image to transform it. There is any posibility to do this with javascript ? I have done with java, but I can't load web images from other http servers,...
1
by: admin | last post by:
Hi all, I wrote a small text editor (using a JTextPane) in order to ease the use of a CMS, in a more WYSIWYG way. Basically, you can see directly the effect of setting the background color, the...
0
by: Aws | last post by:
My crazy GridView !! I am using Visual Studio 2005, I have a problem with my GridView. I have one access .mdb table and when I update a record on the table EVERYTHING is perfect. I made a Web...
14
by: Snor | last post by:
I'm attempting to create a lobby & game server for a multiplayer game, and have hit a problem early on with the server design. I am stuck between using a threaded server, and using an event driven...
2
by: Robert Larsen | last post by:
Hi I am developing Java applet games and have come across a problem that seems to exist in the VM from Sun. I have tested in Mozilla and Firefox on Windows and Linux and IE (several versions) on...
2
by: kheitmann | last post by:
OK, so I have a blog. I downloaded the "theme" from somewhere and have edited a few areas to suit my needs. There are different font themes within the page theme. Long story short, my "Text Posts"...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.