Bonjour, j'ai un problème sur l'impression en java. Je ne sais comment passer d'une page à une autre ?
S'il vous plait aidez moi.

Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
public class Impression {
    PrinterJob printer;
    public void printList(int selectedIndex){      
        printer = PrinterJob.getPrinterJob();  
        printer.setPrintable(new Printer());
        printer.setJobName("Resultats de la dichotomie");
        if(!printer.printDialog()){  
            return;
        }
        try{
            printer.setCopies(12);
            printer.print();
 
        }catch(Exception ex){
           System.out.println(ex.getMessage());     
        }
    }
 
    public class Printer implements Printable {
          public Printer() {
        }
 
@Override
    public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException {
            if(pageIndex > 0)
                return (NO_SUCH_PAGE);
            Graphics2D g2d = (Graphics2D)graphics;
            Font titleF = new Font("Goudy Old Style", Font.BOLD, 17);
            Font valueF = new Font("Goudy Old Style", Font.PLAIN, 14);
            Color Blue = new Color(26,175,228);
            g2d.setFont(new Font("Goudy Old Style", Font.PLAIN, 36));
            g2d.drawString("UNIVERSITE DE DSCHANG", 50, 50);
           // g2d.drawString("UNIVERSITE DE DSCHANG", 50, 50);
           //  g2d.drawString("UNIVERSITE DE DSCHANG", 50, 50);
            g2d.setFont(titleF);
 
            g2d.drawString("uv :", 10, 150);
            g2d.drawString("code :", 10, 175);
            g2d.drawString("Enseignants :", 10, 200);
            g2d.setColor(Color.BLACK);
            g2d.setFont(valueF);
            g2d.drawString("projet", 100, 150);
            g2d.drawString("mat", 100, 175);
            g2d.drawString("Dr Dongo ", 100, 200);
 
            g2d.setColor(Blue);
            g2d.setFont(new Font("Goudy Old Style", Font.PLAIN, 30));
            g2d.drawString("resultat", 100, 270);
            g2d.drawLine(100, 275, 495, 275);
             g2d.setColor(Color.BLACK);
 
            return PAGE_EXISTS;
        }
    }
 
}