salut tous le monde,
j'ai probleme avec jtable les titres des colonnes sont mals affiches
voila la source,si vous avez une aidez pour regle se probleme n'hesitez pas de m' informer .
merci d'avance.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
class rech extends JDialog implements ActionListener
{
rech()
{
super(pro,"Recherche",true);
setSize(850,400);
Border etched = BorderFactory.createEtchedBorder();
Border titled = BorderFactory.createTitledBorder(etched, "Type Recherche");
pane=new JPanel();
pane1=new JPanel();
pane2=new JPanel();
pane3=new JPanel();
pane4=new JPanel();
pane5=new JPanel();
type =new JComboBox(typeenerg);
type.setEnabled(false);
typechoix = new JComboBox(typech);
model=new DefaultTableModel(col,0);
ke = new JButton("Recherche");
ke.setEnabled(false);
table=new JTable(model);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
table.setModel(model);
pane6=new JScrollPane(table,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
pane6.setViewportView( table);
l1=new JLabel("Type recherche");
l3=new JLabel("Type energie");
l4 = new JLabel("année");
re=new JTextField(10);
re.setEnabled(false);
anne = new JTextField(4);
pane.setLayout(new BorderLayout());
pane1.setLayout(new FlowLayout());
pane2.setLayout(new FlowLayout());
pane3.setLayout(new FlowLayout());
pane4.setLayout(new FlowLayout());
pane1.add(re);
pane1.add(l4);
pane1.add(anne);
pane1.add(l1);
pane1.add(typechoix);
pane1.add(l3);
pane1.add(type);
pane1.setBorder(titled);
pane2.add(ke);
pane.add(pane1,BorderLayout.NORTH);
pane.add(pane6,BorderLayout.CENTER);
pane.add(pane2,BorderLayout.SOUTH);
setContentPane(pane);
typechoix.addActionListener(this);
ke.addActionListener(this);
setVisible(true);
}
public void actionPerformed (ActionEvent e)
{
}
public JPanel pane,pane1,pane2,pane3,pane4,pane5;
public JScrollPane pane6;
public JComboBox type,intitule,typechoix;
public JLabel l1,l2,l3,l4;
public JTextField re,anne;
public DefaultTableModel model;
public JButton ke;
public JTable table;
private String typeenerg []={"ELEC","GAZ"};
private String typech[]={"ABONNE","INTITULTE","TYPE ENERGIE","COMMUNE","NOM ENTREPRISE"};
private String col[]={"N°RCN","ABONNE","Adresse","Tel","Commune","Intitule de affaire","Type energie","Date Demande","Date Debut etude","Date fin etude","Date Devis","Date paiement devis","Montant Devis","Date OET","Date ODS","Date Transimission Travaux","Nom Entreprise","Adresse Entreprise","Tel Adresse","Date piquetage","Date Reception","Date Raccordement","Date AFT","Date Etablissement OMS"," ETAT "};
}
public class affaire {
/**
* @param args
*/
public static void main(String[] args) {
rech fen= new rech();
fen.setVisible( true);
}
}