2D graphic scrolling
Hi,
I'm trying to make this window frame scroll graphics,
it shows the scroll bar but when I try and scroll it,
the graphics disappear. What am I doing wrong?
import java.awt.*;
import java.awt.Graphics2D.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.applet.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import com.borland.jbcl.control.*;
import javax.swing.event.*;
import javax.swing.border.*;
publicclass FrameProfileextends JFrame
{
public FrameProfile(String title)
{
super(title);
JPanel Profilepane =new JPanel();
Profilepane.setBackground(Color.white);
int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;
int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER;
JScrollPane jsp =new JScrollPane(Profilepane, v, h);
Profilepane.setPreferredSize(new Dimension(476, 1000));
addWindowListener(new WindowAdapter(){
publicvoid windowClosing(WindowEvent e)
{
dispose();
}
});
setLocation(309, 54);
setSize(476, 480);
setContentPane(jsp);
show();
try{
jbInit();
}
catch(Exception e){
e.printStackTrace();
}
}
// Define paint() method for 2D graphical output
publicvoid paint(Graphics screen){
Graphics2D screen2D = (Graphics2D)screen;
super.paint(screen2D);
}
privatevoid jbInit()throws Exception{
}
}

