moitié tp 3
This commit is contained in:
BIN
DEV2.1/Graphique/Bouton.class
Normal file
BIN
DEV2.1/Graphique/Bouton.class
Normal file
Binary file not shown.
21
DEV2.1/Graphique/Bouton.java
Normal file
21
DEV2.1/Graphique/Bouton.java
Normal file
@@ -0,0 +1,21 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Bouton {
|
||||
public static void main(String[] args) {
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(500, 300);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
JButton bouton = new JButton("bonjour");
|
||||
JButton bouton1 = new JButton("bonsoir");
|
||||
JButton bouton2 = new JButton("aurevoir");
|
||||
JButton bouton3 = new JButton("bientôt");
|
||||
JButton bouton4 = new JButton("salut");
|
||||
fenetre.add(bouton, BorderLayout.NORTH);
|
||||
fenetre.add(bouton1, BorderLayout.EAST);
|
||||
fenetre.add(bouton2, BorderLayout.WEST);
|
||||
fenetre.add(bouton3, BorderLayout.SOUTH);
|
||||
fenetre.add(bouton4, BorderLayout.CENTER);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
DEV2.1/Graphique/Choix.class
Normal file
BIN
DEV2.1/Graphique/Choix.class
Normal file
Binary file not shown.
21
DEV2.1/Graphique/Choix.java
Normal file
21
DEV2.1/Graphique/Choix.java
Normal file
@@ -0,0 +1,21 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Choix {
|
||||
public static void main(String[] args) {
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(500, 300);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
JRadioButton etiquette = new JRadioButton("Gryffondor");
|
||||
JRadioButton etiquette1 = new JRadioButton("Serdaigle");
|
||||
JRadioButton etiquette2 = new JRadioButton("Serpantard");
|
||||
ButtonGroup btn = new ButtonGroup();
|
||||
btn.add(etiquette);
|
||||
btn.add(etiquette1);
|
||||
btn.add(etiquette2);
|
||||
fenetre.add(etiquette, BorderLayout.NORTH);
|
||||
fenetre.add(etiquette1, BorderLayout.CENTER);
|
||||
fenetre.add(etiquette2, BorderLayout.SOUTH);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
DEV2.1/Graphique/Saisie.class
Normal file
BIN
DEV2.1/Graphique/Saisie.class
Normal file
Binary file not shown.
23
DEV2.1/Graphique/Saisie.java
Normal file
23
DEV2.1/Graphique/Saisie.java
Normal file
@@ -0,0 +1,23 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
|
||||
public class Saisie {
|
||||
public static void main(String[] args) {
|
||||
Color vert = new Color(0,255,0);
|
||||
Color noir = new Color(0,0,0);
|
||||
Color gris = new Color(127,127,127);
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(500, 300);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
JTextField etiquette = new JTextField("bonjour ça va ?");
|
||||
JTextArea etiquette2 = new JTextArea("bonjour tout va bien ?");
|
||||
etiquette.setForeground(vert);
|
||||
etiquette.setBackground(gris);
|
||||
etiquette2.setForeground(vert);
|
||||
etiquette2.setBackground(noir);
|
||||
fenetre.add(etiquette, BorderLayout.SOUTH);
|
||||
fenetre.add(etiquette2, BorderLayout.CENTER);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
DEV2.1/Graphique/Sirocco.class
Normal file
BIN
DEV2.1/Graphique/Sirocco.class
Normal file
Binary file not shown.
14
DEV2.1/Graphique/Sirocco.java
Normal file
14
DEV2.1/Graphique/Sirocco.java
Normal file
@@ -0,0 +1,14 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Sirocco {
|
||||
public static void main(String[] args) {
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(500, 300);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
JLabel etiquette = new JLabel("Sirocco");
|
||||
etiquette.setHorizontalAlignment(JLabel.RIGHT);
|
||||
fenetre.add(etiquette, BorderLayout.NORTH);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
DEV2.1/Mise_page/Choix.class
Normal file
BIN
DEV2.1/Mise_page/Choix.class
Normal file
Binary file not shown.
26
DEV2.1/Mise_page/Choix.java
Normal file
26
DEV2.1/Mise_page/Choix.java
Normal file
@@ -0,0 +1,26 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Choix {
|
||||
public static void main(String[] args) {
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(500, 300);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
GridLayout gestionnaire = new GridLayout(4, 1);
|
||||
fenetre.setLayout(gestionnaire);
|
||||
JRadioButton etiquette = new JRadioButton("Gryffondor");
|
||||
JRadioButton etiquette1 = new JRadioButton("Serdaigle");
|
||||
JRadioButton etiquette2 = new JRadioButton("Serpantard");
|
||||
JRadioButton etiquette3 = new JRadioButton("Poufsouffle");
|
||||
ButtonGroup btn = new ButtonGroup();
|
||||
btn.add(etiquette);
|
||||
btn.add(etiquette1);
|
||||
btn.add(etiquette2);
|
||||
btn.add(etiquette3);
|
||||
fenetre.add(etiquette);
|
||||
fenetre.add(etiquette1);
|
||||
fenetre.add(etiquette2);
|
||||
fenetre.add(etiquette3);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
DEV2.1/Mise_page/Damier.class
Normal file
BIN
DEV2.1/Mise_page/Damier.class
Normal file
Binary file not shown.
23
DEV2.1/Mise_page/Damier.java
Normal file
23
DEV2.1/Mise_page/Damier.java
Normal file
@@ -0,0 +1,23 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
|
||||
public class Damier {
|
||||
public static void main(String[] args) {
|
||||
Color blanc = new Color(255,255,255);
|
||||
Color cyan = new Color(0,255,255);
|
||||
Color tab[] = {blanc,cyan};
|
||||
int l = Integer.parseInt(args[0]);
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(500, 300);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
GridLayout gestionnaire = new GridLayout(l, l);
|
||||
fenetre.setLayout(gestionnaire);
|
||||
JTextArea block = new JTextArea();
|
||||
for (int i=0; i<(l*l); i++){
|
||||
block.setBackground(tab[i%2]);
|
||||
fenetre.add(block);
|
||||
}
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
DEV2.1/introduction/Bonjour.class
Normal file
BIN
DEV2.1/introduction/Bonjour.class
Normal file
Binary file not shown.
17
DEV2.1/introduction/Bonjour.java
Normal file
17
DEV2.1/introduction/Bonjour.java
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Cette classe est une simple coquille pour recevoir la méthode principale
|
||||
*
|
||||
* @version 1.1 09 March 2014
|
||||
* @author Luc Hernandez
|
||||
*/
|
||||
public class Bonjour {
|
||||
|
||||
/**
|
||||
* Affiche «Bonjour !»
|
||||
*
|
||||
* @param args la liste des arguments de la ligne de commande (inutilisée ici)
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Bonjour !");
|
||||
}
|
||||
}
|
||||
BIN
DEV2.1/introduction/Grille.class
Normal file
BIN
DEV2.1/introduction/Grille.class
Normal file
Binary file not shown.
32
DEV2.1/introduction/Grille.java
Normal file
32
DEV2.1/introduction/Grille.java
Normal file
@@ -0,0 +1,32 @@
|
||||
import java.util.Arrays;
|
||||
/**
|
||||
* Cette classe est une simple coquille pour recevoir la méthode principale
|
||||
*
|
||||
* @version 1.1 09 March 2014
|
||||
* @author Luc Hernandez
|
||||
*/
|
||||
public class Grille {
|
||||
|
||||
/**
|
||||
* Affiche «Grille !»
|
||||
*
|
||||
* @param args la liste des arguments de la ligne de commande (inutilisée ici)
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
int n=Integer.parseInt(args[0]), i, j;
|
||||
System.out.print("+");
|
||||
for (i=0;i<n;i++){
|
||||
System.out.print("-+");
|
||||
}
|
||||
for (j=0;j<n;j++){
|
||||
System.out.print("\n|");
|
||||
for (i=0;i<n;i++){
|
||||
System.out.print(" |");
|
||||
}
|
||||
System.out.print("\n+");
|
||||
for (i=0;i<n;i++){
|
||||
System.out.print("-+");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
DEV2.1/introduction/Somme.class
Normal file
BIN
DEV2.1/introduction/Somme.class
Normal file
Binary file not shown.
21
DEV2.1/introduction/Somme.java
Normal file
21
DEV2.1/introduction/Somme.java
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Cette classe est une simple coquille pour recevoir la méthode principale
|
||||
*
|
||||
* @version 1.1 09 March 2014
|
||||
* @author Luc Hernandez
|
||||
*/
|
||||
public class Somme {
|
||||
|
||||
/**
|
||||
* Affiche «Somme !»
|
||||
*
|
||||
* @param args la liste des arguments de la ligne de commande (inutilisée ici)
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
int n=0;
|
||||
for (String value : args){
|
||||
n = n + Integer.parseInt(value);
|
||||
}
|
||||
System.out.println("Somme: "+n);
|
||||
}
|
||||
}
|
||||
BIN
DEV2.1/introduction/Tri.class
Normal file
BIN
DEV2.1/introduction/Tri.class
Normal file
Binary file not shown.
27
DEV2.1/introduction/Tri.java
Normal file
27
DEV2.1/introduction/Tri.java
Normal file
@@ -0,0 +1,27 @@
|
||||
import java.util.Arrays;
|
||||
/**
|
||||
* Cette classe est une simple coquille pour recevoir la méthode principale
|
||||
*
|
||||
* @version 1.1 09 March 2014
|
||||
* @author Luc Hernandez
|
||||
*/
|
||||
public class Tri {
|
||||
|
||||
/**
|
||||
* Affiche «Tri !»
|
||||
*
|
||||
* @param args la liste des arguments de la ligne de commande (inutilisée ici)
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
int tab[] = new int[args.length];
|
||||
int i=0;
|
||||
for (String value : args){
|
||||
tab[i] = Integer.parseInt(value);
|
||||
i++;
|
||||
}
|
||||
Arrays.sort(tab);
|
||||
for (int value : tab){
|
||||
System.out.println(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
DEV2.1/introduction/argument.class
Normal file
BIN
DEV2.1/introduction/argument.class
Normal file
Binary file not shown.
19
DEV2.1/introduction/argument.java
Normal file
19
DEV2.1/introduction/argument.java
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Cette classe est une simple coquille pour recevoir la méthode principale
|
||||
*
|
||||
* @version 1.1 09 March 2014
|
||||
* @author Luc Hernandez
|
||||
*/
|
||||
public class argument {
|
||||
|
||||
/**
|
||||
* Affiche «argument !»
|
||||
*
|
||||
* @param args la liste des arguments de la ligne de commande (inutilisée ici)
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
for (String value : args){
|
||||
System.out.println("Bonjour "+value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user