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{

}

}

[3066 byte] By [NTK1] at [2007-9-26 1:57:22]
# 1
it seems that you are jsut painting what is on the screen again after scrolling. you probably need to have an Image that you paint the right portion of after reading the scrollbars value. or you can use java 1.4's ADvanced Imaging API i think they have a ScrollingImagePanel
glicious at 2007-6-29 3:13:52 > top of Java-index,Security,Cryptography...
# 2
Your paint method is empty, so nothing is being redrawn to the screen. All that is happening is update() is clearing the screen, and then nothing. Draw your picture to the graphical surface inside paint().
JDunlop at 2007-6-29 3:13:52 > top of Java-index,Security,Cryptography...