SETTING POSITION  
Author Message
El Diablo





PostPosted: 2003-12-26 20:37:00 Top

java-programmer, SETTING POSITION Hello,

I am new to Java and have been practicing by placing graphical shapes on
screen. I would like to know how to choose the coordinates where the shapes
appear within my applet window. I can't seem to find any helpful references
on this seemingly simple task. If anyone could give me details of the method
required I would really appreciate it.

Many Thanks.


 
Ryan Stewart





PostPosted: 2003-12-26 21:21:00 Top

java-programmer >> SETTING POSITION "El Diablo" <email***@***.com> wrote in message
news:3fec2b76$0$25950$email***@***.com...
> Hello,
>
> I am new to Java and have been practicing by placing graphical shapes on
> screen. I would like to know how to choose the coordinates where the
shapes
> appear within my applet window. I can't seem to find any helpful
references
> on this seemingly simple task. If anyone could give me details of the
method
> required I would really appreciate it.
>
> Many Thanks.
>
If you're using a Graphics object to draw shapes or images, you specify the
position as part of the drawImage or drawOval or drawWhatever method.


 
Andrew Thompson





PostPosted: 2003-12-27 3:19:00 Top

java-programmer >> SETTING POSITION "El Diablo" <email***@***.com> wrote in message
news:3fec2b76$0$25950$email***@***.com...
...
> I am new to Java and have been practicing by placing graphical shapes on
> screen. I would like to know how to choose the coordinates where the
shapes
> appear within my applet window.

Shapes? strings? ovals? Are you talking
about the 'Graphics' object El Diablo?

In that case, check this link..
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Graphics.html#drawString(ja
va.lang.String, int, int)

The link will line wrap, make it one line again.

It points to the method for drawing a string on
the graphics object. The second and third parameters
are 'x' and 'y'. So try..

(Graphics)g.drawString("Hello!",10,10);
(Graphics)g.drawString("Hello!",20,20);

or..
(Graphics)g.drawOval(20,20,15,10);
(Graphics)g.drawOval(40,40,15,10);

HTH


 
 
Alex Hunsley





PostPosted: 2003-12-27 5:02:00 Top

java-programmer >> SETTING POSITION El Diablo wrote:

>Hello,
>
>I am new to Java and have been practicing by placing graphical shapes on
>screen. I would like to know how to choose the coordinates where the shapes
>appear within my applet window.
>
If you've already been placing objects on the screen you should surely
know that some of the parameters to the drawing operations allow you to
specify the location on the screen!


>I can't seem to find any helpful references
>on this seemingly simple task. If anyone could give me details of the method
>required I would really appreciate it.
>
>Many Thanks.
>
>
>
>

Read the java docs? I find that helps.