Reputation: 5215
I have the problem of a non displaying swing component. Here is how I have structured my code:
Thats my SelectionComponents
class:
public void init() {
placeSelectionWithButtons();
}
private void placeSelectionWithButtons() {
JPanel selectionArea = new JPanel(new FlowLayout(FlowLayout.CENTER));
marketList = new JComboBox();
countryList = new JComboBox();
selectionArea.add(marketList);
selectionArea.add(countryList);
repaint();
}
With the init function I am initializing the method to Place the Buttons and Comboboxes.
Furthermore I want to put everything together in my MainPanel
class:
I am just initializing this one method(will initialize more later!!!):
public void init(){
log.info("enterMainTabPanel init method");
selectionPanel.init();
}
Finally I am adding it to the method, when I created the TabBar:
public void createTabBar() {
log.info("add Tab Bar");
tabbedPane = new JTabbedPane();
//sets the first Tab
mainTabPanel.init();
tabbedPane.addTab("Main", mainTabPanel);
tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);
...
My problem is that my TabBar gets created and all methods are callen(have viewed the log entries). However nothing displays inside the Tab Content?
Any recommendations what I should change or add?
I appreciate your answer!
Upvotes: 0
Views: 62
Reputation: 5101
The component hierarchy is not clear from your example code.
First check if you have added the TabBar
to the content pane of your frame. Then verify that you have added the selectionArea
to your TabBar
.
Upvotes: 1