(Java/FX ) Java CD Java version Java VC++ Python Ruby Java Java Eclipse Java Java 3 Java for Everyone 2 10 Java Midi Java JavaFX Shape Canvas C
|
|
|
- しょうこ にばし
- 6 years ago
- Views:
Transcription
1 (Java/FX ) Java CD Java version Java VC++ Python Ruby Java Java Eclipse Java Java 3 Java for Everyone 2 10 Java Midi Java JavaFX Shape Canvas Canvas Eclipse Eclipse M... 1
2 javafx e(fx)clipse Eclipse JavaFX 2
3 Java Eclispe Sudoku import javafx.application.application; public class Sudoku extends Application { public static void main(string... args) { } Sudoku Application Application import Sudoku public class Sudoku extends Application { Canvas canvas; int board_size = public void start(stage pstage) { Pane root = new Pane(); canvas = new Canvas(board_size, board_size); root.getchildren().add(canvas); drawcanvas(); Scene scene = new Scene(root); pstage.settitle(" "); pstage.setscene(scene); pstage.show(); void drawcanvas() { public static void main(string... args) { launch(args); } Canvas canvas canvas board_size start(stage pstage) start(stage pstage) Python Ruby canvas = new Canvas(board_size, board_size); drawcanvas() 3
4 void drawcanvas() { int k = 9; int s = board_size / (k+2); int w = (board_size-s*9)/2; int h = (board_size-s*9)/2; GraphicsContext gc = canvas.getgraphicscontext2d(); gc.setstroke(color.blue); for (int i=0; i<=9; i++) { if (i % 3 == 0) { gc.setlinewidth(2); gc.strokeline(w, h+i*s, w+9*s, h+i*s); else { gc.setlinewidth(1); gc.strokeline(w, h+i*s, w+9*s, h+i*s); for (int i=0; i<=9; i++) { if (i % 3 == 0) { gc.setlinewidth(2); gc.strokeline(w+i*s, h, w+i*s, h+9*s); else { gc.setlinewidth(1); gc.strokeline(w+i*s, h, w+i*s, h+9*s); import javafx.application.application; import javafx.scene.scene; import javafx.scene.canvas.canvas; import javafx.scene.canvas.graphicscontext; import javafx.scene.layout.pane; import javafx.scene.paint.color; import javafx.stage.stage; public class Sudoku extends Application { Canvas canvas; int board_size = public void start(stage pstage) { Pane root = new Pane(); 4
5 canvas = new Canvas(board_size, board_size); root.getchildren().add(canvas); drawcanvas(); Scene scene = new Scene(root); pstage.settitle(" "); pstage.setscene(scene); pstage.show(); void drawcanvas() { int k = 9; int s = board_size / (k+2); int w = (board_size-s*9)/2; int h = (board_size-s*9)/2; GraphicsContext gc = canvas.getgraphicscontext2d(); gc.setstroke(color.blue); for (int i=0; i<=9; i++) { if (i % 3 == 0) { gc.setlinewidth(2); gc.strokeline(w, h+i*s, w+9*s, h+i*s); else { gc.setlinewidth(1); gc.strokeline(w, h+i*s, w+9*s, h+i*s); for (int i=0; i<=9; i++) { if (i % 3 == 0) { gc.setlinewidth(2); gc.strokeline(w+i*s, h, w+i*s, h+9*s); else { gc.setlinewidth(1); gc.strokeline(w+i*s, h, w+i*s, h+9*s); public static void main(string... args) { launch(args); } 5
6 import javafx.application.application; import javafx.scene.scene; import javafx.scene.canvas.canvas; import javafx.scene.canvas.graphicscontext; import javafx.scene.layout.pane; import javafx.scene.paint.color; import javafx.stage.stage; import javafx.application.application; import Eclipse drawcanvas() int i = 1, j = 1; int n = 9; gc.setfont(new Font("courier", 50)); gc.setstroke(color.black); gc.settextalign(textalignment.center); 6
7 gc.filltext(string.valueof(n), w+(i+0.5)*s, h+(j+0.9)*s); i = 8; j = 8; n = 5; gc.setfont(new Font(" ", 40)); gc.settextalign(textalignment.left); gc.stroketext(string.valueof(n), w+(i+0.1)*s, h+(j+0.9)*s); gc.stroketext(string.valueof(n), w+(i+0.1)*s, h+(j+0.9)*s); gc.stroketext() gc.settextalign(textalignment.left); gc.settextalign(textalignment.center); y 7
8 gc.setfont(new Font("courier", 50)); gc.setstroke(color.black); ban ban int[][] ban = { {0,1,0,0,0,0,9,0,3}, {0,9,0,0,0,7,0,0,0}, {0,0,0,0,0,0,0,7,1}, {6,0,9,0,0,0,0,0,0}, {0,0,7,6,0,0,0,0,0}, {2,0,0,8,0,5,0,0,0}, {0,0,4,0,0,8,0,0,0}, {0,3,0,0,2,0,0,0,0}, {0,0,8,5,3,0,0,9,4}}; 2 drawcanvas() gc.setfont(new Font("courier", 50)); gc.setstroke(color.black); gc.settextalign(textalignment.center); for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { if (ban[j][i] >0) { gc.filltext(string.valueof(ban[j][i]), w+(i+0.5)*s, h+(j+0.9)*s); import javafx.application.application; import javafx.scene.scene; import javafx.scene.canvas.canvas; import javafx.scene.canvas.graphicscontext; import javafx.scene.layout.pane; import javafx.scene.paint.color; import javafx.scene.text.font; import javafx.scene.text.textalignment; import javafx.stage.stage; public class Sudoku extends Application { Canvas canvas; int board_size = 500; 8
9 int[][] ban = { {0,1,0,0,0,0,9,0,3}, {0,9,0,0,0,7,0,0,0}, {0,0,0,0,0,0,0,7,1}, {6,0,9,0,0,0,0,0,0}, {0,0,7,6,0,0,0,0,0}, {2,0,0,8,0,5,0,0,0}, {0,0,4,0,0,8,0,0,0}, {0,3,0,0,2,0,0,0,0}, public void start(stage pstage) { Pane root = new Pane(); canvas = new Canvas(board_size, board_size); root.getchildren().add(canvas); drawcanvas(); Scene scene = new Scene(root); pstage.settitle(" "); pstage.setscene(scene); pstage.show(); void drawcanvas() { int k = 9; int s = board_size / (k+2); int w = (board_size-s*9)/2; int h = (board_size-s*9)/2; GraphicsContext gc = canvas.getgraphicscontext2d(); gc.setstroke(color.blue); for (int i=0; i<=9; i++) { if (i % 3 == 0) { gc.setlinewidth(3); gc.strokeline(w, h+i*s, w+9*s, h+i*s); else { gc.setlinewidth(1); gc.strokeline(w, h+i*s, w+9*s, h+i*s); for (int i=0; i<=9; i++) { if (i % 3 == 0) { gc.setlinewidth(3); 9
10 gc.strokeline(w+i*s, h, w+i*s, h+9*s); else { gc.setlinewidth(1); gc.strokeline(w+i*s, h, w+i*s, h+9*s); gc.setfont(new Font("courier", 50)); gc.setstroke(color.black); gc.settextalign(textalignment.center); for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { if (ban[j][i] >0) { gc.filltext(string.valueof(ban[j][i]), w+(i+0.5)*s, h+(j+0.9)*s); public static void main(string... args) { launch(args); } if (i % 3 == 0) { gc.setlinewidth(3); gc.strokeline(w, h+i*s, w+9*s, h+i*s); else { gc.setlinewidth(1); gc.strokeline(w, h+i*s, w+9*s, h+i*s); 10
11 start(stage pstage) public void start(stage pstage) { MenuBar bar = new MenuBar(); Menu m1 = new Menu("Sample"); MenuItem sample1 = new MenuItem("Sample1"); MenuItem sample2 = new MenuItem("Sample2"); m1.getitems().addall(sample1, sample2); bar.getmenus().add(m1); VBox root = new VBox(); canvas = new Canvas(board_size, board_size); root.getchildren().addall(bar, canvas); drawcanvas(); Scene scene = new Scene(root); pstage.settitle(" "); pstage.setscene(scene); pstage.show(); 11
12 Pane root = new Pane(); VBox root = new VBox(); start(stage pstage) sample1.setonaction((event)->{ ban = ban1; drawcanvas(); ); sample2.setonaction((event)->{ ban = ban2; drawcanvas(); ); Sudoku 12
13 int[][] ban = { {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0} ; int[][] ban1 = { {0,1,0,0,0,0,9,0,3}, {0,9,0,0,0,7,0,0,0}, {0,0,0,0,0,0,0,7,1}, {6,0,9,0,0,0,0,0,0}, {0,0,7,6,0,0,0,0,0}, {2,0,0,8,0,5,0,0,0}, {0,0,4,0,0,8,0,0,0}, {0,3,0,0,2,0,0,0,0}, {0,0,8,5,3,0,0,9,4} ; int[][] ban2 = { {0,0,0,0,0,6,2,0,1}, {0,0,0,0,4,0,3,7,0}, {0,0,3,0,9,2,0,0,6}, {4,0,5,0,0,0,0,6,0}, {0,0,0,0,7,0,0,0,0}, {0,2,0,0,0,0,4,0,5}, {9,0,0,4,5,0,1,0,0}, {0,5,4,0,2,0,0,0,0}, {7,0,1,9,0,0,0,0,0} ; drawcanvas() 2 gc.clearrect(0, 0, board_size, board_size); import javafx.application.application; import javafx.scene.scene; import javafx.scene.canvas.canvas; import javafx.scene.canvas.graphicscontext; 13
14 import javafx.scene.control.menu; import javafx.scene.control.menubar; import javafx.scene.control.menuitem; import javafx.scene.layout.vbox; import javafx.scene.paint.color; import javafx.scene.text.font; import javafx.scene.text.textalignment; import javafx.stage.stage; public class Sudoku extends Application { Canvas canvas; int board_size = 500; int[][] ban = { {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0} ; int[][] ban1 = { {0,1,0,0,0,0,9,0,3}, {0,9,0,0,0,7,0,0,0}, {0,0,0,0,0,0,0,7,1}, {6,0,9,0,0,0,0,0,0}, {0,0,7,6,0,0,0,0,0}, {2,0,0,8,0,5,0,0,0}, {0,0,4,0,0,8,0,0,0}, {0,3,0,0,2,0,0,0,0}, {0,0,8,5,3,0,0,9,4} ; int[][] ban2 = { {0,0,0,0,0,6,2,0,1}, {0,0,0,0,4,0,3,7,0}, {0,0,3,0,9,2,0,0,6}, {4,0,5,0,0,0,0,6,0}, {0,0,0,0,7,0,0,0,0}, {0,2,0,0,0,0,4,0,5}, {9,0,0,4,5,0,1,0,0}, {0,5,4,0,2,0,0,0,0}, 14
15 {7,0,1,9,0,0,0,0,0} public void start(stage pstage) { MenuBar bar = new MenuBar(); Menu m1 = new Menu("Sample"); MenuItem sample1 = new MenuItem("Sample1"); MenuItem sample2 = new MenuItem("Sample2"); m1.getitems().addall(sample1, sample2); bar.getmenus().add(m1); VBox root = new VBox(); canvas = new Canvas(board_size, board_size); root.getchildren().addall(bar, canvas); drawcanvas(); Scene scene = new Scene(root); pstage.settitle(" "); pstage.setscene(scene); pstage.show(); sample1.setonaction((event)->{ ban = ban1; drawcanvas(); ); sample2.setonaction((event)->{ ban = ban2; drawcanvas(); ); void drawcanvas() { int k = 9; int s = board_size / (k+2); int w = (board_size-s*9)/2; int h = (board_size-s*9)/2; GraphicsContext gc = canvas.getgraphicscontext2d(); gc.clearrect(0, 0, board_size, board_size); gc.setstroke(color.blue); for (int i=0; i<=9; i++) { if (i % 3 == 0) { gc.setlinewidth(3); gc.strokeline(w, h+i*s, w+9*s, h+i*s); else { 15
16 gc.setlinewidth(1); gc.strokeline(w, h+i*s, w+9*s, h+i*s); for (int i=0; i<=9; i++) { if (i % 3 == 0) { gc.setlinewidth(3); gc.strokeline(w+i*s, h, w+i*s, h+9*s); else { gc.setlinewidth(1); gc.strokeline(w+i*s, h, w+i*s, h+9*s); gc.setfont(new Font("courier", 50)); gc.setstroke(color.black); gc.settextalign(textalignment.center); for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { if (ban[j][i] >0) { gc.filltext(string.valueof(ban[j][i]), w+(i+0.5)*s, h+(j+0.9)*s); public static void main(string... args) { launch(args); } 16
17 Sample1 Sample2 17
18 start(stage pstage) RadioButton rb1 = new RadioButton("Ban"); RadioButton rb2 = new RadioButton("Ans"); ToggleGroup group = new ToggleGroup(); rb1.settogglegroup(group);; rb2.settogglegroup(group);; rb1.setselected(true);; root.getchildren().addall(bar, canvas, rb1, rb2); 18
19 start(stage pstage) canvas.setonmouseclicked((event)->{ buttonpressed(event.getx(), event.gety()); ); Sudoku buttonpressed(double x, double y) void buttonpressed(double x, double y) { int k = 9; int s = board_size / (k+2); int w = (board_size-s*9)/2; int h = (board_size-s*9)/2; int i = (int) Math.floor((x - w) / s); int j = (int) Math.floor((y - h) / s); int n = 7; if (i >= 0 && i < 9 && j >= 0 && j < 9) { gc.setfont(new Font("courier", 50)); gc.setstroke(color.black); gc.settextalign(textalignment.center); gc.filltext(string.valueof(n), w+(i+0.5)*s, h+(j+0.9)*s); 19
20 gc drawcanvas() Sudoku GraphicsContext gc; drawcanvas() gc = canvas.getgraphicscontext2d(); import javafx.application.application; import javafx.scene.scene; import javafx.scene.canvas.canvas; import javafx.scene.canvas.graphicscontext; import javafx.scene.control.menu; import javafx.scene.control.menubar; import javafx.scene.control.menuitem; import javafx.scene.control.radiobutton; import javafx.scene.control.togglegroup; import javafx.scene.layout.vbox; import javafx.scene.paint.color; import javafx.scene.text.font; import javafx.scene.text.textalignment; import javafx.stage.stage; public class Sudoku extends Application { Canvas canvas; GraphicsContext gc; int board_size = 500; int[][] ban = { {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0} ; int[][] ban1 = { {0,1,0,0,0,0,9,0,3}, {0,9,0,0,0,7,0,0,0}, {0,0,0,0,0,0,0,7,1}, {6,0,9,0,0,0,0,0,0}, 20
21 {0,0,7,6,0,0,0,0,0}, {2,0,0,8,0,5,0,0,0}, {0,0,4,0,0,8,0,0,0}, {0,3,0,0,2,0,0,0,0}, {0,0,8,5,3,0,0,9,4} ; int[][] ban2 = { {0,0,0,0,0,6,2,0,1}, {0,0,0,0,4,0,3,7,0}, {0,0,3,0,9,2,0,0,6}, {4,0,5,0,0,0,0,6,0}, {0,0,0,0,7,0,0,0,0}, {0,2,0,0,0,0,4,0,5}, {9,0,0,4,5,0,1,0,0}, {0,5,4,0,2,0,0,0,0}, {7,0,1,9,0,0,0,0,0} public void start(stage pstage) { MenuBar bar = new MenuBar(); Menu m1 = new Menu("Sample"); MenuItem sample1 = new MenuItem("Sample1"); MenuItem sample2 = new MenuItem("Sample2"); m1.getitems().addall(sample1, sample2); bar.getmenus().add(m1); RadioButton rb1 = new RadioButton("Ban"); RadioButton rb2 = new RadioButton("Ans"); ToggleGroup group = new ToggleGroup(); rb1.settogglegroup(group);; rb2.settogglegroup(group);; rb1.setselected(true);; VBox root = new VBox(); canvas = new Canvas(board_size, board_size); root.getchildren().addall(bar, canvas, rb1, rb2); drawcanvas(); Scene scene = new Scene(root); pstage.settitle(" "); pstage.setscene(scene); pstage.show(); sample1.setonaction((event)->{ ban = ban1; 21
22 drawcanvas(); ); sample2.setonaction((event)->{ ban = ban2; drawcanvas(); } ); canvas.setonmouseclicked((event)->{ buttonpressed(event.getx(), event.gety()); ); void buttonpressed(double x, double y) { int k = 9; int s = board_size / (k+2); int w = (board_size-s*9)/2; int h = (board_size-s*9)/2; int i = (int) Math.floor((x - w) / s); int j = (int) Math.floor((y - h) / s); int n = 7; if (i >= 0 && i < 9 && j >= 0 && j < 9) { gc.setfont(new Font("courier", 50)); gc.setstroke(color.black); gc.settextalign(textalignment.center); gc.filltext(string.valueof(n), w+(i+0.5)*s, h+(j+0.9)*s); void drawcanvas() { int k = 9; int s = board_size / (k+2); int w = (board_size-s*9)/2; int h = (board_size-s*9)/2; gc = canvas.getgraphicscontext2d(); gc.clearrect(0, 0, board_size, board_size); gc.setstroke(color.blue); for (int i=0; i<=9; i++) { if (i % 3 == 0) { gc.setlinewidth(3); gc.strokeline(w, h+i*s, w+9*s, h+i*s); else { gc.setlinewidth(1); gc.strokeline(w, h+i*s, w+9*s, h+i*s); 22
23 for (int i=0; i<=9; i++) { if (i % 3 == 0) { gc.setlinewidth(3); gc.strokeline(w+i*s, h, w+i*s, h+9*s); else { gc.setlinewidth(1); gc.strokeline(w+i*s, h, w+i*s, h+9*s); gc.setfont(new Font("courier", 50)); gc.setstroke(color.black); gc.settextalign(textalignment.center); for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { if (ban[j][i] >0) { gc.filltext(string.valueof(ban[j][i]), w+(i+0.5)*s, h+(j+0.9)*s); public static void main(string... args) { launch(args); } 23
24 buttonpressed(double x, double y) void buttonpressed(double x, double y) { int k = 9; int s = board_size / (k+2); int w = (board_size-s*9)/2; int h = (board_size-s*9)/2; int i = (int) Math.floor((x - w) / s); int j = (int) Math.floor((y - h) / s); if (i >= 0 && i < 9 && j >= 0 && j < 9) { String str = " "; TextInputDialog dlg = new TextInputDialog(str); str = dlg.showandwait().orelse(""); if (str!= "") { int n = Integer.parseInt(str); ban[j][i] = n; drawcanvas(); 24
25 OK ans[][] Sudoku Sudoku int[][] ans = new int[9][9];; RadioButton rb1; RadioButton rb2; start(stage pstage) 25
26 rb1 = new RadioButton("Ban"); rb2 = new RadioButton("Ans"); sample1.setonaction() sample1.setonaction() sample1.setonaction((event)->{ ban = ban1; for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { ans[j][i] = ban[j][i]; drawcanvas(); ); sample2.setonaction((event)->{ ban = ban2; for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { ans[j][i] = ban[j][i]; drawcanvas(); ); buttonpressed(double x, double y) void buttonpressed(double x, double y) { int k = 9; int s = board_size / (k+2); int w = (board_size-s*9)/2; int h = (board_size-s*9)/2; int i = (int) Math.floor((x - w) / s); int j = (int) Math.floor((y - h) / s); if (i >= 0 && i < 9 && j >= 0 && j < 9) { String str = " "; TextInputDialog dlg = new TextInputDialog(str); str = dlg.showandwait().orelse(""); if (str!= "") { int n = Integer.parseInt(str); if (rb1.isselected()) { ban[j][i] = n; ans[j][i] = n; else { ans[j][i] = n; 26
27 drawcanvas(); drawcanvas() void drawcanvas() { int k = 9; int s = board_size / (k+2); int w = (board_size-s*9)/2; int h = (board_size-s*9)/2; gc = canvas.getgraphicscontext2d(); gc.clearrect(0, 0, board_size, board_size); gc.setstroke(color.blue); for (int i=0; i<=9; i++) { if (i % 3 == 0) { gc.setlinewidth(3); gc.strokeline(w, h+i*s, w+9*s, h+i*s); else { gc.setlinewidth(1); gc.strokeline(w, h+i*s, w+9*s, h+i*s); for (int i=0; i<=9; i++) { if (i % 3 == 0) { gc.setlinewidth(3); gc.strokeline(w+i*s, h, w+i*s, h+9*s); else { gc.setlinewidth(1); gc.strokeline(w+i*s, h, w+i*s, h+9*s); gc.setfont(new Font("courier", 50)); gc.settextalign(textalignment.center); for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { if (ban[j][i] >0) { gc.setfill(color.blue); gc.filltext(string.valueof(ban[j][i]), w+(i+0.5)*s, h+(j+0.9)*s); else if (ans[j][i] > 0) { gc.setfill(color.red); 27
28 gc.filltext(string.valueof(ans[j][i]), w+(i+0.5)*s, h+(j+0.9)*s); filltext() gc.setfill(color.blue); ban ans VC++ MenuBar bar = new MenuBar(); Menu m2 = new Menu("File"); MenuItem savemenu = new MenuItem("Save"); MenuItem openmenu = new MenuItem("Open"); m2.getitems().addall(savemenu, openmenu); Menu m1 = new Menu("Sample"); MenuItem sample1 = new MenuItem("Sample1"); MenuItem sample2 = new MenuItem("Sample2"); 28
29 m1.getitems().addall(sample1, sample2); bar.getmenus().addall(m2, m1); savemenu.setonaction((event)->{ try { FileChooser fc = new FileChooser(); File sf = fc.showsavedialog(pstage); if (sf!= null) { FileWriter fileout = new FileWriter(sf); for (int j=0; j<9; j++) { String str = ""; for (int i=0; i<9; i++) { str += String.valueOf(ban[j][i])+ " "; fileout.write(str + "\n"); for (int j=0; j<9; j++) { String str = ""; for (int i=0; i<9; i++) { str += String.valueOf(ans[j][i])+ " "; fileout.write(str + "\n"); fileout.close(); catch(exception e) {}; ); openmenu.setonaction((event)->{ try { FileChooser fc = new FileChooser(); File sf = fc.showopendialog(pstage); if (sf!= null) { FileReader filein = new FileReader(sf); BufferedReader buf = new BufferedReader(filein); String data; int row = 0; while ((data = buf.readline())!= null) { String[] sa = data.split(" "); if (row < 9) { for (int i=0; i<9; i++) { 29
30 ban[row][i] = Integer.parseInt(sa[i]); else { for (int i=0; i<9; i++) { ans[row-9][i] = Integer.parseInt(sa[i]); row++; filein.close(); catch(exception e) {}; drawcanvas(); ); 30
31 ban[][] ans[][] Open 31
32 1 9 Java Python Ruby set boolean[][][] hint[j][i][n] = true if n is candidate, = false if n is not candidate Sudoku boolean[][][] hint = new boolean[9][9][10]; 101 n 9 sample1.setonaction((event)->{ ban = ban1; for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { ans[j][i] = ban[j][i]; sethint(); drawcanvas(); ); sample2.setonaction((event)->{ 32
33 ban = ban2; for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { ans[j][i] = ban[j][i]; sethint(); drawcanvas(); ); sethint(); openmenu.setonaction((event)->{ try { FileChooser fc = new FileChooser(); File sf = fc.showopendialog(pstage); if (sf!= null) { FileReader filein = new FileReader(sf); BufferedReader buf = new BufferedReader(filein); String data; int row = 0; while ((data = buf.readline())!= null) { String[] sa = data.split(" "); if (row < 9) { for (int i=0; i<9; i++) { ban[row][i] = Integer.parseInt(sa[i]); else { for (int i=0; i<9; i++) { ans[row-9][i] = Integer.parseInt(sa[i]); row++; filein.close(); catch(exception e) {}; sethint(); drawcanvas(); ); 33
34 sethint(); sethint() void sethint() { int[][][] box = new int[9][9][2]; for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { int m = j / 3 * 3 + i / 3; int n = j % 3 * 3 + i % 3; box[m][n][0] = j; box[m][n][1] = i; for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { for (int n=1; n<=9; n++) { boolean flag = true; for (int k=0; k<9; k++) { if (ans[j][k]==n) { flag = false; break; for (int k=0; k<9; k++) { if (ans[k][i]==n) { flag = false; break; int m = j / 3 * 3 + i / 3; for (int k=0; k<9; k++) { if (ans[box[m][k][0]][box[m][k][1]]==n) { flag = false; break; hint[j][i][n] = flag; 34
35 void buttonpressed(double x, double y) { int k = 9; int s = board_size / (k+2); int w = (board_size-s*9)/2; int h = (board_size-s*9)/2; int i = (int) Math.floor((x - w) / s); int j = (int) Math.floor((y - h) / s); if (i >= 0 && i < 9 && j >= 0 && j < 9) { String str = " "; TextInputDialog dlg = new TextInputDialog(str); str = dlg.showandwait().orelse(""); if (str!= "") { int n = Integer.parseInt(str); if (rb1.isselected()) { ban[j][i] = n; ans[j][i] = n; else { ans[j][i] = n; sethint(); drawcanvas(); sethint(); drawcanvas() gc.setfont(new Font("courier", 12)); gc.settextalign(textalignment.center); gc.setfill(color.black); for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { if (ans[j][i] == 0) { for (int n=1; n<=9; n++) { if (hint[j][i][n]) { int r = (int) ((j+((n-1)/3*2+1.5)/6.0)*s); int l = (int) ((i+((n-1)%3*2+1)/6.0)*s); gc.filltext(string.valueof(n), w+l, h+r); 35
36 void drawcanvas() { int k = 9; int s = board_size / (k+2); int w = (board_size-s*9)/2; int h = (board_size-s*9)/2; gc = canvas.getgraphicscontext2d(); gc.clearrect(0, 0, board_size, board_size); gc.setstroke(color.blue); for (int i=0; i<=9; i++) { if (i % 3 == 0) { gc.setlinewidth(3); gc.strokeline(w, h+i*s, w+9*s, h+i*s); else { gc.setlinewidth(1); gc.strokeline(w, h+i*s, w+9*s, h+i*s); for (int i=0; i<=9; i++) { if (i % 3 == 0) { gc.setlinewidth(3); gc.strokeline(w+i*s, h, w+i*s, h+9*s); else { gc.setlinewidth(1); gc.strokeline(w+i*s, h, w+i*s, h+9*s); gc.setfont(new Font("courier", 50)); gc.settextalign(textalignment.center); for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { if (ban[j][i] >0) { gc.setfill(color.blue); gc.filltext(string.valueof(ban[j][i]), w+(i+0.5)*s, h+(j+0.9)*s); else if (ans[j][i] > 0) { gc.setfill(color.red); gc.filltext(string.valueof(ans[j][i]), w+(i+0.5)*s, h+(j+0.9)*s); 36
37 gc.setfont(new Font("courier", 12)); gc.settextalign(textalignment.center); gc.setfill(color.black); for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { if (ans[j][i] == 0) { for (int n=1; n<=9; n++) { if (hint[j][i][n]) { int r = (int) ((j+((n-1)/3*2+1.5)/6.0)*s); int l = (int) ((i+((n-1)%3*2+1)/6.0)*s); gc.filltext(string.valueof(n), w+l, h+r); 37
38 Sample (One-choice: A cell that contains only one candidate value) 1 (5,1) 38
39 1 (One-choice: A cell that contains only one candidate value) (One-place: A region(row, column, or block) that has only one cell available for a given number) 39
40 start(stage pstage) Button b1 = new Button(" 1 "); Button b2 = new Button(" 1 "); HBox hb = new HBox(); hb.getchildren().addall(b1, b2); root.getchildren().addall(bar, canvas, rb1, rb2, hb); 40
41 b1.setonaction((event) -> { setuniquesell(); ); start(stage pstage) setuniquesell() boolean setuniquesell() { boolean FLAG = false; for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { if (ans[j][i] > 0) continue; int count = 0; int index = -1; for (int n=1; n<=9; n++) { if (hint[j][i][n]) { count++; index = n; 41
42 if (count == 1) { ans[j][i] = index; FLAG = true; sethint(); drawcanvas(); return FLAG; boolean setuniquesell() void setuniquesell() Sample1 1 1 b2.setonaction((event) -> { setsinglecand(); ); 42
43 start(stage pstage) setsinglecand() boolean setsinglecand() { boolean F = false; int[][][] box = new int[9][9][2]; for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { int m = j / 3 * 3 + i / 3; int n = j % 3 * 3 + i % 3; box[m][n][0] = j; box[m][n][1] = i; for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { if (ans[j][i] > 0) continue; for (int n=1; n<=9; n++) { if (!hint[j][i][n]) continue; boolean flag = true; for (int k=0; k<9; k++) { if (k == i ans[j][k]>0) continue; if (hint[j][k][n]) { flag = false; break; if (flag) { ans[j][i] = n; F = true; sethint(); drawcanvas(); return F; flag = true; for (int k=0; k<9; k++) { if (k == j ans[k][i]>0) continue; if (hint[k][i][n]) { flag = false; break; if (flag) { ans[j][i] = n; 43
44 F = true; sethint(); drawcanvas(); return F; int m = j / 3 * 3 + i / 3; int p = j % 3 * 3 + i % 3; flag = true; for (int k=0; k<9; k++) { if (k == p ans[box[m][k][0]][box[m][k][1]]>0) continue; if (hint[box[m][k][0]][box[m][k][1]][n]) { flag = false; break; if (flag) { ans[j][i] = n; F = true; sethint(); drawcanvas(); return F; sethint(); drawcanvas(); return F; Sample1 1 44
45 Sample2 1 45
46 Button b3 = new Button(" "); start(stage pstage) hb.getchildren().addall(b1, b2, b3); regularplay() void regularplay() { boolean F= false; do { do { F = setuniquesell(); while (F); F = setsinglecand(); while (F); b3.setonaction((event) -> { regularplay(); drawcanvas(); ); 46
47 Sample2 Button b4 = new Button(" "); start(stage pstage) hb.getchildren().addall(b1, b2, b3, b4); 47
48 completep() boolean completep() { for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { if (ans[j][i] == 0) { return false; for (int j=0; j<9; j++) { for (int n=1; n<=9; n++) { boolean flag = false; for (int i=0; i<9; i++) { if (ans[j][i] == n) { flag = true; break; if (!flag) return false; 48
49 for (int i=0; i<9; i++) { for (int n=1; n<=9; n++) { boolean flag = false; for (int j=0; j<9; j++) { if (ans[j][i] == n) { flag = true; break; if (!flag) return false; int[][][] box = new int[9][9][2]; for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { int m = j / 3 * 3 + i / 3; int n = j % 3 * 3 + i % 3; box[m][n][0] = j; box[m][n][1] = i; for (int k=0; k<9; k++) { for (int n=1; n<=9; n++) { boolean flag = false; for (int i=0; i<9; i++) { if (ans[box[k][i][0]][box[k][i][1]] == n) { flag = true; break; if (!flag) return false; return true; losingp() boolean losingp() { sethint(); for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { 49
50 boolean flag = false; for (int n=1; n<=9; n++) { if (hint[j][i][n]) { flag = true; break; if (!flag) return true; for (int j=0; j<9; j++) { int[] P = {0,0,0,0,0,0,0,0,0,0}; for (int i=0; i<9; i++) { P[ans[j][i]] = P[ans[j][i]]+1; for (int n=1; n<=9; n++) { if (P[n] > 1) return true; for (int i=0; i<9; i++) { int[] P = {0,0,0,0,0,0,0,0,0,0}; for (int j=0; j<9; j++) { P[ans[j][i]] = P[ans[j][i]]+1; for (int n=1; n<=9; n++) { if (P[n] > 1) return true; int[][][] box = new int[9][9][2]; for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { int m = j / 3 * 3 + i / 3; int n = j % 3 * 3 + i % 3; box[m][n][0] = j; box[m][n][1] = i; for (int k=0; k<9; k++) { int[] P = {0,0,0,0,0,0,0,0,0,0}; for (int i=0; i<9; i++) { P[ans[box[k][i][0]][box[k][i][1]]] = 50
51 P[ans[box[k][i][0]][box[k][i][1]]]+1; for (int n=1; n<=9; n++) { if (P[n] > 1) return true; return false; b4.setonaction((event) -> { solver(); drawcanvas(); ); solver() boolean solver() { if (losingp()) { return false; if (completep()) return true; int jj = -1, ii = -1; boolean flag = false; out: for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { if (ans[j][i] == 0) { jj = j; ii = i; flag = true; break out; if (flag) { sethint(); boolean[] S = new boolean[10]; for (int n=1; n<=9; n++) S[n] = hint[jj][ii][n]; for (int n=1; n<=9; n++) { if (S[n]) { 51
52 ans[jj][ii] = n; if (solver()) return true; ans[jj][ii] = 0; return false; solver() boolean solver() { regularplay(); if (losingp()) { return false; if (completep()) return true; int jj = -1, ii = -1; boolean flag = false; 52
53 out: for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { if (ans[j][i] == 0) { jj = j; ii = i; flag = true; break out; if (flag) { int[][] tempans = new int[9][9]; for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { tempans[j][i] = ans[j][i]; sethint(); boolean[] S = new boolean[10]; for (int n=1; n<=9; n++) S[n] = hint[jj][ii][n]; for (int n=1; n<=9; n++) { if (S[n]) { ans[jj][ii] = n; if (solver()) return true; for (int j=0; j<9; j++) { for (int i=0; i<9; i++) { ans[j][i] = tempans[j][i]; ans[jj][ii] = 0; return false; 53
54 VC++ Python Java VC++ VC++ JavaFX Java 3 Java Java Python Ruby andoroid Kotlin Python Ruby Java Giulio Zambon Sudoku Programming with C Apress VC++ box[][][] 54
GIMP import javafx.application.application; import javafx.scene.scene; import javafx.scene.canvas.canvas; import javafx.scene.canvas.graphicscontext;
(JavaFX ) JavaFX 2 1. 2 2. 52 3. A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2 4. 13 5. 6. 7. 8. 9. 13 10. 11. 12. Java.gif 1 GIMP import javafx.application.application; import javafx.scene.scene; import javafx.scene.canvas.canvas;
K227 Java 2
1 K227 Java 2 3 4 5 6 Java 7 class Sample1 { public static void main (String args[]) { System.out.println( Java! ); } } 8 > javac Sample1.java 9 10 > java Sample1 Java 11 12 13 http://java.sun.com/j2se/1.5.0/ja/download.html
Java (9) 1 Lesson Java System.out.println() 1 Java API 1 Java Java 1
Java (9) 1 Lesson 7 2008-05-20 Java System.out.println() 1 Java API 1 Java Java 1 GUI 2 Java 3 1.1 5 3 1.0 10.0, 1.0, 0.5 5.0, 3.0, 0.3 4.0, 1.0, 0.6 1 2 4 3, ( 2 3 2 1.2 Java (stream) 4 1 a 5 (End of
// ステージを設定します stage.setscene(scene); stage.settitle(" キャンバス "); // ステージを表示します stage.show(); public static void main(string[] args) launch(args); キャンバス
HCI プログラミング 11 回目グラフィックス 今日の講義で学ぶ内容 キャンバスと図形描画 マウスを用いたインタラクション ラジオボタンなど GUI 部品を用いたインタラクション キャンバスと図形描画 1 キャンバスに線を引いてみましょう 画用紙を表すキャンバスに図形を描くことができます ソースファイル名 :Sample11_1.java // HP よりインポート文をここへ貼り付けてください //
I java A
I java 065762A 19.6.22 19.6.22 19.6.22 1 1 Level 1 3 1.1 Kouza....................................... 3 1.2 Kouza....................................... 4 1.3..........................................
新・明解Java入門
537,... 224,... 224,... 32, 35,... 188, 216, 312 -... 38 -... 38 --... 102 --... 103 -=... 111 -classpath... 379 '... 106, 474!... 57, 97!=... 56 "... 14, 476 %... 38 %=... 111 &... 240, 247 &&... 66,
オブジェクト指向言語 Java 博士 ( 情報理工学 ) 小林貴訓博士 ( 工学 ) Htoo Htoo 共著工学博士大澤裕 コロナ社 コロナ社
オブジェクト指向言語 Java 博士 ( 情報理工学 ) 小林貴訓博士 ( 工学 ) Htoo Htoo 共著工学博士大澤裕 Java Java Java Java C# Visual Basic.NETC++ Java CD DVD Eclipse NetBeans IDE Java ii 2016 9 Java Web http://www.coronasha.co.jp/np/isbn/9784339028652/
Java プログラミング Ⅰ 7 回目 switch 文と論理演算子 今日の講義講義で学ぶ内容 switch 文 論理演算子 条件演算子 条件判断文 3 switch 文 switch 文 式が case のラベルと一致する場所から直後の break; まで処理しますどれにも一致致しない場合 def
Java プログラミング Ⅰ 7 回目 switch 文と論理演算子 今日の講義講義で学ぶ内容 switch 文 論理演算子 条件演算子 条件判断文 3 switch 文 switch 文 式が case のラベルと一致する場所から直後の まで処理しますどれにも一致致しない場合 default: から直後の まで処理します 式の結果 ラベル 定数 整数または文字 (byte, short, int,
8 if switch for while do while 2
(Basic Theory of Information Processing) ( ) if for while break continue 1 8 if switch for while do while 2 8.1 if (p.52) 8.1.1 if 1 if ( ) 2; 3 1 true 2 3 false 2 3 3 8.1.2 if-else (p.54) if ( ) 1; else
r1.dvi
2006 1 2006.10.6 ( 2 ( ) 1 2 1.5 3 ( ) Ruby Java Java Java ( Web Web http://lecture.ecc.u-tokyo.ac.jp/~kuno/is06/ / ( / @@@ ( 3 ) @@@ : ( ) @@@ (Q&A) ( ) 1 http://www.sodan.ecc.u-tokyo.ac.jp/cgi-bin/qbbs/view.cgi
HCI プログラミング 8 回目ボタン チェックボックス ラジオボタン 今日の講義で学ぶ内容 ボタンとアクションイベント ボタンのカスタマイズ チェックボックスとラジオボタン ボタンとアクションイベント 1 ボタンを配置してみましょう ボタンは ラベルと同じようにフォントやその色 画像の貼り付けなど
HCI プログラミング 8 回目ボタン チェックボックス ラジオボタン 今日の講義で学ぶ内容 ボタンとアクションイベント ボタンのカスタマイズ チェックボックスとラジオボタン ボタンとアクションイベント 1 ボタンを配置してみましょう ボタンは ラベルと同じようにフォントやその色 画像の貼り付けなどを設定できます ソースファイル名 :Sample8_1.java // HP よりインポート文をここへ貼り付けてください
やさしいJavaプログラミング -Great Ideas for Java Programming サンプルPDF
pref : 2004/6/5 (11:8) pref : 2004/6/5 (11:8) pref : 2004/6/5 (11:8) 3 5 14 18 21 23 23 24 28 29 29 31 32 34 35 35 36 38 40 44 44 45 46 49 49 50 pref : 2004/6/5 (11:8) 50 51 52 54 55 56 57 58 59 60 61
: : : TSTank 2
Java (8) 2008-05-20 Lesson6 Lesson5 Java 1 Lesson 6: TSTank1, TSTank2, TSTank3 java 2 car1 car2 Car car1 = new Car(); Car car2 = new Car(); car1.setcolor(red); car2.setcolor(blue); car2.changeengine(jet);
1/8 ページ Java 基礎文法最速マスター Java Javaの文法一覧です 他の言語をある程度知っている人はこれを読めばJavaの基礎をマスターしてJavaを書くことができるようになっています 簡易リファレンスとしても利用できると思いますので これは足りないと思うものがあれば教えてください 1. 基礎 class の作成プログラムはclassに記述します たとえばSampleという名前のclassを作る場合
r02.dvi
172 2017.7.16 1 1.1? X A B A X B ( )? IBMPL/I FACOM PL1 ( ) X ( ) 1.2 1 2-0 ( ) ( ) ( ) (12) ( ) (112) (131) 281 26 1 (syntax) (semantics) ( ) 2 2.1 BNF BNF(Backus Normal Form) Joun Backus (grammer) English
10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV
[email protected] [email protected] http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/sem3/ 2002 12 11 p.1/33 10/16 1. 10/23 2. 10/30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20
Java演習(4) -- 変数と型 --
50 20 20 5 (20, 20) O 50 100 150 200 250 300 350 x (reserved 50 100 y 50 20 20 5 (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics; (reserved public class Blocks1 extends
Java updated
Java 2003.07.14 updated 3 1 Java 5 1.1 Java................................. 5 1.2 Java..................................... 5 1.3 Java................................ 6 1.3.1 Java.......................
break 文 switch ブロック内の実行中の処理を強制的に終了し ブロックから抜けます switch(i) 強制終了 ソースコード例ソースファイル名 :Sample7_1.java // 入力値の判定 import java.io.*; class Sample7_1 public stati
Java プログラミング Ⅰ 7 回目 switch 文と論理演算子 今日の講義で学ぶ内容 switch 文 論理演算子 条件演算子 条件判断文 3 switch 文 switch 文 式が case のラベルと一致する場所から直後の まで処理しますどれにも一致しない場合 default: から直後の まで処理します 式は byte, short, int, char 型 ( 文字または整数 ) を演算結果としますラベルには整数リテラル
2 1 Web Java Android Java 1.2 6) Java Java 7) 6) Java Java (Swing, JavaFX) (JDBC) 7) OS 1.3 Java Java
1 Java Java 1.1 Java 1) 2) 3) Java OS Java 1.3 4) Java Web Start Web / 5) Java C C++ Java JSP(Java Server Pages) 1) OS 2) 3) 4) Java Write Once, Run Anywhere 5) Java Web Java 2 1 Web Java Android Java
Object MenuComponent MenuBar MenuItem Menu CheckboxMenuItem
Java Object MenuComponent MenuBar MenuItem Menu CheckboxMenuItem 2 MenuComponent MenuComponent setfont() void setfont(font f) MenuBar MenuBar MenuBar() MenuBar add() Menu add(menu m) Menu Menu Menu String
ALG2012-F.ppt
2012 7 26 ([email protected]) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2012/index.html 5 2 3 4 - 5 .. 6 - 7 public class KnapsackBB { // 0-1 private static double maxsofar; private
3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World");
(Basic Theory of Information Processing) Java (eclipse ) Hello World! eclipse Java 1 3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello
class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value =
Part2-1-3 Java (*) (*).class Java public static final 1 class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value
オブジェクト指向プログラミング・同演習 5月21日演習課題
オブジェクト指向プログラミング 同演習 5 月 21 日演習課題 問題 1 配列の例外処理例外が発生する可能性のある処理を try で囲み その後に catch で例外を捕捉します 例外処理の終了処理として finally が行われます これは書かなくて自動的に行われます 提出課題 1 (Kadai052301.java) 以下のプログラムは例外処理をしていない ArrayIndexOutOfBoundsException
明解Javaによるアルゴリズムとデータ構造
21 algorithm List 1-1 a, b, c max Scanner Column 1-1 List 1-1 // import java.util.scanner; class Max3 { public static void main(string[] args) { Scanner stdin = new Scanner(System.in); Chap01/Max3.java
IE6 2 BMI chapter1 Java 6 chapter2 Java 7 chapter3 for if 8 chapter4 : BMI 9 chapter5 Java GUI 10 chapter6 11 chapter7 BMI 12 chap
1-1 1-2 IE6 2 BMI 3-1 3-2 4 5 chapter1 Java 6 chapter2 Java 7 chapter3 for if 8 chapter4 : BMI 9 chapter5 Java GUI 10 chapter6 11 chapter7 BMI 12 chapter8 : 13-1 13-2 14 15 PersonTest.java KazuateGame.java
Exam : 1z1-809-JPN Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z1-809-JPN Exam's Question and Answers 1 from Ac
Actual4Test http://www.actual4test.com Actual4test - actual test exam dumps-pass for IT exams Exam : 1z1-809-JPN Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z1-809-JPN
2 static final int DO NOTHING ON CLOSE static final int HIDE ON CLOSE static final int DISPOSE ON CLOSE static final int EXIT ON CLOSE void setvisible
12 2013 7 2 12.1 GUI........................... 12 1 12.2............................... 12 4 12.3..................................... 12 7 12.4....................................... 12 9 12.5 : FreeCellPanel.java............................
Java学習教材
Java 2016/4/17 Java 1 Java1 : 280 : (2010/1/29) ISBN-10: 4798120987 ISBN-13: 978-4798120980 2010/1/29 1 Java 1 Java Java Java class FirstExample { public static void main(string[] args) { System.out.println("
Java言語 第1回
Java 言語 第 11 回ウインドウ型アプリケーション (2) 知的情報システム工学科 久保川淳司 [email protected] メニュー (1) メニューを組み込むときには,MenuBar オブジェクトに Menu オブジェクトを登録し, その Menu オブジェクトに MenuItem オブジェクトを登録する 2 つの Menu オブジェクト File New
問題1 以下に示すプログラムは、次の処理をするプログラムである
問題 1 次に示すプログラムは 配列 a の値を乱数で設定し 配列 a の値が 333 より大きく 667 以下の値 の合計値を求めるプログラムである 1 と 2 に適切なコードを記述してプログラムを完 成させよ class TotalNumber { public static void main(string[] args) { int[] a = new int[1000]; // 1 解答条件
class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value =
Part2-1-3 Java (*) (*).class Java public static final 1 class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value
{:from => Java, :to => Ruby } Java Ruby KAKUTANI Shintaro; Eiwa System Management, Inc.; a strong Ruby proponent http://kakutani.com http://www.amazon.co.jp/o/asin/4873113202/kakutani-22 http://www.amazon.co.jp/o/asin/477413256x/kakutani-22
2.2 Java C main Java main 2 C 6 C Java 3 C Java ( ) G101Hello.java G101Hello main G101Hello.java /* G101Hello */ class G101Hello { /* main */ public s
2 2013 4 16 2.1............................... 2 1 2.2 Java......................... 2 2 2.3............. 2 2 2.4................................ 2 4 2.5............................ 2 5 2.6............................
$ java StoreString abc abc ed abced twice abcedabced clear xyz xyz xyz bingo! abc bingo!abc ^Z mport java.io.*; ublic class StoreString { public static void main(string[] args) throws IOException{ BufferedReader
1: Preference Display 1 package sample. pref ; 2 3 import android. app. Activity ; 4 import android. content. Intent ; 5 import android. content. Shar
Android 2 1 (Activity) (layout strings.xml) XML Activity (Intent manifest) Android Eclipse XML Preference, DataBase, File 3 2 Preference Preference Preference URL:[http://www.aichi-pu.ac.jp/ist/lab/yamamoto/android/android-tutorial/tutorial02/tutorial02.pdf]
Java講座
~ 第 1 回 ~ 情報科学部コンピュータ科学科 2 年竹中優 プログラムを書く上で Hello world 基礎事項 演算子 構文 2 コメントアウト (//, /* */, /** */) をしよう! インデントをしよう! 変数などにはわかりやすい名前をつけよう! 要するに 他人が見て理解しやすいコードを書こうということです 3 1. Eclipse を起動 2. ファイル 新規 javaプロジェクト
アルゴリズムとデータ構造1
1 200972 (sakai.keiichi@kochi [email protected]) http://www.info.kochi ://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2009/index.html 29 20 32 14 24 30 48 7 19 21 31 Object public class
Assignment9_1.java
Assignment9_1.java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
解きながら学ぶJava入門編
44 // class Negative { System.out.print(""); int n = stdin.nextint(); if (n < 0) System.out.println(""); -10 Ÿ 35 Ÿ 0 n if statement if ( ) if i f ( ) if n < 0 < true false true false boolean literalboolean
目的 泡立ち法を例に Comparableインターフェイスの実装 抽象クラスの利用 型パラメタの利用 比較 入替 の回数を計測
泡立ち法とその実装 計算機アルゴリズム特論 :2017 年度只木進一 目的 泡立ち法を例に Comparableインターフェイスの実装 抽象クラスの利用 型パラメタの利用 比較 入替 の回数を計測 Comparable インターフェイ ス クラスインスタンスが比較可能であることを示す Int compareto() メソッドを実装 Integer Double String などには実装済み public
JavaプログラミングⅠ
Java プログラミング Ⅰ 3 回目変数 今日の講義で学ぶ内容 変数とは 変数の使い方 キーボード入力の仕方 変 数 変 数 一時的に値を記憶させておく機能です 変数は 型 ( データ型ともいいます ) と識別子をもちます 2 型 変数に記憶できる値の種類です型は 値の種類に応じて次の 8 種類があり これを基本型といいます 基本型値の種類値の範囲または例 boolean 真偽値 true または
,,,,., C Java,,.,,.,., ,,.,, i
24 Development of the programming s learning tool for children be derived from maze 1130353 2013 3 1 ,,,,., C Java,,.,,.,., 1 6 1 2.,,.,, i Abstract Development of the programming s learning tool for children
10K pdf
#1 #2 Java class Circle { double x; // x double y; // y double radius; // void set(double tx, double ty){ x = tx; y = ty; void set(double tx, double ty, double r) { x = tx; y = ty; radius = r; // Circle
2
問題 次の設問に答えよ 設問. Java のソースコードをコンパイルするコマンドはどれか a) java b) javac c) javadoc d) javaw 設問. Java のバイトコード ( コンパイル結果 ) を実行するコマンドはどれか a) java b) javac c) javadoc d).jar 設問. Java のソースコードの拡張子はどれか a).c b).java c).class
Microsoft Word - keisankigairon.ch doc
1000000100001010 1000001000001011 0100001100010010 1010001100001100 load %r1,10 load %r2,11 add %r3,%r1,%r2 store %r3,12 k = i + j ; = > (* 1 2 3 4 5 6 7 8 9 10) 3628800 DO 3 I=1,3 DO3I=1.3 DO3I 1.3
226
226 227 Main ClientThread Request Channel WorkerThread Channel startworkers takerequest requestqueue threadpool WorkerThread channel run Request tostring execute name number ClientThread channel random
2
問題 1 次の設問 1~5 に答えよ 設問 1. Java のソースプログラムをコンパイルするコマンドはどれか a) java b) javac c) javadoc d) jdb 設問 2. Java のバイトコード ( コンパイル結果 ) を実行するコマンドはどれか a) java b) javac c) javadoc d) jdb 設問 3. Java のソースプログラムの拡張子はどれか a).c
r3.dvi
00 3 2000.6.10 0 Java ( 7 1 7 1 GSSM 1? 1 1.1 4 4a 4b / / 0 255 HTML X 0 255 16 (0,32,255 #0020FF Java xclock -bg #0020FF xclock ^C (Control C xclock 4c 1 import java.applet.applet; import java.awt.*;
haskell.gby
Haskell 1 2 3 Haskell ( ) 4 Haskell Lisper 5 Haskell = Haskell 6 Haskell Haskell... 7 qsort [8,2,5,1] [1,2,5,8] "Hello, " ++ "world!" "Hello, world!" 1 + 2 div 8 2 (+) 1 2 8 div 2 3 4 map even [1,2,3,4]
(Eclipse\202\305\212w\202\324Java2\215\374.pdf)
C H A P T E R 11 11-1 1 Sample9_4 package sample.sample11; public class Sample9_4 { 2 public static void main(string[] args) { int[] points = new int[30]; initializearray(points); double averagepoint =
Java Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225
Java Java Java Java Java 4 p35 4-2 * *** ***** *** * Unix p36 4-3 a,b,c,d 100,200,250,500 a*b = 20000 a*b+c = 20250 a*b+c*d = 145000 (a+b)*(c+d) = 225000 a+b*c+d = 50600 b/a+d/c = 4 p38 4-4 (1) mul = 1
55 7 Java C Java TCP/IP TCP/IP TCP TCP_RO.java import java.net.*; import java.io.*; public class TCP_RO { public static void main(string[] a
55 7 Java C Java TCP/IP TCP/IP 7.1 7.1.1 TCP TCP_RO.java import java.net.*; import java.io.*; public class TCP_RO { public static void main(string[] argv) { Socket readsocket = new Socket(argv[0], Integer.parseInt(argv[1]));
アルゴリズムとデータ構造1
1 2005 7 22 22 (sakai.keiichi@kochi [email protected]) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2005/index.html tech.ac.jp/k1sakai/lecture/alg/2005/index.html f(0) = 1, f(x) =
新・明解Javaで学ぶアルゴリズムとデータ構造
第 1 章 基本的 1 n 21 1-1 三値 最大値 algorithm List 1-1 a, b, c max // import java.util.scanner; class Max3 { public static void main(string[] args) { Scanner stdin = new Scanner(System.in); List 1-1 System.out.println("");
ALG2012-A.ppt
21279 ([email protected]) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/212/index.html (, )ε m = n C2 = n ( n 1) / 2 m = n ( n 1) 1 11 11 111 11 111 111 1111 1 1 11 1 11 11 111 4-dimentional
JavaプログラミングⅠ
Java プログラミング Ⅰ 3 回目変数 今日の講義で学ぶ内容 変数とは 変数の使い方 キーボード入力の仕方 変 数 変 数 一時的に値を記憶させておく機能です 変数は 型 ( データ型ともいいます ) と識別子をもちます 2 型 変数に記憶できる値の種類です型は 値の種類に応じて次の 8 種類があり これを基本型といいます 基本型値の種類値の範囲または例 boolean 真偽値 true または
<4D F736F F D2091E F196E291E889F090E C4816A82CC838C E646F6378>
公益財団法人全国商業高等学校協会主催 [2 級 Java 選択者のための問題 ] 平成 26 年度 ( 第 52 回 ) ( 平成 27 年 1 月 18 日実施 ) 情報処理検定試験 2 級プログラミング部門 Java 選択者のための問題 7 問 1 概要 誕生日を入力し 12 星座名を表示させる問題である 星座日と星座名を配列に各データを格納し 各配列の関連性 格納された星座日からどのようにして星座名を探索
目 次 Java GUI 3 1 概要 クラス構成 ソースコード例 課題...7 i
Java GUI 3 Java GUI 3 - サンプルプログラム (1) - 2011-09-25 Version 1.00 K. Yanai 目 次 Java GUI 3 1 概要...1 2 クラス構成...2 3 ソースコード例...3 4 課題...7 i 1 概要まずは簡単なサンプルプログラムをみながら Java GUI の基本的なことを学びましょう 本サンプルは 図に示すようなひとつのメイン画面を使用します
ALG2012-C.ppt
2012717 ([email protected]) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2012/index.html 1 1. 2. 2 .. 3 public class WeightedNode { private E value; // private Map
アプレットの作成
- 1 - import java.applet.applet; import java.awt.graphics; public class HelloWorld extends Applet { public void init() { resize(150,60) ; public void paint ( Graphics g ) { g.drawstring("hello, world!",
オブジェクト脳のつくり方
2003 12 16 ( ) ML Java,.NET, UML J2EE, Web Java, J2EE.NET SI ex. ) OO OO OO OO OO (Controller) (Promoter) (Analyzer) (Supporter) http://nba.nikkeibp.co.jp/coachsp.html It takes time. OO OK OO 1.
. IDE JIVE[1][] Eclipse Java ( 1) Java Platform Debugger Architecture [5] 3. Eclipse GUI JIVE 3.1 Eclipse ( ) 1 JIVE Java [3] IDE c 016 Information Pr
Eclipse 1,a) 1,b) 1,c) ( IDE) IDE Graphical User Interface( GUI) GUI GUI IDE View Eclipse Development of Eclipse Plug-in to present an Object Diagram to Debug Environment Kubota Yoshihiko 1,a) Yamazaki
ALG ppt
2012614 ([email protected]) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2012/index.html 1 2 2 3 29 20 32 14 24 30 48 7 19 21 31 4 N O(log N) 29 O(N) 20 32 14 24 30 48 7 19 21 31 5
