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
| // définition de l'interface graphique
public infosmiRNA()
{
JFrame frame = new JFrame();
frame.setTitle("Recherche d'informations sur les microRNA");
//frame.setSize(720,700);
panel = new JPanel();
// ajout de l'image à l'arrière plan
panelenterprise = new imagepanel(new ImageIcon("C:/Recherche d'informations sur un microRNA/Ressources/Logo enterprise aventis.jpg").getImage());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
/* 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();
//scrollpane = new JScrollPane(panel);
panel.setBackground(Color.cyan);
//scrollpane.setBorder(new EmptyBorder(0, 20, 20, 20));
GridBagLayout layout = new GridBagLayout();
panel.setLayout(layout);
//--------------------------------------------------
// définition des composants
titre = new JLabel("<html><b><u>Recherche d'informations sur un microRNA</u></b></html>");
Font f = new Font("Times New Roman", Font.PLAIN, 24); // par exemple
titre.setFont(f);
indicrech = new JLabel("microRNA à rechercher :");
indicrech.setHorizontalAlignment(JLabel.CENTER);
saisiemirna = new JTextField();
saisiemirna.setSize(50,100);
saisiemirna.setHorizontalAlignment(JTextField.CENTER);
saisiemirna.requestFocus();
reset = new JButton("Reset");
lancement = new JButton("Rechercher");
nouvellerecherche = new JButton("Rechercher à nouveau");
titleinfos = new JLabel("<html><u>Informations sur le microRNA :</u></html>");
access = new JLabel("Numéro d'accession :");
numaccess = new JTextField();
numaccess.setToolTipText("Numéro de référence utilisé dans GenBank, Uniprot, etc.");
numaccess.setHorizontalAlignment(JTextField.CENTER);
idl = new JLabel("Identifiant (nom complet) :");
numid = new JTextField();
numid.setHorizontalAlignment(JTextField.CENTER);
numid.setToolTipText("Nom complet du microRNA, comprenant l'abréviation de l'espèce.");
seql = new JLabel("Séquence mature :");
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);
indiccibles = new JLabel("<html><u>Liste des gènes cibles et mRNA (Gène - mRNA) :</u></html>");
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.");
/*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>");
etat = new JTextField("En attente / Recherche en cours");
etat.setHorizontalAlignment(JTextField.CENTER);
etat.setForeground(Color.white);
etat.setBackground(Color.red);
etat.setEditable(false);
etat.setBorder(BorderFactory.createLineBorder(Color.white));
etat3 = new JTextField("Recherche terminée");
etat3.setHorizontalAlignment(JTextField.CENTER);
etat3.setForeground(Color.white);
etat3.setBackground(Color.white);
etat3.setEditable(false);
etat3.setBorder(BorderFactory.createLineBorder(Color.white));
etat3.setVisible(false);
apropos = new JButton("<html><b>A propos</b></html>");
// déclaration des contraintes associées aux composants
GridBagConstraints gbcLabels = new GridBagConstraints();
GridBagConstraints gbcFields = new GridBagConstraints();
GridBagConstraints gbcScrollPane = new GridBagConstraints();
GridBagConstraints gbcButtons = new GridBagConstraints();
//---------------------------------------------------
// titre général
gbcLabels.gridx = 0;
gbcLabels.gridy = 0;
gbcLabels.gridwidth = 3;
gbcLabels.gridheight = 1;
gbcLabels.anchor = GridBagConstraints.CENTER;
gbcLabels.insets = new Insets (0, 0, 0, 0);
layout.setConstraints(titre, gbcLabels);
panel.add(titre);
// étiquette de la recherche
gbcLabels.gridx = 0;
gbcLabels.gridy = 1;
gbcLabels.gridwidth = 2;
gbcLabels.gridheight = 1;
gbcLabels.fill = GridBagConstraints.CENTER;
gbcLabels.anchor = GridBagConstraints.CENTER;
gbcLabels.insets = new Insets(30, 50, 0, 0);
layout.setConstraints(indicrech, gbcLabels);
panel.add(indicrech, gbcLabels);
// champ de saisie recherche
gbcFields.gridx = 2;
gbcFields.gridy = 1;
gbcFields.gridwidth = 1;
gbcFields.gridheight = 1;
gbcFields.fill = GridBagConstraints.WEST;
gbcFields.anchor = GridBagConstraints.WEST;
Dimension dimension = new Dimension(200, 20);
saisiemirna.setPreferredSize(dimension);
gbcFields.insets = new Insets(30, 0, 0, 0);
layout.setConstraints(saisiemirna, gbcFields);
panel.add(saisiemirna);
// bouton de remise à zéro
gbcButtons.gridx = 0;
gbcButtons.gridy = 2;
gbcButtons.gridwidth = 2;
gbcButtons.gridheight = 1;
gbcButtons.anchor = GridBagConstraints.WEST;
gbcButtons.fill = GridBagConstraints.WEST;
gbcButtons.insets = new Insets (25, 30, 0, 0);
layout.setConstraints(reset, gbcButtons);
panel.add(reset);
// bouton de recherche (lancement)
gbcButtons.gridx = 0;
gbcButtons.gridy = 2;
gbcButtons.gridwidth = 3;
gbcButtons.gridheight = 1;
gbcButtons.anchor = GridBagConstraints.CENTER;
gbcButtons.fill = GridBagConstraints.CENTER;
gbcButtons.insets = new Insets (25, 0, 0, 40);
layout.setConstraints(lancement, gbcButtons);
panel.add(lancement);
// bouton de nouvelle recherche
gbcButtons.gridx = 2;
gbcButtons.gridy = 2;
gbcButtons.gridwidth = 2;
gbcButtons.gridheight = 1;
gbcButtons.anchor = GridBagConstraints.EAST;
gbcButtons.fill = GridBagConstraints.EAST;
gbcButtons.insets = new Insets (25, 0, 0, 0);
layout.setConstraints(nouvellerecherche, gbcButtons);
panel.add(nouvellerecherche);
//-----------------------------------------------------------------
// titre d'infos
gbcLabels.gridx = 0;
gbcLabels.gridy = 3;
gbcLabels.gridwidth = 3;
gbcLabels.gridheight = 1;
gbcLabels.fill = GridBagConstraints.CENTER;
gbcLabels.anchor = GridBagConstraints.CENTER;
gbcLabels.insets = new Insets (30, 0, 0, 0);
layout.setConstraints(titleinfos, gbcLabels);
panel.add(titleinfos);
// étiquette du num d'accession
gbcLabels.gridx = 0;
gbcLabels.gridy = 4;
gbcLabels.gridwidth = 2;
gbcLabels.gridheight = 1;
gbcLabels.fill = GridBagConstraints.CENTER;
gbcLabels.anchor = GridBagConstraints.CENTER;
gbcLabels.insets = new Insets(20, 70, 0, 0);
layout.setConstraints(access, gbcLabels);
panel.add(access, gbcLabels);
// champ de saisie num d'accession
gbcFields.gridx = 2;
gbcFields.gridy = 4;
gbcFields.gridwidth = 1;
gbcFields.gridheight = 1;
gbcFields.fill = GridBagConstraints.WEST;
gbcFields.anchor = GridBagConstraints.WEST;
Dimension dimension2 = new Dimension(200, 20);
numaccess.setPreferredSize(dimension2);
gbcFields.insets = new Insets(20, 0, 0, 0);
layout.setConstraints(numaccess, gbcFields);
panel.add(numaccess);
// étiquette de l'id
gbcLabels.gridx = 0;
gbcLabels.gridy = 5;
gbcLabels.gridwidth = 2;
gbcLabels.gridheight = 1;
gbcLabels.fill = GridBagConstraints.CENTER;
gbcLabels.anchor = GridBagConstraints.CENTER;
gbcLabels.insets = new Insets(15, 45, 0, 0);
layout.setConstraints(idl, gbcLabels);
panel.add(idl, gbcLabels);
// champ de saisie id
gbcFields.gridx = 2;
gbcFields.gridy = 5;
gbcFields.gridwidth = 1;
gbcFields.gridheight = 1;
gbcFields.fill = GridBagConstraints.WEST;
gbcFields.anchor = GridBagConstraints.WEST;
Dimension dimension3 = new Dimension(200,20);
numid.setPreferredSize(dimension3);
gbcFields.insets = new Insets(15, 0, 0, 0);
layout.setConstraints(numid, gbcFields);
panel.add(numid);
// étiquette de la séquence mature
gbcLabels.gridx = 0;
gbcLabels.gridy = 6;
gbcLabels.gridwidth = 3;
gbcLabels.gridheight = 1;
gbcFields.fill = GridBagConstraints.CENTER;
gbcLabels.anchor = GridBagConstraints.CENTER;
gbcLabels.insets = new Insets(15, 0, 0, 0);
layout.setConstraints(seql, gbcLabels);
panel.add(seql, gbcLabels);
// champ de saisie séquence mature
gbcScrollPane.gridx = 0;
gbcScrollPane.gridy = 7;
gbcScrollPane.gridwidth = 3;
gbcScrollPane.gridheight = 1;
gbcScrollPane.anchor = GridBagConstraints.CENTER;
gbcScrollPane.fill = GridBagConstraints.CENTER;
gbcScrollPane.insets = new Insets(10, 0, 0, 0);
Dimension dimensionscroll2 = new Dimension(500,40);
scrollseqq.setPreferredSize(dimensionscroll2);
layout.setConstraints(scrollseqq, gbcScrollPane);
panel.add(scrollseqq, gbcScrollPane);
//------------------------------------------------------
// titre liste gènes cibles et mRNA
gbcLabels.gridx = 0;
gbcLabels.gridy = 8;
gbcLabels.gridwidth = 3;
gbcLabels.gridheight = 1;
gbcLabels.anchor = GridBagConstraints.CENTER;
gbcLabels.fill = GridBagConstraints.CENTER;
gbcLabels.insets = new Insets (30, 0, 0, 0);
layout.setConstraints(indiccibles, gbcLabels);
panel.add(indiccibles);
// liste
gbcScrollPane.gridx = 0;
gbcScrollPane.gridy = 9;
gbcScrollPane.gridwidth = 3;
gbcScrollPane.gridheight = 1;
gbcScrollPane.anchor = GridBagConstraints.CENTER;
gbcScrollPane.fill = GridBagConstraints.CENTER;
gbcScrollPane.insets = new Insets(10, 0, 0, 0);
Dimension dimensionscroll = new Dimension(500,200);
scrollgenes.setPreferredSize(dimensionscroll);
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.CENTER;
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.CENTER;
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.WEST;
gbcButtons.anchor = GridBagConstraints.WEST;
gbcButtons.insets = new Insets (15, 0, 0, 0);
layout.setConstraints(aide, gbcButtons);
panel.add(aide);
// bouton d'A propos (apropos)
gbcButtons.gridx = 2;
gbcButtons.gridy = 12;
gbcButtons.gridwidth = 1;
gbcButtons.gridheight = 1;
gbcFields.fill = GridBagConstraints.EAST;
gbcButtons.anchor = GridBagConstraints.EAST;
gbcButtons.insets = new Insets (15, 0, 0, 0);
layout.setConstraints(apropos, gbcButtons);
panel.add(apropos);
// label d'état de l'application
gbcFields.gridx = 0;
gbcFields.gridy = 13;
gbcFields.gridwidth = 1;
gbcFields.gridheight = 1;
gbcFields.fill = GridBagConstraints.CENTER;
gbcFields.anchor = GridBagConstraints.CENTER;
gbcFields.insets = new Insets (15, 0, 0, 0);
Dimension dimensionetat = new Dimension(250,20);
etat.setPreferredSize(dimensionetat);
layout.setConstraints(etat, gbcFields);
panel.add(etat);
// label3 d'état de l'application
gbcFields.gridx = 2;
gbcFields.gridy = 13;
gbcFields.gridwidth = 1;
gbcFields.gridheight = 1;
gbcFields.fill = GridBagConstraints.EAST;
gbcFields.anchor = GridBagConstraints.EAST;
gbcFields.insets = new Insets (15, 0, 0, 0);
etat3.setPreferredSize(dimensionetat);
layout.setConstraints(etat3, gbcFields);
panel.add(etat3);
gbcpanelimg.gridx = 0;
gbcpanelimg.gridy = 0;
gbcpanelimg.gridwidth = 1;
gbcpanelimg.gridheight = 1;
gbcpanelimg.anchor = GridBagConstraints.SOUTHWEST;
gbcpanelimg.insets = new Insets (25, 0, 0, 90);
layout.setConstraints(panelenterprise, gbcpanelimg);
conteneur.add(panelenterprise);
gbcpanel.gridx = 0;
gbcpanel.gridy = 1;
gbcpanel.gridwidth = 1;
gbcpanel.gridheight = 1;
gbcpanel.anchor = GridBagConstraints.CENTER;
gbcpanel.insets = new Insets (25, 0, 0, 90);
layout.setConstraints(panel, gbcpanel);
conteneur.add(panel);
frame.add(conteneur);
frame.setContentPane(conteneur);
pack();
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 );
frame.setResizable(false);
} |
Partager