Reputation: 571
I have a problem with displaying the components of a JScrollPane. Let me first explain the context. I've got one big splitpane:
center = new JSplitPane(JSplitPane.VERTICAL_SPLIT, p, p1);
center.setDividerLocation(0.9);
center.setDividerSize(3);
center.setResizeWeight(1);
center.setContinuousLayout(true);
The p
pane is shown the right way, no problem here. But the p1
pane won't be displayed, i can see the empty bottom-part of the splitPane, but that's all.
JPanel p = new JPanel();
p.add(canvas);
JPanel p1 = new JPanel();
p1.add(canvasPropPane);
The canvasPropPane
is a scrollPane that i initialize like this:
VolumeSizeAndPosition volum = new VolumeSizeAndPosition();
canvasPropPane = new JScrollPane(volum);
volume
was tested on an independent frame and have been shown the right way.
I tried showing on the canvasPropPane
a simple button canvasPropPane.add(wildButton);
and it has a strange behavior: it paints the button only after i hover the mouse over it's location; at repaint (after resizing the scrollpane) it disappears.
Upvotes: 0
Views: 264
Reputation: 8663
I've solved similar problems by calling invalidate() on all of the underlying nested Swing objects. So for your particular question p.invalidate() and p1.invalidate() may help. I believe this strange behavior to be a bug in Swing.
Upvotes: 1