This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
hi,I'm using netbeans GUI,I am writing a program like paint program(in windows),I have a panel that I can paint on it,and also I can load image into this panel.
but the problem is that when I load an image,when it is bigger than my panel I can not see the hole image,I need to have something to let me edit all of the image,I used scroll Pane this way:
I added to my panel one scroll Pane,and then put another panel inside it,and wrote all of the functions of my first panel for this one.
now I can paint in this one,and I see the scrollbar,but when I use them things does not works well....and also when I load an image,still just one paart of it is seen and there is no scroll bars.
JScrollPane uses the preferred width of the component to determine when to show scroll bars, and how far these can scroll. Make sure the preferred size of the JPanel is correct; you can use setPreferredSize to set it.
thank you,I set the perefferedSize and Know I can see whole image well,but still I have one problem,when I begin painting on it,when I use scrollbars,last paintigs acts strangely!they get thicker or thinner,they would be shifted and ...
can you help me please?
Joined: Jul 06, 2010
you know when I use my panel's graphics to draw on it(:g.drawline()),when I use the scrollbar some previous paintings are lost....