Mise à jour

This commit is contained in:
Tanguy Herbron 2016-10-14 17:52:18 +02:00
parent dff54c09b9
commit 2127f49a73
282 changed files with 136767 additions and 0 deletions

View File

@ -0,0 +1,59 @@
/***************************************************************************
Classe Cadran
Auteur : Philippe CRUCHET - Janvier 2015
Rôle : Permet de définir un cadran digital, la taille est définie par
le constructeur.
Projet : horloge
IDE : Code::Blocks sous linux avec utilisation de la librairie ncurses
***************************************************************************/
#include <stdio.h>
#include "cadran.h"// a faire
Cadran::Cadran(const int _posX,const int _posY,const int _hauteur,const int _largeur)
: posX(_posX), posY(_posY), hauteur(_hauteur), largeur (_largeur)
/*
* Rôle : Initialisation du cadran
* Paramètres : _posX,_posY position du coin gauche du cadran
* _hauteur, _largeur dimensions du cadran
*/
{
initscr();
keypad(stdscr, TRUE);
noecho();// a faire
mvaddch(posY, posX, '+');
mvaddch(posY, posX + largeur, '+');
mvaddch(posY + hauteur, posX, '+');
mvaddch(posY + hauteur, posX + largeur, '+');
mvhline(posY, posX + 1, '-', largeur - 1);
mvhline(posY + hauteur, posX + 1, '-', largeur - 1);
mvvline(posY + 1, posX, '|', hauteur - 1);
mvvline(posY + 1, posX + largeur, '|', hauteur - 1);
refresh();
}
Cadran::~Cadran()
{
endwin();
}
void Cadran::Afficher(const char *texte, const int position)
{
mvprintw(posY + 1 , posX + 1 + position, texte ) ;
mvprintw(0,0,"") ;
refresh() ;
}
void Cadran::Afficher(const int valeur,const int position)
{
char *texte = new char[largeur+1] ;
if(texte != NULL)
{
sprintf(texte,"%02d",valeur);
Afficher(texte,position) ;
delete texte ;
}
}

View File

@ -0,0 +1,30 @@
/* Fichier d'entête cadran.h auteur : Philippe CRUCHET .... janvier 2015 */
#ifndef CADRAN_H
#define CADRAN_H
#include <ncurses.h> // pour les fonctions d'affichage
#include <unistd.h> // pour sleep
/**
Classe pour l'affichage
@author Cruchet Philippe
*/
class Cadran
{
private:
int posX;
int posY;
int hauteur;
int largeur;
public:
Cadran(const int _posX=1,const int _posY=1,const int _hauteur=2,const int _largeur=10);
~Cadran();
void Afficher(const char *texte, const int position=0);
void Afficher(const int valeur,const int position=0);
};
#endif

View File

@ -0,0 +1,87 @@
/**************************************************************************
Classe Clavier
Auteur : Philippe CRUCHET - Janvier 2015
Rôle : Permet de gérer les touches du clavier de l'horloge.
Projet : horloge
IDE : Code::Blocks sous linux utilisation de termios
*************************************************************************/
#include <stdio.h>
#include <iostream>
#include "clavier.h"
using namespace std;
Clavier::Clavier()
/*
* Rôle : Initialisation du clavier
*/
{
tcgetattr(0,&initial_settings);
new_settings = initial_settings;
new_settings.c_lflag &= ~ICANON;
new_settings.c_lflag &= ~ECHO;
new_settings.c_lflag &= ~ISIG;
new_settings.c_oflag &= ~NL0;
new_settings.c_oflag &= ~CR0;
new_settings.c_oflag &= ~TAB0;
new_settings.c_oflag &=~BS0;
new_settings.c_cc[VMIN] = 1;
new_settings.c_cc[VTIME] = 0;
cfsetospeed (&new_settings, B230400);
cfsetispeed(&new_settings, 0);
tcsetattr(0, TCSANOW, &new_settings);
}
Clavier::~Clavier()
{
tcsetattr(0, TCSANOW, &initial_settings);
}
char Clavier::kbhit()
/*
* Rôle : Lit si une touche est enfoncée
* Fonction non bloquante.
*
* Paramètre de retour 0 si aucune touche n'est enfoncée,
* sinon le code de la touche.
*/
{
char ch = 0;
new_settings.c_cc[VMIN]=0;
tcsetattr(0,TCSANOW, &new_settings);
read(0,&ch,1);
new_settings.c_cc[VMIN]=1;
tcsetattr(0,TCSANOW, &new_settings);
return ch;
}
TOUCHES_CLAVIER Clavier::ScruterClavier()
{
TOUCHES_CLAVIER retour;
char key;
key = kbhit();
switch(key)
{
case '+':
retour = PLUS;
break;
case '-':
retour = MOINS;
break;
case 0x20:
retour = MODE;
break;
case '\n':
retour = FIN;
break;
default:
retour = AUCUNE;
}
return retour;
}

View File

@ -0,0 +1,35 @@
/* Fichier d'entête Clavier.h auteur : Philippe CRUCHET .... janvier 2015 */
#ifndef CLAVIER_H
#define CLAVIER_H
#include <termios.h>
#include <unistd.h>
#include <stdlib.h>
/**
*/
enum TOUCHES_CLAVIER
{
AUCUNE,
FIN,
MODE,
MOINS,
PLUS
};
class Clavier{
private :
struct termios initial_settings, new_settings;
public:
Clavier();
~Clavier();
char kbhit();
TOUCHES_CLAVIER ScruterClavier();
};
#endif

View File

@ -0,0 +1,164 @@
#include <stdio.h>
#include "horloge.h"
Horloge::Horloge(const short _resolution, const short _nbMode)
: heures(0), minutes(0), resolution(_resolution), mode(AUCUN_REGLAGE), nbMode(_nbMode)
{}
Horloge::~Horloge()
{
}
bool Horloge::ActualiserHeure()
{
bool retour = false;
bool changementHeure;
changementHeure = AvancerMinutes();
if(changementHeure)
{
retour = AvancerHeures();
}
leCadran->Afficher(heures, 1);
leCadran->Afficher(minutes, 5);
return retour;
}
bool Horloge::AvancerHeures()
{
bool retour = false;
heures++;
if(heures == 12 && resolution == 12)
{
heures = 0;
retour = true;
}
if(heures == 24)
{
heures = 0;
retour = true;
}
return retour;
}
bool Horloge::AvancerMinutes()
{
bool retour = false;
minutes++;
if(minutes == 60)
{
minutes = 0;
retour = true;
}
return retour;
}
void Horloge::ReculerHeures()
{
heures--;
if(heures < 0)
{
heures = 23;
}
}
void Horloge::ReculerMinutes()
{
minutes--;
if(minutes < 0)
{
minutes = 59;
ReculerHeures();
}
}
void Horloge::Controler()
{
short numTouche;
int tempo = 0;
numTouche = leClavier->ScruterClavier();
switch(mode)
{
case AUCUN_REGLAGE:
tempo++;
if(tempo == 10000)
{
ActualiserHeure();
tempo = 0;
}
if(numTouche == MODE)
{
ChangerMode();
}
break;
case REGLAGE_HEURES:
leCadran->Afficher("HH", 1);
leCadran->Afficher(heures, 5);
switch(numTouche)
{
case PLUS:
AvancerHeures();
leCadran->Afficher(heures, 5);
break;
case MOINS:
ReculerHeures();
leCadran->Afficher(heures, 5);
break;
case MODE:
ChangerMode();
}
break;
case REGLAGE_MINUTES:
leCadran->Afficher("MM", 1);
leCadran->Afficher(minutes, 5);
switch(numTouche)
{
case PLUS:
AvancerMinutes();
leCadran->Afficher(minutes, 5);
break;
case MOINS:
ReculerMinutes();
leCadran->Afficher(minutes, 5);
break;
case MODE:
ChangerMode();
}
break;
}
usleep(99);
}
void Horloge::ChangerMode()
{
mode = (mode+1)%nbMode;
}

View File

@ -0,0 +1,41 @@
#ifndef HORLOGE_H_INCLUDED
#define HORLOGE_H_INCLUDED
#include <ncurses.h> // pour les fonctions d'affichage
#include <unistd.h> // pour sleep
#include "cadran.h"
#include "clavier.h"
enum MODES_HORLOGE
{
AUCUN_REGLAGE = 0,
REGLAGE_HEURES,
REGLAGE_MINUTES
};
class Horloge
{
protected:
short heures;
short minutes;
const short resolution;
short mode;
const short nbMode;
Cadran *leCadran = new Cadran();
Clavier *leClavier = new Clavier();
public:
Horloge(const short _resolution=24, const short _nbMode=3);
~Horloge();
bool ActualiserHeure();
bool AvancerHeures();
bool AvancerMinutes();
void ReculerHeures();
void ReculerMinutes();
void Controler();
void ChangerMode();
};
#endif // HORLOGE_H_INCLUDED

View File

@ -0,0 +1,17 @@
#include <iostream>
#include "cadran.h"
#include "clavier.h"
#include "horloge.h"
#include "reveil.h"
using namespace std;
int main()
{
Reveil *monReveil = new Reveil();
monReveil->Controler();
return 0;
}

View File

@ -0,0 +1,84 @@
#include <stdio.h>
#include "reveil.h"
#include "horloge.h"
Reveil::Reveil(const short _resolution, const short _nbMode)
: heureAlarme(0), minuteAlarme(0), active(false), Horloge(_resolution, _nbMode)
{}
bool Reveil::Surveiller()
{
if(heureAlarme == heures && minuteAlarme == minutes)
{
}
}
void Reveil::AvancerHeureAlarme()
{
heureAlarme++;
if(heureAlarme == 24)
{
heureAlarme = 0;
}
}
void Reveil::AvancerMinuteAlarme()
{
minuteAlarme++;
if(heureAlarme == 60)
{
heureAlarme = 0;
}
}
void Reveil::ReculerHeureALarme()
{
heureAlarme--;
if(heureAlarme < 0)
{
heureAlarme = 23;
}
}
void Reveil::ReculerMinuteAlarme()
{
minuteAlarme--;
if(minuteAlarme < 0)
{
minuteAlarme = 59;
}
}
void Reveil::Controler()
{
while(1)
{
switch(mode)
{
case ACTIVER_ALARME:
break;
case REGLAGE_HEURES_ALARME:
break;
case REGLAGE_MINUTES_ALARME:
break;
}
}
}
void Reveil::ChangerEtatAlarme()
{
if(active == false)
{
active = true;
}
else
{
active = false;
}
}

View File

@ -0,0 +1,33 @@
#ifndef REVEIL_H_INCLUDED
#define REVEIL_H_INCLUDED
#include "horloge.h"
enum MODES_ALARME
{
ACTIVER_ALARME = 3,
REGLAGE_HEURES_ALARME,
REGLAGE_MINUTES_ALARME
};
class Reveil : private Horloge
{
private:
short heureAlarme;
short minuteAlarme;
bool active;
Horloge *monHorloge = new Horloge();
public:
Reveil(const short _resolution=24, const short _nbMode=6);
~Reveil();
bool Surveiller();
void AvancerHeureAlarme();
void ReculerHeureALarme();
void AvancerMinuteAlarme();
void ReculerMinuteAlarme();
void Controler();
void ChangerEtatAlarme();
};
#endif // REVEIL_H_INCLUDED

View File

@ -0,0 +1,29 @@
#include "CBarre.h"
CBarre::CBarre(const float _densite, const float _longueur, const string _referenceBar)
: densite(_densite), longueur(_longueur), referenceBarre(_referenceBar)
{
cout << "Je suis le constructeur a argument de Cbarre." << endl;
}
CBarre::CBarre()
: densite(5), longueur(2), referenceBarre("none")
{
cout << "Je suis le constructeur par defaut de Cbarre." << endl;
}
CBarre::CBarre(const CBarre &barre)
: densite(barre.densite), longueur(barre.longueur), referenceBarre(barre.referenceBarre)
{
cout << "Je suis le constructeur par copie de Cbarre." << endl;
}
CBarre::~CBarre()
{
cout << "Barre detruite." << endl;
}
void CBarre::afficherReference()
{
cout << "Reference :" << referenceBarre << endl;
}

26
BTS/C++/Fonderie/CBarre.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef CBARRE_H_INCLUDED
#define CBARRE_H_INCLUDED
#include <string>
#include <iostream>
using namespace std;
class CBarre
{
protected:
float densite;
float longueur;
string referenceBarre;
public:
CBarre(const float _densite, const float _longueur, const string _referenceBarre);
CBarre();
CBarre(const CBarre &barre);
void afficherReference();
~CBarre();
};
#endif // CBARRE_H_INCLUDED

View File

@ -0,0 +1,34 @@
#include "CBarreCarree.h"
#include "CBarre.h"
CBarreCarree::CBarreCarree(const float _densite, const float _longueur, const string _referenceBarre, const float _cote)
: CBarre(_densite, _longueur, _referenceBarre), cote(_cote)
{
cout << "Je suis le constructeur a argument de CBarreCarree." << endl;
}
CBarreCarree::CBarreCarree()
: CBarre(), cote(2)
{
cout << "Je suis le constructeur par defaut de CBarreCarree." << endl;
}
CBarreCarree::CBarreCarree(const CBarreCarree &barreCarree)
{
cout << "Je suis le constructeur par copie de CBarreCarree." << endl;
}
CBarreCarree::~CBarreCarree()
{
cout << "BarreCarree detruite." << endl;
}
float CBarreCarree::calculerSection()
{
return cote*cote;
}
float CBarreCarree::calculerMasse()
{
return longueur*densite*calculerSection();
}

View File

@ -0,0 +1,21 @@
#ifndef CBARRECARREE_H_INCLUDED
#define CBARRECARREE_H_INCLUDED
#include "CBarre.h"
class CBarreCarree : public CBarre
{
private:
float cote;
public:
CBarreCarree(const float _densite, const float _longueur, const string _referenceBar, const float _cote);
CBarreCarree();
CBarreCarree(const CBarreCarree &barreCarree);
~CBarreCarree();
float calculerMasse();
float calculerSection();
};
#endif // CBARRECARREE_H_INCLUDED

View File

@ -0,0 +1,35 @@
#include "CBarreHexagonale.h"
#include "CBarre.h"
#include <math.h>
CBarreHexagonale::CBarreHexagonale(const float _densite, const float _longueur, const string _referenceBarre, const float _cote)
: CBarre(_densite, _longueur, _referenceBarre), cote(_cote)
{
cout << "Je suis le constructeur a argument de CBarreHexagonale." << endl;
}
CBarreHexagonale::CBarreHexagonale(const CBarreHexagonale &barreHexagonale)
{
cout << "Je suis le constructeur par copie de CBarreHexagonale." << endl;
}
CBarreHexagonale::CBarreHexagonale()
: CBarre(), cote(2)
{
cout << "Je suis le constructeur par defaut de CBarreHexagonale." << endl;
}
CBarreHexagonale::~CBarreHexagonale()
{
cout << "BarreHexagonale detruite." << endl;
}
float CBarreHexagonale::calculerSection()
{
return (3*sqrt(3)/2)*cote;
}
float CBarreHexagonale::calculerMasse()
{
return longueur*densite*calculerSection();
}

View File

@ -0,0 +1,23 @@
#ifndef CBARREHEXAGONALE_H_INCLUDED
#define CBARREHEXAGONALE_H_INCLUDED
#include "CBarre.h"
class CBarreHexagonale : public CBarre
{
private:
float cote;
public:
CBarreHexagonale(const float _densite, const float _longueur, const string _referenceBarre, const float _cote);
CBarreHexagonale(const CBarreHexagonale &barreHexagonale);
CBarreHexagonale();
~CBarreHexagonale();
float calculerMasse();
float calculerSection();
};
#endif // CBARREHEXAGONALE_H_INCLUDED

View File

@ -0,0 +1,34 @@
#include "CBarreRectangle.h"
#include "CBarre.h"
CBarreRectangle::CBarreRectangle(const float _densite, const float _longueur, const string _referenceBarre, const float _hauteur, const float _largeur)
: CBarre(_densite, _longueur, _referenceBarre), hauteur(_hauteur), largeur(_largeur)
{
cout << "Je suis le constructeur a argument de CBarreRectangle." << endl;
}
CBarreRectangle::CBarreRectangle(const CBarreRectangle &barreRectangle)
{
cout << "Je suis le constructeur par copie de CBarreRectangle." << endl;
}
CBarreRectangle::CBarreRectangle()
: CBarre(), hauteur(5), largeur(5)
{
cout << "Je suis le constructeur par defaut de CBarreRectangle." << endl;
}
CBarreRectangle::~CBarreRectangle()
{
cout << "BarreRectangle detruite." << endl;
}
float CBarreRectangle::calculerSection()
{
return largeur*hauteur;
}
float CBarreRectangle::calculerMasse()
{
return longueur*densite*calculerSection();
}

View File

@ -0,0 +1,24 @@
#ifndef CBARRERECTANGLE_H_INCLUDED
#define CBARRERECTANGLE_H_INCLUDED
#include "CBarre.h"
class CBarreRectangle : public CBarre
{
private:
float hauteur;
float largeur;
public:
CBarreRectangle(const float _densite, const float _longueur, const string _referenceBarre, const float _hauteur, const float _largeur);
CBarreRectangle(const CBarreRectangle &barreRectangle);
CBarreRectangle();
~CBarreRectangle();
float calculerMasse();
float calculerSection();
};
#endif // CBARRERECTANGLE_H_INCLUDED

View File

@ -0,0 +1,35 @@
#include "CBarreRonde.h"
#include "CBarre.h"
#include <math.h>
CBarreRonde::CBarreRonde(const float _densite, const float _longueur, const string _referenceBarre, const float _rayon)
: CBarre(_densite, _longueur, _referenceBarre), rayon(_rayon)
{
cout << "Je suis le constructeur a argument de CBarreRonde." << endl;
}
CBarreRonde::CBarreRonde()
: CBarre(), rayon(2)
{
cout << "Je suis le constructeur par defaut de CBarreRonde." << endl;
}
CBarreRonde::CBarreRonde(const CBarreRonde &barreRonde)
{
cout << "Je suis le constructeur par copie de CBarreRonde." << endl;
}
CBarreRonde::~CBarreRonde()
{
cout << "BarreRonde detruite." << endl;
}
float CBarreRonde::calculerSection()
{
return M_PI*rayon*rayon;
}
float CBarreRonde::calculerMasse()
{
return longueur*densite*calculerSection();
}

View File

@ -0,0 +1,23 @@
#ifndef CBARRERONDE_H_INCLUDED
#define CBARRERONDE_H_INCLUDED
#include "CBarre.h"
class CBarreRonde : public CBarre
{
private:
float rayon;
public:
CBarreRonde(const float _densite, const float _longueur, const string _referenceBarre, const float _rayon);
CBarreRonde(const CBarreRonde &barreRonde);
CBarreRonde();
~CBarreRonde();
float calculerMasse();
float calculerSection();
};
#endif // CBARRERONDE_H_INCLUDED

41
BTS/C++/Fonderie/main.cpp Normal file
View File

@ -0,0 +1,41 @@
#include <iostream>
#include "CBarre.h"
#include "CBarreCarree.h"
#include "CBarreHexagonale.h"
#include "CBarreRectangle.h"
#include "CBarreRonde.h"
using namespace std;
int main()
{
CBarreCarree *barreCarree1 = new CBarreCarree(8.9, 4, "barreCarree", 2);
CBarreHexagonale *barreHexagonale1 = new CBarreHexagonale(19.8, 651, "barreHexagonale", 5.6);
CBarreRectangle *barreRectangle1 = new CBarreRectangle(19.8, 15.2, "b", 20.8, 60.5);
CBarreRonde *barreRonde1 = new CBarreRonde(11.3, 12, "barreRonde", 3.14);
barreHexagonale1->afficherReference();
cout << "Masse :" << barreHexagonale1->calculerMasse() << endl;
barreCarree1->afficherReference();
cout << "Masse :" << barreCarree1->calculerMasse() << endl;
barreRectangle1->afficherReference();
cout << "Masse :" << barreRectangle1->calculerMasse() << endl;
barreRonde1->afficherReference();
cout << "Masse :" << barreRonde1->calculerMasse() << endl;
delete barreHexagonale1;
delete barreCarree1;
delete barreRectangle1;
delete barreRonde1;
return 0;
}

View File

@ -0,0 +1,58 @@
/***************************************************************************
Classe Cadran
Auteur : Philippe CRUCHET - Janvier 2015
Rôle : Permet de définir un cadran digital, la taille est définie par
le constructeur.
Projet : horloge
IDE : Code::Blocks sous linux avec utilisation de la librairie ncurses
***************************************************************************/
#include <stdio.h>
#include "cadran.h"// a faire
Cadran::Cadran(const int _posX,const int _posY,const int _hauteur,const int _largeur)
: posX(_posX), posY(_posY), hauteur(_hauteur), largeur (_largeur)
/*
* Rôle : Initialisation du cadran
* Paramètres : _posX,_posY position du coin gauche du cadran
* _hauteur, _largeur dimensions du cadran
*/
{
initscr();
keypad(stdscr, TRUE);
noecho();// a faire
mvaddch(posY, posX, '+');
mvaddch(posY, posX + largeur, '+');
mvaddch(posY + hauteur, posX, '+');
mvaddch(posY + hauteur, posX + largeur, '+');
mvhline(posY, posX + 1, '-', largeur - 1);
mvhline(posY + hauteur, posX + 1, '-', largeur - 1);
mvvline(posY + 1, posX, '|', hauteur - 1);
mvvline(posY + 1, posX + largeur, '|', hauteur - 1);
}
Cadran::~Cadran()
{
endwin();
}
void Cadran::Afficher(const char *texte, const int position)
{
mvprintw(posY + 1 , posX + 1 + position, texte ) ;
mvprintw(0,0,"") ;
refresh() ;
}
void Cadran::Afficher(const int valeur,const int position)
{
char *texte = new char[largeur+1] ;
if(texte != NULL)
{
sprintf(texte,"%02d",valeur);
Afficher(texte,position) ;
delete texte ;
}
}

View File

@ -0,0 +1,30 @@
/* Fichier d'entête cadran.h auteur : Philippe CRUCHET .... janvier 2015 */
#ifndef CADRAN_H
#define CADRAN_H
#include <ncurses.h> // pour les fonctions d'affichage
#include <unistd.h> // pour sleep
/**
Classe pour l'affichage
@author Cruchet Philippe
*/
class Cadran
{
private:
int posX;
int posY;
int hauteur;
int largeur;
public:
Cadran(const int _posX=1,const int _posY=1,const int _hauteur=2,const int _largeur=10);
~Cadran();
void Afficher(const char *texte, const int position=0);
void Afficher(const int valeur,const int position=0);
};
#endif

View File

@ -0,0 +1,76 @@
/**************************************************************************
Classe Clavier
Auteur : Philippe CRUCHET - Janvier 2015
Rôle : Permet de gérer les touches du clavier de l'horloge.
Projet : horloge
IDE : Code::Blocks sous linux utilisation de termios
*************************************************************************/
#include "clavier.h"
Clavier::Clavier()
/*
* Rôle : Initialisation du clavier
*/
{
tcgetattr(0,&initial_settings);
new_settings = initial_settings;
new_settings.c_lflag &= ~ICANON;
new_settings.c_lflag &= ~ECHO;
new_settings.c_lflag &= ~ISIG;
new_settings.c_oflag &= ~NL0;
new_settings.c_oflag &= ~CR0;
new_settings.c_oflag &= ~TAB0;
new_settings.c_oflag &=~BS0;
new_settings.c_cc[VMIN] = 1;
new_settings.c_cc[VTIME] = 0;
cfsetospeed (&new_settings, B230400);
cfsetispeed(&new_settings, 0);
tcsetattr(0, TCSANOW, &new_settings);
}
Clavier::~Clavier()
{
tcsetattr(0, TCSANOW, &initial_settings);
}
char Clavier::kbhit()
/*
* Rôle : Lit si une touche est enfoncée
* Fonction non bloquante.
*
* Paramètre de retour 0 si aucune touche n'est enfoncée,
* sinon le code de la touche.
*/
{
char ch = 0;
new_settings.c_cc[VMIN]=0;
tcsetattr(0,TCSANOW, &new_settings);
read(0,&ch,1);
new_settings.c_cc[VMIN]=1;
tcsetattr(0,TCSANOW, &new_settings);
return ch;
}
TOUCHES_CLAVIER Clavier::ScruterClavier()
{
char touche = kbhit();
TOUCHES_CLAVIER retour;
switch (touche)
{
case '\n':
case '\r': retour = FIN ;
break;
case ' ' : retour = MODE ;
break;
case '+' : retour = PLUS ;
break;
case '-' : retour = MOINS ;
break;
default : retour = AUCUNE ;
}
return retour ;
}

View File

@ -0,0 +1,35 @@
/* Fichier d'entête Clavier.h auteur : Philippe CRUCHET .... janvier 2015 */
#ifndef CLAVIER_H
#define CLAVIER_H
#include <termios.h>
#include <unistd.h>
#include <stdlib.h>
/**
*/
enum TOUCHES_CLAVIER
{
AUCUNE,
FIN,
MODE,
MOINS,
PLUS
};
class Clavier{
private :
struct termios initial_settings, new_settings;
public:
Clavier();
~Clavier();
char kbhit();
TOUCHES_CLAVIER ScruterClavier();
};
#endif

View File

@ -0,0 +1,120 @@
#include "horloge.h"
#include "clavier.h"
Horloge::Horloge(const short _nbMode, const short _resolution ) :
heures(0),minutes(0), resolution(_resolution),nbMode(_nbMode),mode (AUCUN_REGLAGE)
{
valAvant = time(NULL);
}
bool Horloge::AvancerHeures()
{
bool retour = false;
if(++heures == resolution)
{
heures = 0;
retour = true;
}
return retour;
}
bool Horloge::AvancerMinutes()
{
bool retour = false;
if(++minutes == 60)
{
minutes = 0;
retour = true;
}
return retour;
}
void Horloge::ReculerHeures()
{
if(--heures == -1)
heures = resolution -1;
}
void Horloge::ReculerMinutes()
{
if(--minutes == -1)
minutes = 59 ;
}
void Horloge::ActualiserHeure()
{
time_t valCourante = time(NULL);
double seconde = difftime(valCourante,valAvant);
if(seconde>60) // à modifier pour aller plus vite pendant le test
{
valAvant = valCourante ;
if(AvancerMinutes())
AvancerHeures();
}
}
TOUCHES_CLAVIER Horloge::Controler(const TOUCHES_CLAVIER numTouche)
{
switch(mode)
{
case AUCUN_REGLAGE :
leCadran.Afficher(heures,1);
leCadran.Afficher(minutes,4);
if(numTouche == MODE)
ChangerMode();
else ActualiserHeure();
break;
case REGLAGE_HEURES:
switch(numTouche)
{
case PLUS:
AvancerHeures();
break;
case MOINS:
ReculerHeures();
break;
case MODE:
ChangerMode();
break;
default:
break;
}
if(mode != AUCUN_REGLAGE)
{
leCadran.Afficher("HH",1);
leCadran.Afficher(heures,4);
}
break;
case REGLAGE_MINUTES:
switch(numTouche)
{
case PLUS:
AvancerMinutes();
break;
case MOINS:
ReculerMinutes();
break;
case MODE:
ChangerMode();
break;
default:
break;
}
if(mode != AUCUN_REGLAGE)
{
leCadran.Afficher("MM",1);
leCadran.Afficher(minutes,4);
}
break;
}
return leClavier.ScruterClavier() ;
}
void Horloge::ChangerMode()
{
leCadran.Afficher(" ");
mode = (mode+1)%nbMode;
}

View File

@ -0,0 +1,39 @@
#ifndef HORLOGE_H
#define HORLOGE_H
#include "clavier.h"
#include "cadran.h"
#include <time.h>
enum MODE_HORLOGE
{
AUCUN_REGLAGE,
REGLAGE_HEURES,
REGLAGE_MINUTES,
REGLAGE_ALARME
};
class Horloge
{
public:
Horloge(const short _nbMode = 3, const short _resolution = 24 );
void ActualiserHeure();
bool AvancerHeures();
bool AvancerMinutes();
void ReculerHeures();
void ReculerMinutes();
TOUCHES_CLAVIER Controler(const TOUCHES_CLAVIER numTouche);
void ChangerMode();
private:
short heures;
short minutes;
short resolution;
const short nbMode;
short mode;
time_t valAvant ;
Clavier leClavier;
Cadran leCadran;
};
#endif // HORLOGE_H

View File

@ -0,0 +1,19 @@
#include <iostream>
#include "horloge.h"
using namespace std;
int main()
{
Horloge uneHorloge ;
TOUCHES_CLAVIER laTouche = AUCUNE;
do
{
laTouche = uneHorloge.Controler(laTouche);
} while (laTouche != FIN);
return 0;
}

View File

View File

@ -0,0 +1,26 @@
#ifndef REVEIL_H_INCLUDED
#define REVEIL_H_INCLUDED
enum MODE_REVEIL
{
REGLAGE_HEURES,
REGLAGE_MINUTES,
ACTIVER_ALARME
};
class Reveil
{
private:
short heure;
short minute;
short mode;
public:
bool AvancerHeure();
bool ReculerHeure();
bool AvancerMinute();
bool ReculerMinute();
};
#endif // REVEIL_H_INCLUDED

View File

@ -0,0 +1,52 @@
#include "Cadran.h"
#include <iostream>
#include <iomanip>
using namespace std;
Cadran::Cadran(const int _posX, const int _posY,const int _hauteur, const int _largeur):
posX(_posX),
posY(_posY),
hauteur(_hauteur),
largeur(_largeur)
{
int i = 0;
cout << setfill('-');
GotoXY(posX, posY + i);
cout << "+" << setw(largeur) << "+";
cout << setfill(' ');
for(i = 1; i <= hauteur; i++)
{
GotoXY(posX, posY + i);
cout << "+" << setw(largeur) << "+";
}
cout << setfill('-');
GotoXY(posX, posY + i);
cout << "+" << setw(largeur) << "+";
}
Cadran::~Cadran()
{
GotoXY(15,15);
}
void Cadran::Afficher(const int _valeur, const int _position) //Affichage d'un entier donné en paramètre à une position donnée en paramètre
{
GotoXY(posX+1+_position,posY+1);
cout << setfill('0');
cout << setw(2);
cout << _valeur;
}
void Cadran::Afficher(const string _texte, const int _position) //Affichage d'une chaine de caractère donnée en paramètre à une position donnée en paramètre
{
GotoXY(posX+1+_position,posY+1);
cout << _texte ;
}
void Cadran::GotoXY(const int _x,const int _y) //Déplace le curseur d'écriture dans la console
{
/*COORD coord;
coord.X = _x;
coord.Y = _y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);*/
printf("%c[%d;%df", 0x1B, _x, _y);
}

View File

@ -0,0 +1,25 @@
#ifndef CADRAN_H
#define CADRAN_H
#include <string>
#include <unistd.h>
#include <cstdio>
#define LAG 100000 //Temps de latence en ms
using namespace std;
class Cadran
{
public:
Cadran(const int _posX = 1, const int _posY = 1,const int _hauteur = 2, const int _largeur = 10);
virtual ~Cadran();
void Afficher(const string _texte, const int _position = 2);
void Afficher(const int _valeur, const int _position = 2);
private:
void GotoXY(const int _x, const int _y);
int posX;
int posY;
int hauteur;
int largeur;
};
#endif // CADRAN_H

View File

@ -0,0 +1,24 @@
#include <iostream>
#include "Cadran.h"
using namespace std;
int main()
{
Cadran leCadran;
Cadran leCadran0(15, 1);
for(int i = 1; i <= 10; i++)
{
leCadran.Afficher(i, 5);
usleep(LAG);
}
leCadran.Afficher("Fin", 2);
for(int i = 1; i <= 15; i++)
{
leCadran0.Afficher(i, 5);
usleep(LAG);
}
leCadran.Afficher("Termine", 15);
return 0;
}

13
BTS/C++/boolalpha.cpp Normal file
View File

@ -0,0 +1,13 @@
#include <iostream>
using namespace std;
int main()
{
cout << true << " et " << false << endl;
cout << boolalpha;
cout << true << " et " << false << endl;
cout << noboolalpha;
cout << true << " et " << false << endl;
return 0;
}

31
BTS/C++/fluxEntrant.cpp Normal file
View File

@ -0,0 +1,31 @@
#include <iostream>
using namespace std;
int main()
{
int nombre;
string phrase;
char car;
//Entrer un nombre
cout << "Entrer un nombre : " << endl;
cin >> nombre;
cout << "Vous avez entré " << nombre << "." << endl;
//Entrer une phrase (Le premier caractère est manquant)
cout << "Entrer une phrase : " << endl;
do
{
cin >> car;
}while(car == '\n');
getline(cin, phrase);
cout << "Vous avez entré la phrase \"" << phrase << "\".";
return 0;
}

18
BTS/C++/fluxSortant.cpp Normal file
View File

@ -0,0 +1,18 @@
#include <iostream>
using namespace std;
int main()
{
cout << "Bonsoir" << endl;
int unEntier = 10;
cout << unEntier << endl;
char uneLettre = 'a';
cout << uneLettre << endl;
string phrase = "test de phrase";
cout << phrase << endl;
return 0;
}

View File

@ -0,0 +1,18 @@
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
cout << setfill('.');
for (int i = 0; i < 10; i++)
{
if (i%2)
cout << "|" << left << setw(5) << i << "|" << endl;
else
cout << "|" << right << setw(5) << i << "|" << endl;
}
return 0;
}

View File

@ -0,0 +1,30 @@
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double nombre = 12345.09876;
double pi = 3.141592653;
cout << "Avec un int" << endl;
cout << 45 << endl;
cout << hex << 45 << endl;
cout << oct << 45 << endl;
cout << dec << 45 << endl;
cout << "Avec un double;" << endl;
cout << nombre << endl;
cout << fixed << nombre << endl;
cout << scientific << nombre << endl;
cout << fixed;
cout << " Avec Pi" << endl;
cout << pi << endl;
cout << setprecision(0) << pi << endl;
cout << setprecision(10) << pi << endl;
return 0;
}

View File

@ -0,0 +1,50 @@
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include <errno.h>
using namespace std;
int main()
{
string inputFile;
string pays;
char tmp;
int nbOr;
int nbArgent;
int nbBronze;
cout << "Entrer le nom du fichier a lire : ";
cin >> inputFile;
ifstream fichier(inputFile.c_str()); //Creation du flux en lecture du fichier
if(errno != 0)
{
cerr << "Erreur lors de l'ouverture : " << errno;
return errno;
}
cout << setfill('-');
//affichage de la premiere ligne du tableau
cout << "+" << setw(18) << "+" << setw(9) << "+" << setw(9) << "+" << setw(9) << "+" << endl;
cout << setfill(' ');
while(fichier)
{
fichier >> pays >> nbOr >> nbArgent >> nbBronze; //recuperation des valeurs
if(fichier)//Si le fichier peut etre lu
{
//affichage des lignes du tableau
cout << "| " << left << setw(16) << pays << "|" << right << setw(7) << nbOr << " |" << right << setw(7) << nbArgent << " |" << right << setw(7) << nbBronze << " |" << endl;
}
}
//Affichage du bas du tableau.
cout << setfill('-');
cout << "+" << setw(18) << "+" << setw(9) << "+" << setw(9) << "+" << setw(9) << "+" << endl;
return 0;
}

View File

@ -0,0 +1,10 @@
USA 46 37 38
Grande-bretagne 27 23 17
Chine 26 18 26
Russie 19 18 19
Allemagne 17 10 15
Japon 12 8 21
France 10 18 14
Corée-du-sud 9 3 9
Italie 8 12 8
Australie 8 11 10

View File

@ -0,0 +1,57 @@
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include <errno.h>
using namespace std;
int main()
{
string inputFile;
string pays;
char tmp;
int nbOr;
int nbArgent;
int nbBronze;
cout << "Entrer le nom du fichier a lire : ";
cin >> inputFile;
ifstream fichier(inputFile.c_str()); //Creation du flux en lecture du fichier
ofstream output("nouveau.txt");
if(errno != 0)
{
cerr << "Erreur lors de l'ouverture : " << errno;
return errno;
}
cout << setfill('-');
output << setfill('-');
//affichage de la premiere ligne du tableau
cout << "+" << setw(18) << "+" << setw(9) << "+" << setw(9) << "+" << setw(9) << "+" << endl;
output << "+" << setw(18) << "+" << setw(9) << "+" << setw(9) << "+" << setw(9) << "+" << endl;
cout << setfill(' ');
output << setfill(' ');
while(fichier) //Tant que le fichier n'est pas fini
{
fichier >> pays >> nbOr >> nbArgent >> nbBronze; //recuperation des valeurs
if(fichier)//Si le fichier peut etre lu
{
//affichage des lignes du tableau
cout << "| " << left << setw(16) << pays << "|" << right << setw(7) << nbOr << " |" << right << setw(7) << nbArgent << " |" << right << setw(7) << nbBronze << " |" << endl;
output << "| " << left << setw(16) << pays << "|" << right << setw(7) << nbOr << " |" << right << setw(7) << nbArgent << " |" << right << setw(7) << nbBronze << " |" << endl;
}
}
//Affichage du bas du tableau.
cout << setfill('-');
output << setfill('-');
cout << "+" << setw(18) << "+" << setw(9) << "+" << setw(9) << "+" << setw(9) << "+" << endl;
output << "+" << setw(18) << "+" << setw(9) << "+" << setw(9) << "+" << setw(9) << "+" << endl;
return 0;
}

View File

@ -0,0 +1,10 @@
USA 46 37 38
Grande-bretagne 27 23 17
Chine 26 18 26
Russie 19 18 19
Allemagne 17 10 15
Japon 12 8 21
France 10 18 14
Corée-du-sud 9 3 9
Italie 8 12 8
Australie 8 11 10

View File

@ -0,0 +1,12 @@
+-----------------+--------+--------+--------+
| USA | 46 | 37 | 38 |
| Grande-bretagne | 27 | 23 | 17 |
| Chine | 26 | 18 | 26 |
| Russie | 19 | 18 | 19 |
| Allemagne | 17 | 10 | 15 |
| Japon | 12 | 8 | 21 |
| France | 10 | 18 | 14 |
| Corée-du-sud | 9 | 3 | 9 |
| Italie | 8 | 12 | 8 |
| Australie | 8 | 11 | 10 |
+-----------------+--------+--------+--------+

View File

@ -0,0 +1,29 @@
#include "Barre.h"
Barre::Barre(const float _densite, const float _longueur, const string _referenceBar)
: densite(_densite), longueur(_longueur), referenceBarre(_referenceBar)
{
cout << "Je suis le constructeur a argument de Barre." << endl;
}
Barre::Barre()
: densite(5), longueur(2), referenceBarre("none")
{
cout << "Je suis le constructeur par defaut de Barre." << endl;
}
Barre::Barre(const Barre &barre)
: densite(barre.densite), longueur(barre.longueur), referenceBarre(barre.referenceBarre)
{
cout << "Je suis le constructeur par copie de Barre." << endl;
}
Barre::~Barre()
{
cout << "Barre detruite." << endl;
}
void Barre::afficherReference()
{
cout << "Reference :" << referenceBarre << endl;
}

View File

@ -0,0 +1,27 @@
#ifndef BARRE_H_INCLUDED
#define BARRE_H_INCLUDED
#include <string>
#include <iostream>
using namespace std;
class Barre
{
protected:
float densite;
float longueur;
string referenceBarre;
public:
Barre(const float _densite, const float _longueur, const string _referenceBarre);
Barre();
Barre(const Barre &barre);
virtual void afficherReference();
virtual ~Barre();
virtual float CalculerMasse() {return 0;}
};
#endif // BARRE_H_INCLUDED

View File

@ -0,0 +1,34 @@
#include "BarreCarree.h"
#include "Barre.h"
BarreCarree::BarreCarree(const float _densite, const float _longueur, const string _referenceBarre, const float _cote)
: Barre(_densite, _longueur, _referenceBarre), cote(_cote)
{
cout << "Je suis le constructeur a argument de BarreCarree." << endl;
}
BarreCarree::BarreCarree()
: Barre(), cote(2)
{
cout << "Je suis le constructeur par defaut de BarreCarree." << endl;
}
BarreCarree::BarreCarree(const BarreCarree &barreCarree)
{
cout << "Je suis le constructeur par copie de BarreCarree." << endl;
}
BarreCarree::~BarreCarree()
{
cout << "BarreCarree detruite." << endl;
}
float BarreCarree::calculerSection()
{
return cote*cote;
}
float BarreCarree::calculerMasse()
{
return longueur*densite*calculerSection();
}

View File

@ -0,0 +1,21 @@
#ifndef BARRECARREE_H_INCLUDED
#define BARRECARREE_H_INCLUDED
#include "Barre.h"
class BarreCarree : public Barre
{
private:
float cote;
public:
BarreCarree(const float _densite, const float _longueur, const string _referenceBar, const float _cote);
BarreCarree();
BarreCarree(const BarreCarree &barreCarree);
~BarreCarree();
float calculerMasse();
float calculerSection();
};
#endif // BARRECARREE_H_INCLUDED

View File

@ -0,0 +1,35 @@
#include "BarreRonde.h"
#include "Barre.h"
#include <math.h>
BarreRonde::BarreRonde(const float _densite, const float _longueur, const string _referenceBarre, const float _rayon)
: Barre(_densite, _longueur, _referenceBarre), rayon(_rayon)
{
cout << "Je suis le constructeur a argument de BarreRonde." << endl;
}
BarreRonde::BarreRonde()
: Barre(), rayon(2)
{
cout << "Je suis le constructeur par defaut de BarreRonde." << endl;
}
BarreRonde::BarreRonde(const BarreRonde &barreRonde)
{
cout << "Je suis le constructeur par copie de BarreRonde." << endl;
}
BarreRonde::~BarreRonde()
{
cout << "BarreRonde detruite." << endl;
}
float BarreRonde::calculerSection()
{
return M_PI*rayon*rayon;
}
float BarreRonde::calculerMasse()
{
return longueur*densite*calculerSection();
}

View File

@ -0,0 +1,21 @@
#ifndef BARRERONDE_H_INCLUDED
#define BARRERONDE_H_INCLUDED
#include "Barre.h"
class BarreRonde : public Barre
{
private:
float rayon;
public:
BarreRonde(const float _densite, const float _longueur, const string _referenceBarre, const float _rayon);
BarreRonde(const BarreRonde &barreRonde);
BarreRonde();
~BarreRonde();
float calculerMasse();
float calculerSection();
};
#endif // BARRERONDE_H_INCLUDED

View File

@ -0,0 +1,29 @@
#include "TableBarres.h"
TableBarres::TableBarres(short _taille)
:taille(_taille)
{
index = 0 ;
table = new Barre*[taille];
}
TableBarres::~TableBarres()
{
delete[] table ;
}
void TableBarres::add(Barre *pBarre)
{
if (index < taille)
table[index++] = pBarre ;
}
void TableBarres::AfficherCatalogue()
{
for (short indice = 0 ; indice < index ; indice++)
{
table[indice]->afficherReference();
cout << table[indice]->CalculerMasse(); //erreur de compilation
}
}

View File

@ -0,0 +1,21 @@
#ifndef TABLEBARRES_H_INCLUDED
#define TABLEBARRES_H_INCLUDED
#include "Barre.h"
class TableBarres
{
public:
TableBarres(short _taille);
~TableBarres();
void add(Barre *pBarre);
void AfficherCatalogue();
protected:
short taille ;
short index;
// No description
Barre ** table ;
};
#endif // TABLEBARRES_H_INCLUDED

View File

@ -0,0 +1,17 @@
#include <iostream>
#include "TableBarres.h"
#include "BarreRonde.h"
using namespace std;
int main()
{
TableBarres *tableBarre = new TableBarres(10);
tableBarre->add(new BarreRonde(6.2, 5, "coucou", 3));
tableBarre->AfficherCatalogue();
return 0;
}

View File

@ -0,0 +1,28 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package degres;
import java.util.Scanner;
/**
*
* @author therbron
*/
public class Degres {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int fahrenheit;
System.out.print("Température en Fahrenheit :");
Scanner sc = new Scanner(System.in);
fahrenheit = sc.nextInt();
System.out.println(fahrenheit + " en celcius donne " + (5.0/9.0)*(fahrenheit - 32));
}
}

View File

@ -0,0 +1,30 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package factorielentier;
/**
*
* @author therbron
*/
public class FactorielEntier {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int entier = 20;
long resultat = 1;
for(int i = entier; i >= 1; i--)
{
resultat = resultat * i;
}
System.out.println(resultat);
}
}

View File

@ -0,0 +1,50 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Geometrique;
/**
*
* @author therbron
*/
public class Carre {
final private int longueurDuCote;
Carre()
{
longueurDuCote = 5;
}
Carre(int longueurDuCote)
{
this.longueurDuCote = longueurDuCote;
}
int calculerAire()
{
int aire;
aire = longueurDuCote * longueurDuCote;
return aire;
}
int calculerPerimetre()
{
int perimetre;
perimetre = longueurDuCote * 4;
return perimetre;
}
void afficherPerimetre()
{
System.out.println("Perimetre = " + calculerPerimetre());
}
void afficherAire()
{
System.out.println("Aire = " + calculerAire());
}
}

View File

@ -0,0 +1,27 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Geometrique;
/**
*
* @author therbron
*/
public class Cercle {
private int rayon;
Cercle()
{
rayon = 5;
}
Cercle(int rayon)
{
this.rayon = rayon;
}
}

View File

@ -0,0 +1,52 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Geometrique;
/**
*
* @author therbron
*/
public class Geometrique {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Point p1 = new Point();
Point p2 = new Point( 1, 2);
Carre carre0 = new Carre();
Carre carre1 = new Carre(10);
Carre carre2 = new Carre(15);
Carre carre3 = new Carre(100);
Cercle cercle1 = new Cercle();
Triangle triangle1 = new Triangle();
Trait trait1 = new Trait();
p1.translater(10.0, 20.1);
p1.afficher("P1");
p2.afficher("P2");
carre0.calculerAire();
carre0.afficherAire();
carre1.calculerAire();
carre1.afficherAire();
carre2.calculerAire();
carre2.afficherAire();
carre3.calculerAire();
carre3.afficherAire();
}
}

View File

@ -0,0 +1,47 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Geometrique;
/**
*
* @author therbron
*/
public class Point {
private double x;
private double y;
Point()
{
x = 5;
y = 5;
}
Point(double x, double y)
{
this.x = x;
this.y = y;
}
void translater(double dx, double dy)
{
x += dx;
y += dy;
}
double distance()
{
double dist;
dist = Math.sqrt(x*x+y*y);
return dist;
}
void afficher(String nomPoint)
{
System.out.println(nomPoint + " x=" + x + " y=" + y);
}
}

View File

@ -0,0 +1,41 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Geometrique;
/**
*
* @author therbron
*/
public class Trait {
private int departX;
private int departY;
private int arriveX;
private int arriveY;
private boolean pointille;
private int epaisseur;
Trait()
{
departX = 1;
departY = 2;
arriveX = 3;
arriveY = 4;
pointille = false;
epaisseur = 2;
}
Trait(int departX, int departY, int arriveX, int arriveY, boolean pointille, int epaisseur)
{
this.departX = departX;
this.departY = departY;
this.arriveX = arriveX;
this.arriveY = arriveY;
this.pointille = pointille;
this.epaisseur = epaisseur;
}
}

View File

@ -0,0 +1,32 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Geometrique;
/**
*
* @author therbron
*/
public class Triangle {
final private int longueurDuCote1;
final private int longueurDuCote2;
final private int longueurDuCote3;
Triangle()
{
longueurDuCote1 = 5;
longueurDuCote2 = 5;
longueurDuCote3 = 5;
}
Triangle(int longueurDuCote1, int longueurDuCote2, int longueurDuCote3)
{
this.longueurDuCote1 = longueurDuCote1;
this.longueurDuCote2 = longueurDuCote3;
this.longueurDuCote3 = longueurDuCote3;
}
}

View File

@ -0,0 +1,26 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javadecouverte;
/**
*
* @author therbron
*/
public class JavaDecouverte {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int monChiffre = 7;
for(int i = 1; i <= 10; i++)
{
System.out.println(monChiffre + " x " + i + " = " + monChiffre * i);
}
}
}

View File

@ -0,0 +1,42 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package jhms;
import java.util.Scanner;
/**
*
* @author therbron
*/
public class Jhms {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int seconde;
int minute;
int heure;
int jour;
System.out.print("Nombre de secondes :");
Scanner sc = new Scanner(System.in);
seconde = sc.nextInt();
minute = seconde / 60;
seconde %= 60;
heure = minute / 60;
minute %= 60;
jour = heure / 24;
heure %= 24;
System.out.println("Il y a " + jour + " jour(s), " + heure + " heur(s), " + minute + " minute(s) et " + seconde + " seconde(s).");
}
}

View File

@ -0,0 +1,395 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package diet;
/**
*
* @author therbron
*/
public class PoidsIdeal extends javax.swing.JFrame {
private String nom;
private String prenom;
private double imc;
private double poids;
private double taille;
private int age;
final private double imcs[] = {16.5, 18.5, 25, 30, 35, 40};
final private String corpulences[] = {"Famine", "Maigreur", "Normale", "Surpoids", "Obésité modérée", "Obésité sévère", "Obésité morbide"};
final private int NBIMC = 6;
final private int NBCORPULENCE = 7;
/**
* Creates new form PoidsIdeal
*/
public PoidsIdeal() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroupSexe = new javax.swing.ButtonGroup();
jPanelInformations = new javax.swing.JPanel();
jLabelAge = new javax.swing.JLabel();
jLabelNom = new javax.swing.JLabel();
jLabelPoids = new javax.swing.JLabel();
jLabelPrenom = new javax.swing.JLabel();
jLabelSexe = new javax.swing.JLabel();
jLabelTaille = new javax.swing.JLabel();
jTextFieldNom = new javax.swing.JTextField();
jTextFieldPrenom = new javax.swing.JTextField();
jSpinnerAge = new javax.swing.JSpinner();
jSpinnerPoids = new javax.swing.JSpinner();
jSpinnerTaille = new javax.swing.JSpinner();
jPanelSexe = new javax.swing.JPanel();
jRadioFemme = new javax.swing.JRadioButton();
jRadioHomme = new javax.swing.JRadioButton();
jButtonSuite = new javax.swing.JButton();
jPanelPoidsIdeal = new javax.swing.JPanel();
jButtonDevine = new javax.swing.JButton();
jButtonLorentz = new javax.swing.JButton();
jButtonLorentzAge = new javax.swing.JButton();
jTextAreaAfficheur = new javax.swing.JTextArea();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setPreferredSize(new java.awt.Dimension(530, 620));
setResizable(false);
getContentPane().setLayout(null);
jLabelAge.setText("Age");
jLabelNom.setText("Nom");
jLabelPoids.setText("Poids");
jLabelPrenom.setText("Prénom");
jLabelSexe.setText("Sexe");
jLabelTaille.setText("Taille");
jSpinnerAge.setModel(new javax.swing.SpinnerNumberModel(1, 1, 200, 1));
jSpinnerPoids.setModel(new javax.swing.SpinnerNumberModel(15.0d, 15.0d, 300.0d, 0.10000000149011612d));
jSpinnerTaille.setModel(new javax.swing.SpinnerNumberModel(0.5d, 0.5d, 3.0d, 0.009999999776482582d));
buttonGroupSexe.add(jRadioFemme);
jRadioFemme.setText("Femme");
buttonGroupSexe.add(jRadioHomme);
jRadioHomme.setText("Homme");
javax.swing.GroupLayout jPanelSexeLayout = new javax.swing.GroupLayout(jPanelSexe);
jPanelSexe.setLayout(jPanelSexeLayout);
jPanelSexeLayout.setHorizontalGroup(
jPanelSexeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelSexeLayout.createSequentialGroup()
.addComponent(jRadioFemme)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jRadioHomme)
.addGap(0, 0, Short.MAX_VALUE))
);
jPanelSexeLayout.setVerticalGroup(
jPanelSexeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelSexeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jRadioFemme)
.addComponent(jRadioHomme))
);
javax.swing.GroupLayout jPanelInformationsLayout = new javax.swing.GroupLayout(jPanelInformations);
jPanelInformations.setLayout(jPanelInformationsLayout);
jPanelInformationsLayout.setHorizontalGroup(
jPanelInformationsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelInformationsLayout.createSequentialGroup()
.addGap(60, 60, 60)
.addGroup(jPanelInformationsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabelTaille)
.addComponent(jLabelPrenom)
.addComponent(jLabelNom)
.addComponent(jLabelAge)
.addComponent(jLabelPoids)
.addComponent(jLabelSexe))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanelInformationsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSpinnerPoids, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jTextFieldNom, javax.swing.GroupLayout.DEFAULT_SIZE, 154, Short.MAX_VALUE)
.addComponent(jTextFieldPrenom, javax.swing.GroupLayout.DEFAULT_SIZE, 154, Short.MAX_VALUE)
.addComponent(jPanelSexe, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jSpinnerAge)
.addComponent(jSpinnerTaille)))
);
jPanelInformationsLayout.setVerticalGroup(
jPanelInformationsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelInformationsLayout.createSequentialGroup()
.addGroup(jPanelInformationsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanelInformationsLayout.createSequentialGroup()
.addGroup(jPanelInformationsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabelNom)
.addComponent(jTextFieldNom, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanelInformationsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabelPrenom)
.addComponent(jTextFieldPrenom, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanelSexe, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabelSexe))
.addGap(14, 14, 14)
.addGroup(jPanelInformationsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jSpinnerAge, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabelAge))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanelInformationsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jSpinnerPoids, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabelPoids))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanelInformationsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jSpinnerTaille, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabelTaille))
.addGap(0, 24, Short.MAX_VALUE))
);
getContentPane().add(jPanelInformations);
jPanelInformations.setBounds(40, 30, 280, 210);
jButtonSuite.setText("Suite");
jButtonSuite.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButtonSuiteMouseClicked(evt);
}
});
getContentPane().add(jButtonSuite);
jButtonSuite.setBounds(110, 240, 94, 25);
jButtonDevine.setText("Poids idéal Devine");
jButtonDevine.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButtonDevineMouseClicked(evt);
}
});
jButtonLorentz.setText("Poids idéal Lorentz");
jButtonLorentz.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButtonLorentzMouseClicked(evt);
}
});
jButtonLorentzAge.setText("Poids idéal lorentz / age");
jButtonLorentzAge.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButtonLorentzAgeMouseClicked(evt);
}
});
jTextAreaAfficheur.setColumns(20);
jTextAreaAfficheur.setRows(5);
javax.swing.GroupLayout jPanelPoidsIdealLayout = new javax.swing.GroupLayout(jPanelPoidsIdeal);
jPanelPoidsIdeal.setLayout(jPanelPoidsIdealLayout);
jPanelPoidsIdealLayout.setHorizontalGroup(
jPanelPoidsIdealLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelPoidsIdealLayout.createSequentialGroup()
.addGroup(jPanelPoidsIdealLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelPoidsIdealLayout.createSequentialGroup()
.addGap(50, 50, 50)
.addGroup(jPanelPoidsIdealLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButtonLorentzAge)
.addComponent(jButtonLorentz)
.addComponent(jButtonDevine)))
.addGroup(jPanelPoidsIdealLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jTextAreaAfficheur, javax.swing.GroupLayout.PREFERRED_SIZE, 503, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(15, Short.MAX_VALUE))
);
jPanelPoidsIdealLayout.setVerticalGroup(
jPanelPoidsIdealLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelPoidsIdealLayout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(jButtonDevine)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonLorentz)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonLorentzAge)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextAreaAfficheur, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
getContentPane().add(jPanelPoidsIdeal);
jPanelPoidsIdeal.setBounds(0, 290, 530, 330);
jPanelPoidsIdeal.setVisible(false);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButtonSuiteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButtonSuiteMouseClicked
nom = jTextFieldNom.getText();
prenom = jTextFieldPrenom.getText();
age = (int)jSpinnerAge.getValue();
poids = (double)jSpinnerPoids.getValue();
taille = (double)jSpinnerTaille.getValue();
imc = poids/ (taille * taille);
if(jPanelPoidsIdeal.isVisible() != true)
{
jPanelPoidsIdeal.setVisible(true);
jPanelInformations.setVisible(false);
}
else
{
jPanelPoidsIdeal.setVisible(false);
jPanelInformations.setVisible(true);
}
jTextAreaAfficheur.setText("Bonjour " + prenom + " " + nom + "\n" + "Votre indice de masse corporel est de : " + imc);
// recherche de la corpulence de l'individu en fonction de son imc
int indiceCorpulence = 0;
for (int i = 0; i < NBIMC - 1; i++) {
if (imc > imcs[i] && imc <= imcs[i + 1]) {
indiceCorpulence = i + 1;
}
}
// cas extreme
if (imc < 16.5) {
indiceCorpulence = 0;
}
if (imc > 40) {
indiceCorpulence = NBCORPULENCE - 1;
}
jTextAreaAfficheur.append("\nVotre corpulence est qualifiée de " + corpulences[indiceCorpulence]);
}//GEN-LAST:event_jButtonSuiteMouseClicked
private void jButtonDevineMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButtonDevineMouseClicked
double poidsIdeal = 0;
if (jRadioFemme.isSelected()) {
poidsIdeal = 45.5 + 2.3 * (taille / 0.0254 - 60.0);
}
if (jRadioHomme.isSelected()) {
poidsIdeal = 50.0 + 2.3 * (taille / 0.0254 - 60.0);
}
if (poidsIdeal > 0) {
jTextAreaAfficheur.append("\nVotre poids ideal avec la formule de devine : " + ((Double) poidsIdeal).toString() + " kg\n");
double ecart = poids - poidsIdeal;
if (ecart >= 0) {
jTextAreaAfficheur.append("\nVous devez perdre " + ((Double) ecart).toString() + " kg\n");
}
else {
jTextAreaAfficheur.append("\nVous devez prendre " + ((Double) (-ecart)).toString() + " kg\n");
}
}
}//GEN-LAST:event_jButtonDevineMouseClicked
private void jButtonLorentzMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButtonLorentzMouseClicked
double poidsIdeal = 0;
if (jRadioFemme.isSelected()) {
poidsIdeal = taille * 100.0 - 100.0 - ((taille * 100.0 - 150.0) / 2.5);
}
if (jRadioHomme.isSelected()) {
poidsIdeal = taille * 100.0 - 100.0 - ((taille * 100.0 - 150.0) / 4);
}
if (poidsIdeal > 0) {
jTextAreaAfficheur.append("\nVotre poids ideal avec la formule de lorrentz : " + ((Double) poidsIdeal).toString() + " kg\n");
double ecart = poids - poidsIdeal;
if (ecart >= 0) {
jTextAreaAfficheur.append("\nVous devez perdre " + ((Double) ecart).toString() + " kg\n");
}
else {
jTextAreaAfficheur.append("\nVous devez prendre " + ((Double) (-ecart)).toString() + " kg\n");
}
}
}//GEN-LAST:event_jButtonLorentzMouseClicked
private void jButtonLorentzAgeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButtonLorentzAgeMouseClicked
double poidsIdeal = 0;
poidsIdeal = 50 + ((taille * 100 - 150) / 4) + ((age - 20) / 4);
if (poidsIdeal > 0) {
jTextAreaAfficheur.append("\nVotre poids ideal avec la formule de lorrentz/age : " + ((Double) poidsIdeal).toString() + " kg\n");
double ecart = poids - poidsIdeal;
if (ecart >= 0) {
jTextAreaAfficheur.append("\nVous devez perdre " + ((Double) ecart).toString() + " kg\n");
}
else {
jTextAreaAfficheur.append("\nVous devez prendre " + ((Double) (-ecart)).toString() + " kg\n");
}
}
}//GEN-LAST:event_jButtonLorentzAgeMouseClicked
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(PoidsIdeal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(PoidsIdeal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(PoidsIdeal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(PoidsIdeal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new PoidsIdeal().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup buttonGroupSexe;
private javax.swing.JButton jButtonDevine;
private javax.swing.JButton jButtonLorentz;
private javax.swing.JButton jButtonLorentzAge;
private javax.swing.JButton jButtonSuite;
private javax.swing.JLabel jLabelAge;
private javax.swing.JLabel jLabelNom;
private javax.swing.JLabel jLabelPoids;
private javax.swing.JLabel jLabelPrenom;
private javax.swing.JLabel jLabelSexe;
private javax.swing.JLabel jLabelTaille;
private javax.swing.JPanel jPanelInformations;
private javax.swing.JPanel jPanelPoidsIdeal;
private javax.swing.JPanel jPanelSexe;
private javax.swing.JRadioButton jRadioFemme;
private javax.swing.JRadioButton jRadioHomme;
private javax.swing.JSpinner jSpinnerAge;
private javax.swing.JSpinner jSpinnerPoids;
private javax.swing.JSpinner jSpinnerTaille;
private javax.swing.JTextArea jTextAreaAfficheur;
private javax.swing.JTextField jTextFieldNom;
private javax.swing.JTextField jTextFieldPrenom;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,55 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package porteacode;
import java.util.Scanner;
/**
*
* @author therbron
*/
public class PorteACode {
/**
* @param args the command line arguments
*/
static int essais;
public static void main(String[] args)
{
// TODO code application logic here
int[] monCode = {8, 4, 5, 4};
int[] leCodeEntre = new int[4];
while(essais < 3)
{
System.out.print("Saisissez le code :");
Scanner sc = new Scanner(System.in);
for(int i = 0; i < monCode.length; i++)
{
leCodeEntre[i] = sc.nextInt();
checkCode(monCode[i], leCodeEntre[i]);
}
System.out.println("Code correct");
}
System.out.println("Nombre d'essais autorisés dépassé.");
System.exit(0);
}
public static void checkCode(int chiffreCorrect, int chiffreEntre)
{
if(chiffreCorrect != chiffreEntre)
{
System.out.println("Code incorrect");
essais++;
PorteACode.main(null);
}
}
}

View File

@ -0,0 +1,28 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package sommeproduitreels;
/**
*
* @author therbron
*/
public class SommeProduitReels {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
float premierReel = 5;
float secondReel = 4;
float troisiemeReel = 8;
float quatriemReel = 2;
System.out.println(premierReel + "+" + secondReel + "+" + troisiemeReel + "+" + quatriemReel + " = " + (premierReel + secondReel + troisiemeReel + quatriemReel));
System.out.println(premierReel + "*" + secondReel + "*" + troisiemeReel + "*" + quatriemReel + " = " + premierReel * secondReel * troisiemeReel * quatriemReel);
}
}

View File

@ -0,0 +1,46 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package TestInstrument;
/**
*
* @author therbron
*/
public class Guitare extends InstrumentACorde{
private String modele;
public Guitare()
{
super();
System.out.println("Constructeur defaut Guitare");
}
public Guitare(String nom, int nombreDeCorde, String modele)
{
super(nom, nombreDeCorde);
this.modele = modele;
}
public Guitare(Guitare maGuitare)
{
super(maGuitare);
this.modele = maGuitare.modele;
}
public void afficher()
{
super.afficher();
System.out.println("Modele = " + modele);
}
@Override
public String toString() {
return super.toString() + "\n" + "Guitare{" + "modele=" + modele + '}';
}
}

View File

@ -0,0 +1,45 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package TestInstrument;
/**
*
* @author therbron
*/
public class InstrumentACorde extends InstrumentDeMusique{
protected int nombreDeCorde;
public InstrumentACorde()
{
super();
System.out.println("Constructeur defaut InstrumentACorde");
}
public InstrumentACorde(String nom, int nombreDeCorde)
{
super(nom);
this.nombreDeCorde = nombreDeCorde;
}
public InstrumentACorde(InstrumentACorde monInstrument)
{
super(monInstrument);
this.nombreDeCorde = monInstrument.nombreDeCorde;
}
public void afficher()
{
super.afficher();
System.out.println("Corde(s) = " + nombreDeCorde);
}
@Override
public String toString() {
return super.toString() + "\n" + "InstrumentACorde{" + "nombreDeCorde=" + nombreDeCorde + '}';
}
}

View File

@ -0,0 +1,41 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package TestInstrument;
/**
*
* @author therbron
*/
public class InstrumentDeMusique {
protected String nom;
public InstrumentDeMusique()
{
nom = "Guitarette";
System.out.println("Constructeur defaut InstrumentDeMusique");
}
public InstrumentDeMusique(String nom)
{
this.nom = nom;
}
public InstrumentDeMusique(InstrumentDeMusique monInstrument)
{
this.nom = monInstrument.nom;
}
public void afficher()
{
System.out.println("Nom = " + nom);
}
@Override
public String toString() {
return "InstrumentDeMusique{" + "nom=" + nom + '}';
}
}

View File

@ -0,0 +1,22 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package TestInstrument;
/**
*
* @author therbron
*/
public class TestInstrument {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Guitare clapton = new Guitare("Fender Stratocaster 1956", 6, "Brownie");
System.out.println(clapton);
}
}

View File

@ -0,0 +1,93 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package banque;
/**
*
* @author therbron
*/
public class CompteBancaire {
private float solde;
private float decouvertAutorise;
CompteBancaire()
{
solde = 100;
decouvertAutorise = 50;
}
CompteBancaire(float solde, float decouvertAutorise)
{
this.solde = solde;
if(decouvertAutorise < 0)
{
this.decouvertAutorise = 0;
}
else
{
this.decouvertAutorise = decouvertAutorise;
}
}
//Duplication d'un compte existant
CompteBancaire(CompteBancaire unAutreCompte)
{
solde = unAutreCompte.solde;
decouvertAutorise = unAutreCompte.decouvertAutorise;
}
void deposerArgent(float sommeDeposee)
{
if(sommeDeposee >= 0)
{
solde += sommeDeposee;
}
else
{
System.out.println("Vous ne pouvez pas déposer une somme négative.");
}
}
//Retrait d'argent à condition que le dévouert autorisé ne soit pas dépassé
void retirerArgent(float sommeRetiree)
{
if(sommeRetiree < 0)
{
System.out.println("Il est impossible de retirer une somme négative.");
}
else
{
if(( sommeRetiree) <= (solde + decouvertAutorise))
{
solde -= sommeRetiree;
}
else
{
System.out.println("Le retrait de cet argent est impossible, autorisation de découvert dépassée.");
}
}
}
void afficherCompte()
{
System.out.println("Solde : " + solde);
System.out.println("Autorisation de découvert : " + decouvertAutorise);
}
void changerDecouvert(float nouveauDecouvert)
{
if(nouveauDecouvert >= 0)
{
decouvertAutorise = nouveauDecouvert;
}
else
{
System.out.println("Vous ne pouvez pas avoir une autorisation de découvert négative.");
}
}
}

View File

@ -0,0 +1,60 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package banque;
import java.util.Scanner;
/**
*
* @author therbron
*/
public class Main {
public static void main(String[] args)
{
int choix;
CompteBancaire monCompte = new CompteBancaire(-1000,150);
do
{
System.out.println("Que voulez-vous faire ?");
System.out.println("1 - Déposer de l'argent");
System.out.println("2 - Retirer de l'argent");
System.out.println("3 - Modifier l'autorisation de découvert");
System.out.println("4 - Afficher le compte");
System.out.println("5 - Quitter");
Scanner sc = new Scanner(System.in);
choix = sc.nextInt();
switch(choix)
{
case 1:
System.out.println("Combien voulez-vous déposer ?");
monCompte.deposerArgent(sc.nextFloat());
break;
case 2:
System.out.println("Combien voulez-vous retirer ?");
monCompte.retirerArgent(sc.nextFloat());
break;
case 3:
System.out.println("Quel est le nouveau montant du découvert autorisé ?");
monCompte.changerDecouvert(sc.nextFloat());
break;
case 4:
monCompte.afficherCompte();
break;
case 5:
System.out.println("Au revoir.");
break;
default:
System.out.println("Choix incorrecte.");
break;
}
}while(choix != 5);
}
}

View File

@ -0,0 +1,51 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package borneparking;
/**
*
* @author therbron
*/
public class Afficheur {
int longueur;
int hauteur;
int eclairement;
Curseur monCurseur;
char display[][];
Afficheur()
{
longueur = 16;
hauteur = 2;
eclairement = 1;
monCurseur = new Curseur();
display = new char[longueur][hauteur];
}
Afficheur(int longueur, int hauteur)
{
this.longueur = longueur;
this.hauteur = hauteur;
eclairement = 1;
monCurseur = new Curseur();
}
void modifierEclairage(int eclairement)
{
this.eclairement = eclairement;
}
void afficherMessage(String monMessage)
{
System.out.print(monMessage);
}
void afficherCaractere(char car)
{
}
}

View File

@ -0,0 +1,14 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package borneparking;
/**
*
* @author therbron
*/
public class Barriere {
}

View File

@ -0,0 +1,14 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package borneparking;
/**
*
* @author therbron
*/
public class Borne {
}

View File

@ -0,0 +1,21 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package borneparking;
/**
*
* @author therbron
*/
public class BorneParking {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}
}

View File

@ -0,0 +1,14 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package borneparking;
/**
*
* @author therbron
*/
public class Clavier {
}

View File

@ -0,0 +1,33 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package borneparking;
/**
*
* @author therbron
*/
public class Curseur {
int positionX;
int positionY;
Curseur()
{
positionX = 0;
positionY = 0;
}
void deplacerCurseur(int dx, int dy)
{
positionX += dx;
positionY += dy;
}
void afficherCurseur()
{
System.out.print("|");
}
}

View File

@ -0,0 +1,53 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cercledepuisc;
/**
*
* @author therbron
*/
public class Cercle {
private double x;
private double y;
private double rayon;
Cercle()
{
x = 2;
y = 3;
rayon = 1.5;
}
Cercle(double x, double y, double rayon)
{
this.x = x;
this.y = y;
this.rayon = rayon;
}
void deplacerCercle(double nouveauX, double nouveauY)
{
x = nouveauX;
y = nouveauY;
}
void changerRayon(double nouveauRayon)
{
rayon = nouveauRayon;
}
double perimetre()
{
return 2 * Math.PI * rayon;
}
void afficher()
{
System.out.println("x = " + x);
System.out.println("y = " + y);
System.out.println("Rayon = " + rayon);
}
}

View File

@ -0,0 +1,33 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cercledepuisc;
/**
*
* @author therbron
*/
public class CercleDepuisC {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Cercle c1 = new Cercle(3, 5, 10);
Cercle c2 = new Cercle(-2, 4, 3);
c1.afficher();
System.out.println("perimetre = " + c1.perimetre());
c2.afficher();
System.out.println("perimetre = " + c2.perimetre());
c1.deplacerCercle(1, 2);
c1.afficher();
System.out.println("perimetre = " + c1.perimetre());
c2.changerRayon(6);
c2.afficher();
System.out.println("perimetre = " + c2.perimetre());
}
}

View File

@ -0,0 +1,21 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package classcarre;
/**
*
* @author therbron
*/
public class ClassCarre {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}
}

View File

@ -0,0 +1,16 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package classcarre;
/**
*
* @author therbron
*/
public class carre {
public carre (int cote){
}
}

View File

@ -0,0 +1,50 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package figGeometrique;
/**
*
* @author therbron
*/
public class Carre {
final private int longueurDuCote;
Carre()
{
longueurDuCote = 5;
}
Carre(int longueurDuCote)
{
this.longueurDuCote = longueurDuCote;
}
int calculerAire()
{
int aire;
aire = longueurDuCote * longueurDuCote;
return aire;
}
int calculerPerimetre()
{
int perimetre;
perimetre = longueurDuCote * 4;
return perimetre;
}
void afficherPerimetre()
{
System.out.println("Perimetre = " + calculerPerimetre());
}
void afficherAire()
{
System.out.println("Aire = " + calculerAire());
}
}

View File

@ -0,0 +1,27 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Geometrique;
/**
*
* @author therbron
*/
public class Cercle {
private int rayon;
Cercle()
{
rayon = 5;
}
Cercle(int rayon)
{
this.rayon = rayon;
}
}

View File

@ -0,0 +1,36 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package figGeometrique;
/**
*
* @author therbron
*/
public class Main {
/*public static void main(String[] args) {
Point p1, p2, p3, p4;
Trait t1;
Carre c1;
Triangle tri1;
p1 = new Point();
p2 = new Point(1.0, 2.1);
p3 = new Point(p2);
t1 = new Trait(p1, p2, false, 5);
c1 = new Carre(20);
tri1 = new Triangle(10, 12, 14);
System.out.println(tri1);
t1.afficherLongueur();
c1.afficherAire();
tri1.afficherAire();
}*/
}

View File

@ -0,0 +1,75 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package figGeometrique;
/**
*
* @author therbron
*/
public class Point {
private double x;
private double y;
Point()
{
x = 5;
y = 5;
}
Point(double x, double y)
{
this.x = x;
this.y = y;
}
Point(Point p)
{
this.x = p.getX();
this.y = p.getY();
}
void translater(double dx, double dy)
{
x += dx;
y += dy;
}
double distance()
{
double dist;
dist = Math.sqrt(x*x+y*y);
return dist;
}
void afficher(String nomPoint)
{
System.out.println(nomPoint + " x=" + x + " y=" + y);
}
public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
public double getY() {
return y;
}
public void setY(double y) {
this.y = y;
}
@Override
public String toString() {
return "Point{" + "x=" + x + ", y=" + y + '}';
}
}

View File

@ -0,0 +1,62 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package figGeometrique;
/**
*
* @author therbron
*/
public class Trait {
final private double departX;
final private double departY;
final private double arriveX;
final private double arriveY;
final private boolean pointille;
final private double epaisseur;
Trait()
{
departX = 1;
departY = 2;
arriveX = 3;
arriveY = 4;
pointille = false;
epaisseur = 2;
}
Trait(Point p1, Point p2, boolean pointille, double epaisseur)
{
departX = p1.getX();
departY = p1.getY();
arriveX = p2.getX();
arriveY = p2.getY();
this.pointille = pointille;
this.epaisseur = epaisseur;
}
Trait(int departX, int departY, int arriveX, int arriveY, boolean pointille, int epaisseur)
{
this.departX = departX;
this.departY = departY;
this.arriveX = arriveX;
this.arriveY = arriveY;
this.pointille = pointille;
this.epaisseur = epaisseur;
}
public double calculerLongueur()
{
double longueur;
longueur = Math.sqrt((arriveX - departX) * (arriveX - departX) + (arriveY - departY) * (arriveY - departY));
return longueur;
}
public void afficherLongueur()
{
System.out.println("Longueur = " + calculerLongueur());
}
}

View File

@ -0,0 +1,54 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package figGeometrique;
/**
*
* @author therbron
*/
public class Triangle {
private double longueurDuCote1;
private double longueurDuCote2;
private double longueurDuCote3;
Triangle()
{
longueurDuCote1 = 5;
longueurDuCote2 = 5;
longueurDuCote3 = 5;
}
Triangle(int longueurDuCote1, int longueurDuCote2, int longueurDuCote3)
{
this.longueurDuCote1 = longueurDuCote1;
this.longueurDuCote2 = longueurDuCote2;
this.longueurDuCote3 = longueurDuCote3;
}
public double calculerAire()
{
double aire;
double demiPerimetre;
demiPerimetre = (longueurDuCote1 + longueurDuCote2 + longueurDuCote3)/2;
System.out.println(demiPerimetre);
aire = Math.sqrt(demiPerimetre * (demiPerimetre - longueurDuCote1) * (demiPerimetre - longueurDuCote2) * (demiPerimetre - longueurDuCote3));
return aire;
}
public void afficherAire()
{
System.out.println("Aire = " + calculerAire());
}
@Override
public String toString() {
return "Triangle{" + "longueurDuCote1=" + longueurDuCote1 + ", longueurDuCote2=" + longueurDuCote2 + ", longueurDuCote3=" + longueurDuCote3 + '}';
}
}

View File

@ -0,0 +1,47 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package fonderie;
/**
*
* @author therbron
*/
public class Barre {
protected double densite;
protected double longueur;
protected String reference;
Barre()
{
densite = 0.1f;
longueur = 5;
reference = "0001";
System.out.println("Constructeur defaut Barre");
}
Barre(double densite, double longueur, String reference)
{
this.densite = densite;
this.longueur = longueur;
this.reference = reference;
System.out.println("Constructeur parametre Barre");
}
Barre(Barre autreBarre)
{
densite = autreBarre.densite;
longueur = autreBarre.longueur;
reference = autreBarre.reference;
System.out.println("Constructeur copie Barre");
}
void afficherReference()
{
System.out.println("Referenfe = " + reference);
}
}

View File

@ -0,0 +1,39 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package fonderie;
/**
*
* @author therbron
*/
public class BarreCarree extends Barre{
private double cote;
public BarreCarree() {
super();
this.cote = 3.25;
System.out.println("Constructeur defaut BarreCarre");
}
public BarreCarree(double cote, double densite, double longueur, String reference) {
super(densite, longueur, reference);
this.cote = cote;
System.out.println("Constructeur parametre et super parametres BarreCarre");
}
public BarreCarree(BarreCarree autreBarre) {
super(autreBarre);
this.cote = autreBarre.cote;
System.out.println("Constructeur copie BarreCarre");
}
double calculerMasse()
{
return longueur*densite*(cote*cote);
}
}

View File

@ -0,0 +1,43 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package fonderie;
/**
*
* @author therbron
*/
public class BarreRectangle extends Barre{
private double hauteur;
private double largeur;
public BarreRectangle() {
super();
this.hauteur = 5;
this.largeur = 4.2;
System.out.println("Constructeur defaut BarreRectangle");
}
public BarreRectangle(double hauteur, double largeur, double densite, double longueur, String reference) {
super(densite, longueur, reference);
this.hauteur = hauteur;
this.largeur = largeur;
System.out.println("Constructeur parametres et super parametres BarreRectangle");
}
public BarreRectangle(BarreRectangle autreBarre) {
super(autreBarre);
this.hauteur = autreBarre.hauteur;
this.largeur = autreBarre.largeur;
System.out.println("Constructeur copie BarreRectangle");
}
double calculerMasse()
{
return longueur*densite*(hauteur*largeur);
}
}

View File

@ -0,0 +1,39 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package fonderie;
/**
*
* @author therbron
*/
public class BarreRonde extends Barre{
private double rayon;
public BarreRonde() {
super();
this.rayon = 3;
System.out.println("Constructeur defaut BarreRonde");
}
public BarreRonde(double rayon, double densite, double longueur, String reference) {
super(densite, longueur, reference);
this.rayon = rayon;
System.out.println("Constructeur parametre et super parametres BarreRonde");
}
public BarreRonde(BarreRonde autreBarre) {
super(autreBarre);
this.rayon = autreBarre.rayon;
System.out.println("Constructeur copie BarreRonde");
}
double calculerMasse()
{
return longueur*densite*(2*Math.PI*rayon);
}
}

View File

@ -0,0 +1,39 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package fonderie;
/**
*
* @author therbron
*/
public class Fonderie {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Barre barre = new Barre();
//Barre ronde en cuivre
BarreRonde barreRonde0 = new BarreRonde(3, 8.9, 8, "0002");
BarreRonde barreRonde1 = new BarreRonde(4, 8.9, 8, "0002");
//Barre carree en cuivre
BarreCarree barreCarree = new BarreCarree(3, 8.9, 8, "0003");
//Barre rectangle en plutonium
BarreRectangle barreRectangle = new BarreRectangle(8, 2.1, 19.8, 15, "0004");
barre.afficherReference();
barreRonde0.afficherReference();
System.out.println(barreRonde0.calculerMasse());
barreRonde1.afficherReference();
System.out.println(barreRonde1.calculerMasse());
barreCarree.afficherReference();
System.out.println(barreCarree.calculerMasse());
barreRectangle.afficherReference();
System.out.println(barreRectangle.calculerMasse());
}
}

View File

@ -0,0 +1,349 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<NonVisualComponents>
<Component class="javax.swing.JMenuItem" name="jMenuItem5">
<Properties>
<Property name="text" type="java.lang.String" value="jMenuItem5"/>
</Properties>
</Component>
<Component class="javax.swing.JMenuItem" name="jMenuItem6">
<Properties>
<Property name="text" type="java.lang.String" value="jMenuItem6"/>
</Properties>
</Component>
<Component class="javax.swing.ButtonGroup" name="grOS">
</Component>
<Menu class="javax.swing.JMenuBar" name="menuBarPrinc">
<Properties>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[83000, 32769]"/>
</Property>
</Properties>
<SubComponents>
<Menu class="javax.swing.JMenu" name="menuPrinc">
<Properties>
<Property name="text" type="java.lang.String" value="Langages"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="itemC">
<Properties>
<Property name="text" type="java.lang.String" value="C"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="itemCActionPerformed"/>
</Events>
</MenuItem>
<Menu class="javax.swing.JMenu" name="menuPoubelle">
<Properties>
<Property name="text" type="java.lang.String" value="La poubelle"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="itemPython">
<Properties>
<Property name="text" type="java.lang.String" value="Python"/>
<Property name="toolTipText" type="java.lang.String" value=""/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="itemPythonActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="itemBrainFuck">
<Properties>
<Property name="text" type="java.lang.String" value="BrainFuck"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="itemBrainFuckActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="menuObject">
<Properties>
<Property name="text" type="java.lang.String" value="Objet"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="itemJava">
<Properties>
<Property name="text" type="java.lang.String" value="Java"/>
<Property name="toolTipText" type="java.lang.String" value=""/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="itemJavaActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="itemCPlusPlus">
<Properties>
<Property name="text" type="java.lang.String" value="C++"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="itemCPlusPlusActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
<MenuItem class="javax.swing.JPopupMenu$Separator" name="jSeparator1">
</MenuItem>
<Menu class="javax.swing.JMenu" name="menuSecond">
<Properties>
<Property name="text" type="java.lang.String" value="Web"/>
</Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleParent" type="javax.accessibility.Accessible" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="menuSecond"/>
</Property>
</AccessibilityProperties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="itemPHP">
<Properties>
<Property name="text" type="java.lang.String" value="php"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="itemPHPActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="itemJavascript">
<Properties>
<Property name="text" type="java.lang.String" value="javascript"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="itemJavascriptActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
</SubComponents>
</Menu>
</SubComponents>
</Menu>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="title" type="java.lang.String" value="exemple d&apos;IHM"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[250, 400]"/>
</Property>
<Property name="resizable" type="boolean" value="false"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="menuBar" type="java.lang.String" value="menuBarPrinc"/>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="true"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-112,0,0,0,-6"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
<Property name="useNullLayout" type="boolean" value="true"/>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="etiSaisieCode">
<Properties>
<Property name="text" type="java.lang.String" value="Entrez votre code"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="10" y="20" width="140" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JTextField" name="zoneSaisie">
<Events>
<EventHandler event="keyPressed" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="zoneSaisieKeyPressed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="150" y="20" width="70" height="30"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="etiChoixSE">
<Properties>
<Property name="text" type="java.lang.String" value="Choix"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="10" y="60" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JComboBox" name="comboEntree">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="5">
<StringItem index="0" value="Linux"/>
<StringItem index="1" value="Windows"/>
<StringItem index="2" value="Unix"/>
<StringItem index="3" value="Solaris"/>
<StringItem index="4" value="Mac OS"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="comboEntreeActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="80" y="60" width="120" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="etiListeSE">
<Properties>
<Property name="text" type="java.lang.String" value="Liste"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="10" y="140" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="80" y="100" width="120" height="110"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JList" name="listeEntree">
<Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
<StringArray count="5">
<StringItem index="0" value="Linux"/>
<StringItem index="1" value="Windows"/>
<StringItem index="2" value="Unix"/>
<StringItem index="3" value="Solaris"/>
<StringItem index="4" value="Mac OS"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="listeEntreeMouseClicked"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JCheckBox" name="boxLin">
<Properties>
<Property name="text" type="java.lang.String" value="Linux"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="boxLinMouseClicked"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="0" y="220" width="70" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JCheckBox" name="boxWin">
<Properties>
<Property name="text" type="java.lang.String" value="Windows"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="boxWinMouseClicked"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="70" y="220" width="90" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JCheckBox" name="boxMac">
<Properties>
<Property name="text" type="java.lang.String" value="Mac OS"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="boxMacMouseClicked"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="160" y="220" width="90" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JRadioButton" name="grLin">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="grOS"/>
</Property>
<Property name="text" type="java.lang.String" value="Linux"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="grLinMouseClicked"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="0" y="250" width="70" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JRadioButton" name="grWin">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="grOS"/>
</Property>
<Property name="text" type="java.lang.String" value="Windows"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="grWinMouseClicked"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="70" y="250" width="90" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JRadioButton" name="grMac">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="grOS"/>
</Property>
<Property name="text" type="java.lang.String" value="Mac OS"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="grMacMouseClicked"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="160" y="250" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Source de l&apos;&#xe9;v&#xe9;nement :"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="10" y="280" width="180" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="etiEventEnCours">
<Properties>
<Property name="text" type="java.lang.String" value=" "/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="10" y="300" width="230" height="-1"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,457 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ihm;
import java.awt.Color;
/**
*
* @author therbron
*/
public class FenPrinc extends javax.swing.JFrame {
/**
* Creates new form FenPrinc
*/
public FenPrinc() {
initComponents();
comboEntree.setBackground(Color.CYAN);
getContentPane().setBackground(new java.awt.Color(204, 255, 204));
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jMenuItem5 = new javax.swing.JMenuItem();
jMenuItem6 = new javax.swing.JMenuItem();
grOS = new javax.swing.ButtonGroup();
etiSaisieCode = new javax.swing.JLabel();
zoneSaisie = new javax.swing.JTextField();
etiChoixSE = new javax.swing.JLabel();
comboEntree = new javax.swing.JComboBox();
etiListeSE = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
listeEntree = new javax.swing.JList();
boxLin = new javax.swing.JCheckBox();
boxWin = new javax.swing.JCheckBox();
boxMac = new javax.swing.JCheckBox();
grLin = new javax.swing.JRadioButton();
grWin = new javax.swing.JRadioButton();
grMac = new javax.swing.JRadioButton();
jLabel1 = new javax.swing.JLabel();
etiEventEnCours = new javax.swing.JLabel();
menuBarPrinc = new javax.swing.JMenuBar();
menuPrinc = new javax.swing.JMenu();
itemC = new javax.swing.JMenuItem();
menuPoubelle = new javax.swing.JMenu();
itemPython = new javax.swing.JMenuItem();
itemBrainFuck = new javax.swing.JMenuItem();
menuObject = new javax.swing.JMenu();
itemJava = new javax.swing.JMenuItem();
itemCPlusPlus = new javax.swing.JMenuItem();
jSeparator1 = new javax.swing.JPopupMenu.Separator();
menuSecond = new javax.swing.JMenu();
itemPHP = new javax.swing.JMenuItem();
itemJavascript = new javax.swing.JMenuItem();
jMenuItem5.setText("jMenuItem5");
jMenuItem6.setText("jMenuItem6");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("exemple d'IHM");
setMinimumSize(new java.awt.Dimension(250, 400));
setResizable(false);
getContentPane().setLayout(null);
etiSaisieCode.setText("Entrez votre code");
getContentPane().add(etiSaisieCode);
etiSaisieCode.setBounds(10, 20, 140, 15);
zoneSaisie.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
zoneSaisieKeyPressed(evt);
}
});
getContentPane().add(zoneSaisie);
zoneSaisie.setBounds(150, 20, 70, 30);
etiChoixSE.setText("Choix");
getContentPane().add(etiChoixSE);
etiChoixSE.setBounds(10, 60, 38, 15);
comboEntree.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Linux", "Windows", "Unix", "Solaris", "Mac OS" }));
comboEntree.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
comboEntreeActionPerformed(evt);
}
});
getContentPane().add(comboEntree);
comboEntree.setBounds(80, 60, 120, 24);
etiListeSE.setText("Liste");
getContentPane().add(etiListeSE);
etiListeSE.setBounds(10, 140, 35, 15);
listeEntree.setModel(new javax.swing.AbstractListModel() {
String[] strings = { "Linux", "Windows", "Unix", "Solaris", "Mac OS" };
public int getSize() { return strings.length; }
public Object getElementAt(int i) { return strings[i]; }
});
listeEntree.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
listeEntreeMouseClicked(evt);
}
});
jScrollPane1.setViewportView(listeEntree);
getContentPane().add(jScrollPane1);
jScrollPane1.setBounds(80, 100, 120, 110);
boxLin.setText("Linux");
boxLin.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
boxLinMouseClicked(evt);
}
});
getContentPane().add(boxLin);
boxLin.setBounds(0, 220, 70, 23);
boxWin.setText("Windows");
boxWin.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
boxWinMouseClicked(evt);
}
});
getContentPane().add(boxWin);
boxWin.setBounds(70, 220, 90, 23);
boxMac.setText("Mac OS");
boxMac.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
boxMacMouseClicked(evt);
}
});
getContentPane().add(boxMac);
boxMac.setBounds(160, 220, 90, 23);
grOS.add(grLin);
grLin.setText("Linux");
grLin.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
grLinMouseClicked(evt);
}
});
getContentPane().add(grLin);
grLin.setBounds(0, 250, 70, 23);
grOS.add(grWin);
grWin.setText("Windows");
grWin.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
grWinMouseClicked(evt);
}
});
getContentPane().add(grWin);
grWin.setBounds(70, 250, 90, 23);
grOS.add(grMac);
grMac.setText("Mac OS");
grMac.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
grMacMouseClicked(evt);
}
});
getContentPane().add(grMac);
grMac.setBounds(160, 250, 77, 23);
jLabel1.setText("Source de l'événement :");
getContentPane().add(jLabel1);
jLabel1.setBounds(10, 280, 180, 15);
etiEventEnCours.setText(" ");
getContentPane().add(etiEventEnCours);
etiEventEnCours.setBounds(10, 300, 230, 15);
menuBarPrinc.setMaximumSize(new java.awt.Dimension(83000, 32769));
menuPrinc.setText("Langages");
itemC.setText("C");
itemC.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
itemCActionPerformed(evt);
}
});
menuPrinc.add(itemC);
menuPoubelle.setText("La poubelle");
itemPython.setText("Python");
itemPython.setToolTipText("");
itemPython.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
itemPythonActionPerformed(evt);
}
});
menuPoubelle.add(itemPython);
itemBrainFuck.setText("BrainFuck");
itemBrainFuck.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
itemBrainFuckActionPerformed(evt);
}
});
menuPoubelle.add(itemBrainFuck);
menuPrinc.add(menuPoubelle);
menuObject.setText("Objet");
itemJava.setText("Java");
itemJava.setToolTipText("");
itemJava.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
itemJavaActionPerformed(evt);
}
});
menuObject.add(itemJava);
itemCPlusPlus.setText("C++");
itemCPlusPlus.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
itemCPlusPlusActionPerformed(evt);
}
});
menuObject.add(itemCPlusPlus);
menuPrinc.add(menuObject);
menuPrinc.add(jSeparator1);
menuSecond.setText("Web");
itemPHP.setText("php");
itemPHP.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
itemPHPActionPerformed(evt);
}
});
menuSecond.add(itemPHP);
itemJavascript.setText("javascript");
itemJavascript.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
itemJavascriptActionPerformed(evt);
}
});
menuSecond.add(itemJavascript);
menuPrinc.add(menuSecond);
menuSecond.getAccessibleContext().setAccessibleParent(menuSecond);
menuBarPrinc.add(menuPrinc);
setJMenuBar(menuBarPrinc);
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void zoneSaisieKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_zoneSaisieKeyPressed
// TODO add your handling code here:
System.out.println("Code entré : " + evt.getKeyChar());
etiEventEnCours.setText("Code entré : " + evt.getKeyChar());
}//GEN-LAST:event_zoneSaisieKeyPressed
private void comboEntreeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboEntreeActionPerformed
// TODO add your handling code here:
System.out.println("Entree combo : " + comboEntree.getSelectedItem());
etiEventEnCours.setText("Entree combo : " + comboEntree.getSelectedItem());
}//GEN-LAST:event_comboEntreeActionPerformed
private void listeEntreeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listeEntreeMouseClicked
// TODO add your handling code here:
System.out.println("Entree choix multiple : " + listeEntree.getSelectedValue());
etiEventEnCours.setText("Entree choix multiple : " + listeEntree.getSelectedValue());
}//GEN-LAST:event_listeEntreeMouseClicked
private void boxLinMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_boxLinMouseClicked
// TODO add your handling code here:
if(boxLin.isSelected())
{
System.out.println("Case Linux cochée");
etiEventEnCours.setText("Case Linux cochée");
}
else
{
System.out.println("Case Linux décochée");
etiEventEnCours.setText("Case Linux décochée");
}
}//GEN-LAST:event_boxLinMouseClicked
private void boxWinMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_boxWinMouseClicked
// TODO add your handling code here:
if(boxWin.isSelected())
{
System.out.println("Case Windows cochée");
etiEventEnCours.setText("Case Windows cochée");
}
else
{
System.out.println("Case Windows décochée");
etiEventEnCours.setText("Case Windows décochée");
}
}//GEN-LAST:event_boxWinMouseClicked
private void boxMacMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_boxMacMouseClicked
// TODO add your handling code here:
if(boxMac.isSelected())
{
System.out.println("Case Mac cochée");
etiEventEnCours.setText("Case Mac cochée");
}
else
{
System.out.println("Case Mac décochée");
etiEventEnCours.setText("Case Mac décochée");
}
}//GEN-LAST:event_boxMacMouseClicked
private void grLinMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_grLinMouseClicked
// TODO add your handling code here:
System.out.println("Entree bouton radio : Linux");
etiEventEnCours.setText("Entree bouton radio : Linux");
}//GEN-LAST:event_grLinMouseClicked
private void grWinMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_grWinMouseClicked
// TODO add your handling code here:
System.out.println("Entree bouton radio : Windows");
etiEventEnCours.setText("Entree bouton radio : Windows");
}//GEN-LAST:event_grWinMouseClicked
private void grMacMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_grMacMouseClicked
// TODO add your handling code here:
System.out.println("Entree bouton radio : Mac");
etiEventEnCours.setText("Entree bouton radio : Mac");
}//GEN-LAST:event_grMacMouseClicked
private void itemCActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemCActionPerformed
// TODO add your handling code here:
System.out.println("Choix menu : C");
etiEventEnCours.setText("Choix menu : C");
}//GEN-LAST:event_itemCActionPerformed
private void itemPythonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemPythonActionPerformed
// TODO add your handling code here:
System.out.println("Choix menu : Python");
etiEventEnCours.setText("Choix menu : Python");
}//GEN-LAST:event_itemPythonActionPerformed
private void itemBrainFuckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemBrainFuckActionPerformed
// TODO add your handling code here:
System.out.println("Choix menu : Brainfuck");
etiEventEnCours.setText("Choix menu : Brainfuck");
}//GEN-LAST:event_itemBrainFuckActionPerformed
private void itemJavaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemJavaActionPerformed
// TODO add your handling code here:
System.out.println("Choix menu : Java");
etiEventEnCours.setText("Choix menu : Java");
}//GEN-LAST:event_itemJavaActionPerformed
private void itemCPlusPlusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemCPlusPlusActionPerformed
// TODO add your handling code here:
System.out.println("Choix menu : C++");
etiEventEnCours.setText("Choix menu : C++");
}//GEN-LAST:event_itemCPlusPlusActionPerformed
private void itemPHPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemPHPActionPerformed
// TODO add your handling code here:
System.out.println("Choix menu : php");
etiEventEnCours.setText("Choix menu : php");
}//GEN-LAST:event_itemPHPActionPerformed
private void itemJavascriptActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemJavascriptActionPerformed
// TODO add your handling code here:
System.out.println("Choix menu : javascript");
etiEventEnCours.setText("Choix menu : javascript");
}//GEN-LAST:event_itemJavascriptActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FenPrinc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FenPrinc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FenPrinc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FenPrinc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FenPrinc().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JCheckBox boxLin;
private javax.swing.JCheckBox boxMac;
private javax.swing.JCheckBox boxWin;
private javax.swing.JComboBox comboEntree;
private javax.swing.JLabel etiChoixSE;
private javax.swing.JLabel etiEventEnCours;
private javax.swing.JLabel etiListeSE;
private javax.swing.JLabel etiSaisieCode;
private javax.swing.JRadioButton grLin;
private javax.swing.JRadioButton grMac;
private javax.swing.ButtonGroup grOS;
private javax.swing.JRadioButton grWin;
private javax.swing.JMenuItem itemBrainFuck;
private javax.swing.JMenuItem itemC;
private javax.swing.JMenuItem itemCPlusPlus;
private javax.swing.JMenuItem itemJava;
private javax.swing.JMenuItem itemJavascript;
private javax.swing.JMenuItem itemPHP;
private javax.swing.JMenuItem itemPython;
private javax.swing.JLabel jLabel1;
private javax.swing.JMenuItem jMenuItem5;
private javax.swing.JMenuItem jMenuItem6;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JPopupMenu.Separator jSeparator1;
private javax.swing.JList listeEntree;
private javax.swing.JMenuBar menuBarPrinc;
private javax.swing.JMenu menuObject;
private javax.swing.JMenu menuPoubelle;
private javax.swing.JMenu menuPrinc;
private javax.swing.JMenu menuSecond;
private javax.swing.JTextField zoneSaisie;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,327 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="name" type="java.lang.String" value="clavier" noResource="true"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[220, 250]"/>
</Property>
<Property name="resizable" type="boolean" value="false"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,-6,0,0,0,-36"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
<Property name="useNullLayout" type="boolean" value="true"/>
</Layout>
<SubComponents>
<Component class="javax.swing.JTextField" name="textMess">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="14" green="ff" red="14" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="textDefaut" type="code"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="10" y="10" width="190" height="30"/>
</Constraint>
</Constraints>
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" red="0" type="rgb"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[120, 160]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[120, 160]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="10" y="40" width="190" height="160"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
<Property name="columns" type="int" value="3"/>
<Property name="rows" type="int" value="4"/>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="touche1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="1"/>
<Property name="toolTipText" type="java.lang.String" value="Appuyer"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="touche1MouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="touche2">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="2"/>
<Property name="toolTipText" type="java.lang.String" value="Appuyer"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="touche2MouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="touche3">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="3"/>
<Property name="toolTipText" type="java.lang.String" value="Appuyer"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="touche3MouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="touche4">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="4"/>
<Property name="toolTipText" type="java.lang.String" value="Appuyer"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="touche4MouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="touche5">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="5"/>
<Property name="toolTipText" type="java.lang.String" value="Appuyer"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="touche5MouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="touche6">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="6"/>
<Property name="toolTipText" type="java.lang.String" value="Appuyer"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="touche6MouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="touche7">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="7"/>
<Property name="toolTipText" type="java.lang.String" value="Appuyer"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="touche7MouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="touche8">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="8"/>
<Property name="toolTipText" type="java.lang.String" value="Appuyer"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="touche8MouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="touche9">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="9"/>
<Property name="toolTipText" type="java.lang.String" value="Appuyer"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="touche9MouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="toucheEtoile">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="*"/>
<Property name="toolTipText" type="java.lang.String" value="Appuyer"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="toucheEtoileMouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="touche0">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="0"/>
<Property name="toolTipText" type="java.lang.String" value="Appuyer"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="touche0MouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="toucheDiese">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="#"/>
<Property name="toolTipText" type="java.lang.String" value="Appuyer"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[26, 26]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="toucheDieseMouseClicked"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -0,0 +1,545 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package simclavier;
/**
*
* @author therbron
*/
public class FenClavier extends javax.swing.JFrame {
/**
* Creates new form FenClavier
*/
String textDefaut = "Veuillez saisir votre code";
public FenClavier() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
textMess = new javax.swing.JTextField();
jPanel1 = new javax.swing.JPanel();
touche1 = new javax.swing.JButton();
touche2 = new javax.swing.JButton();
touche3 = new javax.swing.JButton();
touche4 = new javax.swing.JButton();
touche5 = new javax.swing.JButton();
touche6 = new javax.swing.JButton();
touche7 = new javax.swing.JButton();
touche8 = new javax.swing.JButton();
touche9 = new javax.swing.JButton();
toucheEtoile = new javax.swing.JButton();
touche0 = new javax.swing.JButton();
toucheDiese = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setName("clavier"); // NOI18N
setPreferredSize(new java.awt.Dimension(220, 250));
setResizable(false);
getContentPane().setLayout(null);
textMess.setEditable(false);
textMess.setBackground(new java.awt.Color(20, 255, 20));
textMess.setText(textDefaut);
getContentPane().add(textMess);
textMess.setBounds(10, 10, 190, 30);
jPanel1.setBackground(new java.awt.Color(0, 0, 0));
jPanel1.setMinimumSize(new java.awt.Dimension(120, 160));
jPanel1.setPreferredSize(new java.awt.Dimension(120, 160));
jPanel1.setLayout(new java.awt.GridLayout(4, 3));
touche1.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
touche1.setText("1");
touche1.setToolTipText("Appuyer");
touche1.setMaximumSize(new java.awt.Dimension(26, 26));
touche1.setMinimumSize(new java.awt.Dimension(26, 26));
touche1.setPreferredSize(new java.awt.Dimension(26, 26));
touche1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
touche1MouseClicked(evt);
}
});
jPanel1.add(touche1);
touche2.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
touche2.setText("2");
touche2.setToolTipText("Appuyer");
touche2.setMaximumSize(new java.awt.Dimension(26, 26));
touche2.setMinimumSize(new java.awt.Dimension(26, 26));
touche2.setPreferredSize(new java.awt.Dimension(26, 26));
touche2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
touche2MouseClicked(evt);
}
});
jPanel1.add(touche2);
touche3.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
touche3.setText("3");
touche3.setToolTipText("Appuyer");
touche3.setMaximumSize(new java.awt.Dimension(26, 26));
touche3.setMinimumSize(new java.awt.Dimension(26, 26));
touche3.setPreferredSize(new java.awt.Dimension(26, 26));
touche3.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
touche3MouseClicked(evt);
}
});
jPanel1.add(touche3);
touche4.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
touche4.setText("4");
touche4.setToolTipText("Appuyer");
touche4.setMaximumSize(new java.awt.Dimension(26, 26));
touche4.setMinimumSize(new java.awt.Dimension(26, 26));
touche4.setPreferredSize(new java.awt.Dimension(26, 26));
touche4.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
touche4MouseClicked(evt);
}
});
jPanel1.add(touche4);
touche5.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
touche5.setText("5");
touche5.setToolTipText("Appuyer");
touche5.setMaximumSize(new java.awt.Dimension(26, 26));
touche5.setMinimumSize(new java.awt.Dimension(26, 26));
touche5.setPreferredSize(new java.awt.Dimension(26, 26));
touche5.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
touche5MouseClicked(evt);
}
});
jPanel1.add(touche5);
touche6.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
touche6.setText("6");
touche6.setToolTipText("Appuyer");
touche6.setMaximumSize(new java.awt.Dimension(26, 26));
touche6.setMinimumSize(new java.awt.Dimension(26, 26));
touche6.setPreferredSize(new java.awt.Dimension(26, 26));
touche6.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
touche6MouseClicked(evt);
}
});
jPanel1.add(touche6);
touche7.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
touche7.setText("7");
touche7.setToolTipText("Appuyer");
touche7.setMaximumSize(new java.awt.Dimension(26, 26));
touche7.setMinimumSize(new java.awt.Dimension(26, 26));
touche7.setPreferredSize(new java.awt.Dimension(26, 26));
touche7.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
touche7MouseClicked(evt);
}
});
jPanel1.add(touche7);
touche8.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
touche8.setText("8");
touche8.setToolTipText("Appuyer");
touche8.setMaximumSize(new java.awt.Dimension(26, 26));
touche8.setMinimumSize(new java.awt.Dimension(26, 26));
touche8.setPreferredSize(new java.awt.Dimension(26, 26));
touche8.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
touche8MouseClicked(evt);
}
});
jPanel1.add(touche8);
touche9.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
touche9.setText("9");
touche9.setToolTipText("Appuyer");
touche9.setMaximumSize(new java.awt.Dimension(26, 26));
touche9.setMinimumSize(new java.awt.Dimension(26, 26));
touche9.setPreferredSize(new java.awt.Dimension(26, 26));
touche9.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
touche9MouseClicked(evt);
}
});
jPanel1.add(touche9);
toucheEtoile.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
toucheEtoile.setText("*");
toucheEtoile.setToolTipText("Appuyer");
toucheEtoile.setMaximumSize(new java.awt.Dimension(26, 26));
toucheEtoile.setMinimumSize(new java.awt.Dimension(26, 26));
toucheEtoile.setPreferredSize(new java.awt.Dimension(26, 26));
toucheEtoile.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
toucheEtoileMouseClicked(evt);
}
});
jPanel1.add(toucheEtoile);
touche0.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
touche0.setText("0");
touche0.setToolTipText("Appuyer");
touche0.setMaximumSize(new java.awt.Dimension(26, 26));
touche0.setMinimumSize(new java.awt.Dimension(26, 26));
touche0.setPreferredSize(new java.awt.Dimension(26, 26));
touche0.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
touche0MouseClicked(evt);
}
});
jPanel1.add(touche0);
toucheDiese.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
toucheDiese.setText("#");
toucheDiese.setToolTipText("Appuyer");
toucheDiese.setMaximumSize(new java.awt.Dimension(26, 26));
toucheDiese.setMinimumSize(new java.awt.Dimension(26, 26));
toucheDiese.setPreferredSize(new java.awt.Dimension(26, 26));
toucheDiese.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
toucheDieseMouseClicked(evt);
}
});
jPanel1.add(toucheDiese);
getContentPane().add(jPanel1);
jPanel1.setBounds(10, 40, 190, 160);
pack();
}// </editor-fold>//GEN-END:initComponents
private void touche1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_touche1MouseClicked
// TODO add your handling code here:
if(textMess.getText().equals(textDefaut))
{
textMess.setText(touche1.getText());
}
else
{
if(textMess.getText().length() < 8)
{
textMess.setText(textMess.getText() + touche1.getText());
}
}
if(textMess.getText().length() == 8)
{
if(textMess.getText().equals("12345678"))
{
textMess.setText("Code bon");
}
else
{
textMess.setText("Code mauvais");
}
}
}//GEN-LAST:event_touche1MouseClicked
private void touche2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_touche2MouseClicked
// TODO add your handling code here:
if(textMess.getText().equals(textDefaut))
{
textMess.setText(touche2.getText());
}
else
{
if(textMess.getText().length() < 8)
{
textMess.setText(textMess.getText() + touche2.getText());
}
}
if(textMess.getText().length() == 8)
{
if(textMess.getText().equals("12345678"))
{
textMess.setText("Code bon");
}
else
{
textMess.setText("Code mauvais");
}
}
}//GEN-LAST:event_touche2MouseClicked
private void touche3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_touche3MouseClicked
// TODO add your handling code here:
if(textMess.getText().equals(textDefaut))
{
textMess.setText(touche3.getText());
}
else
{
if(textMess.getText().length() < 8)
{
textMess.setText(textMess.getText() + touche3.getText());
}
}
if(textMess.getText().length() == 8)
{
if(textMess.getText().equals("12345678"))
{
textMess.setText("Code bon");
}
else
{
textMess.setText("Code mauvais");
}
}
}//GEN-LAST:event_touche3MouseClicked
private void touche4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_touche4MouseClicked
// TODO add your handling code here:
if(textMess.getText().equals(textDefaut))
{
textMess.setText(touche4.getText());
}
else
{
if(textMess.getText().length() < 8)
{
textMess.setText(textMess.getText() + touche4.getText());
}
}
if(textMess.getText().length() == 8)
{
if(textMess.getText().equals("12345678"))
{
textMess.setText("Code bon");
}
else
{
textMess.setText("Code mauvais");
}
}
}//GEN-LAST:event_touche4MouseClicked
private void touche5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_touche5MouseClicked
// TODO add your handling code here:
if(textMess.getText().equals(textDefaut))
{
textMess.setText(touche5.getText());
}
else
{
if(textMess.getText().length() < 8)
{
textMess.setText(textMess.getText() + touche5.getText());
}
}
if(textMess.getText().length() == 8)
{
if(textMess.getText().equals("12345678"))
{
textMess.setText("Code bon");
}
else
{
textMess.setText("Code mauvais");
}
}
}//GEN-LAST:event_touche5MouseClicked
private void touche6MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_touche6MouseClicked
// TODO add your handling code here:
if(textMess.getText().equals(textDefaut))
{
textMess.setText(touche6.getText());
}
else
{
if(textMess.getText().length() < 8)
{
textMess.setText(textMess.getText() + touche6.getText());
}
}
if(textMess.getText().length() == 8)
{
if(textMess.getText().equals("12345678"))
{
textMess.setText("Code bon");
}
else
{
textMess.setText("Code mauvais");
}
}
}//GEN-LAST:event_touche6MouseClicked
private void touche7MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_touche7MouseClicked
// TODO add your handling code here:
if(textMess.getText().equals(textDefaut))
{
textMess.setText(touche7.getText());
}
else
{
if(textMess.getText().length() < 8)
{
textMess.setText(textMess.getText() + touche7.getText());
}
}
if(textMess.getText().length() == 8)
{
if(textMess.getText().equals("12345678"))
{
textMess.setText("Code bon");
}
else
{
textMess.setText("Code mauvais");
}
}
}//GEN-LAST:event_touche7MouseClicked
private void touche8MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_touche8MouseClicked
// TODO add your handling code here:
if(textMess.getText().equals(textDefaut))
{
textMess.setText(touche8.getText());
}
else
{
if(textMess.getText().length() < 8)
{
textMess.setText(textMess.getText() + touche8.getText());
}
}
if(textMess.getText().length() == 8)
{
if(textMess.getText().equals("12345678"))
{
textMess.setText("Code bon");
}
else
{
textMess.setText("Code mauvais");
}
}
}//GEN-LAST:event_touche8MouseClicked
private void touche9MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_touche9MouseClicked
// TODO add your handling code here:
if(textMess.getText().equals(textDefaut))
{
textMess.setText(touche9.getText());
}
else
{
if(textMess.getText().length() < 8)
{
textMess.setText(textMess.getText() + touche9.getText());
}
}
if(textMess.getText().length() == 8)
{
if(textMess.getText().equals("12345678"))
{
textMess.setText("Code bon");
}
else
{
textMess.setText("Code mauvais");
}
}
}//GEN-LAST:event_touche9MouseClicked
private void toucheEtoileMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_toucheEtoileMouseClicked
// TODO add your handling code here:
textMess.setText(textDefaut);
}//GEN-LAST:event_toucheEtoileMouseClicked
private void touche0MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_touche0MouseClicked
// TODO add your handling code here:
if(textMess.getText().equals(textDefaut))
{
textMess.setText(touche0.getText());
}
else
{
if(textMess.getText().length() < 8)
{
textMess.setText(textMess.getText() + touche0.getText());
}
}
}//GEN-LAST:event_touche0MouseClicked
private void toucheDieseMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_toucheDieseMouseClicked
// TODO add your handling code here:
}//GEN-LAST:event_toucheDieseMouseClicked
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FenClavier.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FenClavier.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FenClavier.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FenClavier.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FenClavier().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel jPanel1;
private javax.swing.JTextField textMess;
private javax.swing.JButton touche0;
private javax.swing.JButton touche1;
private javax.swing.JButton touche2;
private javax.swing.JButton touche3;
private javax.swing.JButton touche4;
private javax.swing.JButton touche5;
private javax.swing.JButton touche6;
private javax.swing.JButton touche7;
private javax.swing.JButton touche8;
private javax.swing.JButton touche9;
private javax.swing.JButton toucheDiese;
private javax.swing.JButton toucheEtoile;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,22 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package simclavier;
/**
*
* @author therbron
*/
public class SimClavier {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}
}

View File

@ -0,0 +1,34 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package testcompteepargne;
/**
*
* @author therbron
*/
public class CompteBancaire {
protected double solde;
CompteBancaire()
{
}
CompteBancaire(double solde)
{
this.solde = solde;
}
void deposer(double somme)
{
solde += somme;
}
void retirer(double retrait)
{
solde -= retrait;
}
}

View File

@ -0,0 +1,32 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package testcompteepargne;
/**
*
* @author therbron
*/
public class CompteCheque extends CompteBancaire{
private double decouvertAutorise;
CompteCheque(double decouvertAutorise)
{
super();
this.decouvertAutorise = decouvertAutorise;
}
void changerDecouvert(double nouveauDecouvert)
{
decouvertAutorise = nouveauDecouvert;
}
@SuppressWarnings("override")
void retirer(double retrait)
{
}
}

View File

@ -0,0 +1,43 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package testcompteepargne;
/**
*
* @author therbron
*/
public class CompteEpargne extends CompteBancaire{
private double tauxInteret;
CompteEpargne()
{
super();
tauxInteret = 0.03;
}
CompteEpargne(double solde, double tauxInteret)
{
super(solde);
this.tauxInteret = tauxInteret;
}
double calculerInteret()
{
return tauxInteret * solde;
}
void crediterInteret()
{
solde = solde + calculerInteret();
}
void changerTaux(double tauxInteret)
{
this.tauxInteret = tauxInteret;
}
}

View File

@ -0,0 +1,31 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package testcompteepargne;
/**
*
* @author therbron
*/
public class TestCompteEpargne {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
CompteEpargne ce;
CompteCheque cc;
double interet;
ce = new CompteEpargne();
cc = new CompteCheque(50);
ce.deposer(100.0);
interet = ce.calculerInteret();
System.out.println(interet);
}
}

Some files were not shown because too many files have changed in this diff Show More