BoxLayout Exception
privatevoid createTable()
{
for (int j = 0; j < truthTable.length; j++)
{
JPanel panel =new JPanel();
panel.setBackground(Color.white);
panel.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
panel.add(new JLabel(labels[j]));
for (int k = 0; k < truthTable[0].length; k++)
panel.add(new JLabel(truthTable[j][k]));
add(panel);
}
}
publicvoid showTable()
{
JFrame frame =new JFrame("Truth Table");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(this);
frame.pack();
frame.setVisible(true);
}
The method createTable works fine. But when I run the showTable method I get the following error:
BoxLayout can't be shared
I don't understand why, any suggestions?
Thank You

