I want to add a vertical scroll-bar on my JFrame
with null
layout.
Is it possible or not? please help!
Just set the JScrollPane
as ContentPane
for JFrame
as it is described here:
public class TabbedPaneTest {
public static void main(String [] a) {
final JFrame frame = new JFrame();
frame.setSize(500, 500);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JScrollPane pane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
frame.setContentPane(pane);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
frame.setVisible(true);
}
});
}
}