I edited my project using only swing components and a layout (not null).So now i want to add scrollbars to all frame not only at a pictrure.Resizing and moving the scrollbars and showing components under when you scroll down.The difficult is that the frame has many components and users can add pictures and admin can add labels or other components,so i don't know what to redraw when the frame is resized.Redraw everything i can't see for example.I paste some code to tell me where i add scrollpane or scrollbar
public class Test extends JFrame {
private JPanel contentPane;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Test frame = new Test();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public Test() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(new SpringLayout());
//Suppose that here we have many jlabels,jbuttons,jtextfields and other
}
}
I red some other examples and the problem is that i don't have only a picture to redraw or circles but stuff added by users.Its an online application.
ScrollPane
- Second hit from Google; 3-null
layouts WILL NOT HELP YOU with this problem – MadProgrammerScrollPane
relies on information provided to it by the layout manager to determine the overalls size of the component it contains so it make decisions about when it should display the scrollbars – MadProgrammer