11-GUI.key

Size: px
Start display at page:

Download "11-GUI.key"

Transcription

1 10 (GUI)

2 (Graphical User Interface) AWT/Swing Java java.awt, javax.swing

3 (Event-Driven Programming) :,,,, (event-handler or event-listener), Java (action event), (action listner).

4 Java AWT/Swing (component), (label), (text component), (button), (list) (container): (panel): (window), (frame): (dialog): (menu bar):,

5 (Layout) (layout manager) (flow): (border):, (grid):

6 AWT/Swing Component Container Window JApplet JComponen JFrame AbstractButt JLabel JList JMenuB JButton JMenuItem JMenu

7 ,

8 JFrame. "Press This". "OK".....

9 import java.awt.*; import javax.swing.*; public class ButtonFrame extends JFrame { public ButtonFrame() { JLabel label = new JLabel("Press This:"); JButton button = new JButton("OK"); Container c = getcontentpane(); c.setlayout(new FlowLayout()); c.add(label); c.add(button); setsize(200, 60); setvisible(true); public static void main(string[] args) { new ButtonFrame();

10 : import java.awt.*; import javax.swing.*; public class ButtonFrame extends JFrame { public ButtonFrame() { JLabel label = new JLabel("Press this important button:"); JButton button = new JButton("PAV Lab", new ImageIcon("/pav-logo.gif")); Container c = getcontentpane(); c.setlayout(new FlowLayout()); label.setforeground(color.white); c.setbackground(new Color(100,100,100)); c.add(label); c.add(button); setsize(200, 160); setvisible(true); public static void main(string[] args) { new ButtonFrame();

11 . public interface ActionListener { public void actionperformed(actionevent e);.

12 , 1.

13 : public class Counter { private int count; public Counter(int start) { count = start; public void increment() { count++; public int countof() { return count;

14 import java.awt.*; import java.awt.event.*; import javax.swing.*; class Frame2a extends JFrame implements ActionListener { private Counter count; private JLabel label = new JLabel("count = 0"); public Frame2a(Counter c) { count = c; Container cp = getcontentpane(); cp.setlayout(new FlowLayout()); JButton button = new JButton("OK"); cp.add(label); cp.add(button); button.addactionlistener(this); // settitle("frame2a"); setsize(200, 60); setvisible(true); public void actionperformed(actionevent e) { count.increment(); label.settext("count = " + count.countof());

15 public class Example2a { public static void main(string[] args) { Counter model = new Counter(0); Frame2a view = new Frame2a(model);

16 : Example2a main(string[] args) Counter increment() countof() : int Frame2a Frame2a(Counter) actionperformed( ActionEvent) JLabel settext(string) JButton addactionlistener(ac tionlistener)

17 : Example2a main(string[] args) JLabel settext(string) Counter increment() countof() : int Frame2a Frame2a(Counter) actionperformed( ActionEvent) JButton addactionlistener(ac tionlistener)

18 : + JLabel settext(string) Counter increment() countof() : int Frame2a Frame2a(Counter) actionperformed( ActionEvent) JButton addactionlistener(ac tionlistener)

19 : # JLabel Counter increment() countof() : int Frame2a Frame2a(Counter) update() CountControll actionperformed( ActionEvent) settext(string) JButton addactionlistener(ac tionlistener)

20 import java.awt.*; import java.awt.event.*; import javax.swing.*; class Frame2b extends JFrame { private Counter count; private JLabel label = new JLabel("count = 0"); public Frame2b(Counter c) { count = c; Container cp = getcontentpane(); cp.setlayout(new FlowLayout()); JButton button = new JButton("OK"); cp.add(label); cp.add(button); button.addactionlistener(new CountController(count,this)); settitle("frame2b"); setsize(200, 60); setvisible(true); public void update() { // label.settext("count = " + count.countof());

21 import java.awt.event.*; public class CountController implements ActionListener { private Frame2b view; private Counter model; public CountController(Counter m, Frame2b v) { view = v; model = m; public void actionperformed(actionevent e) { model.increment(); view.update();

22 : + JLabel Counter increment() countof() : int Frame2a Frame2a(Counter) update() settext(string) CountButton addactionlistener(ac tionlistener) actionperformed(acti onevent)

23 import java.awt.*; import java.awt.event.*; import javax.swing.*; class Frame2c extends JFrame { private Counter count; private JLabel label = new JLabel("count = 0"); public Frame2b(Counter c) { count = c; Container cp = getcontentpane(); cp.setlayout(new FlowLayout()); CountButton button = new CountButton("OK", count, this); cp.add(label); cp.add(button); // settitle("frame2c"); setsize(200, 60); setvisible(true); public void update() { label.settext("count = " + count.countof());

24 + import javax.swing.*; import java.awt.event.*; public class CountButton extends JButton implements ActionListener { private Frame2c view; private Counter model; public CountButton(String label, Counter m, Frame2c v) { super(label); view = v; model = m; addactionlistener(this); public void actionperformed(actionevent e) { model.increment(); view.update();

25

26 ,

27 import java.awt.event.*; import javax.swing.*; public class ExitButton extends JButton implements ActionListener { public ExitButton(String label) { super(label); addactionlistener(this); public void actionperformed(actionevent e) { System.exit(0);

28 import java.awt.*; import java.awt.event.*; import javax.swing.*; class Frame2c extends JFrame { private Counter count; private JLabel label = new JLabel("count = 0"); public Frame2b(Counter c) { count = c; Container cp = getcontentpane(); cp.setlayout(new FlowLayout()); cp.add(label); cp.add(new CountButton("OK",count,this)); cp.add(new ExitButton("Exit")); settitle("frame2c"); setsize(200, 60); setvisible(true); public void update() { label.settext("count = " + count.countof());

29 ,...

30 (BorderLayout) Frame Panel p1 Panel Drawing Panel p2 p1 NORTH Frame, Drawing p2 SOUTH. Count, Drawing, Label Counter

31 Drawing import java.awt.*; import javax.swing.*; public class Drawing extends JPanel { private Counter count; public Drawing(Counter model) { count = model; setsize(200,80); public void paintcomponent(graphics g) { g.setcolor(color.white); // g.fillrect(0,0,200,80); g.setcolor(color.red); int x=0, y=0; for(int i=0; i<count.countof(); i++) { //. g.filloval(x*25, y*25, 20, 20); x++; if(x>7) { x=0; y++;

32 CountButton import java.awt.*; import javax.swing.*; import java.awt.event.*; public class CountButton extends JButton implements ActionListener { private Frame4 view; private Counter model; public CountButton(String label, Counter m, Frame4 v) { super(label); view = v; model = m; addactionlistener(this); public void actionperformed(actionevent e) { model.increment(); view.update();

33 Frame import java.awt.*; import javax.swing.*; public class Frame4 extends JFrame { private Counter count; private JLabel lab = new JLabel("count = 0"); private JPanel drawing; public void update() { lab.settext("count = " + count.countof()); drawing.repaint();

34 Frame public Frame4(Counter c, JPanel panel) { count = c; drawing = panel; Container cp = getcontentpane(); cp.setlayout(new BorderLayout()); JPanel p1 = new JPanel(new FlowLayout()); JPanel p2 = new JPanel(new FlowLayout()); lab = new JLabel("count = " + count.countof()); p1.add(lab); p2.add(new CountButton("Count", count, this)); p2.add(new ExitButton("Quit")); cp.add(p1, BorderLayout.NORTH); cp.add(drawing); cp.add(p2, BorderLayout.SOUTH); settitle("example4"); setsize(200,150); setvisible(true);

35 public class Example4 { public static void main(string[] args) { Counter model = new Counter(0); Drawing drawing = new Drawing(model); Frame4 view = new Frame4(model, drawing);

36

37 ,,. OK.

38 OK ColorButton ThrobPanel ThrobFrame ThrobController ThrobbingBall

39 ColorButton ColorButton (ThrobPanel f) actionperformed (ActionEvent e) ThrobPanel ThrobPanel (int size, ThrobbingBall b) getcolor() setcolor(color c) ThrobFrame ThrobFrame (int size, ThrobPanel p, ThrobControlle ThrobController (ThrobPanel w, ThrobbingBall b, int delay_time) run() ThrobbingBall islarge(): boolean throb()

40 ThrobbingBall public class ThrobbingBall { private boolean is_large = true; public boolean islarge() { return is_large; public void throb() { is_large = is_large;

41 ThrobPanel mport java.awt.*; import javax.swing.*; public class ThrobPanel extends JPanel { private int panel_size, location, ball_size; private Color c = Color.red; private ThrobbingBall ball; public ThrobPanel(int size, ThrobbingBall b) { panel_size = size; location = size/2; ball_size = size/3; ball = b; setsize(size, size); public Color getcolor() { return c; public void setcolor(color new_color) { c = new_color; public void paintcomponent(graphics g) { g.setcolor(color.white); g.fillrect(0, 0, panel_size, panel_size); g.setcolor(c); if (ball.islarge()) g.filloval(location-ball_size/2,location-ball_size/2,ball_size,ball_size); else g.filloval(location-ball_size/4,location-ball_size/4,ball_size/2,ball_size/2);

42 ColorButton import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ColorButton extends JButton implements ActionListener { private ThrobPanel view; public ColorButton(ThrobPanel f) { super("ok"); view = f; addactionlistener(this); public void actionperformed(actionevent e) { Color c = view.getcolor(); if(c==color.red) view.setcolor(color.blue); else view.setcolor(color.red);

43 ThrobFrame import java.awt.*; import javax.swing.*; public class ThrobFrame extends JFrame { public ThrobFrame(int size, ThrobPanel p, ColorButton b) { Container cp = getcontentpane(); cp.setlayout(new BorderLayout()); cp.add(p, BorderLayout.CENTER); cp.add(b, BorderLayout.SOUTH); settitle("throb"); setsize(size, size+40); setvisible(true);

44 ThrobController public class ThrobController { private ThrobPanel writer; private ThrobbingBall ball; private int time; public ThrobController(ThrobPanel w, ThrobbingBall b, int delay_time) { writer = w; ball = b; time = delay_time; public void run() { while(true) { ball.throb(); writer.repaint(); delay(); private void delay() { try { Thread.sleep(time); catch (InterruptedException e) {

45 public class StartThrob { public static void main(string[] a) { int frame_size = 180; int pause_time = 200; ThrobbingBall b = new ThrobbingBall(); ThrobPanel p = new ThrobPanel(frame_size, b); ThrobFrame f = new ThrobFrame(frame_size, p, new ColorButton(p)); new ThrobController(p, b, pause_time).run();

46 , SlidePuzzleBoard private PuzzlePiece[][] board SlidePuzzleBoard(int size) move(int w): boolean 1 * PuzzlePieces private int face_value PuzzlePiece(int value)

47 , PuzzleFrame PuzzleFrame(int board_size, SlidePuzzleBoard b) update() 1 * PuzzleButton actionperformed(action Event e) SlidePuzzleBoard private PuzzlePiece[][] board SlidePuzzleBoard(int size) move(int w): boolean 1 * PuzzlePieces private int face_value PuzzlePiece(int value)

48 PuzzleButton import javax.swing.*; import java.awt.event.*; public class PuzzleButton extends JButton implements ActionListener { private SlidePuzzleBoard puzzle; private PuzzleFrame view; public PuzzleButton(SlidePuzzleBoard p, PuzzleFrame v) { puzzle = p; view = v; addactionlistener(this); public void actionperformed(actionevent evt) { String s = gettext(); if(s.equals("")) { boolean ok = puzzle.move(new Integer(s).intValue()); if(ok) view.update();

49 PuzzleFrame public class PuzzleFrame extends JFrame { private SlidePuzzleBoard board; private int size, button_size = 60; private PuzzleButton[][] button; public PuzzleFrame(int board_size, SlidePuzzleBoard b) { size = board_size; board = b; button = new PuzzleButton[size][size]; Container cp = getcontentpane(); cp.setlayout(new GridLayout(size, size)); for (int i=0; i<size; i++) for(int j=0; j<size; j++) { button[i][j] = new PuzzleButton(board, this); cp.add(button[i][j]); update(); settitle("puzzleframe"); setsize(size * button_size + 10, size * button_size + 20); setvisible(true);

50 PuzzleFrame public void update() { PuzzlePiece[][] r = board.contents(); for(int i=0; i<size; i++) for(int j=0; j<size; j++) { if (r[i][j]=null) { button[i][j].setbackground(color.white); button[i][j].settext("" + r[i][j].valueof()); else { button[i][j].setbackground(color.black); button[i][j].settext("");

51 , (Scrolling List)

52 ListFrame ListFrame(Counter2[] model) getselecton(): int update() Counter2 private PuzzlePiece[][] board SlidePuzzleBoard(int size) move(int w): boolean JList ListButton ListButton(String label, Counter2[] c, ListFrame v) actionperformed(actionevent

53 Counter2 public class Counter2 { private int count, my_index; public Counter2(int start, int index) { count = start; my_index = index; public void increment() { count++; public int countof() { return count; public String tostring() { return "Counter " + my_index + " has " + countof();

54 ListButton import java.awt.event.*; import javax.swing.*; public class ListButton extends JButton implements ActionListener { private Counter2[] counters; private ListFrame view; public ListButton(String label, Counter2[] c, ListFrame v) { super(label); counters = c; view = v; addactionlistener(this); public void actionperformed(actionevent evt) { int choice = view.getselection(); if(choice = -1) { counters[choice].increment(); view.update();

55 ListFrame import java.awt.*; import javax.swing.*; public class ListFrame extends JFrame { private Counter2[] counters; private JList items; public ListFrame(Counter2[] model) { counters = model; items = new JList(counters); JScrollPane sp = new JScrollPane(items); JPanel p = new JPanel(new GridLayout(2,1)); p.add(new ListButton("Go", counters, this)); p.add(new ExitButton("Quit")); Container cp = getcontentpane(); cp.setlayout(new GridLayout(2,1)); cp.add(sp); cp.add(p); update(); settitle("listexample"); setsize(200,200); setvisible(true); public int getselection() { return items.getselectedindex(); public void update() { items.clearselection();

56 JList. items.addlistselectionlistener(listselectionlisten er); valuechanged.. items.setselectionmode(listselectionmodel.multi PLE_INTERVAL_SELECTION). items.getselectedindices(): int[]

57 JTextField input_text = new JTextField(, ) input_text.gettext(): input_text.settext(... ):

58 JTextArea JTextField JTextArea text = new JTextArea(, 20, 40); text.setlinewrap(true); text.setfont(new Font( Courier, Font.PLAIN, 14)); JScrollPane sp = new JScrollPane(text);

59 JTextArea JTextComponent gettext(): String, settext(string) getcaretposition(): int, setcaretposition(int), movecaretposition(int) getselectedtext(): String, getselectionstart(): int, getselectionend(): int cut(), copy(), paste() iseditable(): boolean, seteditable(boolean) JTextArea setfont(font) setlinewrap(boolean) insert(string, int) replacerange(string, int, int)

60 JMenu & JMenuBar JMenuBar mbar = new JMenuBar(); JMenu file = new JMenu( File ); mbar.add(file);. JMenu edit = new JMenu( Edit ); edit.add(new JMenuItem( Cut )); edit.add(new JMenuItem( Copy )); edit.add(new JMenuItem( Paste )); edit.addseparator(); JMenu search = new JMenu( Search );... edit.add(search); mbar.add(edit); setjmenubar(mbar);

61 ,

62 ,

63 ,

64 ActionListener AWT/Swing classes that detect events ClearMenuItem QuitMenuItem CutMenuItem CopyMenuItem PasteMenuItem FindMenuItem ReplaceMenuItem EditModel EditFrame ReplaceFrame JTextArea JFrame

65 EditModel import java.awt.*; import javax.swing.*; public class EditModel extends JTextArea { public EditModel(String initial_text, int rows, int cols) { super(initial_text, rows, cols); setlinewrap(true); setfont(new Font("Courier", Font.PLAIN, 14)); public void clear() { settext(""); private int find(string s, int position) { int index = gettext().indexof(s, position); if(index = -1) { setcaretposition(index + s.length()); movecaretposition(index); return index; public int findfromstart(string s) { return find(s, 0); public int findfromcaret(string s) { return find(s, getcaretposition());

66 QuitMenuItem import javax.swing.*; import java.awt.event.*; public class QuitMenuItem extends JMenuItem implements ActionListener { public QuitMenuItem(String label) { super(label); addactionlistener(this); public void actionperformed(actionevent e) { System.exit(0);

67 : EditorMenuItem import javax.swing.*; import java.awt.event.*; public abstract class EditorMenuItem extends JMenuItem implements ActionListener { private EditModel buffer; public EditorMenuItem(String label, EditModel model) { super(label); buffer = model; addactionlistener(this); public EditModel mymodel() { return buffer; public abstract void actionperformed(actionevent e);

68 ClearMenuItem import java.awt.event.*; public class ClearMenuItem extends EditorMenuItem { public ClearMenuItem(String label, EditModel model) { super(label, model); public void actionperformed(actionevent e) { mymodel().clear(); cut/copy/pastemenuitem

69 EditFrame import java.awt.*; import javax.swing.*; public class EditFrame extends JFrame { private EditModel buffer = new EditModel("", 15, 50); public EditFrame() { // ReplaceFrame second_frame = new ReplaceFrame(buffer); Container cp = getcontentpane(); cp.setlayout(new BorderLayout()); JMenuBar mbar = new JMenuBar(); JMenu file = new JMenu("File"); file.add(new ClearMenuItem("New", buffer)); file.add(new QuitMenuItem("Exit")); mbar.add(file); JMenu edit = new JMenu("Edit"); edit.add(new CutMenuItem("Cut", buffer)); edit.add(new CopyMenuItem("Copy", buffer)); edit.add(new PasteMenuItem("Paste", buffer)); edit.addseparator();

70 ClearMenuItem // JMenu search = new JMenu("Search"); // search.add(new FindMenuItem("Find", buffer)); // search.add(new ReplaceMenuItem("Replace", // second_frame)); // edit.add(search); mbar.add(edit); setjmenubar(mbar); JScrollPane sp = new JScrollPane(buffer); cp.add(sp, BorderLayout.CENTER); settitle("editframe"); pack(); setvisible(true); public static void main(string[] args) { new EditFrame();

71 FindMenuItem import java.awt.event.*; import javax.swing.*; public class FindMenuItem extends EditorMenuItem { public FindMenuItem(String label, EditModel model) { super(label, model); public void actionperformed(actionevent e) { String s = JOptionPane.showInputDialog(this, "Type string to be found:"); if(s = null) { if(mymodel().findfromcaret(s) == -1) { int response = JOptionPane.showConfirmDialog(this, "String " + s + " not found. Restart search from beginning of buffer?"); if(response == JOptionPane.YES_OPTION) { if(mymodel().findfromstart(s) == -1) JOptionPane.showMessageDialog(this, "String " + s + " not found.");

72 ReplaceMenuItem import java.awt.event.*; import javax.swing.*; public class ReplaceMenuItem extends JMenuItem implements ActionListener { private ReplaceFrame view; public ReplaceMenuItem(String label, ReplaceFrame v) { super(label); view = v; addactionlistener(this); public void actionperformed(actionevent e) { view.setvisible(true);

73 ReplaceFrame import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ReplaceFrame extends JFrame implements ActionListener { private EditModel model; private JButton replace = new JButton("Replace"); private JButton clear = new JButton("Clear"); private JButton close = new JButton("Close"); private JTextField find_text = new JTextField("", 20); private JTextField replace_text = new JTextField("", 20); public ReplaceFrame(EditModel m) { model = m; Container cp = getcontentpane(); cp.setlayout(new BorderLayout()); JPanel p1 = new JPanel(new GridLayout(2, 1)); JPanel p11 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); p11.add(new JLabel("From caret, replace ")); p11.add(find_text); p1.add(p11);

74 ReplaceFrame JPanel p12 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); p12.add(new JLabel("by ")); p12.add(replace_text); p1.add(p12); cp.add(p1, BorderLayout.CENTER); JPanel p2 = new JPanel(new FlowLayout()); p2.add(replace); p2.add(clear); p2.add(close); cp.add(p2, BorderLayout.SOUTH); replace.addactionlistener(this); clear.addactionlistener(this); close.addactionlistener(this); settitle("replaceframe"); pack(); setvisible(false);

75 ReplaceFrame public void actionperformed(actionevent e) { if(e.getsource() == close) { setvisible(false); else if(e.getsource() == clear) { find_text.settext(""); replace_text.settext(""); else if(e.getsource() == replace) { String find = find_text.gettext(); int location = model.findfromcaret(find); if(location == -1) JOptionPane.showMessageDialog(this, "String " + find + " not found."); else model.replacerange(replace_text.gettext(), location, location+find.length());

76 . (listener object). b.addactionlistener(ob) actionperformed. GUI. Observable Observer(update ) addobserver.

77 implements Observer ➊ addobserver ➍ update implements Observable addobserver() setchanged() ➋ setchanged ➌ notifyobservers

78 ,. public class Counter3 { private int count; public Counter3(int start) { count = start; public int countof() { return count; public void increment() { count++; System.out.println("new count = " + countof()); MVC

79 ? public class Counter3 { private int count; private PrintCount view; public Counter3(int start, PrintCount v) { count = start; view = v; public int countof() { return count; public void increment() { count++; view.update(); public class PrintCount { private Counter3 counter; public PrintCount(Counter3 c) { counter = c; public void update() { System.out.println( "new count = " + counter.countof());

80 Observable, Observer public class Counter3 implements Observable { private int count; public Counter3(int start) { count = start; public int countof() { return count; public void increment() { count++; setchanged(); notifyobservers(); public class PrintCount implements Observer { private Counter3 counter; public PrintCount(Counter3 c){ counter = c; c.addobserver(this); public void update() { System.out.println( "new count = " + counter.countof()); : Counter3 PrintCount

81 , CountButton import java.awt.*; import javax.swing.*; import java.awt.event.*; public class CountButton extends JButton implements ActionListener { private Frame4 view; private Counter model; public CountButton(String label, Counter m, Frame4 v) { super(label); view = v; model = m; addactionlistener(this); public void actionperformed(actionevent e) { model.increment(); view.update();

82 Observable, Observer import java.awt.*; import javax.swing.*; import java.awt.event.*; public class CountButton extends JButton implements ActionListener { private Frame4 view; private Counter3 model; public CountButton(String label, Counter3 m, Frame4 v) { super(label); view = v; model = m; addactionlistener(this); public void actionperformed(actionevent e) { model.increment(); view.update();

83 Frame import java.awt.*; import javax.swing.*; public class Frame4 extends JFrame implements Observer { private Counter count; private JLabel lab = new JLabel("count = 0"); private JPanel drawing; public void update() { lab.settext("count = " + count.countof()); drawing.repaint(); public Frame4(Counter c, JPanel panel) { c.addobserver(this);...

84 Observabl Counter Observer Frame4 Counter Frame4 CountButto CountButto

9장.key

9장.key JAVA Programming 1 GUI(Graphical User Interface) 2 GUI!,! GUI! GUI, GUI GUI! GUI AWT Swing AWT - java.awt Swing - javax.swing AWT Swing 3 AWT(Abstract Windowing Toolkit)! GUI! java.awt! AWT (Heavy weight

More information

11장.key

11장.key JAVA Programming 1 GUI 2 2 1. GUI! GUI! GUI.! GUI! GUI 2. GUI!,,,!! GUI! GUI 11 : GUI 12 : GUI 3 4, JComponent 11-1 :, JComponent 5 import java.awt.*; import java.awt.event.*; import javax.swing.*; public

More information

자바GUI실전프로그래밍2_장대원.PDF

자바GUI실전프로그래밍2_장대원.PDF JAVA GUI - 2 JSTORM http://wwwjstormpekr JAVA GUI - 2 Issued by: < > Document Information Document title: JAVA GUI - 2 Document file name: Revision number: Issued by: Issue Date:

More information

Microsoft PowerPoint - 04-UDP Programming.ppt

Microsoft PowerPoint - 04-UDP Programming.ppt Chapter 4. UDP Dongwon Jeong djeong@kunsan.ac.kr http://ist.kunsan.ac.kr/ Dept. of Informatics & Statistics 목차 UDP 1 1 UDP 개념 자바 UDP 프로그램작성 클라이언트와서버모두 DatagramSocket 클래스로생성 상호간통신은 DatagramPacket 클래스를이용하여

More information

<4D F736F F F696E74202D20C1A63139C0E520B9E8C4A120B0FCB8AEC0DA28B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20C1A63139C0E520B9E8C4A120B0FCB8AEC0DA28B0ADC0C729205BC8A3C8AF20B8F0B5E55D> Power Java 제 19 장배치관리자 이번장에서학습할내용 배치관리자의개요 배치관리자의사용 FlowLayout BorderLayout GridLayout BoxLayout CardLayout 절대위치로배치 컨테이너안에서컴포넌트를배치하는방법에대하여살펴봅시다. 배치관리자 (layout manager) 컨테이너안의각컴포넌트의위치와크기를결정하는작업 [3/70] 상당히다르게보인다.

More information

강의자료

강의자료 Copyright, 2014 MMLab, Dept. of ECE, UOS Java Swing 2014 년 3 월 최성종서울시립대학교전자전기컴퓨터공학부 chois@uos.ac.kr http://www.mmlab.net 차례 2014년 3월 Java Swing 2 2017-06-02 Seong Jong Choi Java Basic Concepts-3 Graphical

More information

10장.key

10장.key JAVA Programming 1 2 (Event Driven Programming)! :,,,! ( )! : (batch programming)!! ( : )!!!! 3 (Mouse Event, Action Event) (Mouse Event, Action Event) (Mouse Event, Container Event) (Key Event) (Key Event,

More information

PowerPoint Presentation

PowerPoint Presentation 객체지향프로그래밍 그래픽사용자인터페이스 ( 실습 ) 손시운 ssw5176@kangwon.ac.kr 예제 1. 프레임생성 (1) import javax.swing.*; public class FrameTest { public static void main(string[] args) { JFrame f = new JFrame("Frame Test"); JFrame

More information

<4D F736F F F696E74202D20C1A63230C0E520BDBAC0AE20C4C4C6F7B3CDC6AE203128B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20C1A63230C0E520BDBAC0AE20C4C4C6F7B3CDC6AE203128B0ADC0C729205BC8A3C8AF20B8F0B5E55D> Power Java 제 20 장스윙컴포넌트 1 이번장에서학습할내용 텍스트컴포넌트 텍스트필드 텍스트영역 스크롤페인 체크박스 라디오버튼 스윙에서제공하는기초적인컴포넌트들을살펴봅시다. 스윙텍스트컴포넌트들 종류텍스트컴포넌트그림 텍스트필드 JTextField JPasswordField JFormattedTextField 일반텍스트영역 JTextArea 스타일텍스트영역

More information

public class FlowLayoutPractice extends JFrame { public FlowLayoutPractice() { super("flowlayout Practice"); this. Container contentpane = getcontentp

public class FlowLayoutPractice extends JFrame { public FlowLayoutPractice() { super(flowlayout Practice); this. Container contentpane = getcontentp 8 장 1 번 public class MyFrame extends JFrame { public MyFrame(String title) { super(title); this. setsize(400,200); new MyFrame("Let's study Java"); 2번 public class MyBorderLayoutFrame extends JFrame {

More information

gnu-lee-oop-kor-lec10-1-chap10

gnu-lee-oop-kor-lec10-1-chap10 어서와 Java 는처음이지! 제 10 장이벤트처리 이벤트분류 액션이벤트 키이벤트 마우스이동이벤트 어댑터클래스 스윙컴포넌트에의하여지원되는이벤트는크게두가지의카테고리로나누어진다. 사용자가버튼을클릭하는경우 사용자가메뉴항목을선택하는경우 사용자가텍스트필드에서엔터키를누르는경우 두개의버튼을만들어서패널의배경색을변경하는프로그램을작성하여보자. 이벤트리스너는하나만생성한다. class

More information

Microsoft PowerPoint - EEL2 Lecture10 -Swing and Event Handling.pptx

Microsoft PowerPoint - EEL2 Lecture10 -Swing and Event Handling.pptx 전자공학실험 2 1 WEEK10: SWING AND EVENT HANDLING Fall, 2014 건국대전자공학부 Notice: 주별강의 / 실습 /HW 내용 2 Week Date 강의주제 Homework 실습과제 Handouts 1 09월 03일 Orientation Lab1 Lecture0 2 09월 10일 추석 3 09월 17일 Using Objects

More information

05-class.key

05-class.key 5 : 2 (method) (public) (private) (interface) 5.1 (Method), (public method) (private method) (constructor), 3 4 5.2 (client). (receiver)., System.out.println("Hello"); (client object) (receiver object)

More information

<4D F736F F F696E74202D20C1A63233C0E520B1D7B7A1C7C820C7C1B7CEB1D7B7A1B9D628B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20C1A63233C0E520B1D7B7A1C7C820C7C1B7CEB1D7B7A1B9D628B0ADC0C729205BC8A3C8AF20B8F0B5E55D> Power Java 제 23 장그래픽프로그래밍 이번장에서학습할내용 자바에서의그래픽 기초사항 기초도형그리기 색상 폰트 Java 2D Java 2D를이용한그리기 Java 2D 를이용한채우기 도형회전과평행이동 자바를이용하여서화면에그림을그려봅시다. 자바그래픽데모 자바그래픽의두가지방법 자바그래픽 AWT Java 2D AWT를사용하면기본적인도형들을쉽게그릴수있다. 어디서나잘실행된다.

More information

iii. Design Tab 을 Click 하여 WindowBuilder 가자동으로생성한 GUI 프로그래밍환경을확인한다.

iii. Design Tab 을 Click 하여 WindowBuilder 가자동으로생성한 GUI 프로그래밍환경을확인한다. Eclipse 개발환경에서 WindowBuilder 를이용한 Java 프로그램개발 이예는 Java 프로그램의기초를이해하고있는사람을대상으로 Embedded Microcomputer 를이용한제어시스템을 PC 에서 Serial 통신으로제어 (Graphical User Interface (GUI) 환경에서 ) 하는프로그램개발예를설명한다. WindowBuilder:

More information

Java Programing Environment

Java Programing Environment Lab Exercise #7 Swing Component 프로그래밍 2007 봄학기 고급프로그래밍 김영국충남대전기정보통신공학부 실습내용 실습과제 7-1 : 정규표현식을이용한사용자정보의유효성검사 (ATM 에서사용자등록용도로사용가능 ) 실습과제 7-2 : 숫자맞추기게임 실습과제 7-3 : 은행관리프로그램 고급프로그래밍 Swing Component 프로그래밍 2

More information

제8장 자바 GUI 프로그래밍 II

제8장 자바 GUI 프로그래밍 II 제8장 MVC Model 8.1 MVC 모델 (1/7) MVC (Model, View, Controller) 모델 스윙은 MVC 모델에기초를두고있다. MVC란 Xerox의연구소에서 Smalltalk 언어를바탕으로사용자인터페이스를개발하기위한방법 MVC는 3개의구성요소로구성 Model : 응용프로그램의자료를표현하기위한모델 View : 자료를시각적으로 (GUI 방식으로

More information

Microsoft PowerPoint - 14주차 강의자료

Microsoft PowerPoint - 14주차 강의자료 Java 로만드는 Monster 잡기게임예제이해 2014. 12. 2 게임화면및게임방법 기사초기위치 : (0,0) 아이템 10 개랜덤생성 몬스터 10 놈랜덤생성 Frame 하단에기사위치와기사파워출력방향키로기사이동아이템과몬스터는고정종료버튼클릭하면종료 Project 구성 GameMain.java GUI 환경설정, Main Method 게임객체램덤위치에생성 Event

More information

12-file.key

12-file.key 11 (String).. java.lang.stringbuffer. s String s = "abcd"; s = s + "e"; a b c d e a b c d e ,., "910359,, " "910359" " " " " (token) (token),, (delimiter). java.util.stringtokenizer String s = "910359,,

More information

Microsoft PowerPoint - ÀÚ¹Ù08Àå-1.ppt

Microsoft PowerPoint - ÀÚ¹Ù08Àå-1.ppt AWT 컴포넌트 (1) 1. AWT 패키지 2. AWT 프로그램과이벤트 3. Component 클래스 4. 컴포넌트색칠하기 AWT GUI 를만들기위한 API 윈도우프로그래밍을위한클래스와도구를포함 Graphical User Interface 그래픽요소를통해프로그램과대화하는방식 그래픽요소를 GUI 컴포넌트라함 윈도우프로그램만들기 간단한 AWT 프로그램 import

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Graphical User Interface 배효철 th1g@nate.com 1 목차 자바의 GUI AWT와 Swing 패키지 Swing 클래스의특징 컨테이너와컴포넌트 Swing GUI 만들기 컨테이너와배치 2 자바의 GUI GUI 목적 그래픽이용, 사용자에게이해하기쉬운모양으로정보제공 사용자는마우스나키보드를이용하여쉽게입력 자바 GUI 특징 강력한 GUI 컴포넌트제공

More information

No Slide Title

No Slide Title 사건처리와 GUI 프로그래밍 이충기 명지대학교컴퓨터공학과 사건 사건은우리가관심을가질지모르는어떤일이일어나는것을나타내는객체이다. 예를들면, 다음이일어날때프로그램이어떤일을수행해야하는경우에사건이발생한다 : 1. 마우스를클릭한다. 2. 단추를누른다. 3. 키보드의키를누른다. 4. 메뉴항목을선택한다. 2 사건 사건은컴포넌트에서사용자나시스템에의하여발생하는일이다. 자바는사건을나타내는많은사건클래스를제공한다.

More information

Chap12

Chap12 12 12Java RMI 121 RMI 2 121 RMI 3 - RMI, CORBA 121 RMI RMI RMI (remote object) 4 - ( ) UnicastRemoteObject, 121 RMI 5 class A - class B - ( ) class A a() class Bb() 121 RMI 6 RMI / 121 RMI RMI 1 2 ( 7)

More information

02 C h a p t e r Java

02 C h a p t e r Java 02 C h a p t e r Java Bioinformatics in J a va,, 2 1,,,, C++, Python, (Java),,, (http://wwwbiojavaorg),, 13, 3D GUI,,, (Java programming language) (Sun Microsystems) 1995 1990 (green project) TV 22 CHAPTER

More information

ch09

ch09 9 Chapter CHAPTER GOALS B I G J A V A 436 CHAPTER CONTENTS 9.1 436 Syntax 9.1 441 Syntax 9.2 442 Common Error 9.1 442 9.2 443 Syntax 9.3 445 Advanced Topic 9.1 445 9.3 446 9.4 448 Syntax 9.4 454 Advanced

More information

슬라이드 1

슬라이드 1 13 장. 스윙사용방법 학습목표 레이아웃관리자 스윙구성요소 비트박스프로그램 스윙을알아봅시다 스윙구성요소 구성요소 (Component) 위젯 (widget) 이라고도부름 GUI에집어넣는모든것 텍스트필드, 버튼, 스크롤목록, 라디오버튼등 javax.swing.jcomponent 의하위클래스 대화형구성요소, 배경구성요소로나뉨 JButton JFrame JPanel

More information

rmi_박준용_final.PDF

rmi_박준용_final.PDF (RMI) - JSTORM http://wwwjstormpekr (RMI)- Document title: Document file name: Revision number: Issued by: Document Information (RMI)- rmi finaldoc Issue Date: Status:

More information

Microsoft PowerPoint - [JAVA프로그래밍]9장GUI

Microsoft PowerPoint - [JAVA프로그래밍]9장GUI 명품 JAVA Programming 1 제 9 장자바 GUI 기초, AWT 와스윙 (SWING) 자바의 GUI(Graphical User Interface) 2 GUI 목적 그래픽이용, 사용자에게이해하기쉬운모양으로정보제공 사용자는마우스나키보드를이용하여쉽게입력 자바 GUI 특징 강력한 GUI 컴포넌트제공 쉬운 GUI 프로그래밍 자바의 GUI 프로그래밍방법 GUI

More information

10 이벤트 처리와 그래픽 프로그래밍.key

10 이벤트 처리와 그래픽 프로그래밍.key [ 10 ] ..,..,,,., 2 1. 3 Section 1 p408 (event) (listen) (event listener) 4 Section 1 [ 1: ] [ 2: ] 5 Section 1 (ActionEvent) (MouseEvent) 6 Section 1 EventObject getsource() 7 Section 1 8 Section 1 MouseListener

More information

슬라이드 1

슬라이드 1 12 장. GUI 학습목표 GUI 이벤트, 이벤트리스너와이벤트소스그림그리기내부클래스 창 Jframe 의모양 (Metal L&F) Jframe 의모양 (Aqua L&F) 창을만드는방법 1. 프레임 (JFrame) 만들기 JFrame frame = new JFrame(); 2. 위젯만들기 JButton button = new JButton( click me );

More information

Microsoft PowerPoint - ÀÚ¹Ù08Àå-2.ppt

Microsoft PowerPoint - ÀÚ¹Ù08Àå-2.ppt AWT 컴포넌트 (2) 1. 메뉴 2. 컨테이너와컨트롤 3. 배치관리자 메뉴관련클래스계층구조 Object MenuComponent MenuBar MenuItem Menu CheckboxMenuItem PopupMenu 메뉴 풀다운메뉴 제목표시줄밑의메뉴바를가짐 메뉴만들기과정 MenuBar 객체생성 MenuBar 에추가할 Menu 객체를생성 Menu 에추가할또다른서브

More information

<4D F736F F F696E74202D20C1A63236C0E520BED6C7C3B8B428B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20C1A63236C0E520BED6C7C3B8B428B0ADC0C729205BC8A3C8AF20B8F0B5E55D> Power Java 제 26 장애플릿 이번장에서학습할내용 애플릿소개 애플릿작성및소개 애플릿의생명주기 애플릿에서의그래픽컴포넌트의소개 Applet API의이용 웹브라우저상에서실행되는작은프로그램인애플릿에대하여학습합니다. 애플릿이란? 애플릿은웹페이지같은 HTML 문서안에내장되어실행되는자바프로그램이다. 애플릿을실행시키는두가지방법 1. 웹브라우저를이용하는방법 2. Appletviewer를이용하는방법

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 명품 JAVA Essential 1 2 학습목표 1. 이벤트기반 GUI 프로그래밍이해 2. 자바 GUI 패키지이해 3. 스윙으로 GUI 프로그램작성 4. 컨테이너와컴포넌트, 배치 5. FlowLayout 배치관리자활용 6. BorderLayout 배치관리자활용 7. GridLayout 배치관리자활용 8. 배치관리자없는컨테이너만들기 자바의 GUI(Graphical

More information

<4D F736F F F696E74202D20C1A63138C0E520C0CCBAA5C6AE20C3B3B8AE28B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20C1A63138C0E520C0CCBAA5C6AE20C3B3B8AE28B0ADC0C729205BC8A3C8AF20B8F0B5E55D> Power Java 제 18 장이벤트처리 이번장에서학습할내용 이벤트처리의개요 이벤트 액션이벤트 Key, Mouse, MouseMotion 어댑터클래스 버튼을누르면반응하도록만들어봅시다. 이번장의목표 버튼을누르면버튼의텍스트가변경되게한다. 이벤트처리과정 이벤트처리과정 (1) 이벤트를발생하는컴포넌트를생성하여야한다. 이벤트처리과정 (2) 이벤트리스너클래스를작성한다.

More information

Microsoft PowerPoint - Java-03.pptx

Microsoft PowerPoint - Java-03.pptx JAVA 프로그래밍 Chapter 19. GUI 프로그래밍 1 GUI 환경에서작동하는프로그램 윈도우프로그램에대하여 텍스트모드프로그램과윈도우프로그램 a) 텍스트모드의프로그램 b) 윈도우프로그램 2 GUI 환경에서작동하는프로그램 -2 윈도우프로그램에대하여 텍스트모드프로그램과윈도우프로그램의구조적차이 3 윈도우프로그램의작성방법 윈도우프로그램의구조 네단계로실행되는윈도우프로그램

More information

JMF3_심빈구.PDF

JMF3_심빈구.PDF JMF JSTORM http://wwwjstormpekr Issued by: < > Revision: Document Information Document title: Document file name: Revision number: Issued by: JMF3_ doc Issue Date:

More information

09-interface.key

09-interface.key 9 Database insert(record r): boolean find(key k): Record 1 Record getkey(): Key * Record Key Database.? Key equals(key y): boolean Database insert(record r): boolean find(key k): Record * Database OK 1

More information

PowerPoint Presentation

PowerPoint Presentation 객체지향프로그래밍 그래픽프로그래밍 손시운 ssw5176@kangwon.ac.kr 자바에서의그래픽 2 자바그래픽의두가지방법 3 간단한예제 4 (1) 프레임생성하기 public class BasicPaint { public static void main(string[] args) { JFrame f = new JFrame(" 그래픽기초프로그램 "); f.setdefaultcloseoperation(jframe.exit_on_close);

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 @ Lesson 2... ( ). ( ). @ vs. logic data method variable behavior attribute method field Flow (Type), ( ) member @ () : C program Method A ( ) Method B ( ) Method C () program : Java, C++, C# data @ Program

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 명품 JAVA Essential 1 2 학습목표 1. 스윙컴포넌트종류이해 2. JLabel로문자열과이미지출력 3. JButton으로버튼만들기 4. JCheckBox로체크박스만들기 5. JRadioButton으로라디오버튼만들기 6. JTextField로한줄입력창만들기 7. JTextArea로여러줄의입력창만들기 8. JList로리스트만들기 9. JComboBox로콤보박스만들기

More information

모든스윙컴포넌트에는텍스트옆에이미지를추가로표시할수있다. ImageIcon image = new ImageIcon("image.gif"); JLabel label = new JLabel(" 이미지레이블 "); label.seticon(image);

모든스윙컴포넌트에는텍스트옆에이미지를추가로표시할수있다. ImageIcon image = new ImageIcon(image.gif); JLabel label = new JLabel( 이미지레이블 ); label.seticon(image); JAVA Programming Spring, 2016 Dongwoo Kang 모든스윙컴포넌트에는텍스트옆에이미지를추가로표시할수있다. ImageIcon image = new ImageIcon("image.gif"); JLabel label = new JLabel(" 이미지레이블 "); label.seticon(image); 이미지버튼을표시하고사용자가버튼을누르면레이블의텍스트를이미지로바꾸어서표시하는프로그램을작성해보자.

More information

JTable과 MVC(Model-View-Controller) 구조 - 모델-뷰-컨트롤러구조는데이터의저장과접근에대한제공은모델이담당하고, 화면표시는뷰, 이벤트의처리는컨트롤러가하도록각역할을구분한구조이다. 즉, 역할의분담을통하여상호간의영향을최소화하고각요소의독립성을보장하여독자

JTable과 MVC(Model-View-Controller) 구조 - 모델-뷰-컨트롤러구조는데이터의저장과접근에대한제공은모델이담당하고, 화면표시는뷰, 이벤트의처리는컨트롤러가하도록각역할을구분한구조이다. 즉, 역할의분담을통하여상호간의영향을최소화하고각요소의독립성을보장하여독자 JTable 에서사용하는 Model 객체 JTable - JTable은데이터베이스의검색결과를 GUI에보여주기위해사용되는컴포넌트이다. 가로와세로로구성된테이블을을사용해서행과열에데이터를위치시킨다. - JTable을사용하는방법은다음과같다. 1 테이블에출력될데이터를 2차원배열에저장한다. Object[][] records = { {..., {..., {... ; 2 제목으로사용할문제열을

More information

비긴쿡-자바 00앞부속

비긴쿡-자바 00앞부속 IT COOKBOOK 14 Java P r e f a c e Stay HungryStay Foolish 3D 15 C 3 16 Stay HungryStay Foolish CEO 2005 L e c t u r e S c h e d u l e 1 14 PPT API C A b o u t T h i s B o o k IT CookBook for Beginner Chapter

More information

Microsoft PowerPoint 자바-AWT컴포넌트(Ch8).pptx

Microsoft PowerPoint 자바-AWT컴포넌트(Ch8).pptx 5. 배치관리자 1 AWT 컴포넌트 1. AWT 프로그램과이벤트 2. Component 클래스 3. 메뉴 4. 컨테이너와컨트롤 AWT AWT: Abstract t Window Toolkit GUI 를만들기위한 API 윈도우프로그래밍을위한클래스와도구를포함 Graphical User Interface 그래픽요소를통해프로그램과대화하는방식 그래픽요소를 GUI 컴포넌트라함

More information

Microsoft PowerPoint - java1-lecture11.ppt [호환 모드]

Microsoft PowerPoint - java1-lecture11.ppt [호환 모드] Overview Swing Component 514760-1 2018 년봄학기 5/22/2018 박경신 JLabel, ImageIcon JTextField, JTextArea JButton, JCheckBox, JRadioButton JSlider, JComboBox JPanel, JScrollPane, JOptionPane JTable Timer JFileChooser,

More information

PowerPoint Presentation

PowerPoint Presentation 객체지향프로그래밍 이벤트처리 손시운 ssw5176@kangwon.ac.kr 이벤트 - 구동프로그래밍 이벤트 - 구동프로그래밍 (event-driven programming): 프로그램의실행이이벤트의발생에의하여결정되는방식 2 이벤트처리과정 3 이벤트리스너 발생된이벤트객체에반응하여서이벤트를처리하는객체를이벤트리스너 (event listener) 라고한다. 4 이벤트처리과정

More information

PowerPoint Presentation

PowerPoint Presentation public class SumTest { public static void main(string a1[]) { int a, b, sum; a = Integer.parseInt(a1[0]); b = Integer.parseInt(a1[1]); sum = a + b ; // 두수를더하는부분입니다 System.out.println(" 두수의합은 " + sum +

More information

Microsoft PowerPoint - java1-lecture11.ppt [호환 모드]

Microsoft PowerPoint - java1-lecture11.ppt [호환 모드] 자바에서의그래픽 그래픽스, 이미지 514760-1 2019 년봄학기 6/4/2019 박경신 자바그래픽의두가지방법 간단한그래픽 // (1) 프레임생성하기 public class BasicPaint { JFrame f = new JFrame(" 그래픽기초프로그램 "); f.setdefaultcloseoperation(jframe.exit_on_close); f.setsize(300,

More information

PowerPoint Presentation

PowerPoint Presentation 객체지향프로그래밍 그래픽사용자인터페이스 손시운 ssw5176@kangwon.ac.kr 그래픽사용자인터페이스 그래픽사용자인터페이스 (Graphical User Interface, 간단히 GUI) 는컴포넌 트들로구성된다. 2 자바에서 GUI 의종류 GUI AWT(Abstract Windows Toolkit) AWT 는운영체제가제공하는자원을이용하여서컴포넌트를생성

More information

PowerPoint Presentation

PowerPoint Presentation 객체지향프로그래밍 인터페이스, 람다식, 패키지 ( 실습 ) 손시운 ssw5176@kangwon.ac.kr 예제 1. 홈네트워킹 public interface RemoteControl { public void turnon(); // 가전제품을켠다. public void turnoff(); // 가전제품을끈다. 인터페이스를구현 public class Television

More information

Microsoft PowerPoint - java2-lecture5.ppt [호환 모드]

Microsoft PowerPoint - java2-lecture5.ppt [호환 모드] 자바에서 GUI 의종류 자바 GUI & 이벤트처리 514770-1 2017 년봄학기 4/19/2017 박경신 AWT(Abstract Windows Toolkit) 운영체제가제공하는자원을이용하여서컴포넌트를생성한다. SWING 스윙컴포넌트가자바로작성되어있기때문에어떤플랫폼에서도일관된화면을보여줄수있다. AWT AWT(Abstract Windows Toolkit) 자바가처음나왔을때함께배포된

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 그래픽 배효철 th1g@nate.com 1 목차 스윙컴포넌트그리기 자바의그래픽좌표시스템 Graphics 2 스윙컴포넌트그리기 스윙의그리기기본철학 모든컴포넌트는자신의모양을스스로그린다. 컨테이너는자신을그린후자식들에게그리기지시 public void paintcomponent(graphics g) 스윙컴포넌트가자신의모양을그리는메소드 JComponent 의메소드 모든스윙컴포넌트가이메소드를가지고있음

More information

Microsoft PowerPoint - Java7.pptx

Microsoft PowerPoint - Java7.pptx HPC & OT Lab. 1 HPC & OT Lab. 2 실습 7 주차 Jin-Ho, Jang M.S. Hanyang Univ. HPC&OT Lab. jinhoyo@nate.com HPC & OT Lab. 3 Component Structure 객체 (object) 생성개념을이해한다. 외부클래스에대한접근방법을이해한다. 접근제어자 (public & private)

More information

JMF1_심빈구.PDF

JMF1_심빈구.PDF JSTORM http://wwwjstormpekr Issued by: < > Revision: Document Information Document title: Document file name: Revision number: Issued by: 1_ doc Issue Date:

More information

Microsoft PowerPoint - java1-lecture10.ppt [호환 모드]

Microsoft PowerPoint - java1-lecture10.ppt [호환 모드] 그래픽사용자인터페이스 그래픽사용자인터페이스이벤트객체, 리스너 그래픽사용자인터페이스 (Graphical User Interface, 간단히 GUI) 는컴포넌트들로구성된다. 514760-1 2018 년봄학기 5/15/2018 박경신 자바에서 GUI 의종류 AWT(Abatract Windows Toolkit) 운영체제가제공하는자원을이용하여서컴포넌트를생성한다. SWING

More information

8장.그래픽 프로그래밍

8장.그래픽 프로그래밍 윈도우프레임 도형그리기색과폰트이미지그리기그리기응용 2 윈도우프레임 제목표시줄을갖는윈도우를의미 생성과정 1 JFrame 객체생성 2 프레임의크기설정 3 프레임의제목설정 4 기본닫힘연산지정 5 프레임이보이도록만듦. 3 윈도우프레임예제 [ 예제 8.1 - EmptyFrameViewer.java] import javax.swing.*; public class EmptyFrameViewer

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 @ Lesson 3 if, if else, if else if, switch case for, while, do while break, continue : System.in, args, JOptionPane for (,, ) @ vs. logic data method variable Data Data Flow (Type), ( ) @ Member field

More information

중간고사

중간고사 기말고사 담당교수 : 단국대학교응용컴퓨터공학박경신 답은반드시답안지에기술할것. 공간이부족할경우반드시답안지몇쪽의뒤에있다고명기한 후기술할것. 그외의경우의답안지뒤쪽이나연습지에기술한내용은답안으로인정안함. 답 에는반드시네모를쳐서확실히표시할것. 답안지에학과, 학번, 이름외에본인의암호 (4 자리숫자 ) 를기입하면성적공고시학번대신암호를 사용할것임. // ArithmeticOperator

More information

JMF2_심빈구.PDF

JMF2_심빈구.PDF JMF JSTORM http://wwwjstormpekr Issued by: < > Document Information Document title: Document file name: Revision number: Issued by: JMF2_ doc Issue Date: Status: < > raica@nownurinet

More information

5장.key

5장.key JAVA Programming 1 (inheritance) 2!,!! 4 3 4!!!! 5 public class Person {... public class Student extends Person { // Person Student... public class StudentWorker extends Student { // Student StudentWorker...!

More information

No Slide Title

No Slide Title 그래픽사용자인터페이스 이충기 명지대학교컴퓨터공학과 그래픽사용자인터페이스 그래픽사용자인터페이스 (GUI) 는사람과컴퓨터간의상호작용을위한사람 - 컴퓨터인터페이스 (HCI) 중의하나이다. GUI 는사용자가컴퓨터화면상에있는객체들과상호작용을하는인터페이스이다. 오늘날사실상거의모든컴퓨터플랫폼에서 GUI 가사용되고있다. 2 GUI 프로그래밍 GUI 프로그램은실행시키면메뉴가있는창이뜨고창에는아이콘,

More information

10-Java Applet

10-Java Applet JAVA Programming Language JAVA Applet Java Applet >APPLET< >PARAM< HTML JAR 2 JAVA APPLET HTML HTML main( ). public Applet 3 (HelloWorld.html) Applet

More information

Java Coding Standard

Java Coding Standard Revision ÿ JSTORM http:www.jstorm.pe.kr Revision: Document Information Document title: Document file name: ( ÿ, 1.0,draft).doc Revision number: Issued by: < ÿ > (mailto:

More information

01-OOPConcepts(2).PDF

01-OOPConcepts(2).PDF Object-Oriented Programming Concepts Tel: 02-824-5768 E-mail: hhcho@selabsoongsilackr? OOP (Object) (Encapsulation) (Message) (Class) (Inheritance) (Polymorphism) (Abstract Class) (Interface) 2 1 + = (Dependency)

More information

쉽게 풀어쓴 C 프로그래밍

쉽게 풀어쓴 C 프로그래밍 Power Java 제 23 장스레드 이번장에서학습할내용 스레드의개요 스레드의생성과실행 스레드상태 스레드의스케줄링 스레드간의조정 스레드는동시에여러개의프로그램을실행하는효과를냅니다. 멀티태스킹 멀티태스킹 (muli-tasking) 는여러개의애플리케이션을동시에실행하여서컴퓨터시스템의성능을높이기위한기법 스레드란? 다중스레딩 (multi-threading) 은하나의프로그램이동시에여러가지작업을할수있도록하는것

More information

歯제9장.PDF

歯제9장.PDF 9 (Swing) Model-View-Controller 1 8 GUI(Graphic User Interface) GUI (swing) (architecture),,, look and feel AWT 2 (frame work) Kim Topley Core Java Foundation Classes (Prentice Hall 1998) - - ( Model-View-Controller

More information

Cluster management software

Cluster management software 자바네트워크프로그래밍 (OCJP 국제공인자격취득중심 ) 충북대학교 최민 java.awt Package java.awt 패키지는자바애플리케이션프로그래밍인터페이스 (API : Application Programming Interface) 의일부로서그래픽처리를담당하는컴포넌트들을포함합니다. 즉, 화면상에윈도우를그리고, 그위에버튼이나텍스트필드등을붙이는데필요한 GUI

More information

(Microsoft PowerPoint - java1-lecture7.ppt [\310\243\310\257 \270\360\265\345])

(Microsoft PowerPoint - java1-lecture7.ppt [\310\243\310\257 \270\360\265\345]) 그래픽사용자인터페이스 그래픽사용자인터페이스이벤트객체, 리스너 그래픽사용자인터페이스 (Graphical User Interface, 간단히 GUI) 는컴포넌트들로구성된다. 514760-1 2016 년가을학기 11/10/2016 박경신 자바에서 GUI 의종류 AWT(Abatract Windows Toolkit) 운영체제가제공하는자원을이용하여서컴포넌트를생성한다.

More information

untitled

untitled - -, (insert) (delete) - - (insert) (delete) (top ) - - (insert) (rear) (delete) (front) A A B top A B C top push(a) push(b) push(c) A B top pop() top A B D push(d) top #define MAX_STACK_SIZE 100 int

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 명품 JAVA Essential 1 2 학습목표 1. 멀티태스킹과스레드의개념이해 2. Thread 클래스를상속받아자바스레드만들기 3. Runnable 인터페이스를구현하여자바스레드만들기 4. 스레드종료시키기 5. 스레드의동기화개념과필요성이해 6. synchronized로간단한스레드동기화 7. wait()-notify() 로간단한스레드동기화 멀티태스킹 (multi-tasking)

More information

Microsoft Word - java19-1-final-answer.doc

Microsoft Word - java19-1-final-answer.doc 기말고사 담당교수 : 단국대학교응용컴퓨터공학박경신 답은반드시답안지에기술할것. 공간이부족할경우반드시답안지몇쪽의뒤에있다고명기한후기술할것. 그외의경우의답안지뒤쪽이나연습지에기술한내용은답안으로인정안함. 답에는반드시네모를쳐서확실히표시할것. 답안지에학과, 학번, 이름외에본인의암호 (4자리숫자 ) 를기입하면성적공고시학번대신암호를 사용할것임. 1. 다음코드의실행결과를적어라

More information

13ÀåÃß°¡ºÐ

13ÀåÃß°¡ºÐ 13 CHAPTER 13 CHAPTER 2 3 4 5 6 7 06 android:background="#ffffffff"> 07

More information

Cluster management software

Cluster management software 자바프로그래밍 (OCJP 국제공인자격취득중심 ) 충북대학교정보통신공학부 최민 이벤트처리 지금까지 GUI 를구성하는 Component 의종류와이 Component 들을 Container 위에적절하게배치하기위한 LayoutManager 를학습하였음 앞에서만들었던 GUI 프로그램은모양만그럴듯할뿐, 실제 Button 을누르거나, Frame 우측상단의 X 표시를클릭해도아무런동작을하지않음이벤트처리가포함되어있지않기때문

More information

Interstage5 SOAP서비스 설정 가이드

Interstage5 SOAP서비스 설정 가이드 Interstage 5 Application Server ( Solaris ) SOAP Service Internet Sample Test SOAP Server Application SOAP Client Application CORBA/SOAP Server Gateway CORBA/SOAP Gateway Client INTERSTAGE SOAP Service

More information

DB 에데이터저장을위한입력창설계 - JLabel, JTextField, JButton 을이용한입력창설계 - 2 -

DB 에데이터저장을위한입력창설계 - JLabel, JTextField, JButton 을이용한입력창설계 - 2 - Swing 을이용한 DB 작업 Swing Swing은 AWT와함께 Java2에추가된 GUI 처리패키지이다. AWT는해당컴퓨터의 OS가가지고있는컴포넌트를이용하기때문에사용컴퓨터에종속적인 GUI를제공한다. 그러므로, OS의종류에따라화면에출력되는 GUI가다르게된다. 반면에 Swing은 JVM이직접 Swing 패키지를사용해서구현하기때문에 OS가서로달라도동일한화면을제공하는장점을가지고있다.

More information

Microsoft PowerPoint - java2-lecture6.ppt [호환 모드]

Microsoft PowerPoint - java2-lecture6.ppt [호환 모드] Multi-tasking vs Thread Thread & Multitasking 멀티태스킹 (Multi-tasking) 하나의응용프로그램이여러개의작업 ( 태스크 ) 을동시에처리 스레드 (Thread) 마치바늘이하나의실 (thread) 을가지고바느질하는것과자바의스레드는일맥상통함 514770 2018 년가을학기 11/19/2018 박경신 다림질하면서이어폰으로전화하는주부운전하면서화장하는운전자제품의판독과포장작업의두기능을갖춘기계

More information

Microsoft Word - java18-1-final-answer.doc

Microsoft Word - java18-1-final-answer.doc 기말고사 담당교수 : 단국대학교응용컴퓨터공학박경신 답은반드시답안지에기술할것. 공간이부족할경우반드시답안지몇쪽의뒤에있다고명기한후기술할것. 그외의경우의답안지뒤쪽이나연습지에기술한내용은답안으로인정안함. 답에는반드시네모를쳐서확실히표시할것. 답안지에학과, 학번, 이름외에본인의암호 (4자리숫자 ) 를기입하면성적공고시학번대신암호를사용할것임. 1. 다음 sub1 과 sub2

More information

(Microsoft PowerPoint - java2-lecture6.ppt [\310\243\310\257 \270\360\265\345])

(Microsoft PowerPoint - java2-lecture6.ppt [\310\243\310\257 \270\360\265\345]) 멀티태스킹과스레드개념 Thread & Multitasking 멀티태스킹 (Multi-tasking) 하나의응용프로그램이여러개의작업 ( 태스크 ) 을동시에처리 스레드 (Thread) 마치바늘이하나의실 (thread) 을가지고바느질하는것과자바의스레드는일맥상통함 514770-1 2017 년봄학기 5/10/2017 박경신 다림질하면서이어폰으로전화하는주부운전하면서화장하는운전자제품의판독과포장작업의두기능을갖춘기계

More information

제8장 자바 GUI 프로그래밍 II

제8장 자바 GUI 프로그래밍 II 프로그래머를위한 Java 2, 4 판 제8장자바 GUI 프로그래밍 II 8.1 MVC 스윙모델 MVC (Model, View, Controller) 모델 스윙은 MVC 모델에기초를두고있다. MVC란 Xerox의연구소에서 Smalltalk 언어를바탕으로사용자인터페이스를개발하기위한방법 MVC는 3개의구성요소로구성 Model : 응용프로그램의자료를표현하기위한모델

More information

자바 프로그래밍

자바 프로그래밍 5 (kkman@mail.sangji.ac.kr) (Class), (template) (Object) public, final, abstract [modifier] class ClassName { // // (, ) Class Circle { int radius, color ; int x, y ; float getarea() { return 3.14159

More information

웹연동 } 웹 (Web) 환경에서데이터베이스시스템을연동하는방법은다음과같다 } Server Client 구조의통신 (2-Tier) } Server Middleware Client 구조의통신 (3-Tier) 2

웹연동 } 웹 (Web) 환경에서데이터베이스시스템을연동하는방법은다음과같다 } Server Client 구조의통신 (2-Tier) } Server Middleware Client 구조의통신 (3-Tier) 2 DB 와 WEB 연동 (1) [2-Tier] Java Applet 이용 웹연동 } 웹 (Web) 환경에서데이터베이스시스템을연동하는방법은다음과같다 } Server Client 구조의통신 (2-Tier) } Server Middleware Client 구조의통신 (3-Tier) 2 JAVA Applet 을이용한 Client Server 연동기법 } Applet

More information

(Microsoft PowerPoint - LZVNQBAJWGTC.ppt [\310\243\310\257 \270\360\265\345])

(Microsoft PowerPoint - LZVNQBAJWGTC.ppt [\310\243\310\257 \270\360\265\345]) GUI 인터페이스의이벤트 학습목표 윈도우환경에서작성된 GUI 인터페이스의이벤트개념을이해한다. 다양한컴포넌트에대한이벤트를처리한다 이벤트란? 자바이벤트란 사용자가키보드, 마우스등의장치로부터 AWT 컴포넌트에발생시키는모든사건을의미 이벤트주도형프로그램은사용자로부터발생된이벤트를처리하여사용자와상호작용을가능하게함 자바이벤트모델 컴퓨터 키보드 운영체제 마우스 이벤트객체자바가상머신이벤트소스객체이벤트리스너객체애플리케이션

More information

Orcad Capture 9.x

Orcad Capture 9.x OrCAD Capture Workbook (Ver 10.xx) 0 Capture 1 2 3 Capture for window 4.opj ( OrCAD Project file) Design file Programe link file..dsn (OrCAD Design file) Design file..olb (OrCAD Library file) file..upd

More information

fundamentalOfCommandPattern_calmglow_pattern_jstorm_1.0_f…

fundamentalOfCommandPattern_calmglow_pattern_jstorm_1.0_f… Command JSTORM http://www.jstorm.pe.kr Command Issued by: < > Revision: Document Information Document title: Command Document file name: Revision number: Issued by: Issue

More information

오버라이딩 (Overriding)

오버라이딩 (Overriding) WindowEvent WindowEvent 윈도우가열리거나 (opened) 닫힐때 (closed) 활성화되거나 (activated) 비활성화될때 (deactivated) 최소화되거나 (iconified) 복귀될때 (deiconified) 윈도우닫힘버튼을누를때 (closing) WindowEvent 수신자 abstract class WindowListener

More information

신림프로그래머_클린코드.key

신림프로그래머_클린코드.key CLEAN CODE 6 11st Front Dev. Team 6 1. 2. 3. checked exception 4. 5. 6. 11 : 2 4 : java (50%), javascript (35%), SQL/PL-SQL (15%) : Spring, ibatis, Oracle, jquery ? , (, ) ( ) 클린코드를 무시한다면 . 6 1. ,,,!

More information

Microsoft PowerPoint - 06-Chapter09-Event.ppt

Microsoft PowerPoint - 06-Chapter09-Event.ppt AWT 이벤트처리하기 1. 이벤트처리방식 2. 이벤트클래스와리스너 3. 이벤트어댑터 4. 이벤트의종류 이벤트 (Event) 이벤트 사용자가 UI 컴포넌트에대해취하는행위로인한사건이벤트기반프로그래밍 무한루프를돌면서사용자의행위로인한이벤트를청취하여응답하는형태로작동하는프로그래밍 java.awt.event 이벤트처리 AWT 컴포넌트에서발생하는다양한이벤트를처리하기위한인터페이스와클래스제공

More information

자바로

자바로 ! from Yongwoo s Park ZIP,,,,,,,??!?, 1, 1 1, 1 (Snow Ball), /,, 5,,,, 3, 3, 5, 7,,,,,,! ,, ZIP, ZIP, images/logojpg : images/imageszip :, backgroundjpg, shadowgif, fallgif, ballgif, sf1gif, sf2gif, sf3gif,

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 명품 JAVA Programming 1 제 14 장고급스윙컴포넌트 메뉴만들기 2 메뉴만들기에필요한스윙컴포넌트 JMenuBar 메뉴바의기능을하는컴포넌트 JMenu 파일, 편집등하나의메뉴기능을하는컴포넌트 JMenuItem 파일메뉴내에저장등의세부기능을하는컴포넌트 JMenu 컴포넌트 JMenuBar 컴포넌트 separator JMenuItem 컴포넌트 메뉴만드는과정

More information

mytalk

mytalk 한국정보보호학회소프트웨어보안연구회 총괄책임자 취약점분석팀 안준선 ( 항공대 ) 도경구 ( 한양대 ) 도구개발팀도경구 ( 한양대 ) 시큐어코딩팀 오세만 ( 동국대 ) 전체적인 그림 IL Rules Flowgraph Generator Flowgraph Analyzer 흐름그래프 생성기 흐름그래프 분석기 O parser 중간언어 O 파서 RDL

More information

슬라이드 1

슬라이드 1 이벤트 () 란? - 사용자가입력장치 ( 키보드, 마우스등 ) 등을이용해서발생하는사건 - 이벤트를처리하는프로그램은이벤트가발생할때까지무한루프를돌면서대기상태에있는다. 이벤트가발생하면발생한이벤트의종류에따라특정한작업을수행한다. - 이벤트관련프로그램작성을위해 java.awt.event.* 패키지가필요 - 버튼을누른경우, 1 버튼클릭이벤트발생 2 발생한이벤트인식 ( 이벤트리스너가수행

More information

DocsPin_Korean.pages

DocsPin_Korean.pages Unity Localize Script Service, Page 1 Unity Localize Script Service Introduction Application Game. Unity. Google Drive Unity.. Application Game. -? ( ) -? -?.. 준비사항 Google Drive. Google Drive.,.. - Google

More information

Connection 8 22 UniSQLConnection / / 9 3 UniSQL OID SET

Connection 8 22 UniSQLConnection / / 9 3 UniSQL OID SET 135-080 679-4 13 02-3430-1200 1 2 11 2 12 2 2 8 21 Connection 8 22 UniSQLConnection 8 23 8 24 / / 9 3 UniSQL 11 31 OID 11 311 11 312 14 313 16 314 17 32 SET 19 321 20 322 23 323 24 33 GLO 26 331 GLO 26

More information

07 자바의 다양한 클래스.key

07 자바의 다양한 클래스.key [ 07 ] . java.lang Object, Math, String, StringBuffer Byte, Short, Integer, Long, Float, Double, Boolean, Character. java.util Random, StringTokenizer Calendar, GregorianCalendar, Date. Collection, List,

More information

ilist.add(new Integer(1))과 같이 사용하지 않고 ilist.add(1)과 같이 사용한 것은 자바 5.0에 추가된 기본 자료형과 해당 객체 자료 형과의 오토박싱/언박싱 기능을 사용한 것으로 오토박싱이란 자바 컴파일러가 객체를 요구하는 곳에 기본 자료형

ilist.add(new Integer(1))과 같이 사용하지 않고 ilist.add(1)과 같이 사용한 것은 자바 5.0에 추가된 기본 자료형과 해당 객체 자료 형과의 오토박싱/언박싱 기능을 사용한 것으로 오토박싱이란 자바 컴파일러가 객체를 요구하는 곳에 기본 자료형 바에 제네릭스(generics)를 도입하기 위한 연구는 이미 8년 전인 1996년부터라고 한다. 실제로 자바에 제네릭스를 도입하 는 몇 가지 방안들이 논문으로 나오기 시작한 것이 1998년 초임을 감 안하면 무려 8년이 지난 후에야 자바 5.0에 전격 채택되었다는 것은 이것이 얼마나 어려운 일이었나 하는 것을 보여준다. 자바의 스펙을 결정하는 표준화 절차인

More information

MAX+plus II Getting Started - 무작정따라하기

MAX+plus II Getting Started - 무작정따라하기 무작정 따라하기 2001 10 4 / Version 20-2 0 MAX+plus II Digital, Schematic Capture MAX+plus II, IC, CPLD FPGA (Logic) ALTERA PLD FLEX10K Series EPF10K10QC208-4 MAX+plus II Project, Schematic, Design Compilation,

More information

PowerPoint Presentation

PowerPoint Presentation 객체지향프로그래밍 클래스, 객체, 메소드 ( 실습 ) 손시운 ssw5176@kangwon.ac.kr 예제 1. 필드만있는클래스 텔레비젼 2 예제 1. 필드만있는클래스 3 예제 2. 여러개의객체생성하기 4 5 예제 3. 메소드가추가된클래스 public class Television { int channel; // 채널번호 int volume; // 볼륨 boolean

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 명품 JAVA Essential 1 2 학습목표 1. 스윙컴포넌트그리기와 paintcomponent() 활용 2. Graphics 객체에대한이해 3. 도형그리기와칠하기 4. 이미지그리기 5. repaint() 활용하기 6. 마우스와그래픽응용 스윙컴포넌트그리기, paintcomponent() 3 스윙의페인팅기본 모든컴포넌트는자신의모양을스스로그린다. 컨테이너는자신을그린후그위에자식컴포넌트들에게그리기지시

More information

Spring Boot/JDBC JdbcTemplate/CRUD 예제

Spring Boot/JDBC JdbcTemplate/CRUD 예제 Spring Boot/JDBC JdbcTemplate/CRUD 예제 오라클자바커뮤니티 (ojc.asia, ojcedu.com) Spring Boot, Gradle 과오픈소스인 MariaDB 를이용해서 EMP 테이블을만들고 JdbcTemplate, SimpleJdbcTemplate 을이용하여 CRUD 기능을구현해보자. 마리아 DB 설치는다음 URL 에서확인하자.

More information

제11장 프로세스와 쓰레드

제11장 프로세스와 쓰레드 제9장자바쓰레드 9.1 Thread 기초 (1/5) 프로그램 명령어들의연속 (a sequence of instruction) 프로세스 / Thread 실행중인프로그램 (program in execution) 프로세스생성과실행을위한함수들 자바 Thread 2 9.1 Thread 기초 (2/5) 프로세스단위작업의문제점 프로세스생성시오버헤드 컨텍스트스위치오버헤드

More information