Voilà je veux afficher l'histogramme d'une image .

Je ne sais pas comment faire appel à l'histogramme pour qu'il s'affiche

Voilà 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
 
public class fen02 extends JFrame implements ActionListener{
 
private JLabel photoPreview;private JLabel histo;
 
private BufferedImage image,image2;
int width;        
int height;
 
public fen02(){
        super("");    
        build();
        }
 
    public void build(){
        setTitle("debut du projet"); 
        setSize(1200,900); 
        setResizable(true);
        setContentPane(buildContentPane());}
 
        private JPanel buildContentPane(){
        JPanel panel = new JPanel();
        panel.setLayout(null);
 
 
        photoPreview = new JLabel();
        photoPreview.setBounds(100,200,200,200);
        panel.add(photoPreview);
 
        histo = new JLabel();
        histo.setBounds(400,600,200,200);
        panel.add(histo);
 
 
 
 
        JMenuBar menuBar = new JMenuBar();
        JMenu menu1 = new JMenu("Fichier");
        JMenuItem ouvrir = new JMenuItem("Ouvrir");
        menu1.add(ouvrir);
        Ecouteur1 ec1=new Ecouteur1();
        ouvrir.addActionListener(ec1);
        menuBar.add(menu1);
        setJMenuBar(menuBar);
 
        return panel;
 
        }
 
 
        class Ecouteur1 implements ActionListener{
        public void actionPerformed(ActionEvent e)
        {
        JFileChooser fc = new JFileChooser();
        int returnVal = fc.showOpenDialog
        (fen02.this);
        if(returnVal == JFileChooser.APPROVE_OPTION){
 
        java.awt.Toolkit toolkit = java.awt.Toolkit.getDefaultToolkit();
        String f=fc.getSelectedFile().getName();
        Image img = toolkit.getImage(f);
        ImageIcon ic = new ImageIcon(img.getScaledInstance(150, 150,Image.SCALE_AREA_AVERAGING));
 
        photoPreview.setIcon(ic);
 
 
        String ff=fc.getSelectedFile().getName();
 
        try{
        image = ImageIO.read(new File(ff));
 
 
 
 
        int[] histoRouge = new int[256];
int[] histoVert = new int[256];
int[] histoBleu = new int[256];
int w = image.getWidth();
int h =image.getHeight();
int[] rgbs = new int[w*h]; 
image.getRGB(0,0,w,h,rgbs,0,w);
for(int c=0; c<256; c++){
  histoRouge[c] = 0;
  histoVert[c] = 0;
  histoBleu[c] = 0;
}
 
 
 
 
for (int i = 0; i < rgbs.length; i++) {
  int rouge = (rgbs[i] >>16 ) & 0xFF;
  int vert = (rgbs[i] >> 8 ) & 0xFF;
  int bleu = rgbs[i] & 0xFF;
  histoRouge[rouge] ++;
  histoVert[vert] ++;
  histoBleu[bleu] ++;
        }
 
 
        }
 
 
 
 
 
 
        catch (IOException ee){}
 
        }}}
 
 
        public void actionPerformed(ActionEvent e) {
        Object source = e.getSource();
        }
 
 
        public static void main(String[] args) {
        fen02 fenetre = new fen02();
        fenetre.setVisible(true);
 
        }
 
    }
Si quelqu'un voit mon erreur.