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 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274
| import javax.swing.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.File;
import java.awt.*;
import java.awt.event.*;
import javax.imageio.ImageIO;
public class ihm extends JFrame
{ BufferedImage image;
float inergie;
float width;
JButton button1;
JButton button2;
JButton button3;
JButton button4;
String file;
JLabel label1;
JLabel label2;
JLabel label3;
JLabel label4;
JLabel label5;
JLabel label6;
JLabel label7;
JLabel label8;
JLabel label9;
JLabel label10;
JLabel label11;
JLabel label12;
JLabel label13;
JLabel label14;
JLabel label15;
JLabel label16;
JTextArea textarea1;
Container conteneur=null;
JTextArea textarea2;
JTextArea textarea3;
JTextArea textarea4;
JTextArea textarea5;
JTextArea textarea6;
JTextArea textarea7;
JTextArea textarea8;
JTextArea textarea9;
JTextArea textarea10;
JTextArea textarea11;
JTextArea textarea12;
JTextArea textarea13;
JTextArea tt;
public ihm()
{
super();
this.setSize(900,900);
this.setTitle("Indexation et recherche d'image par contenu");
conteneur=this.getContentPane();
conteneur.setLayout(null);
button1=new JButton("Afficher l'image");
button2=new JButton("traitemment");
button3=new JButton("enregister dans la base de données");
button4=new JButton("afficher les résultat ");
button3.setBounds(350,350,150,20);
button1.setBounds(10,350,150,20);
button2.setBounds(400,350,150,20);
button4.setBounds(550,350,150,20);
conteneur.add(button4);
conteneur.add(button2);
conteneur.add(button1);
conteneur.add(button3);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTextArea tt=new JTextArea();
JLabel label1=new JLabel();
JLabel label2=new JLabel();
JLabel label3=new JLabel();
JLabel label4=new JLabel();
JLabel label5=new JLabel();
JLabel label6=new JLabel();
JLabel label7=new JLabel();
JLabel label8=new JLabel();
JLabel label9=new JLabel();
JLabel label10=new JLabel();
JLabel label11=new JLabel();
JLabel label12=new JLabel();
JLabel label13=new JLabel();
JLabel label14=new JLabel();
JLabel label15=new JLabel();
JLabel label16=new JLabel();
JLabel label17=new JLabel();
JLabel label18=new JLabel();
JTextArea textarea1=new JTextArea("0");
JTextArea textarea2=new JTextArea();
JTextArea textarea3=new JTextArea();
JTextArea textarea4=new JTextArea();
JTextArea textarea5=new JTextArea();
JTextArea textarea6=new JTextArea();
JTextArea textarea7=new JTextArea();
JTextArea textarea8=new JTextArea();
JTextArea textarea9=new JTextArea();
JTextArea textarea10=new JTextArea();
JTextArea textarea11=new JTextArea();
JTextArea textarea12=new JTextArea();
JTextArea textarea13=new JTextArea();
label1.setText("Extraire des informations sur la couleur:");
label1.setBounds(20,50,400,20);
conteneur.add(label1);
textarea1.setBounds(150,90,100,20);
conteneur.add(textarea1);
Font font=new Font("Arial", Font.BOLD, 20);
Font font1=new Font("Arial", Font.BOLD, 15);
label1.setFont(font);
label1.setForeground(Color.blue);
label2.setText("la taille de l'image :");
label2.setFont(font1);
label2.setBounds(12,90,400,20);
label3.setText("la somme des couleurs:");
label3.setFont(font1);
label3.setBounds(12,129,400,20);
label4.setText(" rouge:");
textarea2.setBounds(270,129,100,20);
conteneur.add(textarea2);
label4.setFont(font1);
label4.setBounds(200,129,400,20);
label5.setText(" blue:");
textarea3.setBounds(550,129,100,20);
conteneur.add(textarea3);
label5.setFont(font1);
label5.setBounds(500,129,400,20);
label6.setText("verte:");
label6.setFont(font1);
label6.setBounds(700,129,400,20);
textarea4.setBounds(750,129,100,20);
conteneur.add(textarea4);
conteneur.add(label2);
conteneur.add(label3);
conteneur.add(label4);
conteneur.add(label5);
conteneur.add(label6);
label7.setText("La moyenne des couleurs:");
label7.setFont(font1);
label7.setBounds(12,180,400,20);
label8.setText(" rouge:");
label8.setFont(font1);
label8.setBounds(200,180,400,20);
textarea6.setBounds(260,180,100,20);
conteneur.add(textarea6);
label9.setText("blue:");
label9.setFont(font1);
textarea5.setBounds(550,180,100,20);
conteneur.add(textarea5);
label9.setBounds(500,180,400,20);
label10.setText("verte:");
label10.setFont(font1);
label10.setBounds(700,180,400,20);
textarea7.setBounds(750,180,100,20);
conteneur.add(textarea7);
conteneur.add(label7);
conteneur.add(label8);
conteneur.add(label9);
conteneur.add(label10);
label11.setText("La moyenne des couleurs:");
label11.setFont(font1);
label11.setBounds(12,230,400,20);
label12.setText(" rouge:");
textarea8.setBounds(260,230,100,20);
conteneur.add(textarea8);
label12.setFont(font1);
label12.setBounds(200,230,400,20);
label13.setText(" blue:");
label13.setFont(font1);
textarea9.setBounds(550,230,100,20);
conteneur.add(textarea9);
label13.setBounds(500,230,400,20);
label14.setText("verte:");
label14.setFont(font1);
textarea10.setBounds(750,230,100,20);
conteneur.add(textarea10);
label14.setBounds(700,230,400,20);
conteneur.add(label11);
conteneur.add(label12);
conteneur.add(label13);
conteneur.add(label14);
label15.setText("La Extraire des informations sur la texture :");
label15.setForeground(Color.blue);
label15.setFont(font);
label15.setBounds(12,270,500,20);
label16.setText(" Inertie:");
label16.setFont(font1);
label16.setBounds(200,310,400,20);
textarea11.setBounds(260,310,100,20);
conteneur.add(textarea11);
label17.setText("Energie:");
label17.setFont(font1);
label17.setBounds(500,310,400,20);
label18.setText("Enropie:");
textarea12.setBounds(570,310,100,20);
conteneur.add(textarea12);
label18.setFont(font1);
label18.setBounds(700,310,400,20);
textarea13.setBounds(765,310,100,20);
conteneur.add(textarea13);
conteneur.add(label15);
conteneur.add(label16);
conteneur.add(label17);
conteneur.add(label18);
button1.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt){
button1_clic(evt);
}
}
);
button2.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt){
button2_clic(evt);
}
}
);
button3.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt){
button3_clic(evt);
}
}
);
button4.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt){
button4_clic(evt);
}
}
);
show();
}
public void button1_clic(ActionEvent e) {
Graphics g=null;
file =imagefile.getImageFile();
if (file != null) {
try{
image=ImageIO.read(new File(file));
repaint();
} catch(IOException ee)
{
ee.printStackTrace();
}
}
}
public void paint (Graphics g)
{
g.drawImage(image,14, 400,600,600, this);
}
public void button3_clic(ActionEvent e)
{
//textarea1.append(""+inergie);
}
public void button4_clic(ActionEvent e)
{}
public void button2_clic(ActionEvent e)
{
width=image.getWidth();
float height=image.getHeight(),
rows=height,
cols=width;
JTextArea textarea1=new JTextArea();
this. textarea1.setText(""+width);
}
} |
Partager