J
jcd.news
Hello.
I would like to know how to center scrollbars:
I created a JScrollPane called panneauVueDuHaut (in french).
I added panneauDessinVueDuHaut to this JScrollPane which is an
instance of the class ClassePanneauVueDuHaut which extends JPanel.
I overrode the paint method:
public void paint(Graphics g) {
if(img==null) { //img is an instance of Image
img=createImage(Xmax,Ymax);
bg=img.getGraphics();
}
Graphics2D g2=(Graphics2D) bg;
g2.setColor(Color.white);
g2.fillRect(0,0,Xmax,Ymax);
g2.drawline........
..........
g.drawImage(img,0,0,this);
Is it well built to be as fast as possible?
When panneauDessinVueDuHaut is first displayed, I would like the
scrollbars to be centered on the Image img (the size of img is
(Xmax,Ymax)).
How I can I do or where can I find a website about this?
thank you.
I would like to know how to center scrollbars:
I created a JScrollPane called panneauVueDuHaut (in french).
I added panneauDessinVueDuHaut to this JScrollPane which is an
instance of the class ClassePanneauVueDuHaut which extends JPanel.
I overrode the paint method:
public void paint(Graphics g) {
if(img==null) { //img is an instance of Image
img=createImage(Xmax,Ymax);
bg=img.getGraphics();
}
Graphics2D g2=(Graphics2D) bg;
g2.setColor(Color.white);
g2.fillRect(0,0,Xmax,Ymax);
g2.drawline........
..........
g.drawImage(img,0,0,this);
Is it well built to be as fast as possible?
When panneauDessinVueDuHaut is first displayed, I would like the
scrollbars to be centered on the Image img (the size of img is
(Xmax,Ymax)).
How I can I do or where can I find a website about this?
thank you.