<commit_before>package projet_poo2;

import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

public class IHM extends JFrame 
{
	private static final long serialVersionUID = 1L;
	private JMenuBar menuBar = new JMenuBar();
	private JMenu menu1 = new JMenu("Fichier");
	private JMenuItem item1 = new JMenuItem("Ouvrir");
	
	public IHM()
	{
		super();
		
		this.setTitle("Project");
		this.setPreferredSize(new Dimension(200,200));
		this.menuBar.add(menu1);
		this.menu1.add(item1);
		item1.addActionListener(new ActionListener(){
		      
			public void actionPerformed(ActionEvent event)
			{
				JFileChooser chooser = new JFileChooser();
			    FileNameExtensionFilter filter = new FileNameExtensionFilter(
			        "JPG & PNG & GIF Images", "jpg", "png","gif","jpeg");
			    chooser.setFileFilter(filter);
			    int returnVal = chooser.showOpenDialog(IHM.this);
			    if(returnVal == JFileChooser.APPROVE_OPTION)
			    {
			       System.out.println("You chose to open this file: " +
			            chooser.getSelectedFile().getName());
			    }
			   
			   if(chooser.getSelectedFile() != null)
			   {
				   ouvrirImage(chooser.getSelectedFile().getAbsolutePath());
			   }
			    
		    }
		});
		this.setJMenuBar(menuBar);
	}
	
	public void ouvrirImage(String filename)
	{
		Picture pic=new Picture(filename);
		ImageIcon ic = new ImageIcon(pic.image);
		JLabel jl=new JLabel(ic);
		//this.setContentPane(jl);
		this.setSize(new Dimension(pic.width,pic.height));
		this.add(jl);
		
	}
}


/*
package projet_poo2;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

public class IHM extends JFrame {
	
	private JMenuBar menuBar = new JMenuBar();
	private JMenu menu1 = new JMenu("Fichier");
	private JMenuItem item1 = new JMenuItem("Ouvrir");
	
	public IHM(){
		super();
		this.setTitle("Project");
		this.setSize(1000,500);
		this.menuBar.add(menu1);
		this.menu1.add(item1);
		this.setJMenuBar(menuBar);
	}
	
	private static final long serialVersionUID = 1L;

}
*/<commit_msg>option du crtl+O ajoutée<commit_after>package projet_poo2;

import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

public class IHM extends JFrame implements KeyListener
{
	private static final long serialVersionUID = 1L;
	private JMenuBar menuBar = new JMenuBar();
	private JMenu menu1 = new JMenu("Fichier");
	private JMenuItem item1 = new JMenuItem("Ouvrir");
	
	public IHM()
	{
		super();
		
		this.setTitle("Project");
		this.setPreferredSize(new Dimension(200,200));
		this.addKeyListener(this);
		this.menuBar.add(menu1);
		this.menu1.add(item1);
		item1.addActionListener(new ActionListener(){
		      
			public void actionPerformed(ActionEvent event)
			{
				openFileLocation();
		    }
		});
		this.setJMenuBar(menuBar);
	}
	
	public void ouvrirImage(String filename)
	{
		Picture pic=new Picture(filename);
		ImageIcon ic = new ImageIcon(pic.image);
		JLabel jl=new JLabel(ic);
		this.setSize(new Dimension(pic.width,pic.height));
		this.add(jl);
		
	}
	
	public void openFileLocation(){
		JFileChooser chooser = new JFileChooser();
		FileNameExtensionFilter filter = new FileNameExtensionFilter(
		    "JPG & PNG & GIF Images", "jpg", "png","gif","jpeg");
		chooser.setFileFilter(filter);
		chooser.showOpenDialog(IHM.this);
		if(chooser.getSelectedFile() != null)
		{
			ouvrirImage(chooser.getSelectedFile().getAbsolutePath());
		}
	}

	@Override
	public void keyTyped(KeyEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void keyPressed(KeyEvent e) {
		if (e.isControlDown() && e.getKeyChar() != 'o' && e.getKeyCode() == 79) {
			openFileLocation();
		}
	}

	@Override
	public void keyReleased(KeyEvent e) {
		// TODO Auto-generated method stub
		
	}
}
{'fraction_non_alphanumeric': 0.12186298892154646, 'fraction_numerical': 0.009947999095636446, 'mean_word_length': 4.156177156177156, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '85847', 'n_tokens_mistral': 1657, 'n_tokens_neox': 1469, 'n_words': 302}