The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

who overrites most of the absract methods in awt.Graphics

Posted by Lucas on November 07, 2000 at 7:00 AM


How did i got here:

in all my work with all kind of AWT components i never cared about who implemens most of the draw... and fill... methods of
abstract class Graphics.
I wanted to draw on a Component? get your bloody Graphics instance over here(only if it's showing, i know) without caring where that component whould get that Graphics.

But it happend this:
- i wanted to print something.(i've just started with that)
ok so I get a Toolkit( default Toolkit or the Components Toolkit
, what is the difference ?), from Toolkit i get a Printjob.
From the printjob i get a Graphics instance!!! on wich I shoud
"draw" something whether "by hand" with a component with its print(Graphics ) method (result is the same).
WHAT HAPPENS??:
- this particular Graphics instance(provided by Prinjob) doesn't
know most of the draw and fill methods of the abstr Graphics class??!!!!!!
my question is WHY ????!!!!!
So i started to dig on this bloody Graphics class
is an abstract class so most of the important methods are abstract.
Ok ok, no problem i said , there must be some classes who should overrite these methods right?
Well i am still looking and nothing.
For example Panel: - is uses the possible getGraphics of it's superclass ---> Container
Container : no, Container doesn't define the method, so maybe
is it's superclass ---> Component
Component: well Component indeed has getGraphics but after checkig some stuff( if the component does have a parent and is somehow showing ) calls the getGraphics of it's parent.
Ok, so this goes on and on but it has to reach somewere right?
So if the Panel is on an Applet (added ) who is the Panel's parent because Applet is no Component :) ??
1.So, where is the Graphics instance "borned" afterall???
2. Why the "borned" Graphics instance of the printer(prinjob)
is that stupid and what can i do about it?
(how can i modify the printer's Graphics resolution to avoid
1 millimeter painted pixels on the paper when i use drawImage
of any kind ...)
Kindly please excuse my tone but i am very pissed off and i can't hold it inside (ggrrrr).
Thank you very much for your patience if u reached this line :),
and u name-it what if u really can help.
nerve_recked Lucas...





Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us