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 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534
| // définition de l'interface graphique
public infosmiRNA()
{
frame = new JFrame();
frame.setTitle("Recherche d'informations sur les microRNA");
//frame.setSize(720,700);
Image logosa = new ImageIcon(getClass().getResource("Logo sa.jpg")).getImage();
frame.setIconImage(logosa);
panel = new JPanel();
// ajout de l'image à l'arrière plan
panelsa = new imagepanel(new ImageIcon(getClass().getResource("Logo sa .jpg")).getImage());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// permet de fermer le programme quand la touche Echap est pressée
KeyStroke escapeKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);
Action escapeAction = new AbstractAction()
{
// ferme l'application quand l'utilisateur appuie sur la touche Echap
public void actionPerformed(ActionEvent e)
{
System.exit(0);
}
};
frame.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(escapeKeyStroke, "ESCAPE");
frame.getRootPane().getActionMap().put("ESCAPE", escapeAction);
/* permet de centrer la fenêtre dans l'écran
// on récupère la taille/résolution de l'écran
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
// et on place notre fenêtre au milieu
frame.setLocation((screen.width - frame.getSize().width)/2,(screen.height - frame.getSize().height)/2);
*/
conteneur = new Container();
conteneur = getContentPane();
JScrollPane scrollconteneur = new JScrollPane(conteneur);
scrollconteneur.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
panel.setBackground(Color.cyan);
GridBagLayout layout = new GridBagLayout();
panel.setLayout(layout);
Border ltd = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
//--------------------------------------------------
Font f = new Font("Times New Roman", Font.PLAIN, 28); // par exemple
Font f2 = new Font("Times New Roman", Font.PLAIN, 20);
Font f2bis = new Font("Times New Roman", Font.PLAIN, 18);
Font f3 = new Font("Verdana", Font.ITALIC, 14);
Font f3bis = new Font("Times New Roman", Font.PLAIN, 20);
Font f4 = new Font("Arial", Font.BOLD, 14);
// définition des composants
titre = new JLabel("<html><b><u>Recherche d'informations sur un microRNA</u></b></html>");
titre.setFont(f);
titreespece = new JLabel("<html><u>Espèce d'intérêt :</u></html>");
titreespece.setFont(f2);
human = new Checkbox("Homo sapiens");
human.setFont(f3);
mouse = new Checkbox("Mus musculus");
mouse.setFont(f3);
rat = new Checkbox("Rattus norvegicus");
rat.setFont(f3);
indicrech = new JLabel("<html><u>microRNA à rechercher :</u></html>");
indicrech.setHorizontalAlignment(JLabel.CENTER);
indicrech.setFont(f2);
saisiemirna = new JTextField();
saisiemirna.setSize(70,100);
saisiemirna.setHorizontalAlignment(JTextField.CENTER);
saisiemirna.setBorder(ltd);
saisiemirna.setFont(f2);
reset = new JButton("Reset");
reset.setFont(f4);
lancement = new JButton("Rechercher");
lancement.setFont(f4);
nouvellerecherche = new JButton("Rechercher à nouveau");
nouvellerecherche.setFont(f4);
titleinfos = new JLabel("<html><u>Informations sur le microRNA :</u></html>");
titleinfos.setFont(f2);
access = new JLabel("Numéro d'accession :");
access.setFont(f2bis);
numaccess = new JTextField();
numaccess.setToolTipText("Numéro de référence utilisé dans GenBank, Uniprot, etc."); // ajoute une info-bulle
numaccess.setHorizontalAlignment(JTextField.CENTER);
numaccess.setEditable(false);
numaccess.setBorder(ltd);
numaccess.setBackground(Color.white);
numaccess.setFont(f3bis);
idl = new JLabel("Identifiant (nom complet) :");
idl.setFont(f2bis);
numid = new JTextField();
numid.setHorizontalAlignment(JTextField.CENTER);
numid.setToolTipText("Nom complet du microRNA, comprenant l'abréviation de l'espèce.");
numid.setEditable(false);
numid.setBorder(ltd);
numid.setBackground(Color.white);
numid.setFont(f3bis);
seql = new JLabel("Séquence mature :");
seql.setFont(f2bis);
seqq = new JTextPane();
scrollseqq = new JScrollPane(seqq);
seqq.setToolTipText("Séquence mature du microRNA (après clivage par le complexe protéique DICER).");
scrollseqq.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
// ajoute des ascenceurs au besoin
seqq.setEditable(false);
seqq.setFont(f3bis);
indiccibles = new JLabel("<html><u>Liste des gènes et mRNA potentiellement cibles :</u></html>");
indiccibles.setFont(f2);
genes = new JTextPane();
scrollgenes = new JScrollPane(genes);
scrollgenes.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
genes.setToolTipText("Liste des mRNA et des gènes qui les codent avec lesquels le microRNA " +recherche +" peut s'hybrider en théorie ou en pratique.");
genes.setEditable(false);
genes.setFont(f2);
/*titrelistexpression = new JLabel("<html><u>Profils d'expressions du microRNA et des gènes cibles dans 15 tissus/lignées cellulaires :</u></html>");
panellabels = new JPanel();
scrollexpress = new JScrollPane(panellabels);
panellabels.setBackground(Color.white);
gbblayout = new GridBagLayout();
panellabels.setLayout(gbblayout);
//scrollexpress.setViewportView(panellabels);
scrollexpress.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
panellabels.setToolTipText("Expressions relatives du microRNA et de certains de ses gènes cibles potentiels dans 15 tissus/lignées cellulaires ");*/
aide = new JButton("<html><b>?</b></html>");
aide.setFont(f3);
etat = new JTextField("En attente / Recherche en cours");
etat.setHorizontalAlignment(JTextField.CENTER);
etat.setForeground(Color.white);
etat.setBackground(Color.red);
etat.setEditable(false); // permet de rendre les champs non modifiables
etat.setBorder(BorderFactory.createLineBorder(Color.white));
// pour personnaliser la bordure du JTextField
Font fontetat = new Font("Times New Roman", Font.PLAIN, 17);
etat.setFont(fontetat);
apropos = new JButton("<html><b>A propos</b></html>");
apropos.setFont(f4);
// déclaration des contraintes associées aux composants
GridBagConstraints gbcLabels = new GridBagConstraints();
GridBagConstraints gbcFields = new GridBagConstraints();
GridBagConstraints gbcScrollPane = new GridBagConstraints();
GridBagConstraints gbcButtons = new GridBagConstraints();
GridBagConstraints gbcCheckbox = new GridBagConstraints();
//---------------------------------------------------
// titre général
gbcLabels.gridx = 0;
gbcLabels.gridy = 0;
gbcLabels.gridwidth = 3;
gbcLabels.gridheight = 1;
gbcLabels.anchor = GridBagConstraints.CENTER;
gbcLabels.fill = GridBagConstraints.NONE;
gbcLabels.insets = new Insets (10, 10, 0, 0);
gbcLabels.weightx = 0.0f;
gbcLabels.weighty = 0.0f;
layout.setConstraints(titre, gbcLabels);
panel.add(titre);
// titre espèce d'intérêt
gbcLabels.gridx = 0;
gbcLabels.gridy = 1;
gbcLabels.gridwidth = 2;
gbcLabels.gridheight = 1;
gbcLabels.fill = GridBagConstraints.NONE;
gbcLabels.anchor = GridBagConstraints.CENTER;
gbcLabels.insets = new Insets (20, 40, 0, 0);
gbcLabels.weightx = 0.0f;
gbcLabels.weighty = 1.0f;
layout.setConstraints(titreespece, gbcLabels);
panel.add(titreespece);
// checkbox humain
gbcCheckbox.gridx = 2;
gbcCheckbox.gridy = 1;
gbcCheckbox.gridwidth = 2;
gbcCheckbox.gridheight = 1;
gbcCheckbox.fill = GridBagConstraints.NONE;
gbcCheckbox.anchor = GridBagConstraints.EAST;
gbcCheckbox.insets = new Insets(20, 0, 0, 100);
gbcCheckbox.weightx = 0.0f;
gbcCheckbox.weighty = 1.0f;
layout.setConstraints(human, gbcCheckbox);
panel.add(human, gbcCheckbox);
// checkbox souris
gbcCheckbox.gridx = 1;
gbcCheckbox.gridy = 2;
gbcCheckbox.gridwidth = 3;
gbcCheckbox.gridheight = 1;
gbcCheckbox.fill = GridBagConstraints.NONE;
gbcCheckbox.anchor = GridBagConstraints.CENTER;
gbcCheckbox.insets = new Insets(0, 0, 0, 0);
gbcCheckbox.weightx = 0.0f;
gbcCheckbox.weighty = 1.0f;
layout.setConstraints(mouse, gbcCheckbox);
panel.add(mouse, gbcCheckbox);
// checkbox rat
gbcCheckbox.gridx = 2;
gbcCheckbox.gridy = 2;
gbcCheckbox.gridwidth = 1;
gbcCheckbox.gridheight = 1;
gbcCheckbox.fill = GridBagConstraints.NONE;
gbcCheckbox.anchor = GridBagConstraints.EAST;
gbcCheckbox.insets = new Insets(0, 0, 0, 0);
gbcCheckbox.weightx = 0.0f;
gbcCheckbox.weighty = 1.0f;
layout.setConstraints(rat, gbcCheckbox);
panel.add(rat, gbcCheckbox);
// étiquette de la recherche
gbcLabels.gridx = 0;
gbcLabels.gridy = 3;
gbcLabels.gridwidth = 2;
gbcLabels.gridheight = 1;
gbcLabels.fill = GridBagConstraints.NONE;
gbcLabels.anchor = GridBagConstraints.CENTER;
gbcLabels.insets = new Insets(15, 50, 0, 0);
gbcLabels.weightx = 0.0f;
gbcLabels.weighty = 1.0f;
layout.setConstraints(indicrech, gbcLabels);
panel.add(indicrech, gbcLabels);
// champ de saisie recherche
gbcFields.gridx = 2;
gbcFields.gridy = 3;
gbcFields.gridwidth = 1;
gbcFields.gridheight = 1;
gbcFields.fill = GridBagConstraints.NONE;
gbcFields.anchor = GridBagConstraints.CENTER;
Dimension dimension = new Dimension(240, 25);
saisiemirna.setPreferredSize(dimension);
gbcFields.insets = new Insets(15, 0, 0, 0);
gbcFields.weightx = 0.0f;
gbcFields.weighty = 1.0f;
layout.setConstraints(saisiemirna, gbcFields);
panel.add(saisiemirna);
// bouton de remise à zéro
gbcButtons.gridx = 0;
gbcButtons.gridy = 4;
gbcButtons.gridwidth = 2;
gbcButtons.gridheight = 1;
gbcButtons.anchor = GridBagConstraints.WEST;
gbcButtons.fill = GridBagConstraints.NONE;
gbcButtons.insets = new Insets (25, 30, 0, 0);
gbcButtons.weightx = 0.0f;
gbcButtons.weighty = 1.0f;
layout.setConstraints(reset, gbcButtons);
panel.add(reset);
// bouton de recherche (lancement)
gbcButtons.gridx = 0;
gbcButtons.gridy = 4;
gbcButtons.gridwidth = 3;
gbcButtons.gridheight = 1;
gbcButtons.anchor = GridBagConstraints.CENTER;
gbcButtons.fill = GridBagConstraints.NONE;
gbcButtons.insets = new Insets (25, 0, 0, 40);
gbcButtons.weightx = 0.0f;
gbcButtons.weighty = 1.0f;
layout.setConstraints(lancement, gbcButtons);
panel.add(lancement);
// bouton de nouvelle recherche
gbcButtons.gridx = 2;
gbcButtons.gridy = 4;
gbcButtons.gridwidth = 2;
gbcButtons.gridheight = 1;
gbcButtons.anchor = GridBagConstraints.EAST;
gbcButtons.fill = GridBagConstraints.NONE;
gbcButtons.insets = new Insets (25, 0, 0, 0);
gbcButtons.weightx = 0.0f;
gbcButtons.weighty = 1.0f;
layout.setConstraints(nouvellerecherche, gbcButtons);
panel.add(nouvellerecherche);
//-----------------------------------------------------------------
// titre d'infos
gbcLabels.gridx = 0;
gbcLabels.gridy = 5;
gbcLabels.gridwidth = 3;
gbcLabels.gridheight = 1;
gbcLabels.fill = GridBagConstraints.NONE;
gbcLabels.anchor = GridBagConstraints.CENTER;
gbcLabels.insets = new Insets (30, 0, 0, 0);
gbcLabels.weightx = 0.0f;
gbcLabels.weighty = 1.0f;
layout.setConstraints(titleinfos, gbcLabels);
panel.add(titleinfos);
// étiquette du num d'accession
gbcLabels.gridx = 0;
gbcLabels.gridy = 6;
gbcLabels.gridwidth = 2;
gbcLabels.gridheight = 1;
gbcLabels.fill = GridBagConstraints.NONE;
gbcLabels.anchor = GridBagConstraints.CENTER;
gbcLabels.insets = new Insets(0, 70, 0, 0);
gbcLabels.weightx = 0.0f;
gbcLabels.weighty = 1.0f;
layout.setConstraints(access, gbcLabels);
panel.add(access, gbcLabels);
// champ de saisie num d'accession
gbcFields.gridx = 2;
gbcFields.gridy = 6;
gbcFields.gridwidth = 1;
gbcFields.gridheight = 1;
gbcFields.fill = GridBagConstraints.NONE;
gbcFields.anchor = GridBagConstraints.CENTER;
numaccess.setPreferredSize(dimension);
gbcFields.insets = new Insets(0, 0, 0, 0);
gbcFields.weightx = 0.0f;
gbcFields.weighty = 1.0f;
layout.setConstraints(numaccess, gbcFields);
panel.add(numaccess);
// étiquette de l'id
gbcLabels.gridx = 0;
gbcLabels.gridy = 7;
gbcLabels.gridwidth = 2;
gbcLabels.gridheight = 1;
gbcLabels.fill = GridBagConstraints.NONE;
gbcLabels.anchor = GridBagConstraints.CENTER;
gbcLabels.insets = new Insets(2, 45, 0, 0);
gbcLabels.weightx = 0.0f;
gbcLabels.weighty = 1.0f;
layout.setConstraints(idl, gbcLabels);
panel.add(idl, gbcLabels);
// champ de saisie id
gbcFields.gridx = 2;
gbcFields.gridy = 7;
gbcFields.gridwidth = 1;
gbcFields.gridheight = 1;
gbcFields.fill = GridBagConstraints.NONE;
gbcFields.anchor = GridBagConstraints.CENTER;
numid.setPreferredSize(dimension);
gbcFields.insets = new Insets(2, 0, 0, 0);
gbcFields.weightx = 0.0f;
gbcFields.weighty = 1.0f;
layout.setConstraints(numid, gbcFields);
panel.add(numid);
// étiquette de la séquence mature
gbcLabels.gridx = 0;
gbcLabels.gridy = 8;
gbcLabels.gridwidth = 3;
gbcLabels.gridheight = 1;
gbcFields.fill = GridBagConstraints.NONE;
gbcLabels.anchor = GridBagConstraints.CENTER;
gbcLabels.insets = new Insets(2, 0, 0, 0);
gbcLabels.weightx = 0.0f;
gbcLabels.weighty = 1.0f;
layout.setConstraints(seql, gbcLabels);
panel.add(seql, gbcLabels);
// champ de saisie séquence mature
gbcScrollPane.gridx = 0;
gbcScrollPane.gridy = 9;
gbcScrollPane.gridwidth = 3;
gbcScrollPane.gridheight = 1;
gbcScrollPane.anchor = GridBagConstraints.CENTER;
gbcScrollPane.fill = GridBagConstraints.BOTH;
gbcScrollPane.insets = new Insets(0, 0, 0, 0);
Dimension dimensionscroll2 = new Dimension(600,45);
scrollseqq.setPreferredSize(dimensionscroll2);
gbcScrollPane.weightx = 0.0f;
gbcScrollPane.weighty = 1.0f;
layout.setConstraints(scrollseqq, gbcScrollPane);
panel.add(scrollseqq, gbcScrollPane);
//------------------------------------------------------
// titre liste gènes cibles et mRNA
gbcLabels.gridx = 0;
gbcLabels.gridy = 10;
gbcLabels.gridwidth = 3;
gbcLabels.gridheight = 1;
gbcLabels.anchor = GridBagConstraints.CENTER;
gbcLabels.fill = GridBagConstraints.NONE;
gbcLabels.insets = new Insets (20, 0, 0, 0);
gbcLabels.weightx = 0.0f;
gbcLabels.weighty = 1.0f;
layout.setConstraints(indiccibles, gbcLabels);
panel.add(indiccibles);
// liste
gbcScrollPane.gridx = 0;
gbcScrollPane.gridy = 11;
gbcScrollPane.gridwidth = 3;
gbcScrollPane.gridheight = 1;
gbcScrollPane.anchor = GridBagConstraints.CENTER;
gbcScrollPane.fill = GridBagConstraints.NONE;
gbcScrollPane.insets = new Insets(0, 0, 0, 0);
Dimension dimensionscroll = new Dimension(600,300);
scrollgenes.setPreferredSize(dimensionscroll);
gbcScrollPane.weightx = 0.0f;
gbcScrollPane.weighty = 1.0f;
layout.setConstraints(scrollgenes, gbcScrollPane);
panel.add(scrollgenes, gbcScrollPane);
// titre liste expression
//gbcLabels.gridx = 0;
//gbcLabels.gridy = 10;
//gbcLabels.gridwidth = 3;
//gbcLabels.gridheight = 1;
//gbcLabels.anchor = GridBagConstraints.CENTER;
//gbcLabels.fill = GridBagConstraints.NONE;
//gbcLabels.insets = new Insets (15, 0, 0, 0);
//layout.setConstraints(titrelistexpression, gbcLabels);
//panel.add(titrelistexpression);
// liste des profils d'expression
//gbcScrollPane.gridx = 0;
//gbcScrollPane.gridy = 11;
//gbcScrollPane.gridwidth = 3;
//gbcScrollPane.gridheight = 1;
//gbcScrollPane.anchor = GridBagConstraints.CENTER;
//gbcScrollPane.fill = GridBagConstraints.NONE;
//gbcScrollPane.insets = new Insets(10, 0, 0, 0);
//Dimension dimensionscroll3 = new Dimension(500,150);
//scrollexpress.setPreferredSize(dimensionscroll3);
//layout.setConstraints(scrollexpress, gbcScrollPane);
//panel.add(scrollexpress, gbcScrollPane);
// déclaration des contraintes de layout sur les deux panels
//GridBagConstraints gbcpanelimg = new GridBagConstraints();
//GridBagConstraints gbcpanel = new GridBagConstraints();
// bouton d'aide ?
gbcButtons.gridx = 0;
gbcButtons.gridy = 12;
gbcButtons.gridwidth = 1;
gbcButtons.gridheight = 1;
gbcButtons.fill = GridBagConstraints.NONE;
gbcButtons.anchor = GridBagConstraints.WEST;
gbcButtons.insets = new Insets (0, 0, 0, 0);
gbcButtons.weightx = 0.0f;
gbcButtons.weighty = 1.0f;
layout.setConstraints(aide, gbcButtons);
panel.add(aide);
// bouton d'A propos (apropos)
gbcButtons.gridx = 2;
gbcButtons.gridy = 12;
gbcButtons.gridwidth = 1;
gbcButtons.gridheight = 1;
gbcButtons.fill = GridBagConstraints.NONE;
gbcButtons.anchor = GridBagConstraints.EAST;
gbcButtons.insets = new Insets (0, 0, 0, 0);
gbcButtons.weightx = 0.0f;
gbcButtons.weighty = 1.0f;
layout.setConstraints(apropos, gbcButtons);
panel.add(apropos);
// label d'état de l'application
gbcLabels.gridx = 0;
gbcLabels.gridy = 12;
gbcLabels.gridwidth = 3;
gbcLabels.gridheight = 1;
gbcLabels.fill = GridBagConstraints.NONE;
gbcLabels.anchor = GridBagConstraints.CENTER;
gbcLabels.insets = new Insets (0, 0, 0, 20);
Dimension dimensionetat = new Dimension(250,20);
etat.setPreferredSize(dimensionetat);
gbcLabels.weightx = 0.0f;
gbcLabels.weighty = 1.0f;
layout.setConstraints(etat, gbcLabels);
panel.add(etat);
conteneur.add(panelsa, BorderLayout.CENTER);
conteneur.add(panel, BorderLayout.CENTER);
frame.add(scrollconteneur);
frame.setContentPane(scrollconteneur);
frame.pack();
human.addItemListener(this);
mouse.addItemListener(this);
rat.addItemListener(this);
reset.addActionListener(this);
lancement.addActionListener(this);
nouvellerecherche.addActionListener(this);
aide.addActionListener(this);
apropos.addActionListener(this);
// permet de définir le bouton de recherche par défaut (activé par la touche Entrée)
frame.getRootPane().setDefaultButton(lancement);
frame.setVisible(true);
// permet d'agrandir automatiquement la fenêtre sur l'écran (à mettre après setvisible)
frame.setExtendedState(JFrame.MAXIMIZED_BOTH );
// rend impossible le redimenssionnement de la fenêtre
frame.setResizable(false);
} |
Partager