Hy all,
i have aproblem, i made a simple applet that works fine at a first glance,
so i just wanted to add some drawing on it like : -
class Ap extends java.applet.Applet {
-
-
java.awt.Graphics g;
-
-
public void start() {
-
g = getGraphics();
-
paint(getGraphics());
-
getGraphics().drawString("ok let's get it on !!",53,94);
-
}
-
-
public void paint(java.awt.Graphics g) {
-
getGraphics().drawString ("paint()",33,120);
-
g = getGraphics();
-
}
-
}
-
so put this applet in a page and see that it will only paint "paint()" , not what i wrote inside start(), if i did the same with a windowed component like frame/jframe/window it had printed both "ok lt's get it on " and "paint ()"
and i want to have it done outside paint() as i need adtion triggered paintings, so i cannot rely only on paint
Kind Regards !
5 2007
What does 'getGraphics()' do and where does it come from?
kind regards,
Jos
What does 'getGraphics()' do and where does it come from?
kind regards,
Jos
well it comes like this.getGraphics() , u should know that appet derives from container that has getGraphics(), if u do not know what getGraphics does in container then it is bad :)
Kind Regards
JosAH i did not mean to be meen :), i now realize that this is not a java specific forum, and i was wrong to assume u knew it all
kind regards !
JosAH i did not mean to be meen :), i now realize that this is not a java specific forum, and i was wrong to assume u knew it all
No hard feelings and about that getGraphics() method, I could've looked it up.
I find it a bit strange though that you're drawing 'on your own'. When I use swing
I let the AWT thread determine when something needs to be drawn and stick
the actual drawing functionality somewere in, or derived from the paint (or
paintComponent) method. I never had to use the getGraphics method, i.e the
AWT Thread always passes a Graphics object to my paint(Component) method ...
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Remon Huijts |
last post by:
Hi there,
For a very specific service, I have created a PHP script that uses the GD
library functions to create a PNG image from a few lines of XML data
describing a simple diagram/drawing. It's...
|
by: timtt |
last post by:
does anyone guideline to speed up drawing in awt applet??
i have thousands of g.drawstring() + d.drawline()
actually, does Swing applet draw much faster than awt applet??
|
by: nathanlaan |
last post by:
This is the stupidest thing I have ever seen. Java 1.2, 1.3, and 1.4.1, and
1.4.2 all define the Applet.getDocumentBase() method differently! How am I
supposed to get the directory of the document...
|
by: James Hong |
last post by:
Help please, I try to sending an email from my html page using the java
applet.
but it give error on most of the PC only very few work, what is the error i
make
the java applet show as below
...
|
by: Hermund ?rdalen |
last post by:
Hi!
We're developing some children's pages for one of our customers.
Already we've found some nice crossword and puzzle programs/applets.
What we really need now is a drawing program.
It must...
|
by: Tomi Holger Engdahl |
last post by:
I am looking for a solution to add on-line drawing tool
to a phpBB discussion board.
The idea would be that the users can draw their own
simple drawings with the tool and attach them easily
as...
|
by: Champika Nirosh |
last post by:
Hi,
I want to create drawing board application that can draw Line, rectagle,
circle and free hand drawing.
Each drawing need to be transparent, moveable (draggable), have bring to
front and...
|
by: barbaros |
last post by:
Hello everybody,
I need to put some dynamic drawings on my web page. More precisely, I
need to draw a number of geometric figures (circles, rectangles) which
evolve into a graphics windows...
|
by: sheephead86 |
last post by:
Hi,
I'm pretty new to java, and I have a small problem involving drawing a rectangle on a java applet.Firstly this is not a plea for someone to help me with this peice of work, I just need pointing...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
| |