Thread View: borland.public.jbuilder.java.swing
1 messages
1 total messages
Started by Dean Ware
Sun, 27 Jun 2004 04:40
Newbie paint/upsate question
Author: Dean Ware
Date: Sun, 27 Jun 2004 04:40
Date: Sun, 27 Jun 2004 04:40
59 lines
2917 bytes
2917 bytes
Hi, I'm building a simple image maniplulation program.
I am putting an ImageCanvas object inside a Scrollpane. An imageCanvas
is just an "extended" canvas. I then put this scrolpane inside a
Jtabbedpane.
Thing is, I am doing things with the image but the changes are not
updated immediately. They only take effect after I either switch tabs or
minimise/maximise the window.
This leads me to believe it is a painting/updating problem.
I am a newbie, and this is my first Java GUI.
Below is where I am trying to get the image to update(setMagnification
is where the image gets resized):
public void mousePressed(MouseEvent e) {
myImageCanvas1.setMagnification(2);
myImageCanvas1.update(myImageCanvas1.getGraphics());
myscrollpane1.update(myscrollpane1.getGraphics());
myImagePanel.updateUI();
myImageCanvas1.validate();
myscrollpane1.validate();
myImagePanel.validate();
myImageCanvas1.invalidate();
myscrollpane1.invalidate();
myImagePanel.invalidate();
myImageCanvas1.repaint();
myscrollpane1.repaint();
myImagePanel.repaint();
parent.update(parent.getGraphics());
}
This is just the latest version of the code. I have tried paint() and
repaint() plus invalidate() for ALL objects.
You will notice the "parent" object. This I added as desperation. I
passed parent (which is the Jtabbedpane inside a frame) to the
"ImageCanvas" object in the thought that perhaps the parent needded to
be repainted too.
DIDN'T WORK.
As I say, closing and reopening the window make everything resize and work.
I am obviously missing something here. Looked on google but found nothing.
ANY ideas??
Thanks
"a frustrated" Choca.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads