Details
I have some questions concerning the javax.swing.Box class (please see http://docs.oracle.com/javase/7/docs/api/javax/swing/Box.html for documentation). I have recently updated my dev environment to Java 7u5 and am in the process of recompiling some old projects... however, when dealing with a project which contains the javax.swing.Box class, I get a "constructor Box in class Box cannot be applied to given types; required: no arguments found: int" error. These worked perfectly before.
Questions
Does anyone have any thoughts as to why this is happening? The constructor doesn't look like it has changed. Is there something I'm missing? Can't for the life of me find a documented change anywhere. Please see the sample code below which recreates the error.
Sample Code
import java.awt.*;
import javax.swing.*;
public class BoxTest
{
private JFrame $_frame;
private JPanel $_panel;
private Box $_box;
private JButton $_button1, $_button2;
public BoxTest()
{
$_frame = new JFrame("Box Test");
$_panel = new JPanel(new BorderLayout());
$_box = new Box(BoxLayout.Y_AXIS);
$_button1 = new JButton("Test Button 1");
$_button2 = new JButton("Test Button 2");
}
public void buildGUI()
{
$_box.add($_button1);
$_box.add($_button2);
$_panel.add(BorderLayout.EAST, $_box);
$_frame.getContentPane().add(this.$_panel);
$_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
$_frame.setBounds(50, 50, 300, 300);
$_frame.setVisible(true);
}
public static void main(String[] args)
{
BoxTest boxTest = new BoxTest();
boxTest.buildGUI();
}
}
thanks!