import java.awt.Frame;

import java.awt.Graphics;

import java.awt.Image;

import java.awt.Toolkit;


public class MyFrame extends Frame{

private Image img; 

public MyFrame(){

Toolkit tk = Toolkit.getDefaultToolkit();

img = tk.getImage("res/nhnsvc.jpg");   //사진위치

}

public void paint(Graphics g){

String a = "ㅋㅋ";

super.paint(g);

g.drawLine(10, 20, 200, 200);

g.drawString(a, 50, 200 );

g.drawOval(20, 20, 300, 300);

g.drawImage(img, 10,10, this);

}

}



import java.awt.Frame;



public class Program {


public static void main(String[] args) 

{

Frame fm = new MyFrame();

fm.setVisible(true);

fm.setSize(1024,768);  //윈도우 사이즈

}


}



package com.newlecture.game;


public class RankingView {


public void print() {

System.out.println("1. ㅡㅡㅡㅡ");

}


}



package com.newlecture.game;


public class StatusBar {


private String stat;

public StatusBar()

{

this.stat="black";

}

public void print() 

{

System.out.println("turn : "+this.stat);

}

public void stat(String stat)

{

this.stat = stat;

}


}



package com.newlecture.game;


public class OmokBoard {

private char [][]buf;  

private char [][]om;

private int width;

private int height;

private int count;

public OmokBoard(int width, int height) //생성자 - 초기값설정

{

count = 0;

buf = new char[30][40];

this.width = width;

this.height = height;

for(int i=0; i<height; i++)

for(int j=0; j<width; j++)

{

if(i==0 && j==0)

{

buf[i][j] = '┌';

}

else if (i ==height-1 && j==width-1)

{

buf[i][j] = '┘';

}

else if (i ==height-1 && j==0)

{

buf[i][j] = '└';

}

else if (i ==0&& j==width-1)

{

buf[i][j] = '┐';

}

else if (i ==0)

{

buf[i][j] = '┬';

}

else if (j==0)

{

buf[i][j] = '├';

}

else if (i==height-1)

{

buf[i][j] = '┴';

}

else if (j==width-1)

{

buf[i][j] = '┤';

}

else  

buf[i][j] = '┼';

}

}

public void print()

{

for(int i=0; i<height; i++)

{

for(int j=0; j<width; j++)

System.out.printf("%c",  buf[i][j]);

System.out.println();

}

}


public void put(Omok omok) 

{

int x=omok.getX();

int y=omok.getY();

if(buf[x-1][y-1] =='○' || buf[x-1][y-1] == '●')

System.out.println("다시놔주세요");

else if(count%2 == 0)

{

this.buf[x-1][y-1] = '●';

count++;

}

else

{

this.buf[x-1][y-1] = '○';

count++;

}

this.print();

}

}


+ Recent posts