0

I have a GroupLayout object

GroupLayout uniquechart[] = new GroupLayout[1000];

That object saves a GroupLayout set, to draw this into JPanelResult I'm doing the following, but I can't put the charts vertically (uniquechart[0] at the top and below uniquechart[1], and so).

for (int m = 0; m < disrup.countInterruptions(); m++) {
    JPanelResult.setLayout(uniquechart[m]);
}

UPDATE 1 Working with JPanels

verticalPanel = new javax.swing.JPanel();

JPanel uniquechart[] = new JPanel[1000];

verticalPanel.setLayout(new FlowLayout());
verticalPanel.setLayout(new BoxLayout(verticalPanel, BoxLayout.Y_AXIS));

for (int m = 0; m < disrup.countInterruptions(); m++) {
    verticalPanel.add(uniquechart[m]);
    jScrollPane4.setViewportView(verticalPanel);
}
  • uniquechart[] == interesting, but please whats real reason for, btw question in this form isn't answerable here – mKorbel Dec 10 '14 at 08:19
  • I'm receiving from a function a grouplayout every time that I called, and then I have to draw all the elements received from that function into a JPanel. I saved the group layouts received into uniquechart[]. – Christian Monzón Cárdenas Dec 10 '14 at 08:26
  • How I can configure the Jpanelresult to show properly all the grouplayouts?? is there a way? – Christian Monzón Cárdenas Dec 10 '14 at 08:30
  • You probably need to create a new JPanel for every layout, assign the layout to the JPanel, and then place all the JPanels in your JPanelResult somehow. This "somehow" depends on how you want to show them, you could either use a FlowLayout or a CardLayout or another LayoutManager to display all those panels. But the important part is: you only have the layouts, you need a different JPanel for each Layout if you want to show them at the same time. – cello Dec 10 '14 at 08:59
  • Please, take a look to the new code. – Christian Monzón Cárdenas Dec 10 '14 at 09:31

0 Answers0