repaint type problem with scrollable

I

Ian

Hi,
I am having a problem trying to repaint a Jpanel.
The problem is I have a editor(jpanel), I then call a method to resize and
change its properties. In order to achieve this I create a new drawing
editor(editorNew)
I change its size and other properties - and to keep older functionality I
point the new editor to the older one
editor = editorNew;
If I do the following the new version successfully "overwrites" the first
one and is repainted immediately.
However, I would like to make the new version scrollable- which if I do the
commented code below works- but the panel is not painted.
The strange thing is that as soon as I manually resize the whole window with
the mouse the new correctly scrollable version magically appears?
Can anyone please tell me the correct way/order of making the panel being
redrawn immediately?
tried repaint(), paintcomponent() etc.
regards

getContentPane().remove(editor);
editorNew = new DrawingEditor(xnew, ynew);
editor.setVisible(false);
editorNew.setVisible(false);
editorNew.addMyListener(this);
editor = editorNew;
//JScrollPane scrollPane = new JScrollPane(editor);
// scrollPane.revalidate();
// scrollPane.repaint();
// scrollPane.validate();
// scrollPane.setVisible(true);
//getContentPane().add(scrollPane, BorderLayout.CENTER);
getContentPane().add(editor, BorderLayout.CENTER);
editor.revalidate();
editor.repaint();
editor.validate();
editor.setVisible(true);
 
A

Andrew Thompson

I am having a problem trying to repaint a Jpanel.

The problem is I have a editor(jpanel), I then call a method to resize and ....
However, I would like to make the new version scrollable- which if I do the
commented code below works-

..but the panel is not painted.

It is probably..
<http://www.physci.org/guifaq.jsp#2.4>

Please also note that
'alt.comp.lang.java'
is not a valid group.

** F'Ups set to c.l.j.gui **
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top