PDA

View Full Version : JAVA JButton img


Pro7on
05-06-2007, 13:40
una domanda il file img dove lo devo mettere nella cartella del progetto?



new JButton("<html><img src=\"img.jpg\"></html>");

ally
05-06-2007, 15:02
...l'immagine puoi metterla dove vuoi facendo attenzione al path relativo del progetto...

ImageIcon img = new ImageIcon("images/image.jpg");
JButton button = new JButton(img);

...ciao...

Pro7on
06-06-2007, 08:25
...l'immagine puoi metterla dove vuoi facendo attenzione al path relativo del progetto...

ImageIcon img = new ImageIcon("images/image.jpg");
JButton button = new JButton(img);

...ciao...

a ecco era quel image icon che mi fregava.. :D Thx


ora perņ mi mostra il button con dentro al img, come faccio a visualizzare img come button?