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
| public class ihm extends JFrame{
private JTextField field1 ;
private JTextField field2 ;
private JLabel label ;
private JComboBox liste ;
public ihm() {
super("ihm") ;
build() ;//On initialise notre fenetre.
}
private void build(){
setSize(1500,998) ;
JLabel label = new JLabel() ;???
label.setSize(1500, 998) ;
JPanel panel = new JPanel() ;
}
public void actionPerformed(ActionEvent e) {
JFileChooser chooser = new JFileChooser() ;
chooser.setCurrentDirectory(new File("/")) ;
chooser.changeToParentDirectory() ;
if(chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
String name = chooser.getSelectedFile().getName() ;
label.setIcon(new ImageIcon(name)) ;
}
} |
Partager