Progarmmation java

cs_betoile Messages postés 28 Date d'inscription vendredi 11 juin 2010 Statut Membre Dernière intervention 22 mai 2013 - 18 juin 2011 à 20:09
 Utilisateur anonyme - 20 juin 2011 à 23:35
bonjour a tous ma fenetre a un defaut genre une tache quelqu'un peut m'ameliorer la fenetre svp



import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.sql.SQLException;

import javax.imageio.ImageIO;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;


@SuppressWarnings("serial")
public class fenetre4 extends JFrame {
protected static JTextField critere;
private JButton lancer;
private static JTextArea resultatRecherche;

private Button bouton0=new Button("propagation");
private Button bouton=new Button("afficher resulat");
private Button bouton2=new Button("visualiser un document");
private Button bouton3=new Button("EXIT");

private JPanel pan1=new JPanel();
private JPanel pan=new JPanel();
private JPanel pan2=new JPanel();
private JPanel recherche = new JPanel();

private String str="" ;
//private JScrollPane sc=new JScrollPane(FichierI);
public fenetre4(){
super("Recherche Terrier");
this.setTitle("RESULAT");
this.setSize(500,640);

this.setLocationRelativeTo(null);
GridLayout G=new GridLayout();
G.setColumns(1);
G.setRows(12);
G.setHgap(5);
G.setVgap(5);
//FichierI.setBackground(Color.white);
//FichierI.setText("");
//FichierI.setCaretColor(Color.LIGHT_GRAY);
Font police1 = new Font("Script MT Bold", Font.BOLD,20);
//FichierI.setFont(police1);
//FichierI.setForeground(Color.black);


// this.add(recherche,BorderLayout.NORTH);
pan1.add(new JLabel("Rechercher"));
critere = new JTextField(15);
pan1.add(critere);
lancer = new JButton("Lancer la recherche");

pan1.add(lancer);
resultatRecherche = new JTextArea(5,5);
JScrollPane sp = new JScrollPane(resultatRecherche);
this.add(sp, BorderLayout.CENTER);






//pack();
setVisible(true);
setSize(700,500);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setTitle(" SEARCHING NOW !!!! ");
pan1.setBackground(Color.LIGHT_GRAY);
pan1.add(new Panneau());




//sc.add(pan1);

bouton3.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
System.exit(-1);
}
});
pan2.add(bouton3);
pan.setLayout(G);
recherche.setLayout(G);
pan.setBackground(Color.GRAY);

JPanel p1=new JPanel();
JPanel p5=new JPanel();
JPanel p4=new JPanel();
JPanel p3=new JPanel();
JPanel p6=new JPanel();

p1.setBackground(Color.black);
p6.setBackground(Color.black);
p3.setBackground(Color.black);
p4.setBackground(Color.black);
p5.setBackground(Color.black);
pan.add(p1);
pan.add(p6);
pan.add(p3);
pan.add(p4);
pan.add(p5 );

bouton2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
//reinitialiser r=new reinitialiser(resulat.getres());
}
});
bouton0.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){

//SEARCH t=new SEARCH();
}
});
pan.add(bouton0);
bouton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){

//m t=new m();
}
});






//bouton.addActionListener(new ClassePrincipale());
//bouton2.addActionListener(new affiche());



pan.add(bouton);
pan.add(bouton2);
pan2.setBackground(Color.black);
this.add(pan2,BorderLayout.SOUTH);

//this.getContentPane().add(sc,BorderLayout.CENTER);
this.getContentPane().add(pan, BorderLayout.WEST);
this.getContentPane().add(pan1,BorderLayout.NORTH);
this.setVisible(true);



}


//class ClassePrincipale implements ActionListener {

/**
* @param args
*/

@SuppressWarnings("static-access")
/* public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
SelectionCorpusDocumentaire S=new SelectionCorpusDocumentaire();
S.main();
int i=0;
int j=0,k=S.listFile.length;
File[] ListofFileIndex=new File[k];
//}
while(i<k){
File f=S.listFile[i];
if(f.getName().endsWith(".xml")){
ListofFileIndex[j]=f;
j++;
}
i++;
}*/

/*if (j==0){
String myString="\n \n Le Corpus selectionné ne contient pas de fichier d'extension xml";
System.out.println("Le Dossier ne contenait pas de fichier d'extension xml"+str);
//System.exit(0);
//tf.setText(myString);
FichierI.append(myString);
}
else{
String[] emplacement=new String[j];
System.out.println("liste des documents à indexer:");
for (i=0;i<j;i++){
System.out.println(ListofFileIndex[i]);
emplacement[i]=ListofFileIndex[i].getAbsolutePath();
}
i=0;

while(i<j){
SavingData save=new SavingData();
try {
save.main(emplacement[i]);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
i++;
}
FichierI.append("\n \n"+i+" sur "+j+" fichiers indexés avec Succes!!! "+str);
}

/*Ponderation P=new Ponderation();
try {
P.affichefichierInverse();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//label.setText(P.fichierI);
*/

/*class affiche implements ActionListener {
@SuppressWarnings("static-access")

public void actionPerformed(ActionEvent e){
Ponderation P=new Ponderation();
try {
P.affichefichierInverse();

} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

String line ="\n";
try{
// Création du flux bufférisé sur un FileReader, immédiatement suivi par un
// try/finally, ce qui permet de ne fermer le flux QUE s'il le reader
// est correctement instancié (évite les NullPointerException)
BufferedReader buff = new BufferedReader(new FileReader("fichier inverse.txt"));

try {
String line1;
// Lecture du fichier ligne par ligne. Cette boucle se termine
// quand la méthode retourne la valeur null.
while ((line1 = buff.readLine()) != null) {
line=line+line1+"\n";
//faites ici votre traitement
}
} finally {
// dans tous les cas, on ferme nos flux
buff.close();
}
} catch (IOException ioe) {
// erreur de fermeture des flux
System.out.println("Erreur --" + ioe.toString());
}

@SuppressWarnings("unused")
File f=new File("fichier inverse.txt");
FichierI.append(line);
*/




class Panneau extends JPanel{
JButton bouton=new JButton("propagation");

/*public void paintComponent(Graphics g){
try {

Image img = ImageIO.read(new File("Skul2.jpg"));

g.drawImage(img, 0,0, this.getWidth(), this.getHeight(), this);
//this.setSize(200, 50);


} catch(IOException e)
{ // TODO Auto-generated catch block
e.printStackTrace();
}
}*/

}













}
merciii bien

3 réponses

Utilisateur anonyme
20 juin 2011 à 00:09
Vu l'heure, on n'a pas forcément envie de lire tout ça...

Refais un post plus clair stp en utilisant les balises pour afficher lisiblement le code.
Ensuite, un screen-shots de ta fenêtre serait bien car une "tâche" est assez vague...


--
Pylouq
0
cs_Julien39 Messages postés 6414 Date d'inscription mardi 8 mars 2005 Statut Modérateur Dernière intervention 29 juillet 2020 371
20 juin 2011 à 08:44
Idem, je ne comprends pas quel est ton problème et ce qu'est cette mystérieuse "tache"
0
Utilisateur anonyme
20 juin 2011 à 23:35
A tout hasard, ta fameuse "tâche", elle est noire non ?
A mon avis, la "tâche" serait due à un JPanel mal utilisé (j'ai survolé rapidement le code mais je ne suis pas sur de ce que j'avance).

Sans screen-shots ou explications, pas d'aide.


--
Pylouq
0
Rejoignez-nous