NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
rosejac12 Posted via mailing list.
|
Posted: Sun May 15, 2011 8:56 am Post subject: Reset the origin of a JPanel using Graphics.translate(x, y) |
|
|
I have made a JFrame 800 x 800 through a Swing Form in netbeans. This JFrame
is grey in color.
I have inserted a JPanel for drawing which is 500 x 500 onto the right side
of the frame, and i changed its colour to white.
I want to translate the default origin of the JPanel from the upper left
corner to lower left corner, which i did using paint(Graphics g) {
g.translate(0, 500); }. // or should it be (0, -500) ??? PLZ HELP?!
i also included g.drawLine(0, 0, 300, 300) after that. The line however did
not start from the lower left corner of the JFrame. It started from the left
edge's middle point of the JPanel.
I have also added buttons and labels to the left of the JFrame, i.e the area
that does not include the JPanel.
When the window is displayed, it shows the whole window in white including
the left space of the JFrame (also in white which in fact, should have been
grey). I want to display something like the Paint application of Windows.
PLease Help!
Thanks in advance.
--
View this message in context: http://netbeans-org.1045718.n5.nabble.com/Reset-the-origin-of-a-JPanel-using-Graphics-translate-x-y-tp4397303p4397303.html
Sent from the Netbeans IDE Users mailing list archive at Nabble.com. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|