You are on page 1of 55

by

(Stand Alone)
(Database Application)
(Web Application)



1




(Drag and Drop)
(Visual Programming)
:
[ 11]
:

[ 13]

2
:

[ 15]
(Source Code)
:

[ 20]
:

[ 25]
:

[ 40]
:


[ 44]

2


()

[ 61]
:

[ 71]

3
:

[ 76]
:


[ 87]
:


[ 95]

3

(Commponent)

(JPanel)
(JLabel), (JTextField) (JButton), (JToggleButton),
(JFormattedTextField) (JTextArea),
(JPasswordField)

:

[ 104]
:
[ 113]

[ 127]

[ 140]

:


[ 150]

[ 155]

:


[ 165]

:


[ 168]

:


[ 172]

4

(JComboBox) (JList) (JCheckBox) (JRadioButton)
(JOptionGroup) (JProgressbar) (JScrollbar)
(JSlider) (JSpinner) (JTabbedPane) (JSplitPane)
(JDesktopPane) (JInternalFrame)

5

[ 179]

:


[ 184]
:


[ 187]

:



[ 191]
:


[ 198]
:

[ 202]
:


[ 204]
:

[ 208]
:


[ 210]
:


[ 214]

:



[ 217]

5

(JDialog) (JFileChooser) (JTree)
(JColorChooser) (JOptionPane) (JTable)
(Menu Bar)
(Tool Bar) (Popup Menu)

:
[ 224]
:

[ 229]
:


[ 233]
:


[ 239]
:

[ 242]
:


[ 247]

[ 258]

:

[ 270]

[ 273]

6

(Text File)
(Binary File)

:

[ 278]
:


[ 280]
:

[ 292]
:

[ 302]

7

(MySQL)



:

[ 302]
:

[ 316]
:

[ 338]
:

[ 349]
: iReport
(Jasper
Report)

[ 370]

8


(Java Server Page) (JSP)
(MySQL)
(GlassFish)

9
:

[ 391]
:


[ 394]
: HTML

[ 399]
:
SELECT INSERT

[ 420]

9

.jar

install Creator

:
.jar
[ 432]
:


[ 442]
:

[ 462]

(JComboBox) (JList)
(JCheckBox) (JRadioButton) (JOptionGroup)

(JProgressbar) (JScrollbar)
(JSlider) (JSpinner)
(JTabbedPane)
(JSplitPane) (JDesktopPane) (JInternalFrame)

179

(2545, 38-39)


(2543 , 129) dropdown list
JComboBox

4.1

4.1
jComoBox->Properties
background
componentPopupMenu
editable
font
foreground
maximumRowCount
model
selectedIndex

180

selectedItem
toolTipText UIClassID
action, actionCommand

alignmentX, alignmentY
autoscrolls
baselineResizeBehavior
border
debugGraphicOption
doubleBuffered
enabled
focus
inheritsPopupMenu
inputVerfier
insets insets
itemCount
keySelectionManager
lightWeighPopupEnable
maximumSize, minumSize
name
nextFocusableComponent
opaque
paintForPrint
preferedSize
prototypeDisplayValue
renderor
requestFocusEnabled, verifyInputFocusWhenTaget

jComboBox->Events

181

actionPerformed

ancestor
caretPostionChanged

component
focus
hierachyChanged
inputMethodTextChanged
itemStateChanged
key
mouse
mouse
popup
PropertyChanged
vetoableChanged
jComboBox->Code
Bean Class
Variable Name
Variable Modifiers
Use Local Variable
Code Generation
Pre-Creation Code
Post-Creation Code
Pre-Init Code
Post-Init Code
Serialize To
Custom Creation Code

182

Layout Accessibility


4.1


1. Ex_ComboBox
2. 4.2

4.2 4.1
3. Properties->model
4.3

4.3

183

OK
4.4

4.4
4. Events ->Action-> ActionPerform
jCombox1ActionPerform


jTextField1.setText(jComboBox1.getSelectedItem().toString());
1 1

4.6

4.6 4.1

184

Sun Microsystems (2007 G)


ListModel

(2545, 40)


(2543 , 131)
JList

Beginner-java-tutorial.com (2007 H)







4.7

4.7

185

jList->Properties
background, border, componentPopupMenu, font, forground, model, toolTipText

selectionMode

cellRender
firstVisibleIndex
fixedCellHight, fixedCellWidth
lastVisibleIndex
layoutOrientation
leadSelectionIndex
listSelectionListeners
selectedIndices

selected
valueIsAdjusting
Accessibility

drag&drop, focus, max-min size


4.2 5

1. Ex_JList
2. JList 4.7
3. model
4.8

186

4.8
(Edit) (Add)
OK

4.9 4.2
4. 4.10

4.10 4.2

187

5. jTextField1 jList1
Events->Mouse->mouseClicked
jList1MouseClicked


jTextField1.setText(jList1.getSelectedValue().toString());
1 1

jList1.getSelectedValue()
4.11

4.11 4.2

Sun Microsystems (2007 D)



(2545, 24)

true false (2543 ,
124) on-off

188

Beginner-java-tutorial.com (2007 D)


true
false
4.12

4.12


jCheckBox->Properties
action
buttonGroup
borderPainted
borderPaintedFlat
contentAreaFilled
disableIcon
disableSelectedIcon
doubleBuffered, enabled, focus
hideActionText
multiClickThreshold

189

model, name, nextFocusableComponents, opaque, paintingForPrint, preferSize,


pressIcon, requestFocusEnabled, verifiyInputWhenFocusTaget

roll
verticalAlignment, verticalTextPosition
Layout Accessibility




4.3

1. Ex_CheckBox
2.
4.13

4.13 4.3
3. Events->Action->actionPerformed
jButton1ActionPerformed
int money = 0;
if(jCheckBox1.isSelected() == true){
money = money+25;

190

}
if(jCheckBox2.isSelected() == true){
money = money+10;
}
if(jCheckBox3.isSelected() == true){
money = money+30;
}
if(jCheckBox4.isSelected() == true){
money = money+10;
}
jTextField1.setText(String.valueOf(money));

int money = 0; money
jCheckBox1.isSelected() == true jCheckBox1

money = money+10; 10
String.valueOf(money) money

jTextField1.setText(String.valueOf(money)); 1
money
5.
4.14

4.14 4.3

191

Sun Microsystems (2007 C)


ButtonGroup

(2543 , 127)

ButtonGroup
Beginner-java-tutorial.com (2007 L)




Sun Microsystems (2007 C)


(2545, 27)



1

4.15

192

4.15


jRadioButton->Properties





label jRadioButton1
Layout Accessibility
jbuttonGroup->Properties
buttonCount
class
elements
selection



193

4.4
4.5

4.4 4.3

1. Ex_Option
2.
4.16

4.16 4.4
3. jButton1 Events->Action->actionPerformed
jButton1ActionPerforemd
int money = 0;
if(jRadioButton1.isSelected() == true){
money = money+30;
}
if(jRadioButton2.isSelected() == true){
money = money+40;
}
if(jRadioButton3.isSelected() == true){
money = money+20;
}
if(jRadioButton4.isSelected() == true){

194

money = money+25;
}
jTextField1.setText(String.valueOf(money));

int money = 0; money
if(jRadioButton1.isSelected() == true) 1
true false
money = money+30; money 30
4.

4.17

4.17 4.4
4.5

195

1. Ex_OptionGroup
2.
4.18

4.18 4.5
3.
Other Components 4.19

4.19

196

4. jRadioButton1->buttongroup->ButtonGroup1

jRadionButton 2, 3, 4 4.20
Group

4.20
5. jRadioButton5->buttongroup->ButtonGroup2
jRadionButton 6 7
6. 1
4.21

4.21

197

7. Events->Action->actionPerformed

int money = 0;
if(jRadioButton1.isSelected() == true){
money = money+30;
}
if(jRadioButton2.isSelected() == true){
money = money+40;
}
if(jRadioButton3.isSelected() == true){
money = money+20;
}
if(jRadioButton4.isSelected() == true){
money = money+25;
}
if(jRadioButton5.isSelected() == true){
money = money+20;
}
if(jRadioButton6.isSelected() == true){
money = money+15;
}
if(jRadioButton7.isSelected() == true){
money = money+20;
}
jTextField1.setText(String.valueOf(money));
8. 4.22

198

4.22 4.5

Sun Microsystems (2007 H)



(2545, 36)

(2543 , 180)


100%



4.23

199

4.23

(Value)


jProgressBar->Properties
orientation
value 0
background, font, foreground, alignment, border, focus

string
%
stringPainted



4.6
4.6 4
25

200

1. Frame Ex_ProgressBar
2. jProgressBar 4.24

4.24 4.6
3. jProgressBar1 page OtherProperties->stringPainted ->True
4.25
stringPainted

4.25
0%
4. 25%,50%,75% 100%
jButtonActionPerformed

201


jProgressBar1.setValue(25);
25
100
jProgressBar1.setValue(50);
50
100
jProgressBar1.setValue(75);
75
100
jProgressBar1.setValue(100);

100 100
5.
75% 4.26

4.26 4.6

202

Sun Microsystems (2007 I)



100% 0%
(2545, 33)

(2543 ,
163)





4.27

4.27
jScrollBar->Properties
maximum
minimum
orientation

203

unitIncrement
value
autoscrolls

valueIsAdjusting
border, enabled, focus, model, paintingForPrint
Layout Accessibility


4.7
4.7

1. Ex_ScrollBar
2. orientation->HORIZONTAL

4.28
3. 4.29

4.29 4.7

204

4. jScrollBar1->Events->Adjustment->adjustmentValuechanged
jScrollBar1AdjustmentValueChanged


jScrollBar1.getValue() jScrollBar1
String.valueOf(jScrollBar1.getValue()) jScrollBar1

jTextField1.setText(String.valueOf(jScrollBar1.getValue()));
jTextField1
5.
4.30

4.30 4.7

Sun Microsystems (2007 J)



(2545, 34)


205

(2543 , 165)

thumb



4.31

4.31


4.8


jSlider->Properties
majorTickSpacing 10, 20
maximum, minimum
minorTickSpacing major
orientation
paintLabels
paintTicks

206

paintTrack major
snapToTicks

value 50 100

extent 0

4.8

4.8

1. Ex_Slider
2. 4.32

4.32
3. Properties->majorTickSpace 5
4.33

207

majorTickSpacing
4.33 majorTickSpacing
4. Properties->minorTickSpacing 1 Properties>paintLabels, Properties->paintTicks, paintTrack ture 4.34
,

4.34

6. 4.35

4.35 4.8

208

7. Events->Changed->stateChanged


jSlider1.getValue() jSlider1
String.valueOf(jSlider1.getValue()) jSlider1
jTextField1.setText(String.valueOf(jSlider1.getValue()));

jTextField1
8.
4.36

4.36 4.8


Sun Microsystems (2007)





4.37

209

4.37




4.9

1. Ex_Spinner
2. 4.38

4.38 4.9

210

3. Events->Change->stateChanged
jSpinner1StateChanged


jSpinner1.getValue() jSpinner1
String.valueOf(jSpinner1.getValue()) jSpinner1

jTextField1.setText(String.valueOf(jSpinner1.getValue()));
jTextField1 jSpinner1
4.

4.39

4.39 4.9

Sun Microsystems (2007 M)



Beginner-java-tutorial.com (2007 J)

211

(2543 , 188)




4.40

4.40

jTabbledPane->Properties
tabCount
tabRunCount



4.10 3
1

212

1. Ex_JTabbedPane
2. JTabbedPane
3. jTabbedPane1 inspectors AddFrom
Palette->Swing->JPanel 4.41

4.41
4. 3 3 4.42

4.42

213

5. Properties->tabPlacement
TOP
4.43

4.43
6. jPanel1 inspector 4.44 tab
Title 1

4.44

7. 6 jPanel2 jPanel3 4.45

4.45

214

8.
4.46

4.46
9. Events->Action->actionPerformed
this.dispose();
10. 4.47
3

4.47 4.10

Sun Microsystems (2007 L)


215

(2543 , 183)
2


4.48

4.48







jSplitPane->Properties
dividerLocation
divideSize
resizeWeight
continuousLayout
lastDividerLocation
maximumDividerLocation

216

minimumDeviderLocation
minimumSize
background, border, alignment, focus, name

oneTouchExpandable

4.11

1. Ex_SplitPane
2. 4.49

4.49
3. jSplitPane1 Inspector Add From Palatte
->Swing->JTextArea 4.50

4.50

217

4. 3
4.51

4.51
5. 4.52

4.52 4.11
6.
4.53

4.53 4.11


Sun Microsystems (2007 E)

218




Sun Microsystems (2007 F)





4.54

4.54


jInternalFrame->Properties
closable
defaultCloseOperation
iconifiable
maximizable
resizable

219

title
frameIcon
icon
lastCursor
layer

normalBounds
visible
X, Y x y
Width, Height


jInternalFrame->Events
internalFrameActivated
internalFrameClosed, internalFrameClosing
internalFramDeactivated
internalFramDeciconfieable
internalFrameOpened

4.12
2

1. Ex_InternamFrame
2. 4.55

4.55

220

3. 4.56

4.56
4. closable, iconifiable,
maximizable, resizable ture title Internal Frame 1
4.57

4.57
5. 4
4.58

4.58

221

6. 4.59

4.59 4.12

222


1.

2.

3.
0-3 50 4-10 2 11-50
2.50 50 30
4.

5. 5

6.

7.

8. 5
9. , , ,
, , ,
10. , ,
, , ,
11.
, , ,
3
12. 3 Red Green Blue

13. 1
14. 3

15.

You might also like