关于JSCrollPane
public class GraphFrame extends JInternalFrame{
private GraphPanel panel;
private JScrollPane scroll;
GraphFrame(String title) throws Exception{
super(title, true, true, true, true);
panel = new GraphPanel("G:\\Picture\\WallPaper\\shanks1.jpg");
scroll = new JScrollPane(panel);
scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
this.setLayout(new BorderLayout());
this.getContentPane().add(scroll, BorderLayout.CENTER);
this.setSize(400, 300);
this.setVisible(true);
}
}
GraphPanel类是画了一副图的JPanel,现在是这样写的,想做出滚动条的效果,滚动条内部是图片,就是怎么弄也弄不出来