k41d3n
asked on
Positioning a button pane in an existing pane
Ok, with these methods:
/**
* This method initializes jScrollPane3
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane3() {
if (jScrollPane3 == null) {
jScrollPane3 = new JScrollPane();
jScrollPane3.setViewportVi ew(getJPan eCheckBox( ));
}
return jScrollPane3;
}
private JPanel getJPaneCheckBox() {
JPanel insidePanel = new JPanel(new FlowLayout(FlowLayout.LEFT ));
JPanel jPanelCheckBox = new JPanel();
GridLayout checkbox = new GridLayout(0, 4);
jPanelCheckBox.setLayout(c heckbox);
try {
Set methods = GetTestMethods
.findMethods(DeviceIdentif ication.cl ass);
System.out.println(methods .size());
//these variables are defined private elsewhere in the class
//For a set or list
for (Iterator it = methods.iterator(); it.hasNext();) {
Object listElement = it.next();
String element = listElement.toString();
System.out.println(element );
JCheckBox newCheckBox = new JCheckBox(element);
newCheckBox.setName(elemen t);
System.out.println(newChec kBox.getNa me());
jPanelCheckBox.add(newChec kBox);
}
} catch (Exception e) {
atelog.error(e);
e.printStackTrace();
}
insidePanel.add(jPanelChec kBox);
return insidePanel;
}
/**
* This method initializes jTestbuttonPane
*
* @return javax.swing.JTestButtonPan e
*/
private JPanel getJTestButtonPane() {
if (jTestButtonPane == null) {
jTestButtonPane = new JPanel();
jTestButtonPane.setLayout( new java.awt.BorderLayout());
JPanel jPanelHttpTestButtons = new JPanel();
GridLayout buttons = new GridLayout(1, 2);
jPanelHttpTestButtons.setL ayout(butt ons);
JButton runAll = new JButton("Run All");
JButton runSelected = new JButton("Run Selected");
jPanelHttpTestButtons.add( runAll);
jPanelHttpTestButtons.add( runSelecte d);
jTestButtonPane.add(jPanel HttpTestBu ttons);
jTestButtonPane.setVisible (false);
}
return jTestButtonPane;
}
/**
* This method initializes jPanel1
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel1() {
if (jPanel1 == null) {
jPanel1 = new JPanel();
jPanel1.setLayout(new BorderLayout());
jPanel1.add(getJPanel(), java.awt.BorderLayout.NORT H);
jPanel1.add(getJTabbedPane 2(), java.awt.BorderLayout.CENT ER);
jPanel1.add(getJTestButton Pane(), java.awt.BorderLayout.SOUT H);
}
return jPanel1;
}
It puts the button pane at the bottom of the entire GUI, I'm thinking that it would be better of the buttons were at the bottom of each checkbox grid.
but when I try to add it to the checkbox grid, it puts it to the right side of it and not below.
Is there a way to do a border layout inside a scrollpanel so that the checkboxes are at the top, and the buttons are below it?
That way they will be on any tab that has tests in it yes?
/**
* This method initializes jScrollPane3
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane3() {
if (jScrollPane3 == null) {
jScrollPane3 = new JScrollPane();
jScrollPane3.setViewportVi
}
return jScrollPane3;
}
private JPanel getJPaneCheckBox() {
JPanel insidePanel = new JPanel(new FlowLayout(FlowLayout.LEFT
JPanel jPanelCheckBox = new JPanel();
GridLayout checkbox = new GridLayout(0, 4);
jPanelCheckBox.setLayout(c
try {
Set methods = GetTestMethods
.findMethods(DeviceIdentif
System.out.println(methods
//these variables are defined private elsewhere in the class
//For a set or list
for (Iterator it = methods.iterator(); it.hasNext();) {
Object listElement = it.next();
String element = listElement.toString();
System.out.println(element
JCheckBox newCheckBox = new JCheckBox(element);
newCheckBox.setName(elemen
System.out.println(newChec
jPanelCheckBox.add(newChec
}
} catch (Exception e) {
atelog.error(e);
e.printStackTrace();
}
insidePanel.add(jPanelChec
return insidePanel;
}
/**
* This method initializes jTestbuttonPane
*
* @return javax.swing.JTestButtonPan
*/
private JPanel getJTestButtonPane() {
if (jTestButtonPane == null) {
jTestButtonPane = new JPanel();
jTestButtonPane.setLayout(
JPanel jPanelHttpTestButtons = new JPanel();
GridLayout buttons = new GridLayout(1, 2);
jPanelHttpTestButtons.setL
JButton runAll = new JButton("Run All");
JButton runSelected = new JButton("Run Selected");
jPanelHttpTestButtons.add(
jPanelHttpTestButtons.add(
jTestButtonPane.add(jPanel
jTestButtonPane.setVisible
}
return jTestButtonPane;
}
/**
* This method initializes jPanel1
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel1() {
if (jPanel1 == null) {
jPanel1 = new JPanel();
jPanel1.setLayout(new BorderLayout());
jPanel1.add(getJPanel(), java.awt.BorderLayout.NORT
jPanel1.add(getJTabbedPane
jPanel1.add(getJTestButton
}
return jPanel1;
}
It puts the button pane at the bottom of the entire GUI, I'm thinking that it would be better of the buttons were at the bottom of each checkbox grid.
but when I try to add it to the checkbox grid, it puts it to the right side of it and not below.
Is there a way to do a border layout inside a scrollpanel so that the checkboxes are at the top, and the buttons are below it?
That way they will be on any tab that has tests in it yes?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Indeed, that worked!
Thanks!
Thanks!
You're welcome :°)
Of course only when needed