En effet, j'ai le code suivant qui permet de créer l'interface de mon projet:// {$R conducteur.JFM}
import java.awt.*;
import java.applet.Applet;
// Class conducteur
public class conducteur extends Applet
{
final int MenuBarHeight = 0;
// Declaration
public Panel Panel1;
public Panel Panel2;
public Panel Panel3;
public Panel Panel4;
public Panel Panel5;
public Panel Panel6;
public Label Label1;
public Label Label2;
public Label Label3;
public Choice Choice1;
public Choice Choice2;
public TextField TextField1;
public Button Button1;
public Button Button2;
public Button Button3;
public Button Button4;
public Button Button5;
public Button Button6;
public Button Button7;
public Button Button9;
public Label Label4;
public Label Label5;
public Choice Choice3;
public Choice Choice4;
public TextArea TextArea1;
public Label Label6;
public TextArea TextArea2;
public Button Button8;
public Button Button10;
public Button Button11;
public Button Button12;
public Button Button13;
public Button Button14;
public Label Label7;
public Label Label8;
public Label Label9;
public Choice Choice5;
public Choice Choice6;
public TextField TextField2;
public Button Button15;
public Button Button16;
public Label Label10;
public TextArea TextArea3;
// fin Declaration
// init()
public void init()
{
// Fond
setForeground(Color.black);
setBackground(Color.lightGray);
setFont(new Font("Dialog",Font.BOLD,12));
setLayout(null);
// fin fond
// initialisation
Panel1 = new Panel();
Panel1.setLayout(null);
Panel1.setForeground(Color.black);
Panel1.setBackground(Color.blue);
Panel1.setFont(new Font("Dialog",Font.BOLD,12));
Panel2 = new Panel();
Panel2.setLayout(null);
Panel2.setForeground(Color.black);
Panel2.setBackground(Color.lightGray);
Panel2.setFont(new Font("Dialog",Font.BOLD,12));
Panel3 = new Panel();
Panel3.setLayout(null);
Panel3.setForeground(Color.black);
Panel3.setBackground(Color.white);
Panel3.setFont(new Font("Dialog",Font.BOLD,12));
Panel4 = new Panel();
Panel4.setLayout(null);
Panel4.setForeground(Color.black);
Panel4.setBackground(Color.blue);
Panel4.setFont(new Font("Dialog",Font.BOLD,12));
Panel5 = new Panel();
Panel5.setLayout(null);
Panel5.setForeground(Color.black);
Panel5.setBackground(Color.pink);
Panel5.setFont(new Font("Dialog",Font.BOLD,12));
Panel6 = new Panel();
Panel6.setLayout(null);
Panel6.setForeground(Color.black);
Panel6.setBackground(Color.lightGray);
Panel6.setFont(new Font("Dialog",Font.BOLD,12));
Label1 = new Label("Code Média:",Label.LEFT);
Label1.setFont(new Font("Dialog",Font.BOLD,10));
Label2 = new Label("Média:",Label.LEFT);
Label2.setFont(new Font("Dialog",Font.BOLD,10));
Label3 = new Label("Date",Label.LEFT);
Label3.setFont(new Font("Dialog",Font.BOLD,10));
Choice1 = new Choice();
Choice1.setFont(new Font("Dialog",Font.BOLD,12));
Choice2 = new Choice();
Choice2.addItem("RTA Tananarive");
Choice2.addItem("RTA Tuléar");
Choice2.addItem("RTA Tamatave");
Choice2.addItem("RTA Antsirabe");
Choice2.addItem("RTA Antsohihy");
Choice2.addItem("RTA Majunga");
Choice2.addItem("RTA Mananjary");
Choice2.setFont(new Font("Dialog",Font.PLAIN,10));
TextField1 = new TextField("");
TextField1.setForeground(Color.black);
TextField1.setBackground(Color.white);
TextField1.setFont(new Font("Dialog",Font.BOLD,12));
Button1 = new Button("prec");
Button1.setFont(new Font("Dialog",Font.BOLD,10));
Button2 = new Button("deb");
Button2.setFont(new Font("Dialog",Font.BOLD,10));
Button3 = new Button("suiv");
Button3.setFont(new Font("Dialog",Font.BOLD,10));
Button4 = new Button("fin");
Button4.setFont(new Font("Dialog",Font.BOLD,10));
Button5 = new Button("nouv");
Button5.setFont(new Font("Dialog",Font.BOLD,10));
Button6 = new Button("sup");
Button6.setFont(new Font("Dialog",Font.BOLD,10));
Button7 = new Button("X");
Button7.setFont(new Font("Dialog",Font.BOLD,12));
Button9 = new Button("Fermer");
Button9.setFont(new Font("Dialog",Font.BOLD,12));
Label4 = new Label("Diffuseur principal",Label.LEFT);
Label4.setFont(new Font("Dialog",Font.BOLD,10));
Label5 = new Label("Diffuseur supplémentaire",Label.LEFT);
Label5.setFont(new Font("Dialog",Font.BOLD,10));
Choice3 = new Choice();
Choice3.addItem("Mamy");
Choice3.addItem("Vivien");
Choice3.addItem("Herilanto");
Choice3.addItem("Harizo");
Choice3.setFont(new Font("Dialog",Font.BOLD,10));
Choice4 = new Choice();
Choice4.addItem("Mamy");
Choice4.addItem("Vivien");
Choice4.addItem("Herilanto");
Choice4.addItem("Harizo");
Choice4.setFont(new Font("Dialog",Font.BOLD,10));
TextArea1 = new TextArea("TextArea1");
TextArea1.setForeground(Color.black);
TextArea1.setBackground(Color.white);
TextArea1.setFont(new Font("Dialog",Font.BOLD,12));
Label6 = new Label("OBSERVATIONS",Label.LEFT);
Label6.setFont(new Font("Dialog",Font.BOLD,10));
TextArea2 = new TextArea("TextArea2");
TextArea2.setForeground(Color.black);
TextArea2.setBackground(Color.white);
TextArea2.setFont(new Font("Dialog",Font.BOLD,12));
Button8 = new Button("saisie");
Button8.setFont(new Font("Dialog",Font.BOLD,10));
Button10 = new Button("affi");
Button10.setFont(new Font("Dialog",Font.BOLD,10));
Button11 = new Button("suppr");
Button11.setFont(new Font("Dialog",Font.BOLD,10));
Button12 = new Button("Modif");
Button12.setFont(new Font("Dialog",Font.BOLD,10));
Button13 = new Button("impression avec résumé");
Button13.setFont(new Font("Dialog",Font.BOLD,10));
Button14 = new Button("impression sans résumé");
Button14.setFont(new Font("Dialog",Font.BOLD,10));
Label7 = new Label("Code média",Label.LEFT);
Label7.setFont(new Font("Dialog",Font.BOLD,10));
Label8 = new Label("Média",Label.LEFT);
Label8.setFont(new Font("Dialog",Font.BOLD,10));
Label9 = new Label("Date conducteur",Label.LEFT);
Label9.setFont(new Font("Dialog",Font.BOLD,10));
Choice5 = new Choice();
Choice5.setFont(new Font("Dialog",Font.BOLD,12));
Choice6 = new Choice();
Choice6.addItem("RTA Tananarive");
Choice6.addItem("RTA Tamatave");
Choice6.addItem("RTA Tuléar");
Choice6.addItem("RTA Antsirabe");
Choice6.addItem("RTA Antsohihy");
Choice6.addItem("RTA Majunga");
Choice6.addItem("RTA Mananjary");
Choice6.addItem("RTA Fianarantsoa");
Choice6.addItem("TVM");
Choice6.addItem("Prime TV");
Choice6.addItem("Ma_TV");
Choice6.addItem("TV Plus");
Choice6.addItem("MBS");
Choice6.addItem("MTV");
Choice6.addItem("TV5");
Choice6.addItem("TF1");
Choice6.addItem("TV Africa");
Choice6.addItem("Teva");
Choice6.addItem("Mcm");
Choice6.addItem("Parabole");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.addItem("");
Choice6.setFont(new Font("Dialog",Font.PLAIN,10));
TextField2 = new TextField("");
TextField2.setForeground(Color.black);
TextField2.setBackground(Color.white);
TextField2.setFont(new Font("Dialog",Font.BOLD,12));
Button15 = new Button("Valider");
Button15.setFont(new Font("Dialog",Font.BOLD,10));
Button16 = new Button("ajout");
Button16.setFont(new Font("Dialog",Font.BOLD,10));
Label10 = new Label("TOTAL PAR TYPE DE PROGRAMME",Label.LEFT);
Label10.setFont(new Font("Dialog",Font.BOLD,10));
TextArea3 = new TextArea("TextArea3");
TextArea3.setForeground(Color.black);
TextArea3.setBackground(Color.white);
TextArea3.setFont(new Font("Dialog",Font.BOLD,12));
//fin initialisation
// Add()s
Panel4.add(TextArea3);
Panel4.add(Label10);
Panel4.add(Button16);
Panel6.add(Button15);
Panel6.add(TextField2);
Panel6.add(Choice6);
Panel6.add(Choice5);
Panel6.add(Label9);
Panel6.add(Label8);
Panel6.add(Label7);
Panel3.add(Button14);
Panel3.add(Button13);
Panel3.add(Button12);
Panel3.add(Button11);
Panel3.add(Button10);
Panel3.add(Button8);
Panel5.add(TextArea2);
Panel5.add(Label6);
Panel3.add(TextArea1);
Panel2.add(Choice4);
Panel2.add(Choice3);
Panel2.add(Label5);
Panel2.add(Label4);
Panel1.add(Button9);
Panel1.add(Button7);
Panel1.add(Button6);
Panel1.add(Button5);
Panel1.add(Button4);
Panel1.add(Button3);
Panel1.add(Button2);
Panel1.add(Button1);
Panel1.add(TextField1);
Panel1.add(Choice2);
Panel1.add(Choice1);
Panel1.add(Label3);
Panel1.add(Label2);
Panel1.add(Label1);
add(Panel6);
add(Panel5);
add(Panel4);
add(Panel3);
add(Panel2);
add(Panel1);
// End of Add()s
InitialPositionSet();
} // End of init()
// start()
public void start()
{
} // End of start()
// stop()
public void stop()
{
} // End of stop()
// destroy()
public void destroy()
{
} // End of destroy()
public void paint(Graphics g)
{
// paint()
// End of paint()
}
public void InitialPositionSet()
{
// InitialPositionSet()
resize(624,538);
Panel1.reshape(11,9+MenuBarHeight,590,78);
Panel2.reshape(11,80+MenuBarHeight,590,51);
Panel3.reshape(11,130+MenuBarHeight,590,212);
Panel4.reshape(290,340+MenuBarHeight,311,191);
Panel5.reshape(11,340+MenuBarHeight,283,70);
Panel6.reshape(11,409+MenuBarHeight,283,122);
Label1.reshape(14,10,84,19);
Label2.reshape(218,8,51,19);
Label3.reshape(404,6,51,19);
Choice1.reshape(104,5,100,27);
Choice2.reshape(271,4,120,24);
TextField1.reshape(450,3,114,25);
Button1.reshape(22,41,33,20);
Button2.reshape(57,42,35,20);
Button3.reshape(95,41,32,21);
Button4.reshape(130,41,33,21);
Button5.reshape(168,40,33,22);
Button6.reshape(204,40,32,22);
Button7.reshape(239,40,29,21);
Button9.reshape(489,39,75,25);
Label4.reshape(37,17,133,19);
Label5.reshape(304,16,181,19);
Choice3.reshape(184,14,81,24);
Choice4.reshape(486,12,78,24);
TextArea1.reshape(2,5,583,158);
Label6.reshape(83,4,133,19);
TextArea2.reshape(4,23,271,43);
Button8.reshape(6,170,42,32);
Button10.reshape(49,170,38,32);
Button11.reshape(91,170,37,32);
Button12.reshape(139,169,41,33);
Button13.reshape(209,174,180,20);
Button14.reshape(413,172,170,22);
Label7.reshape(9,8,87,19);
Label8.reshape(9,50,101,19);
Label9.reshape(9,82,107,19);
Choice5.reshape(94,2,123,27);
Choice6.reshape(93,43,124,24);
TextField2.reshape(117,81,100,25);
Button15.reshape(227,23,51,65);
Button16.reshape(136,166,75,20);
Label10.reshape(35,2,242,19);
TextArea3.reshape(11,22,291,133);
// End of InitialPositionSet()
}
public boolean handleEvent(Event evt)
{
// handleEvent()
if (evt.id == Event.WINDOW_DESTROY && evt.target == this) conducteur_WindowDestroy(evt.target);
// End of handleEvent()
return super.handleEvent(evt);
}
// Event Handling Routines
public void conducteur_WindowDestroy(Object target)
{
System.exit(0);
}
// End of Event Handling Routines
} // End of Class conducteur
Comment faire pour mettre sur un table sur le Panel1.
Pour plus d'information sur la création de la table, voici le code sur cette table
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.table.*;
public class TableColumnColor extends JFrame
{ String[] columnNames = {"heure", "type", "ID programme", "Titre", "Espace pub", "liste pub","commentaire"};
Object[][] data = {
{"", "","","","","","" },
{"", "","","","","","" },
{"", "","","","","","" },
{"", "","","","","","" },
{"", "","","","","","" },
{"","", "","","","",""}
};
public TableColumnColor()
{
DefaultTableModel dtm = new DefaultTableModel(data,columnNames);
JTable table=new JTable(dtm)
{
public Component prepareRenderer(TableCellRenderer renderer, int row, int column)
{
Component component = super.prepareRenderer(renderer,row,column);
if(column == 0)
{
component.setBackground(Color.white);
}
if(column == 1)
{
component.setBackground(Color.white);
}
if(column == 2)
{
component.setBackground(Color.white);
if(column == 3)
{
component.setBackground(Color.white);
}
if(column == 4)
{
component.setBackground(Color.white);
}
if(column == 5)
{
component.setBackground(Color.white);
}
if(column == 6)
{
component.setBackground(Color.white);
}
}
return component;
}
};
JScrollPane scroll=new JScrollPane(table);
this.setContentPane(scroll);
this.setBounds(100,50,300,150);
}
public static void main (String arg[])
{
TableColumnColor tes = new TableColumnColor();
tes.setVisible(true);
tes.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
Svp!!! Aidez moi!!!!