Skip to main content



      Home
Home » Newcomers » Newcomers » color
color [message #124938] Tue, 20 December 2005 03:02 Go to next message
Eclipse UserFriend
Originally posted by: quarinteen.hotmail.com

how do i make this box colored so i can see it?

import java.awt.Rectangle;
import java.awt.Color;
public class Rect {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Rectangle box = new Rectangle(5, 10, 50, 80);

box.translate(15, 65);
System.out.println(box.getX());
System.out.println(box.getY());
System.out.println(box.getLocation());

}

}
Re: color [message #125205 is a reply to message #124938] Tue, 20 December 2005 19:38 Go to previous message
Eclipse UserFriend
The Rectangle class does not do any drawing by itself. I'd suggest
looking at Sun's Tutorial on 2D drawing here:
http://java.sun.com/docs/books/tutorial/2d/index.html to get started
with graphics in Java.

Hope this helps,
- Jeff

quarinteen wrote:
> how do i make this box colored so i can see it?
>
> import java.awt.Rectangle;
> import java.awt.Color;
> public class Rect {
>
> /**
> * @param args
> */
> public static void main(String[] args) {
> // TODO Auto-generated method stub
> Rectangle box = new Rectangle(5, 10, 50, 80);
>
> box.translate(15, 65);
> System.out.println(box.getX());
> System.out.println(box.getY());
> System.out.println(box.getLocation());
>
> }
>
> }
>
>
Previous Topic:start debugger at beginning
Next Topic:ViewPart painting
Goto Forum:
  


Current Time: Sat Jun 07 22:46:06 EDT 2025

Powered by FUDForum. Page generated in 0.08282 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top