
February 18th, 2003, 07:25 PM
|
|
Contributing User
|
|
Join Date: Feb 2001
Posts: 129
Time spent in forums: < 1 sec
Reputation Power: 8
|
|
|
Having trouble with setsize
Hi all. I'm having trouble with setsize. I've seen that there is a known problem with setsize, but I'm unsure of the solution. Here's a section of code. I'm trying to set the size of the read 'Clear' button. Any help?
PHP Code:
//Create the navigation bar at the top of the applet
JPanel jpNavigation = new JPanel(); //Create the navigation panel
jpNavigation.setLayout(new BorderLayout());
//Create the Student control Panel
JPanel jpStudentControl = new JPanel();
jpStudentControl.setLayout(new BorderLayout());
JButton jbtStudentDown = new JButton("<=");
JButton jbtStudentUp = new JButton("=>");
jpStudentControl.add(jbtStudentDown, BorderLayout.WEST);
jpStudentControl.add(new Label("Students"), BorderLayout.CENTER);
jpStudentControl.add(jbtStudentUp, BorderLayout.EAST);
jpStudentControl.add(new Label("A Total Of"), BorderLayout.SOUTH);
//Create the Clear Button
JPanel jpClearPanel = new JPanel();
JButton jbtClear = new JButton("Clear");
jbtClear.setSize(50,40);
jbtClear.setBackground(new Color(255,0,0));
jpClearPanel.add(jbtClear);
//Create the Course control Panel
JPanel jpCourseControl = new JPanel();
jpCourseControl.setLayout(new BorderLayout());
JButton jbtCourseDown = new JButton("<=");
JButton jbtCourseUp = new JButton("=>");
jpCourseControl.add(jbtCourseDown, BorderLayout.WEST);
jpCourseControl.add(new Label("Courses"), BorderLayout.CENTER);
jpCourseControl.add(jbtCourseUp, BorderLayout.EAST);
jpCourseControl.add(new Label("A Total Of"), BorderLayout.SOUTH);
jpNavigation.add(jpStudentControl, BorderLayout.WEST);
jpNavigation.add(jpClearPanel, BorderLayout.CENTER);
jpNavigation.add(jpCourseControl, BorderLayout.EAST);
getContentPane().add(jpNavigation, BorderLayout.NORTH);
JPanel p2 = new JPanel(); //Create the Student Panel
JPanel p3 = new JPanel(); //Create the Course Panel
JPanel p4 = new JPanel(); //Create Bottom Panel
p2.add(new Label("Student"));
p3.add(new Label("Course"));
p4.add(new Label("Bottom"));
getContentPane().add(p2, BorderLayout.WEST);
getContentPane().add(p3, BorderLayout.EAST);
getContentPane().add(p4, BorderLayout.SOUTH);
}
|