Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (2)
ajout du setvisible pour afficher la fenetre et creation d'une instance de l'objet calculatrice
· 37dea0d7
rahim mebrouka
authored
Apr 06, 2023
37dea0d7
ajout de plein de choses j'ai oublié de faire des commits comme dhab
· 78083674
rahim mebrouka
authored
Apr 06, 2023
78083674
Show whitespace changes
Inline
Side-by-side
.gitignore
0 → 100644
View file @
78083674
/target/
src/main/java/Content/MaCalculatrice.java
0 → 100644
View file @
78083674
/*
* 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
Content
;
import
java.awt.BorderLayout
;
import
java.awt.Color
;
import
java.awt.FlowLayout
;
import
java.awt.GridLayout
;
import
javax.swing.JButton
;
import
javax.swing.JFrame
;
import
javax.swing.JLabel
;
import
javax.swing.JPanel
;
/**
*
* @author stag
*/
public
class
MaCalculatrice
extends
JFrame
{
public
MaCalculatrice
()
{
this
(
"Ma fenetre"
);
}
public
MaCalculatrice
(
String
title
)
{
super
(
title
);
BorderLayout
borderL
=
new
BorderLayout
(
0
,
10
);
this
.
setLayout
(
borderL
);
JPanel
divtop
=
new
JPanel
(
new
FlowLayout
());
JLabel
label
=
new
JLabel
(
"0"
);
label
.
setOpaque
(
true
);
this
.
add
(
divtop
,
BorderLayout
.
NORTH
);
this
.
add
(
label
,
BorderLayout
.
NORTH
);
JPanel
divleft
=
new
JPanel
(
new
GridLayout
(
0
,
3
,
2
,
2
));
JButton
egal
=
new
JButton
(
"="
);
JButton
point
=
new
JButton
(
"."
);
JButton
un
=
new
JButton
(
"1"
);
JButton
deux
=
new
JButton
(
"2"
);
JButton
trois
=
new
JButton
(
"3"
);
JButton
quatre
=
new
JButton
(
"4"
);
JButton
cinq
=
new
JButton
(
"5"
);
JButton
six
=
new
JButton
(
"6"
);
JButton
sept
=
new
JButton
(
"7"
);
JButton
huit
=
new
JButton
(
"8"
);
JButton
neuf
=
new
JButton
(
"9"
);
JButton
zero
=
new
JButton
(
"0"
);
divleft
.
add
(
sept
);
sept
.
setBackground
(
Color
.
white
);
divleft
.
add
(
huit
);
huit
.
setBackground
(
Color
.
white
);
divleft
.
add
(
neuf
);
neuf
.
setBackground
(
Color
.
white
);
divleft
.
add
(
quatre
);
quatre
.
setBackground
(
Color
.
white
);
divleft
.
add
(
cinq
);
cinq
.
setBackground
(
Color
.
white
);
divleft
.
add
(
six
);
six
.
setBackground
(
Color
.
white
);
divleft
.
add
(
un
);
un
.
setBackground
(
Color
.
white
);
divleft
.
add
(
deux
);
deux
.
setBackground
(
Color
.
white
);
divleft
.
add
(
trois
);
trois
.
setBackground
(
Color
.
white
);
divleft
.
add
(
zero
);
zero
.
setBackground
(
Color
.
white
);
divleft
.
add
(
point
);
point
.
setBackground
(
Color
.
white
);
divleft
.
add
(
egal
);
egal
.
setBackground
(
Color
.
white
);
this
.
add
(
divleft
,
BorderLayout
.
WEST
);
JPanel
divright
=
new
JPanel
(
new
GridLayout
(
0
,
2
,
4
,
2
));
JButton
CE
=
new
JButton
(
"CE"
);
CE
.
setBackground
(
Color
.
red
);
JButton
C
=
new
JButton
(
"C"
);
JButton
plus
=
new
JButton
(
"+"
);
JButton
moins
=
new
JButton
(
"-"
);
JButton
fois
=
new
JButton
(
"x"
);
JButton
diviser
=
new
JButton
(
"/"
);
divright
.
add
(
CE
);
divright
.
add
(
C
);
divright
.
add
(
plus
);
divright
.
add
(
moins
);
divright
.
add
(
fois
);
divright
.
add
(
diviser
);
this
.
add
(
divright
,
BorderLayout
.
EAST
);
this
.
pack
();
this
.
setDefaultCloseOperation
(
DISPOSE_ON_CLOSE
);
this
.
setVisible
(
true
);
}
}
src/main/java/Content/label.java
0 → 100644
View file @
78083674
/*
* 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
Content
;
import
javax.swing.JFrame
;
import
javax.swing.JLabel
;
/**
*
* @author stag
*/
public
class
label
extends
JLabel
{
public
label
()
{
//
}
public
label
(
String
content
)
{
super
(
content
);
}
}
src/main/java/Main/MainCalculatrice.java
View file @
78083674
...
...
@@ -5,10 +5,20 @@
*/
package
Main
;
import
Content.MaCalculatrice
;
import
javax.swing.JFrame
;
import
static
javax
.
swing
.
WindowConstants
.
DISPOSE_ON_CLOSE
;
/**
*
* @author stag
*/
public
class
MainCalculatrice
{
public
static
void
main
(
String
[]
args
)
{
JFrame
Calcul
=
new
MaCalculatrice
(
"Ma calculatrice"
);
}
}