my dog learned polymorphism*
The moose likes Game Development and the fly likes Java 2d graphics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "Java 2d graphics" Watch "Java 2d graphics" New topic
Author

Java 2d graphics

aswen singh
Greenhorn

Joined: Mar 31, 2012
Posts: 1
Guys i need help on the java graphics coding....basically this is my painter code....

Basically all i want is a rectangle that is red color with a stroke color (border) of black. But my question is how to set color for the stroke? i tried drawing the square then after that setPaint to black & draw again but dosent work that way either....been trying so many other ways & google-ing but couldnt find any result...

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
possibly create 2 rectangles
1) draw() - which will give you the black border
2) fill() - this is red and will be the inside, so the x,y,w,h will need to be adjusted for 'strokeValue'

don't know what you're doing, but might be a lot easier using a component
 
wood burning stoves
 
subject: Java 2d graphics