push
This commit is contained in:
51
DEV2.1/CM1/Exercice3/Direction.java
Normal file
51
DEV2.1/CM1/Exercice3/Direction.java
Normal file
@@ -0,0 +1,51 @@
|
||||
import java.awt.GridLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public class Direction extends JFrame{
|
||||
|
||||
GridLayout grid = new GridLayout(2, 2);
|
||||
|
||||
public Direction(){
|
||||
grid.setHgap(350);
|
||||
grid.setVgap(350);
|
||||
JFrame frame = new JFrame();
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setSize(1900,900);
|
||||
frame.setVisible(true);
|
||||
JPanel panel = new JPanel();
|
||||
frame.setContentPane(panel);
|
||||
panel.setLayout(grid);
|
||||
|
||||
|
||||
|
||||
JButton btn1 = new JButton("◤");
|
||||
btn1.setSize(20,50);
|
||||
|
||||
panel.add(btn1);
|
||||
JButton btn2 = new JButton("◥");
|
||||
panel.add(btn2);
|
||||
JButton btn3 = new JButton("◣");
|
||||
panel.add(btn3);
|
||||
JButton btn4 = new JButton("◢");
|
||||
panel.add(btn4);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
new Direction();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
29
DEV2.1/CM1/Exercice3/Directions.java
Normal file
29
DEV2.1/CM1/Exercice3/Directions.java
Normal file
@@ -0,0 +1,29 @@
|
||||
//MELIANI SAMY (TP1)
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class Directions {
|
||||
public static void main(String[] args) {
|
||||
// un objet pour servir de fenetre
|
||||
JFrame fenetre = new JFrame();
|
||||
// on configure la fenetre
|
||||
fenetre.setSize(800, 800);
|
||||
fenetre.setLocation(0, 0);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
GridLayout layout = new GridLayout(2, 2);
|
||||
|
||||
|
||||
fenetre.setLayout(layout);
|
||||
fenetre.add(new Button("◤"));
|
||||
fenetre.add(new Button("◥"));
|
||||
fenetre.add(new Button("◣"));
|
||||
fenetre.add(new Button("◢"));
|
||||
layout.setHgap(500);
|
||||
layout.setVgap(500);
|
||||
layout.setAlignment(100);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user