//javac -encoding Unicode choi.java //appletviewer -encoding Unicode choi.html import java.awt.*; import java.applet.Applet; public class choi extends Applet { final int N = 9; final int NN = 7; int a = 9; int b = 3; final int MX = 56; final int MY = 10; String string[] = {"- -","▲玉","▲飛","▲角","▲金","▲銀","▲桂","▲香","▲歩" ,"▲成飛","▲成角","▲成銀","▲成桂","▲成香","▲成歩" ,"△玉","△飛","△角","△金","△銀","△桂","△香","△歩" ,"△成飛","△成角","△成銀","△成桂","△成香","△成歩"}; String string_m[] = {"無し","飛","角","金","銀","桂","香","歩" ,"飛2","角2","金2","金3","金4","銀2","銀3","銀4" ,"桂2","桂3","桂4","香2","香3","香4" ,"歩2","歩3","歩4","歩5","歩6","歩7","歩8","歩9" ,"歩10","歩11","歩12","歩13","歩14","歩15","歩16","歩17","歩18"}; Choice choice[][] = new Choice[N][N]; Choice choice_b[] = new Choice[NN]; Choice choice_w[] = new Choice[NN]; public void init() { for(int i = 0; i < N; i++) { for(int j = 0; j < N; j++) { choice[i][j] = new Choice(); for(int k = 0; k < string.length; k++) { choice[i][j].addItem(string[k]); } add( choice[i][j] ); } } choice[0][0].select(21); choice[1][0].select(20); choice[2][0].select(19); choice[3][0].select(18); choice[4][0].select(15); choice[5][0].select(18); choice[6][0].select(19); choice[7][0].select(20); choice[8][0].select(21); choice[1][1].select(16); choice[7][1].select(17); choice[0][2].select(22); choice[1][2].select(22); choice[2][2].select(22); choice[3][2].select(22); choice[4][2].select(22); choice[5][2].select(22); choice[6][2].select(22); choice[7][2].select(22); choice[8][2].select(22); choice[0][8].select(7); choice[1][8].select(6); choice[2][8].select(5); choice[3][8].select(4); choice[4][8].select(1); choice[5][8].select(4); choice[6][8].select(5); choice[7][8].select(6); choice[8][8].select(7); choice[7][7].select(2); choice[1][7].select(3); choice[0][6].select(8); choice[1][6].select(8); choice[2][6].select(8); choice[3][6].select(8); choice[4][6].select(8); choice[5][6].select(8); choice[6][6].select(8); choice[7][6].select(8); choice[8][6].select(8); for(int i = 0; i < NN; i++) { choice_b[i] = new Choice(); choice_w[i] = new Choice(); add( choice_b[i] ); add( choice_w[i] ); for(int j = 0; j < string_m.length; j++) { choice_b[i].addItem(string_m[j]); choice_w[i].addItem(string_m[j]); } } } public void paint( Graphics g ) { for( int i = 0; i < N; i++) { for( int j = 0; j < N; j++) { choice[i][j].setBounds(NN*a*i+MX+2, NN*a*j+MY, 60, 50); } } for(int i = 0; i < 7; i++) { choice_b[i].setBounds(2+MX+N*NN*a, 322+NN*b*i+MY, 50, 50); choice_w[i].setBounds(2, NN*b*i+MY, 50, 50); } for( int i = 0; i <= N; i++) { //g.drawLine( MX, MY, MX+N*NN*a, MY+N*NN*a); g.drawLine( MX, MY+NN*a*i, MX+N*NN*a, MY+NN*a*i); g.drawLine( MX+NN*a*i, MY, MX+NN*a*i, MY+N*NN*a); } } }
戻る