color [message #124938] |
Tue, 20 December 2005 03:02  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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());
>
> }
>
> }
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.08282 seconds