Problème d'affichage d'une fenêtre

208893 Messages postés 55 Date d'inscription mercredi 14 avril 2010 Statut Membre Dernière intervention 21 décembre 2010 - 13 sept. 2010 à 15:08
208893 Messages postés 55 Date d'inscription mercredi 14 avril 2010 Statut Membre Dernière intervention 21 décembre 2010 - 22 sept. 2010 à 08:52
salut;
j'ai une application quand j'appuis sur le bouton de recherche; il affiche la fenêtre suivant et on même temps la fenêtre de recherche reste ouvert j'ai met
this.setVisible(true);

et ne fonctionne pas.
aussi au niveau de la page d'authentification
après la saisie des coordonnés et l'affichage de la page correspondent la fenêtre d'authentification reste afficher

4 réponses

cs_Julien39 Messages postés 6414 Date d'inscription mardi 8 mars 2005 Statut Modérateur Dernière intervention 29 juillet 2020 371
19 sept. 2010 à 16:13
"le bouton de recherche", "la fenêtre suivant", "la fenêtre de recherche" qu'est ce que c'est tout ca ? Personne ne sait de quoi est faite ton application, il faut être plus précis.
0
208893 Messages postés 55 Date d'inscription mercredi 14 avril 2010 Statut Membre Dernière intervention 21 décembre 2010 2
20 sept. 2010 à 08:42
bonjour;
mon problème:
après un lancement de recherche des données sont afficher avec un photo
mais le photo s'affiche avec un grand taille et au milieux
merci d'avance
0
cs_Julien39 Messages postés 6414 Date d'inscription mardi 8 mars 2005 Statut Modérateur Dernière intervention 29 juillet 2020 371
21 sept. 2010 à 18:44
donne nous un morceau de code qu'on puisse comprendre ...
0
208893 Messages postés 55 Date d'inscription mercredi 14 avril 2010 Statut Membre Dernière intervention 21 décembre 2010 2
22 sept. 2010 à 08:52
bonjour;
package form;

import java.awt.*;

import javax.imageio.ImageIO;
import javax.swing.*;

import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.io.InputStream;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.text.ParseException;


 class search  {


protected static final int parameterIndex = 0;
JFrame f;
JPanel p1;
JLabel l1;
JTextField tf1;
JButton savebtn;
rech r;
 

search(){

f=new JFrame("Form");	
p1=new JPanel(new GridLayout(12,2,15,15));
//tp=new JTabbedPane();

l1=new JLabel("Matricule :");
l1.setHorizontalAlignment(SwingConstants.LEFT);






tf1=new JTextField(12);
savebtn=new JButton(" Rechercher ");

p1.setLayout(null);
p1.setBorder(BorderFactory.createEtchedBorder());

addComponent(p1, l1, 5,17,80,18);
addComponent(p1, tf1, 110,15,90,22);

addComponent(p1, savebtn, 90,60,100,28);

f.getContentPane().add(p1);

savebtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae){

String value=tf1.getText();
Connection con = null;
 String url = "jdbc:mysql://localhost:3306/";
 String db = "teste_deux_form";
 String driver = "com.mysql.jdbc.Driver";
 String user = "root";
 String pass = "";
try{
Class.forName(driver);
con = DriverManager.getConnection(url+db, user, pass);
PreparedStatement st=con.prepareStatement("select mat,nom,prenom,affectation,niveau_scolaire,fonction,etat,situation,date,note,img from personnels where mat=?");
 Blob blob;


st.setString(1,value);


ResultSet res=st.executeQuery();



res.next();


r=new rech();
//m.form();
r.tff1.setText(tf1.getText());
r.tf2.setText(res.getString(2));
r.dis();

r.tf3.setText(res.getString(3));
r.tf4.setText(Integer.toString(res.getInt(4)));
r.tf5.setText(res.getString(5));
r.tf6.setText(res.getString(6));
r.tf71.setText(res.getString(7));
r.tf7.setText(res.getString(8));

r.tf8.setText(res.getString(9));
r.tf9.setText(res.getString(10));

blob = res.getBlob("img");
JLabel icon = new JLabel(new ImageIcon(blob.getBytes(1, (int)blob.length())));
            r.photo = new JLabel();
            JPanel panIcon = new JPanel();
            r.p1.add(r.photo, BorderLayout.NORTH);
            r.p1.setBackground(Color.white);
     		r.p1.setLayout(new BorderLayout());
    		r.p1.add(icon);
    		((RootPaneContainer) r.p1).getContentPane().add(panIcon, BorderLayout.EAST);
con.close();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(p1,"Ce matricule n'existe pas");
}
}
});
}
/** Add Component Without a Layout Manager (Absolute Positioning) */
private void addComponent(Container container,Component c,int x,int y,int width,int height) {
    c.setBounds(x,y,width,height);
    container.add(c);
} //end of addComponent()

void dis()
{
f.getContentPane().add(p1);

f.setSize(320,180);
f.setVisible(true);
f.setResizable(false);
}
public static void main(String z[]){
search pro=new search();
pro.dis();

}
}



et aussi
package form;

import java.awt.*;

import javax.swing.*;

import java.awt.event.*;
import java.io.BufferedInputStream;
import java.net.MalformedURLException;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.text.ParseException;


 class rech  {


protected static final int parameterIndex = 0;
//protected static final GridBagConstraints gbc = null;
JFrame f;
JPanel p1;
//JTabbedPane tp;
JLabel tff1,l1, l2, l3,l4,l5,l6,l7,l71,l8,lj8,lm8,la8,l9,tf2,tf3,tf4,tf5,tf6,tf7,tf71,tf8,tf9,p,photo;
JComboBox jj=null,jm=null,ja=null;
//JButton savebtn,annul;
search s;
//protected Object panIcon;
 




rech(){

f=new JFrame("Ouvrier");	
p1=new JPanel(new GridLayout(12,2));

l1=new JLabel("Matricule :");
l2=new JLabel("Nom :");
l3=new JLabel("Prénom :");
l4=new JLabel("Affectation :");
l5=new JLabel("Niveau scolaire :");
l6=new JLabel("Fonction :");
l71=new JLabel("Etat");
l7=new JLabel("Situation :");
l8=new JLabel("Date d'entrée :");
l9=new JLabel("Note :");
p=new JLabel("photo");





tff1=new JLabel();
tf2=new JLabel();
tf3=new JLabel();
tf4=new JLabel();
tf5=new JLabel();
tf6=new JLabel();
tf71 =new JLabel();
tf7 =new JLabel();	
tf8=new JLabel();
tf9=new JLabel();

photo = new JLabel();
//savebtn=new JButton(" Imprimer ");
            p1.setLayout(null);
p1.setBorder(BorderFactory.createEtchedBorder());

addComponent(p1, l1, 5,17,106,18);
addComponent(p1, l2, 5,47,106,18);
addComponent(p1, l3, 5,77,106,18);
addComponent(p1, l4, 5,107,106,18);
addComponent(p1, l5, 5,137,106,18);
addComponent(p1, l6, 5,167,106,18);
addComponent(p1, l71, 5,197,106,18);
addComponent(p1, l7, 5,227,106,18);
addComponent(p1, l8, 5,257,106,18);
addComponent(p1, l9, 5,287,106,18);
addComponent(p1, p, 5,317,106,18);

addComponent(p1, tff1, 110,15,183,22);
addComponent(p1, tf2, 110,45,183,22);
addComponent(p1, tf3, 110,75,183,22);
addComponent(p1, tf4, 110,105,183,22);
addComponent(p1, tf5, 110,135,183,22);
addComponent(p1, tf6, 110,165,183,22);
addComponent(p1, tf71, 110,195,183,22);
addComponent(p1, tf7, 110,225,183,22);
addComponent(p1, tf8, 110,255,183,22);
addComponent(p1, tf9, 110,285,183,22);
addComponent(p1, photo, 110,315,106,18);

//addComponent(p1, savebtn, 90,700,106,18);


f.getContentPane().add(p1);




}



/** Add Component Without a Layout Manager (Absolute Positioning) */
private void addComponent(Container container,Component c,int x,int y,int width,int height) {
    c.setBounds(x,y,width,height);
    container.add(c);
} //end of addComponent()

void dis()
{
f.getContentPane().add(p1);

f.setSize(350,500);
f.setVisible(true);
f.setResizable(true);
}


 }

le photo s'affiche avec grand taille et au milieu de page
merci d'avance
0
Rejoignez-nous