Have you checked Java Online Source for the sample
source code? I do not have source code available, but
according to the way I interpreted your question is
create a Frame, add scrolling pane feature, and then
some other components.
////////////
// creat a frame named Scroll Bar Demo
public class ScrollDemo extends JFrame {
public ScrollDemo() {
super("Scroll Bar Demo");
setSize(300,250);
CustomScrollPane sp=new CustomScrollPane(new
JLabel());
getContentPane().add(sp); // add Scrollpane to
Frame
// add other components if you wanted to
WindowListener wndCloser=new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
};
addWindowListener(wndCloser); // register window
listener
setVisible(true); // without this you can not see
the frame
}
// execute application
public static void main(String[] args) {
new ScrollDemo(); // create a new application
}
}
}