| Author |
scrollpane and panels
|
vidya archana
Ranch Hand
Joined: Oct 29, 2002
Posts: 36
|
|
can anyone please help me out in this problem? i cant giev a scoll to the panel. and even this simple code is not working.. Please help. JFrame fr = new JFrame(); Container c = fr.getContentPane(); JPanel p = new JPanel(null); JPanel pp = new JPanel(); // adding a textfield to panel p JTextField a = new JTextField(); a.setBounds(80, 50, 250, 28); a.setHorizontalAlignment(JTextField.RIGHT); p.add(a); // adding panel p to scrollpane JScrollPane scroll = new JScrollPane(p,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); scroll.setBounds(120,0,100,200); // scrollpane is added to panel pp pp.add(scroll); //add panel pp to frame c.add(pp); fr.setSize(250,200); fr.show();
|
 |
Amol Desai
Ranch Hand
Joined: Jan 29, 2003
Posts: 82
|
|
Hi, Your code works after adding the following to JScrollPane scroll.setPreferredSize(new Dimension(100,100));
|
 |
 |
|
|
subject: scrollpane and panels
|
|
|