![](/user_photo/1549_7W_y5.jpg)
Конспект(слайды) лекций (4 сем)
.pdf![](/html/1549/349/html_AJnUXLcNas.xQXt/htmlconvd-meYoCG31x1.jpg)
^+,2',H I+)*
JButton button = new JButton("Button 1 (PAGE_START)"); pane.add(button, BorderLayout.PAGE_START);
button = new JButton("Button 2 (CENTER)"); button.setPreferredSize(new Dimension(200, 100)); pane.add(button, BorderLayout.CENTER);
button = new JButton("Button 3 (LINE_START)"); pane.add(button, BorderLayout.LINE_START);
button = new JButton("Long-Named Button 4 (PAGE_END)"); pane.add(button, BorderLayout.PAGE_END);
button = new JButton("5 (LINE_END)"); pane.add(button, BorderLayout.LINE_END);
^+ H I+)*
•listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS));
•JLabel label = new JLabel(labelText);
•listPane.add(label);
•listPane.add(Box.createRigidArea(new Dimension(0,5)));
•listPane.add(listScroller);
R # :
•?Lm%L`
•LYU%
•md`%_
•UdW%_
•kLU%
•HXmLnLm5
•HXmLnU%Y`%
•ZYVLnLm5
•ZYVLnU%Y`%
R # :
•inYiXU
•jnYiXU
•ZYVLnYiXU
•HXmLnYiXU
•+,-,./0-1 -,2./3/456 4, 7,.870860/9:48/ 52;</45/
22.05.2007
^+ H I+)*
? ,2H I+)*
6
![](/html/1549/349/html_AJnUXLcNas.xQXt/htmlconvd-meYoCG32x1.jpg)
? ,2H I+)*
JPanel cards;
final static String BUTTONPANEL = "JPanel with JButtons"; final static String TEXTPANEL = "JPanel with JTextField";
JPanel card1 = new JPanel();
JPanel card2 = new JPanel();
cards = new JPanel(new CardLayout()); cards.add(card1, BUTTONPANEL); cards.add(card2, TEXTPANEL);
\-+ H I+)*
contentPane.setLayout(new FlowLayout());
contentPane.add(new JButton("Button 1")); contentPane.add(new JButton("Button 2")); contentPane.add(new JButton("Button 3")); contentPane.add(new JButton("Long-Named Button 4")); contentPane.add(new JButton("5"));
? ,2H I+)* YZX
•+ 2 Q , *B?+ * ',C
•+ 2 ' *B?+ * ',C
•+ 2 .,' +) B?+ * ',C
•+ 2 - *B?+ * ',C
•+ 2 &+ B?+ * ',S U*, C
R # :
•HL\%
•`XV_%
•?Lm%L`
•HLY5XmV
•%`YXHXmV
public FlowLayout()
public FlowLayout(int alignment)
public FlowLayout(int alignment, int horizontalGap, int verticalGap)
22.05.2007
\-+ H I+)*
V, 2^ H I+)*
7
![](/html/1549/349/html_AJnUXLcNas.xQXt/htmlconvd-meYoCG33x1.jpg)
22.05.2007
R # : |
|
V, 2H I+)* |
|
V, 2H I+)* |
• +,-,./0-1 -,2./3/456 4, 7,.870860/9:48/ |
|
|
|
pane.setLayout(new GridLayout(0,2)); |
52;</45/ |
|
|
|
|
|
|
|
|
pane.add(new JButton("Button 1")); |
|
|
|
|
pane.add(new JButton("Button 2")); |
|
|
|
|
pane.add(new JButton("Button 3")); |
|
|
|
|
pane.add(new JButton("Long-Named Button 4")); |
|
|
|
|
pane.add(new JButton("5")); |
|
|
|
|
|
|
R # : |
|
U., H I+)* |
|
R # : |
• |
.)3- 0 V, 2H I+)*B * ,+ S * 0+-)1 C |
|
|
|
• +,-,./0-1 -,2./3/456 4, 7,.870860/9:48/ |
• |
.)3- 0 V, 2H I+)*B * ,+ S * 0+-)1 S * |
|
|
|
52;</45/ |
|
&+, ]+ * -V .S * ',* 0 -V .C |
|
|
|
|
|
|
|
|
|
|
8
![](/html/1549/349/html_AJnUXLcNas.xQXt/htmlconvd-meYoCG34x1.jpg)
a E T # E# F ! J
pane.setLayout(null);
JButton b1 = new JButton("one"); JButton b2 = new JButton("two"); JButton b3 = new JButton("three"); pane.add(b1);
pane.add(b2);
pane.add(b3);
Insets insets = pane.getInsets(); Dimension size = b1.getPreferredSize();
b1.setBounds(25 + insets.left, 5 + insets.top, size.width, size.heightCo
q ;$" r K
b ; #
•_I.',- 4H *' ',
•<' )H *' ',
•% 3-'<+2'-H *' ',
•%,''U'-'0* + H *' ',
•M
8 : A
•L ' * d3 '0*
•H+ [H' '- L ' * 2 U'1 * 0 L ' *
•1.-'1' * pH *' ',
•L ' * Y2 .*', B C
•X ', BY + I1+) C ?- '
t # ! [ K P
•Y0* + H *' ',
•?& 'H *' ',
•X*'1H *' ',
•H *U'-'0* + H *' ',
•H *5 * H *' ',
22.05.2007
q8 F r K
•B0+1.+ ' *s ]'S .+ * + S +,
3 - *IC
•$ B '2 +, -+ * 4'I3+ ,2 .)*C
•= " B4'I .,' ' C
•B1+) ' 0- 04 2 1+ '1' * *+ +, +)* 2, ,' C
•> B0& ' 0), +,s .+ * + C
•> B1+) ' &''- 1+ '1' *C
l! !! :
9
![](/html/1549/349/html_AJnUXLcNas.xQXt/htmlconvd-meYoCG35x1.jpg)
l! !! A
public class MyClass extends Applet {
...
someObject.addMouseListener(new MyAdapter());
...
class MyAdapter extends MouseAdapter {
public void |
|
mouseClicked(MouseEvent e) { |
} |
} |
|
} |
|
u! ! #!:A
public class MyClass extends Applet { void someMethod() {
...
someObject.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
…
}
});
...
}
}
22.05.2007
v ; T J 9! !! N 9
•A B * * 0 ' *'2 0-C
•b A B ', g + [ * * 0h 0-C
•w P!:A B-+0-0-C
•u! ! #!:A B + I1+) 0-C
|
R !: ; PE 9 ! J |
|
y ; 9! K! # |
|
y ; 9! K! # |
• |
w T T ;; 9 ! 9 |
|
public class StackOfInts { |
|
|
• |
x9 ! ! ; J$ |
|
private int[] stack; |
|
|
• |
x9 ! P! |
|
… |
|
|
|
private class StepThrough { |
|
|
||
|
|
|
|
|
|
|
|
|
… |
|
|
|
|
|
public void increment() { |
|
|
|
|
|
if ( i < stack.length) i++; |
|
|
|
|
|
} |
|
|
|
|
|
… |
|
U* 04dQX * |
|
|
|
} |
|
|
|
|
|
… |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
10
![](/html/1549/349/html_AJnUXLcNas.xQXt/htmlconvd-meYoCG36x1.jpg)
z! T ; ! P 9 U
8 ! 9!: 9 ; : ; #
•c !$! P!: 9 E# O!
•N J G # ! 9 ; 9 ! J
•u T #: E# F ! J G # ! 9 ; 9 ! J
•8 ! " A !:N : A
v ; T J ; 9
•X *-*&,' 2
•L ' * 2 . *0& *&,' 2 BL5%C
•k+,4', B3 04 ,+) 2C *&,' 2
U +3 '0* 1'*&+2 ,' +* {*&,' 2 Q'{
b 9 P VWX |
R # " #:
22.05.2007
; : K ! J
SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI();
}
}
1.6 ) ?@ @ A = B# CD
D K ! E : q !! Nr E 9
N J ! A! 9
11
![](/html/1549/349/html_AJnUXLcNas.xQXt/htmlconvd-meYoCG37x1.jpg)
•!"#$%
•&
•'()* " + %
•* * ,
-
•-. / 0 / 1 2 /
/
•(3
•4
•56)
7 8 / 9:7 / 8 / 9
•56
7 8 / 9:;;7 < 9:7= >9?78 9:7= 9;756 =2 >9
22.05.2007
@ /
•A / 2/ B /
2 > < = A 2/ C
7 9 D E2 1 /* 7F9
G HI = .I 2 /7;F9 7; 9
CSS - Cascading Style Sheets
DOM - Document Object Model
JavaScript
@ / &
•&% JK# + "LF$JMF M
•N A / A /
• 6OP* 6 * %Q * & * R( S
•O O* & O* & !Q T
•&
<?xml version="1.0" encoding="UTF-8"?>
<Recipe name=" " prep_time="5 " cook_time="3 "> <title> </title>
<ingredient amount="3" unit=" "> </ingredient> <ingredient amount="1" unit=" "> </ingredient> <Instructions>
<step> .</step> <step> ! !.</step> <step> , ! ! !
.</step> </Instructions> </Recipe>
1
![](/html/1549/349/html_AJnUXLcNas.xQXt/htmlconvd-meYoCG38x1.jpg)
'()* " + % S
•'(): A "+* '* UVV* W%QXJ* 6F W S
•" + % B C
–,$ !Q XT! %
–YXKK
–S
* * , S
• Z < / < 0 V [ N
• \ > = > E
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
||||
|
|
|
||
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
||||
|
|
|||
|
||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
&5 * , +XJ S
•X]#++ PXFJ^ %#XJ
•#!"XKX_%
•&
•!"#$%* W%QXJ* B * '4 C
•'
&5
7`aT+ "K#XJbcdSec`9 7`aT+ K%W+ KQ % Q" _bc!Q"XT :;;M+X +;KL#J;c %W$ bc% a%;!KKc`9
7 #^bc_#J^_#+ f#J^Xfc %#%+ bc c X"# J%bcQX"#]XJ% +c aT+JKbcQ%%$:;;fffSTX]#++ SX"M;L WT K% ";M % L $ ";%Q " S#KSXJ+W SaF+c9
7!"## #^bc_#J^ F%%XJc + +bc c;9
7!"## #^bc! J! + F%%XJc + +bc$% &c;9 7;f#J^Xf9
22.05.2007
\ E = A
•U / / > E 2 /
•>N . 0
•Z 8 2 gK% % + KKh
–!XXL# K
•gi 2= Ah >
–,$$+ %* P+ KQ
–, ,&
\ =
•j . g N h
/ 8
•\ E = A
2
![](/html/1549/349/html_AJnUXLcNas.xQXt/htmlconvd-meYoCG39x1.jpg)
$%
•" %+' " % '
-
•0 * !% -
•%! 1 *
|
|
23 45 67895: ; |
= 85 >6: |
< 6 = 85 >6: ?@ A: B85 CD |
|
E |
|
|
|
& % .
•F " %! "
)+ . " #
%! 1 " ' % * % + " " "
•+ . " G %
-.
22.05.2007
•! "
#$%
•& % ' ( ) * #
""+
#, ' '-.
•/ * ( " ( "
#% " % ( "
, ' '-.
•, ' "-" ( " %
% '
–% %! 6 % ( .% :
–% %! 6 %! H . :
•I 6 %J' %-:
, '-.
1
![](/html/1549/349/html_AJnUXLcNas.xQXt/htmlconvd-meYoCG40x1.jpg)
/ * ( "
, " "
•/ +* ( " 1 K %
•% ( " 1 ' . " 6 +%
* :
)0 #
•[ % 0
•, % *
6 ( . : + T
•J % %
•" N9<<585>\5 >586" Y 45\5 >586]< 45 7^7_::D
•) . .#
` ! ( .%
• ` ! ( .% %! + a8 =7H a8 =74=H < 8M 7
PrintWriter pr =
new PrintWriter(
new BufferedWriter(
new FileWriter(filename)));
22.05.2007
, 6L785 M:
•, ) # 68 2: . 6NO75 L785 MP:
•, " % 6Q3 8 R758 L785 MP:
•$+( 6N9<<585> L785 MP:
• , " 6S 7 L785 MP:
•, T 6UB 5R7 L785 MP:
•V %! +J-
W" % X
• Y 45 Z Y 45 H
• Y 45 Z Y 45 !
,
2