FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
UseACabecaJava/src/chapter1/firstjava/party.java at main · DG-DanielDev/UseACabecaJava · GitHub
DG-DanielDev
/
UseACabecaJava
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
UseACabecaJava
/
src
/
chapter1
/
firstjava
/
party.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
43 lines (37 loc) · 1.27 KB
Breadcrumbs
UseACabecaJava
/
src
/
chapter1
/
firstjava
/
party.java
Copy path
File metadata and controls
43 lines (37 loc) · 1.27 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package
chapter1
.
firstjava
;
import
java
.
awt
.*;
import
java
.
awt
.
event
.
WindowAdapter
;
import
java
.
awt
.
event
.
WindowEvent
;
public
class
party
{
public
void
buildInvite
() {
// Obtem a configuração gráfica atual
GraphicsConfiguration
ge
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
().
getDefaultScreenDevice
().
getDefaultConfiguration
();
Rectangle
bounds
=
ge
.
getBounds
();
// Cria o Frame conforme a resolução da Tela
Frame
f
=
new
Frame
(
"Festa na cada do Tim!"
,
ge
);
f
.
setSize
(
bounds
.
width
/
2
,
bounds
.
height
/
2
);
f
.
setLocation
((
bounds
.
width
-
f
.
getWidth
())/
2
, (
bounds
.
height
-
f
.
getHeight
())/
2
);
// Adiciona conteúdo ao Frame
Label
l
=
new
Label
(
"Party at Tim's"
);
Button
b
=
new
Button
(
"You bet"
);
Button
c
=
new
Button
(
"Shoot me"
);
Button
d
=
new
Button
(
"Ignore me"
);
Panel
p
=
new
Panel
();
p
.
add
(
l
);
p
.
add
(
b
);
p
.
add
(
c
);
p
.
add
(
d
);
f
.
add
(
p
);
// Configurações do Frame
f
.
setVisible
(
true
);
f
.
addWindowListener
(
new
WindowAdapter
() {
public
void
windowClosing
(
WindowEvent
e
) {
f
.
dispose
();
// fecha o Frame ao clicar no botão de fechar (IDE não permite sem tal exceção)
}
});
}
public
static
void
main
(
String
[]
args
) {
party
p
=
new
party
();
p
.
buildInvite
();
}
}
Back
|
FazBrowse Home
|
New Git URL