I've been having trouble implementing a JScrollPane. Nothing shows up inside the JScrollPane but the other component (an exit button) shows up below it like it should. Can anyone help me resolve this issue? Is it maybe that JScrollBar would fit better within my program's needs?
JScrollPane Problems
Collapse
X
-
Tags: None
-
Whoops, forgot the source code to help with this.
public String main(ArrayListS erial list) {
x=0;
g=false;
JScrollBar scroll = new JScrollBar();
int r = 0;
JPanel uber = new JPanel();
uber.setLayout( new BorderLayout()) ;
x=0;
JPanel panel = new JPanel();
while(r<list.si ze()){
JPanel panel2 = new JPanel();
panel2.add(getS ingle(list.get( r)));
panel2.addMouse Listener(this);
panel2.setName( "Z"+r);
panel2.setPrefe rredSize(new Dimension(200,5 00));
System.out.prin tln(panel2.getN ame());
panel.add(panel 2);
r++;
}
uber.add(panel) ;
scroll.add(uber );
scroll.setLocat ion(0, 0);
add(scroll, "North");
JButton exit = new JButton("Exit") ;
exit.setName("E xit");
exit.addMouseLi stener(this);
add(exit, "South");
setSize(500, 500);
setLocationRela tiveTo(null);
setVisible(true );
while(x==0){
if(g){
return ""+number+" 2";
}
}
return "003";
}
Comment