Dear Java Gurus, I have a jtabbedpanel which is contained inside a frame. Each tab of the tabbedpanel contains a component to be displayed. There are a total of 3 tabs and thus 3 total components. The problem arises when i run the frame after compiling. Each tab's display is not working properly but only works after clicking through all the tabs a couple of times. The code below lists a component out of the total 3 similar ones that is to be displayed. I am wondering could it be because of overusing arrays for each panel. Please kindly enlighten me. Thanks!
protected Component buildBookingPanel() { // main panel JPanel mainPanel = new JPanel(); // divided into three panes. these panes will be added to mainPanel JPanel westPane = new JPanel(); JPanel centrePane = new JPanel(); JPanel southPane = new JPanel(); // assign the layout managers mainPanel.setLayout(new BorderLayout()); westPane.setLayout(new GridLayout(12,1)); centrePane.setLayout(new GridLayout(12,1)); // create array of Panels for label textfield and buttons and make them left align Panel labelPane[] = new Panel[12]; Panel textPane[] = new Panel[12]; Panel buttonPane[] = new Panel[2]; for (int i=0; i < labelPane.length; ++i) { labelPane[i] = new Panel(); labelPane[i].setLayout(new FlowLayout(FlowLayout.LEFT)); } for (int i=0; i < textPane.length; ++i) { textPane[i] = new Panel(); textPane[i].setLayout(new FlowLayout(FlowLayout.LEFT)); } for (int i=0; i < buttonPane.length; ++i) { buttonPane[i] = new Panel(); buttonPane[i].setLayout(new FlowLayout(FlowLayout.LEFT)); }
for (int i = 0; i < labelPane.length; ++i) westPane.add(labelPane[i]); for (int i = 0; i < textPane.length; ++i) centrePane.add(textPane[i]); for (int i = 0; i < buttonPane.length; ++i) southPane.add(buttonPane[i]); mainPanel.add(westPane,BorderLayout.WEST); mainPanel.add(centrePane,BorderLayout.CENTER); mainPanel.add(southPane,BorderLayout.SOUTH);
return mainPanel; }
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.