Strange behaviour of JTabbedPane
- From: "Roland Zitzke" <NZEONTQYRAHL@xxxxxxxxxxxxx>
- Date: Mon, 28 Nov 2005 16:53:40 +0100
Hi,
I have a tabbed pane with three tabs (only two are shown below).
All content is different except that two tabs share a status message box.
Sharing means that I want to display the same content in both tabs at that
position.
The strange effect is that the status box is only visible in the last tab I
added to the tabbed pane.
Do I need to "refresh" something here?
Is there a general problem with sharing the same Gui object accross
different panes? any hints?
Thanks and regards
Roland
code fragments:
private JTabbedPane tabPane;
private JPanel traceButtonPane = null;
private JPanel masterButtonPane = null;
private JScrollPane statusPane = null;
private JTextArea statusText = null;
JScrollPane getStatusPane() {
if (statusPane == null) {
statusPane = new JScrollPane();
statusPane.setViewportView(getStatusText());
}
return statusPane;
}
JTextArea getStatusText() {
if (statusText == null) {
statusText = new JTextArea("Message console\n");
statusText.setEditable(false);
}
return statusText;
}
private JPanel getMasterButtonPane() {
if (masterButtonPane == null) {
// here seems to be a problem
// removing the comments below will switch the tab with the visible status
pane
masterButtonPane.add(getStatusPane());
}
return masterButtonPane;
}
private JPanel getTraceButtonPane() {
if (traceButtonPane == null) {
traceButtonPane = new JPanel();
// here we add the status pane to the second tab and this fails
// in the sense that only one tab actually shows it
traceButtonPane.add(getStatusPane());
}
return traceButtonPane; }
private JTabbedPane getTabPane() {
if (tabPane == null) {
tabPane = new JTabbedPane();
tabPane.add(getMasterButtonPane());
tabPane.add(getTracerButtonPane());
}
return tabPane;
}
.
- Follow-Ups:
- Re: Strange behaviour of JTabbedPane
- From: Oliver Wong
- Re: Strange behaviour of JTabbedPane
- Prev by Date: Java 1.5 and system fonts
- Next by Date: Re: Dynamically load laf
- Previous by thread: Java 1.5 and system fonts
- Next by thread: Re: Strange behaviour of JTabbedPane
- Index(es):