A
A Watcher
I'm trying to develop a slider control for an application. The slider
would be in a new Window. I can't seem to set the size of it. Here
is the code. Setting the location works, but not the size. In this
example SliderDemo2 is a class that extends JPanel. What am I doing
wrong? I've tried setting the size of the JPanel too, without
success.
public static void createAndShowGUI() {
//Create and set up the window.
JFrame frame = new JFrame("SliderDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Wrapper.slider = new SliderDemo2();
frame.setLocation(600,300);
Dimension minSize = new Dimension(400,200);
frame.setMinimumSize(minSize);
//Add content to the window.
frame.add(Wrapper.slider, BorderLayout.WEST);
//Display the window.
frame.pack();
frame.setVisible(true);
}
would be in a new Window. I can't seem to set the size of it. Here
is the code. Setting the location works, but not the size. In this
example SliderDemo2 is a class that extends JPanel. What am I doing
wrong? I've tried setting the size of the JPanel too, without
success.
public static void createAndShowGUI() {
//Create and set up the window.
JFrame frame = new JFrame("SliderDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Wrapper.slider = new SliderDemo2();
frame.setLocation(600,300);
Dimension minSize = new Dimension(400,200);
frame.setMinimumSize(minSize);
//Add content to the window.
frame.add(Wrapper.slider, BorderLayout.WEST);
//Display the window.
frame.pack();
frame.setVisible(true);
}