Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

Sujet : Gestion du contenu d'une fênetre suivant choix de l'utilisateur [ Multimédia / Java2D ] (argoth)

lundi 16 juillet 2007 à 20:17:53 | Gestion du contenu d'une fênetre suivant choix de l'utilisateur

argoth

Bonjour,

Je débute en Java/J# ainsi qu'en utilisation d'interface graphique (je code en C/C++ sans GUI)
Mon problème est le suivant:

Je souhaite créer une simple application de gestion de réservation de salles en J# couplé à une BDD MySQL.
Les fonctionnalités du programmes sont les suivantes: Formulaire de réservation, Recherche de salle disponible et Ajout/Supprission de salles.

Afin d'éclaircir au maximun l'interface utilisateur, je souhaite qu'elle possède cette apparence:
[ Lien ]

Si l'utilisateur clique sur le premier bouton, un formulaire apparaît, sur le deuxième un formulaire de recherche et sur le troisième un formulaire d'ajout/suppression.

J'ai construi la première page à l'aide de Visual Studio J# dont le code est fournit plus bas.
Je souhaiterais supprimer le groupBox1 (deuxième cadre si dessus dans la fenetre) et afficher un autre groupBox(2) si l'utilisateur clique sur le 2eme bouton.

J'ai penser à mettre tout ce qui concernait la création du groupBox1 dans une fonction et faire un "groupBox1.Dispose()" si on clique sur un autre bouton que le 1er et appeler cette fonction pour reconstruire le groupBox1.

Le problème est que je n'arrive pas à savoir quel doivent être les élements qui doivent être présent dans cette fonction.
Est-ce la bonne méthode, si oui pouvez vous m'aider à le faire, après il sera de même pour les deux autre boutons.

Voici le code de la page:
[code]

package

WindowsApplication1;

import

System.Collections.Generic.*;

import

System.Data.*;

import

System.Drawing.*;

import

System.ComponentModel.*;

import

System.Windows.Forms.*;

/**

* Description r,sum,e de Form1.

*/

public

classForm1extends System.Windows.Forms.Form

{

privatePanel panel1;

privateButton button3;

privateButton button2;

privateButton button1;

privatePanel panel2;

privateButton button4;

privateGroupBox groupBox1;

privateLabel label3;

privateLabel label2;

privateLabel label1;

privateRichTextBox richTextBox1;

privateLabel label7;

privateLabel label6;

privateLabel label5;

privateLabel label4;

privateTextBox textBox2;

privateTextBox textBox1;

privateComboBox comboBox1;

privateComboBox comboBox3;

privateComboBox comboBox2;

privateTextBox textBox3;

privateLabel label9;

privateLabel label8;

privateNumericUpDown numericUpDown1;

privateDateTimePicker dateTimePicker1;

privateLabel label10;

privateCheckBox checkBox3;

privateCheckBox checkBox2;

privateCheckBox checkBox1;

privateButton button6;

privateButton button5;

/**

* Variable n,cessaire au concepteur.

*/

privateSystem.ComponentModel.IContainer components;

public Form1()

{

//

// Requis pour la prise en charge du Concepteur Windows Form

//

InitializeComponent();

//

// TODOÿ: ajoutez le code constructeur apr¦s l'appel InitializeComponent

//

}

#region

Code g,n,r, par le Concepteur Windows Form

/**

* Nettoyage des ressources utilis,es.

*/

protectedvoid Dispose(boolean disposing)

{

if (disposing)

{

if (components != null)

{

components.Dispose();

}

}

super.Dispose(disposing);

}

/**

* M,thode requise pour la prise en charge du concepteur - ne modifiez pas

* le contenu de cette m,thode avec l',diteur de code.

*/

privatevoid InitializeComponent()

{

this.panel1 = newSystem.Windows.Forms.Panel();

this.button4 = newSystem.Windows.Forms.Button();

this.button3 = newSystem.Windows.Forms.Button();

this.button2 = newSystem.Windows.Forms.Button();

this.button1 = newSystem.Windows.Forms.Button();

this.panel2 = newSystem.Windows.Forms.Panel();

this.groupBox1 = newSystem.Windows.Forms.GroupBox();

this.button6 = newSystem.Windows.Forms.Button();

this.button5 = newSystem.Windows.Forms.Button();

this.numericUpDown1 = newSystem.Windows.Forms.NumericUpDown();

this.dateTimePicker1 = newSystem.Windows.Forms.DateTimePicker();

this.label10 = newSystem.Windows.Forms.Label();

this.checkBox3 = newSystem.Windows.Forms.CheckBox();

this.checkBox2 = newSystem.Windows.Forms.CheckBox();

this.checkBox1 = newSystem.Windows.Forms.CheckBox();

this.textBox3 = newSystem.Windows.Forms.TextBox();

this.label9 = newSystem.Windows.Forms.Label();

this.label8 = newSystem.Windows.Forms.Label();

this.comboBox3 = newSystem.Windows.Forms.ComboBox();

this.comboBox2 = newSystem.Windows.Forms.ComboBox();

this.textBox2 = newSystem.Windows.Forms.TextBox();

this.textBox1 = newSystem.Windows.Forms.TextBox();

this.comboBox1 = newSystem.Windows.Forms.ComboBox();

this.richTextBox1 = newSystem.Windows.Forms.RichTextBox();

this.label7 = newSystem.Windows.Forms.Label();

this.label6 = newSystem.Windows.Forms.Label();

this.label5 = newSystem.Windows.Forms.Label();

this.label4 = newSystem.Windows.Forms.Label();

this.label3 = newSystem.Windows.Forms.Label();

this.label2 = newSystem.Windows.Forms.Label();

this.label1 = newSystem.Windows.Forms.Label();

this.panel1.SuspendLayout();

this.groupBox1.SuspendLayout();

((

System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();

this.SuspendLayout();

//

// panel1

//

this.panel1.get_Controls().Add(this.button4);

this.panel1.get_Controls().Add(this.button3);

this.panel1.get_Controls().Add(this.button2);

this.panel1.get_Controls().Add(this.button1);

this.panel1.get_Controls().Add(this.panel2);

this.panel1.set_Location(newSystem.Drawing.Point(2, 1));

this.panel1.set_Name("panel1");

this.panel1.set_Size(newSystem.Drawing.Size(582, 43));

this.panel1.set_TabIndex(0);

//

// button4

//

this.button4.set_Location(newSystem.Drawing.Point(377, 12));

this.button4.set_Name("button4");

this.button4.set_Size(newSystem.Drawing.Size(75, 23));

this.button4.set_TabIndex(5);

this.button4.set_Text("Quitter");

this.button4.set_UseVisualStyleBackColor(true);

this.button4.add_Click(newSystem.EventHandler(this.button4_Click));

//

// button3

//

this.button3.set_Location(newSystem.Drawing.Point(295, 12));

this.button3.set_Name("button3");

this.button3.set_Size(newSystem.Drawing.Size(75, 23));

this.button3.set_TabIndex(4);

this.button3.set_Text("Ajout/Suppression");

this.button3.set_UseVisualStyleBackColor(true);

this.button3.add_Click(newSystem.EventHandler(this.button3_Click));

//

// button2

//

this.button2.set_Location(newSystem.Drawing.Point(213, 12));

this.button2.set_Name("button2");

this.button2.set_Size(newSystem.Drawing.Size(75, 23));

this.button2.set_TabIndex(3);

this.button2.set_Text("Recherche");

this.button2.set_UseVisualStyleBackColor(true);

this.button2.add_Click(newSystem.EventHandler(this.button2_Click));

//

// button1

//

this.button1.set_Location(newSystem.Drawing.Point(131, 11));

this.button1.set_Name("button1");

this.button1.set_Size(newSystem.Drawing.Size(75, 23));

this.button1.set_TabIndex(2);

this.button1.set_Text("Reservation");

this.button1.set_UseVisualStyleBackColor(true);

this.button1.add_Click(newSystem.EventHandler(this.button1_Click));

//

// panel2

//

this.panel2.set_Location(newSystem.Drawing.Point(0, 49));

this.panel2.set_Name("panel2");

this.panel2.set_Size(newSystem.Drawing.Size(279, 213));

this.panel2.set_TabIndex(1);

//

// groupBox1

//

this.groupBox1.get_Controls().Add(this.button6);

this.groupBox1.get_Controls().Add(this.button5);

this.groupBox1.get_Controls().Add(this.numericUpDown1);

this.groupBox1.get_Controls().Add(this.dateTimePicker1);

this.groupBox1.get_Controls().Add(this.label10);

this.groupBox1.get_Controls().Add(this.checkBox3);

this.groupBox1.get_Controls().Add(this.checkBox2);

this.groupBox1.get_Controls().Add(this.checkBox1);

this.groupBox1.get_Controls().Add(this.textBox3);

this.groupBox1.get_Controls().Add(this.label9);

this.groupBox1.get_Controls().Add(this.label8);

this.groupBox1.get_Controls().Add(this.comboBox3);

this.groupBox1.get_Controls().Add(this.comboBox2);

this.groupBox1.get_Controls().Add(this.textBox2);

this.groupBox1.get_Controls().Add(this.textBox1);

this.groupBox1.get_Controls().Add(this.comboBox1);

this.groupBox1.get_Controls().Add(this.richTextBox1);

this.groupBox1.get_Controls().Add(this.label7);

this.groupBox1.get_Controls().Add(this.label6);

this.groupBox1.get_Controls().Add(this.label5);

this.groupBox1.get_Controls().Add(this.label4);

this.groupBox1.get_Controls().Add(this.label3);

this.groupBox1.get_Controls().Add(this.label2);

this.groupBox1.get_Controls().Add(this.label1);

this.groupBox1.set_Location(newSystem.Drawing.Point(2, 50));

this.groupBox1.set_Name("groupBox1");

this.groupBox1.set_Size(newSystem.Drawing.Size(582, 511));

this.groupBox1.set_TabIndex(1);

this.groupBox1.set_TabStop(false);

this.groupBox1.set_Text("Reservation d\'une salle");

this.groupBox1.add_Enter(newSystem.EventHandler(this.groupBox1_Enter));

//

// button6

//

this.button6.set_Location(newSystem.Drawing.Point(295, 469));

this.button6.set_Name("button6");

this.button6.set_Size(newSystem.Drawing.Size(75, 23));

this.button6.set_TabIndex(25);

this.button6.set_Text("Annuler");

this.button6.set_UseVisualStyleBackColor(true);

this.button6.add_Click(newSystem.EventHandler(this.button6_Click));

//

// button5

//

this.button5.set_Location(newSystem.Drawing.Point(204, 469));

this.button5.set_Name("button5");

this.button5.set_Size(newSystem.Drawing.Size(75, 23));

this.button5.set_TabIndex(24);

this.button5.set_Text("Valider");

this.button5.set_UseVisualStyleBackColor(true);

this.button5.add_Click(newSystem.EventHandler(this.button5_Click));

//

// numericUpDown1

//

this.numericUpDown1.set_Location(newSystem.Drawing.Point(337, 377));

this.numericUpDown1.set_Name("numericUpDown1");

this.numericUpDown1.set_Size(newSystem.Drawing.Size(52, 20));

this.numericUpDown1.set_TabIndex(23);

//

// dateTimePicker1

//

this.dateTimePicker1.set_Location(newSystem.Drawing.Point(113, 129));

this.dateTimePicker1.set_Name("dateTimePicker1");

this.dateTimePicker1.set_Size(newSystem.Drawing.Size(200, 20));

this.dateTimePicker1.set_TabIndex(22);

//

// label10

//

this.label10.set_AutoSize(true);

this.label10.set_Location(newSystem.Drawing.Point(104, 377));

this.label10.set_Name("label10");

this.label10.set_Size(newSystem.Drawing.Size(213, 13));

this.label10.set_TabIndex(21);

this.label10.set_Text("Nombres de postes ayant besoins d\'Internet");

//

// checkBox3

//

this.checkBox3.set_AutoSize(true);

this.checkBox3.set_Location(newSystem.Drawing.Point(319, 345));

this.checkBox3.set_Name("checkBox3");

this.checkBox3.set_Size(newSystem.Drawing.Size(87, 17));

this.checkBox3.set_TabIndex(20);

this.checkBox3.set_Text("Papperboard");

this.checkBox3.set_UseVisualStyleBackColor(true);

//

// checkBox2

//

this.checkBox2.set_AutoSize(true);

this.checkBox2.set_Location(newSystem.Drawing.Point(213, 345));

this.checkBox2.set_Name("checkBox2");

this.checkBox2.set_Size(newSystem.Drawing.Size(100, 17));

this.checkBox2.set_TabIndex(19);

this.checkBox2.set_Text("Vid,oprojecteur");

this.checkBox2.set_UseVisualStyleBackColor(true);

//

// checkBox1

//

this.checkBox1.set_AutoSize(true);

this.checkBox1.set_Location(newSystem.Drawing.Point(107, 345));

this.checkBox1.set_Name("checkBox1");

this.checkBox1.set_Size(newSystem.Drawing.Size(99, 17));

this.checkBox1.set_TabIndex(18);

this.checkBox1.set_Text("R,troprojecteur");

this.checkBox1.set_UseVisualStyleBackColor(true);

//

// textBox3

//

this.textBox3.set_Location(newSystem.Drawing.Point(182, 414));

this.textBox3.set_Name("textBox3");

this.textBox3.set_Size(newSystem.Drawing.Size(207, 20));

this.textBox3.set_TabIndex(16);

//

// label9

//

this.label9.set_AutoSize(true);

this.label9.set_Location(newSystem.Drawing.Point(40, 414));

this.label9.set_Name("label9");

this.label9.set_Size(newSystem.Drawing.Size(134, 13));

this.label9.set_TabIndex(15);

this.label9.set_Text("Adresse email de r,ponse :");

//

// label8

//

this.label8.set_AutoSize(true);

this.label8.set_Location(newSystem.Drawing.Point(40, 345));

this.label8.set_Name("label8");

this.label8.set_Size(newSystem.Drawing.Size(50, 13));

this.label8.set_TabIndex(14);

this.label8.set_Text("Besoins :");

//

// comboBox3

//

this.comboBox3.set_FormattingEnabled(true);

this.comboBox3.set_Location(newSystem.Drawing.Point(130, 207));

this.comboBox3.set_Name("comboBox3");

this.comboBox3.set_Size(newSystem.Drawing.Size(99, 21));

this.comboBox3.set_TabIndex(13);

//

// comboBox2

//

this.comboBox2.set_FormattingEnabled(true);

this.comboBox2.set_Location(newSystem.Drawing.Point(130, 169));

this.comboBox2.set_Name("comboBox2");

this.comboBox2.set_Size(newSystem.Drawing.Size(99, 21));

this.comboBox2.set_TabIndex(12);

//

// textBox2

//

this.textBox2.set_Location(newSystem.Drawing.Point(148, 92));

this.textBox2.set_Name("textBox2");

this.textBox2.set_Size(newSystem.Drawing.Size(392, 20));

this.textBox2.set_TabIndex(11);

//

// textBox1

//

this.textBox1.set_Location(newSystem.Drawing.Point(165, 55));

this.textBox1.set_Name("textBox1");

this.textBox1.set_Size(newSystem.Drawing.Size(256, 20));

this.textBox1.set_TabIndex(10);

//

// comboBox1

//

this.comboBox1.set_FormattingEnabled(true);

this.comboBox1.set_Location(newSystem.Drawing.Point(85, 24));

this.comboBox1.set_Name("comboBox1");

this.comboBox1.set_Size(newSystem.Drawing.Size(121, 21));

this.comboBox1.set_TabIndex(9);

//

// richTextBox1

//

this.richTextBox1.set_Location(newSystem.Drawing.Point(130, 250));

this.richTextBox1.set_Name("richTextBox1");

this.richTextBox1.set_Size(newSystem.Drawing.Size(440, 81));

this.richTextBox1.set_TabIndex(8);

this.richTextBox1.set_Text("");

//

// label7

//

this.label7.set_AutoSize(true);

this.label7.set_Location(newSystem.Drawing.Point(39, 248));

this.label7.set_Name("label7");

this.label7.set_Size(newSystem.Drawing.Size(79, 13));

this.label7.set_TabIndex(7);

this.label7.set_Text("Commentaires :");

//

// label6

//

this.label6.set_AutoSize(true);

this.label6.set_Location(newSystem.Drawing.Point(38, 209));

this.label6.set_Name("label6");

this.label6.set_Size(newSystem.Drawing.Size(71, 13));

this.label6.set_TabIndex(5);

this.label6.set_Text("Heure de fin :");

//

// label5

//

this.label5.set_AutoSize(true);

this.label5.set_Location(newSystem.Drawing.Point(37, 172));

this.label5.set_Name("label5");

this.label5.set_Size(newSystem.Drawing.Size(87, 13));

this.label5.set_TabIndex(4);

this.label5.set_Text("Heure de d,but :");

//

// label4

//

this.label4.set_AutoSize(true);

this.label4.set_Location(newSystem.Drawing.Point(38, 129));

this.label4.set_Name("label4");

this.label4.set_Size(newSystem.Drawing.Size(36, 13));

this.label4.set_TabIndex(3);

this.label4.set_Text("Date :");

//

// label3

//

this.label3.set_AutoSize(true);

this.label3.set_Location(newSystem.Drawing.Point(40, 95));

this.label3.set_Name("label3");

this.label3.set_Size(newSystem.Drawing.Size(102, 13));

this.label3.set_TabIndex(2);

this.label3.set_Text("Objet de la r,union :");

this.label3.add_Click(newSystem.EventHandler(this.label3_Click));

//

// label2

//

this.label2.set_AutoSize(true);

this.label2.set_Location(newSystem.Drawing.Point(38, 58));

this.label2.set_Name("label2");

this.label2.set_Size(newSystem.Drawing.Size(121, 13));

this.label2.set_TabIndex(1);

this.label2.set_Text("Pr,sident de la s,ance :");

this.label2.add_Click(newSystem.EventHandler(this.label2_Click));

//

// label1

//

this.label1.set_AutoSize(true);

this.label1.set_Location(newSystem.Drawing.Point(39, 27));

this.label1.set_Name("label1");

this.label1.set_Size(newSystem.Drawing.Size(36, 13));

this.label1.set_TabIndex(0);

this.label1.set_Text("Salle :");

this.label1.add_Click(newSystem.EventHandler(this.label1_Click_1));

//

// Form1

//

this.set_AutoScaleDimensions(newSystem.Drawing.SizeF(6F, 13F));

this.set_AutoScaleMode(System.Windows.Forms.AutoScaleMode.Font);

this.set_ClientSize(newSystem.Drawing.Size(584, 564));

this.get_Controls().Add(this.panel1);

this.get_Controls().Add(this.groupBox1);

this.set_Name("Form1");

this.set_Text("Gestion de reservations de salles");

this.add_Load(newSystem.EventHandler(this.Form1_Load));

this.panel1.ResumeLayout(false);

this.groupBox1.ResumeLayout(false);

this.groupBox1.PerformLayout();

((

System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();

this.ResumeLayout(false);

}

#endregion

privatevoid button1_Click(Object sender, System.EventArgs e)

{

}

privatevoid button2_Click(Object sender, System.EventArgs e)

{

this.groupBox1.Dispose();

}

privatevoid button3_Click(Object sender, System.EventArgs e)

{

}

privatevoid button4_Click(Object sender, System.EventArgs e)

{

System.exit(0);

}

privatevoid button5_Click(Object sender, System.EventArgs e)

{

}

privatevoid button6_Click(Object sender, System.EventArgs e)

{

}

privatevoid Form1_Load(Object sender, System.EventArgs e)

{

}

privatevoid label1_Click(Object sender, System.EventArgs e)

{

}

privatevoid label2_Click(Object sender, System.EventArgs e)

{

}

privatevoid label3_Click(Object sender, System.EventArgs e)

{

}

privatevoid splitContainer1_Panel2_Paint(Object sender, PaintEventArgs e)

{

}

privatevoid groupBox1_Enter(Object sender, System.EventArgs e)

{

}

privatevoid label1_Click_1(Object sender, System.EventArgs e)

{

}

}[/code]


merci de votre aide

lundi 16 juillet 2007 à 20:21:47 | Re : Gestion du contenu d'une fênetre suivant choix de l'utilisateur

DARKSIDIOUS

Membre Club Administrateur CodeS-SourceS

Je me demande si tu trouvera beaucoup d'aide ici : sur un forum java, J# est tabou

En tout cas, je ne dirais qu'une seule chose : je suis bien content de faire du JAVA moi :
Microsoft."java" == BERK


mardi 17 juillet 2007 à 09:22:36 | Re : Gestion du contenu d'une fênetre suivant choix de l'utilisateur

GodConan

J# berk... ;o) j en voi pas l interer ... de toute facn c est pour faire du .net alors autant rester au C++ .... ;o)
Et puis Site JAVA .... ;o) Pas de réponce pour toi ;o) hihi

++

GodConan ;o)

mardi 17 juillet 2007 à 10:05:18 | Re : Gestion du contenu d'une fênetre suivant choix de l'utilisateur

argoth

c'était pour tester le Java/J# vais essayer sur un autre forum alors si c'est prohibé ici


mardi 17 juillet 2007 à 10:30:12 | Re : Gestion du contenu d'une fênetre suivant choix de l'utilisateur

DARKSIDIOUS

Membre Club Administrateur CodeS-SourceS
C'est pas que c'est prohibé, c'est juste que je connais personne ici qui fait du J# ! (je me demande même si ca existe )

Quite à faire du java, autant faire du java de chez sun, et non du "java" à la sauce microsoft.

Essaye sur d'autres forums (il doit bien y avoir des forums spécialisés J# quand même...) car ici je te garantis pas que tu trouve des réponses.



mardi 17 juillet 2007 à 11:35:35 | Re : Gestion du contenu d'une fênetre suivant choix de l'utilisateur

CicinhoRaul

Salut,J'avoue ,il faudrait que tu essaies en java c mieux et plus pratique....tu ne peux vraiment pas changer de langage de prog?.

Je te dis ca car j'ai un projet du meme type à faire mais en JAVA.

Je dois faire un formulaire dont les données sont enregistrées dans un fichier texte.

mardi 17 juillet 2007 à 14:24:18 | Re : Gestion du contenu d'une fênetre suivant choix de l'utilisateur

argoth

Si je peu le faire en java mais le dépoyement est plus simple en DotNet car pas de necessité de machine virtuelle.
Le fichier .exe gère les composants manquants et les télécharge tout seul.

Je pourrait le faire en Java mais le problème sera identique, comment rendre un groupbox ou encore combobox (en java) invisible pour en afficher une autre au même endoit ?
doit-on le détruire puis le reconstruire ? ou existe t-il une fonction du genre setVisible ?

ps moi c'est à un BDD et pas à un fichier texte que je veux l'interfacer mon prog :p

Je send que je vais finir par le faire en C# au lieu de J# :|

mardi 17 juillet 2007 à 14:30:50 | Re : Gestion du contenu d'une fênetre suivant choix de l'utilisateur