U E D R , A S I H C RSS

데블스캠프2004/금요일

1.1. Java

1.1.1.

PT하? PT .

. C , C++(), Smalltalk(vm) . Early History . (SeeAlso Java Early history
Java 한 Servlet-JSP , 2001 'JavaTM 2 Playtform 1.3,' J2SE . 1.4 1 , 1.5 8 . Java major upgrade
Java
. ActiveX . Rich Client ActiveX Flash . (2003) Java 80% applet J2EE J2ME .

--NeoCoin
; (__) --iruril
, . PT , . , . --NeoCoin

1.1.2.


1.1.2.1.
  • File -> New -> Project
    Java Project


1.1.2.2. Class
  • File -> New -> Class

1.1.2.3.
  • Run -> Run As -> Java Application

1.1.2.4.
  • (FirstJava.java)
    ~cpp           
    public class FirstJava {
      public static void main(String argv[]) {
        System.out.println("Hello world!");
      }
    }
    

1.1.3.


  • JFrame show() -> .

  • JFrame setBounds(int x, int y, int weight, int height)
    -> int 'x표', 'y표', '', ''


  • ~cpp 
    import javax.swing.*;
    
    public class FirstJava extends JFrame{
    	public FirstJava()
    	{
    		
    	}
    	public static void main(String args[]) {
    		FirstJava helloWorld = new FirstJava();
    		helloWorld.setBounds(100,100,800,600);
    		helloWorld.show();
    		
    		
    	}
    }
    

  • BufferedReader - , , 행 해,


    ~cpp 
    package WindowFrame;
    
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    
    import javax.swing.JFrame;
    
    public class WindowFrame {
        static BufferedReader breader;
        
        public WindowFrame(String title, int width, int height) {
            JFrame f = new JFrame(title);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setSize(width, height);
            f.show();
        }
        
        public static int inputInt() throws IOException {
            breader
            	= new BufferedReader(new InputStreamReader(System.in));
            return Integer.parseInt(breader.readLine());
        }
        public static String inputString() throws IOException {
            return breader.readLine();        
        }
        
        public static void main(String[] args) {
            breader = new BufferedReader(new InputStreamReader(System.in));
            try {
    	        System.out.print("  : ");
    	        String title = inputString();
    	        System.out.print(" : ");
    	        int w = inputInt();
    	        System.out.print(" : ");
    	        int h = inputInt();
            
    	        new WindowFrame(title, w, h);
            } catch(IOException ex) {
                ex.printStackTrace();
            }
        }
    }
     
    Swing_JFrame.gif

1.1.4.


  • java.awt.Graphics
  • public void paint(Graphics g)
    -> .

  • g.drawString(String string, int s, int y)
    -> int ' x표', ' y표'

  • g.drawLine(int startX, int startY, int endX, int endY)
    -> int ' x표', ' y표', ' x표', ' y표'

  • g.drawOval(int x, int y, int weight, int height)
    -> int ' x표', ' y표', ' ', ' '

  • g.fillOval(int x, int y, int weight, int height)
    -> int ' x표', ' y표', ' ', ' '


  • ~cpp 
    import java.awt.Graphics;
    import javax.swing.*;
    
    public class FirstJava extends JFrame{
    	public FirstJava()
    	{
    		
    	}
    	public static void main(String args[]) {
    		FirstJava helloWorld = new FirstJava();
    		helloWorld.setBounds(100,100,800,600);
    		helloWorld.show();
    		
    		
    	}
    	public void paint(Graphics g)
    	{
    		g.drawLine(100,100,300,300);
    		g.drawOval(200,200,400,400);
    		g.fillOval(500,500,100,100);
    	}
    }
    

1.1.5.

  • addMouseListener .
  • mouseClicked ->

    ~cpp 
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    
    import javax.swing.*;
    
    public class FirstJava extends JFrame{
    	public FirstJava()
    	{
            addMouseListener(new MouseAdapter() { 
                public void mouseClicked(MouseEvent e) {
                	int x = e.getX();
                	int y = e.getY();
                	
                	System.out.println("x 표 : " + x);
                	System.out.println("y 표 : " + y);
                }
    
            });
    	}
    	public static void main(String args[]) {
    		FirstJava helloWorld = new FirstJava();
    		helloWorld.setBounds(100,100,800,600);
    		helloWorld.show();
    		
    		
    	}
    }
    

1.1.6.1. paint 함

  • repaint()


~cpp 
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.*;

public class FirstJava extends JFrame{
	public FirstJava()
	{
        addMouseListener(new MouseAdapter() { 
            public void mouseClicked(MouseEvent e) {
            	int x = e.getX();
            	int y = e.getY();
            	
                  repaint();

            }

        });
	}
	public static void main(String args[]) {
		FirstJava helloWorld = new FirstJava();
		helloWorld.setBounds(100,100,800,600);
		helloWorld.show();
		
		
	}
         public void paint(Graphics g)
         {
                  System.out.print("Click!! ");
         }
}

2.

Programmer's Toolkit

3. : Programming

~cpp 
6
0 0
222244451
999

Output

1 1 1 1 1 0
0 0 0 0 1 0    
0 0 0 0 1 0
0 0 0 0 2 0
0 0 0 1 0 0
0 0 0 0 0 0

5 
0 0 
22224444346 
999 

Output 
 
2 1 1 1 1  
1 0 0 0 2  
0 0 0 0 1  
0 0 0 0 1  
0 0 0 0 1  

3
0 0 
44220064 
999 

Output 
 
1 1 1  
1 1 1  
1 1 1  


4. Code Review - ?




5.

6. Structured Programming

7. HIPO

8. Paper Programming : HIPO

9. HIPO

10.

11. OOP

12. : CRC Card

13. OOP Demo 1 : Message ~ (Python)



, 해 c:\python23\python.exe 행해.
~cpp 
    from StarCraft import StarCraft 
    sc = StarCraft () 
    dir(sc)
    gateway = sc.createGateway () 
    dir(gateway)
    z1 = gateway.createZealot ()
    dir(z1)
    z1.move (160,160) 
    d1 = gateway.createDragoon () 
    dir(d1)
    d1.move (180,180) 
 
    z1.printHp() 
    z1.getPosition() 
    d1.printHp() 
    d1.getPosition() 
 
    z1.setAttackTarget(d1) 
    z1.printAttackTarget() 
    z1.getAttackTarget().printHp() 
    z1.getAttackTarget().getPosition() 
 
    z1.attack() 
    d1.printHp() 

14. OOP Demo 2 : Message ~ (Java & Eclipse)

15.

16.1. Eclipse

16.2.1. Class

16.2.2. public static void main

16.2.3. : CRC

17.

18. interface

19. : 화 &

20. &

22.


1002
id : cvs_writer
pass: zeropager
, .
~cpp 
:pserver:cvs_writer@zeropage.org:/home/CVS

--NeoCoin

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:57
Processing time 0.0575 sec