Please help me.
I have trie many way sbut neither of them worked.
I have a class that extends JPanel and I want to paint something on it.
public class MyPanel extends JPanel {
public MyPanel() {
// TODO Auto-generated constructor stub
super();
this.setSize(20000,20000);
}
@Override
public void paint(Graphics g) {
// TODO Auto-generated method stub
super.paintComponents(g);
g.drawLine(0,0,1000,1000);
}
}
Now I put that in a JScrollpane to be able to see all the paintings.But
JSCrollpane doesn't show any scrollbars and many parts remain hidden.
What should I do? please show mw the code that works.
Thanks in advance a lot.
Michael Rauscher - 26 Jul 2006 16:27 GMT
Foolad schrieb:
> Please help me.
> I have trie many way sbut neither of them worked.
[quoted text clipped - 16 lines]
> JSCrollpane doesn't show any scrollbars and many parts remain hidden.
> What should I do? please show mw the code that works.
public class MyPanel extends JPanel {
public Dimension getPreferredSize() {
return new Dimension(800,800);
}
public void paintComponent( Graphics g ) {
super.paintComponent( g );
g.drawLine(0,0,800,800);
}
}
Bye
Michael