0% found this document useful (0 votes)
9 views8 pages

Java_swing

The document discusses the Java Foundation Classes (JFC) and their components for building graphical user interfaces (GUIs) in Java applications. It outlines various pre-defined classes and components such as buttons, labels, text fields, and combo boxes, explaining their functionalities and usage. Additionally, it provides code snippets and examples for creating and managing GUI elements in Java applications.

Uploaded by

lavion609
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views8 pages

Java_swing

The document discusses the Java Foundation Classes (JFC) and their components for building graphical user interfaces (GUIs) in Java applications. It outlines various pre-defined classes and components such as buttons, labels, text fields, and combo boxes, explaining their functionalities and usage. Additionally, it provides code snippets and examples for creating and managing GUI elements in Java applications.

Uploaded by

lavion609
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

JFC Ciava Found ouHon cao8s y

t s tamewortk to butld Gnraphical Ugp


9ntertface GtU Prtogtea m.
. QW
JFC Consist OF absrtact wIndow toolki1

and cwmg
JFC etan QWE P Ckouge

OFC
111'

auot Suola
Predened Prtede @ned Foage
Pat Ckage
210r: (u Java,Swinau
Savo auwt)
U T APP
Hea s
wehed )
aPP
Lignt) oephied aPP

suong
St 1s Pre-de'end Packaige
develop GHUT t

apPleaon49 tSwrng Rosed ppu'eoktdb t


ugnt wergnted aPplrcaon..ho933 b
J t does not take ea te OF OPertatng sySkm
h
6 pee der endr 1package i s Jaa.
Somg
Song sup por PLAFCPgble iitoop And Fee
LooP andFept Fompbn ens derer mmed
by SOihg.
D o n tauner
Entet name - eUt Ereled.
oK Jcance
abe
MOle OFemale
comPonent ts aROcy3 addedtoside Contouher

Component cend co ntad nere ts Pree-detend


class

Componentsi CODt ne
JBueto n T Frcome
Labe

STectFreld aPPle
J Comb0 J Jpane
TertAtel
SList
To9g1e Buton
Jeneck eox
J Radroeton.
Pamu0ortd ptend etc

Frta0e
Jt s
S Pree-delend contaibertlaSS
C&edo ereeale condouo o h m1nmize Ma
mize
and CRose button. CLse buton 8 h e eoble.
Ceemove visbt due to ase buton.
treame hde Prte -de herndmenod Fo PereForem
dfeenE kuhd Op cpErnoeton h
set Si2e CW h)
setVisible (bootcan ) 1
se h
caHon (
Lb
ty
+onon Jh
setCurts ort G 13
8et Reeizable boolean)
add C
set Lay out )
8e-BOUnds Cg, w h)
BydeFauut 'S invisible
40 desig0J FMame
oindo0 toHh dimen
WAP

fmport Jaun.Swing
closs my WinEoL4ends Ftame

Myuorn C

setSize (yoo XB00)


See vsbie (4rue)s
3
P.S.V.m (Srng artgstj) e
tmywin, ob new 1nywinc),'

Sa ve

ComPE ayale MyoInJaVa


RuD
Java Myoin
121
JDialDg
St 's Prtede fend Contaner Jags tkekeg
Oreeates dilog bor wlh Ciase ConBrro bAe
t Created Oby OF JFtame
JFrame F new SFrtame c)
Diu loa d- new JDia Dg.CS
d.sers(ze (B60, 00)
360
d set Vrst'bie
(4rtu e) 5
ACMet
s Peeede Fend conlcnP
QPPiet

APPIeR10sa ' Aneehtld etcss dr APotet Clas


APPleL viewe cotmmdnatunsnpple
esegitm
d ede fooct ctose beton fs onabed in Japie
wndo co.
cOmdow 8/2e '8 detiend ASing HTML Ude
aptet. appipt S/arriea ,
HTM, code acony s teeuttercorlen 1
commenAS Sectton,
TAepiet Cto.s contoins Prte defiend metod
catted aPPletPPertcalt'o n.si
C nit ) eole coM bnnAPPIe e Sean
once
Q1 steet ) -

molny tmeg n

(tv) DesItoy NV )1
eNecaktun se2uence oP Cabove metho d 1S calleA

aPpleAHe cyele
WH3P H cteate SAPPlet cwindo 4h sze

(300 B00)
mportt sava. Sing n
Pabltc closS eLtemd s APe
My APP rena AP

aPPletco de my APp) cofd th B00hetght 3o


K/ap ie=
Saver MYAPP Java
1 A
CAOheie h Javac myAPP
RUD OPPIe NiEwerU Java//
myApP Uava A
wASP to addbton n
JAPPet omdow
Import Java. Suothg 0 N
Peablrcclass Ho me APP
etendsTHPiet
SButon
.Peuble Nota mi C

6= neo 3Button (ttok"


add C)
3
3
KaPPie Co de etHome
APe odth 300 "
19 1R
heght so0 Ki/aP Plety
Save Home A pPP'ava
ComPrl savacome nep Sava
Run PPle
VIewen HomeApP Java
Component elass
Sy 1
) 4C
SLobeA
T e t Fret d
T Teut Artea
1iAM
TO 991e Button
SCo Mbo eA
S Radt 0 Bulton

Spass u0o red Pred


( LIs A
AL boveCLse r'S Par 9F Java d S wing
always
Mokagecom poneot.CaLsS S adde d t o Ge

eontanet qiRS
eDmponent obece Ceated ugIng construco
dn
Cuing
swng hene 'S c osstbitito add 'moge
on cbM Ponont obyece
Atton

t s c e d to CHeale Bulton consBrtuctore


ddFort Bcatleon creation
) )
t o n b new Teutton (tok")
SButton new seu4on TohTmoge ob)
B&ton b newleutton C) '
JLabet o ha 2
A
S Ced to cneate headng
h Atyo2131e dad tmeget.a
Consteuctort t's cseldlFon de bet drdeaton
Stber ne Abet e Ente Name "J
Labe nnew Tlabel C Dr
Labet lgnew TLabetCTmage Ican ob)

add( ) Add to contaunert

Teot Fietd v
stS used to CNeate sngiehe snp Hetd
UTeout etd t 1 new JTentt Feld CS
JTect F'etd+ new JTeé Fieid Ctenten
Tet 7aeld t8 new JTee Freld (o)S
Tenct ARea
SCASed to ereatg, multLne, InPE eld.
Addecs
Addrecs eld ndto mmentand Feed badk
PeLd ts des1yned usno Teat At ea.
Tent Artea t new J Te Arie a c
Tent AHea t ne TeNL AOC (tEnier'
STeeArea t8 neu JTeot 0rtea3Ro)
JTogale Buton
3t e uged o chtegue 4 Toggie Bulton.
Toggie means on and oFF
CAttkCACk on hd crcK
OFF,/h
3 Togaje Bcuton b new SToggle Button Cy
Toggte Buton b neu T939e Button (OK").
Jaseond Fletd
S is Prte de Hend uoss Ho design Pousoortd
ConSt uCto U3ed o eeale polss ioond
Ftetd
Passuo otd Freid pe E newJpass u0otd Fleld ()

Cdd PS) olo11206)


dd 4o, he Contau'nerc
CTFreme JAPPIeL
By deFauut displayingchairta cfere is SpIau)
dot

J Combo Bon

t s U8ed to crvecte dropd.ownimenu


S UBed to téate combo bo
Consrtuolo
C Com bo Bo C neuS SCom bo BoNC
Cadd3kem (")y
CaddStem Ca) to
C. add 3tem C . .n1A
add 5 add to he conteun er,
Add Hemmetnod s ued to cadd elemehts t.
Combo bon

Radio Buton
S f's Pre -aeHend dass to e destgn Radi'o bu
Jn contaunerm, 1 12 11 1 .

S t aleocys woreus Co1h BLtton Gioup class.


ButtonCrtoup means Crtotup tn betn rtad!'o
button ObJects.
Singtegeleceton Is POsstble amoung mcaLANPle

ttadto bufton.
end ettr
L

moLe OPemaue Ohen


ohat fs na me2 o Jal Va Comprlee

Javac OJa va p
OJava ,Javad

neus Button rtoupC)S


BcLton GtoULp bg
Radio Ctmae ")
utn neo TBLLton
3 Radi'6 Batton B neup b RadoBtoh/tee
Radio Buton nen SRadl'o tB utoh ( othe
bg add C 1 omnsi
bg add C9 o C
bg add Cra)
add C) add Co2) add Cr)
seLBoandFot s 2 231)
JLSt
3t T'e used to Create

3t Combo bot buealt optrong


Similar H0

aree vis ble


arte sdd te d d TtemC) 1S a Pre-def
e
metddo add etemen is hTList, "t1

You might also like