Help with a JPanel



Hiya, I think this is a fairly common JPanel related question and would
love any help,

I want to store the width,height,x/y coords of a rectangle in an
object, then draw it onto a JPanel. (I can get this far)
I also want to be able to change the width/height/x/y of the rectangle
then have it redrawn. (Im stuck at this point)

Do I have to call some kind of redraw command on the JPanel to have it
updated? Or do I do it on the rectangle itself? Or some other way
perhas?

Pretty stuck, any sample code would be great

Thanks,
Chris

.



Relevant Pages

  • Re: Always two custom components drawn
    ... > create a custom component and I trap the mouse events in my JPanel to call ... > pressed, the rectangle is drawn. ... > component to draw a JLabel at the top of the filled rectangle, ...
    (comp.lang.java.gui)
  • Re: [jCrollPane]Positionning the view with scrollRectToVisible(RectangleToBeDisplayed);
    ... Sorry to come back with this; I recall that I have a main Jpanel associated to a main JScrollPane and in this mainJPanel a collection of JPanels each containing a JTree inside and a JScrollPaneOfJtree associated to view the JTree as desired. ... Rectangle RectangleToBeDisplayed = JScrollPaneOfJtree.getBounds; ... Components that can service the request, such as JViewport, override this method and perform the scrolling. ...
    (comp.lang.java.help)
  • Re: Always two custom components drawn
    ... my JPanel, the rectangle is not drawn correctly - instead I get a rectangle ... around the top left as it does not happen if I draw the rectangle starting ... >> custom component to draw a JLabel at the top of the filled rectangle, ...
    (comp.lang.java.gui)
  • Drawing on a JPanel
    ... I think this is a fairly common JPanel related question and would ... I also want to be able to change the width/height/x/y of the rectangle ... Do I have to call some kind of redraw command on the JPanel to have it ... Pretty stuck, any sample code would be great ...
    (comp.lang.java.programmer)
  • Re: two problems
    ... I forget that twoDig.format made a string. ... >> except I am still stuck with metal look and feel ... JPanel jPanel1 = new JPanel; and 17 similiar statements outside and ... Changed it to Jpanel jpanl1 outside the constructor ...
    (comp.lang.java.programmer)