5 p Point int Java p Point Point p; p = new Point(); Point instance, p Point int 2 Point Point p = new Point(); p.x = 1; p.y = 2;

Size: px
Start display at page:

Download "5 p Point int Java p Point Point p; p = new Point(); Point instance, p Point int 2 Point Point p = new Point(); p.x = 1; p.y = 2;"

Transcription

1 5 p.1 5 JPanel (toy example) extends : Object java.lang.object extends... extends Object Point.java 1 public class Point { // public int x; public int y; Point x y 5.1.1,

2 5 p Point int Java p Point Point p; p = new Point(); Point instance, p Point int 2 Point Point p = new Point(); p.x = 1; p.y = 2; System.out.println("(" + p.x + ", " + p.y + ")"); Point p1 = new Point(), p2 = new Point(); p1.x = 1; p1.y = 2; p2.x = 9; p2.y = 8; System.out.println("(" + p1.x + ", " + p1.y + ")"); System.out.println("(" + p2.x + ", " + p2.y + ")"); C 5.3.1, Point.java 2

3 p.3 public class Point { // ( public int x; public int y; // public void move(int dx, int dy) { x += dx; y += dy; public double distance() { return Math.sqrt(x * x + y * y); public void print() { System.out.printf("(%d, %d)", x, y); public void moveandprint(int dx, int dy) { print(); move(dx, dy); print(); // public Point(int x0, int y0) { x = x0; y = y0; move distance, print, moveandprint x, y move print. Point int 2 : 1 Point p = new Point(1, 2); Point x 1 y 2

4 5 p.4 5. PointTest Point main PointTest.java public class PointTest { public static void main(string args[]) { Point p = new Point(10, 20); p.move(1, -1); p.print(); System.out.println("<br />"); static C C++ PointTest Java Q PointTest : PointTest.java Point.java PointTest.java javac Point.java 5.4 Point ColorPoint Point Point Point ColorPoint ColorPoint Point extends Point.java ColorPoint.java 1 public class ColorPoint extends Point { public String color;

5 p.5 public ColorPoint(int x, int y, String c) { super(x, y); /* 1 */ color = public void print() { System.out.printf("<font color= %s >", color); // System.out.printf("(%d, %d)", x, y); /* 2 */ // super.print(); System.out.print("</font>"); // ColorPoint color print() GUI JPanel super(x, y) /* 1 */ Point super : print() HTML HTML ColorPoint print() 2 /* 2 */ Point print() super.print(); super main 1 /* 3 */ ColorPoint x 10 y 20 color green ColorPoint Point x y move /* 4 */ PointTest.java 2 public static void main(string args[]) { ColorPoint cp = new ColorPoint(10, 20, "green"); /* 3 */ cp.move(1, -1); /* 4 */ cp.print();

6 5 p.6 5 System.out.println("<br />"); Q PointTest 2 Q DeepPoint Point int depth x, y, depth print depth 5 DeepPoint (((((11, 19))))) 5 DeepPoint DeepPoint.java public class DeepPoint { // public DeepPoint(int x, int y, int d) { depth = d; public void print() { int i; for (i = 0; i < depth; i++) { System.out.print("("); System.out.printf("%d, %d", x, y); for (i = 0; i < depth; i++) { System.out.print(")"); 5.5 PointTest testpoint Point PointTest.java 3 public static void testpoint(point p) { p.move(10, 10);

7 p.7 p.print(); main Point, ColorPoint, DeepPoint 3 testpoint PointTest.java 3 public static void main(string args[]) { Point p = new Point(1, 2); ColorPoint cp = new ColorPoint(3, 4, "green"); DeepPoint dp = new DeepPoint(5, 6, 5); testpoint(p); testpoint(cp); testpoint(dp); testpoint ColorPoint, DeepPoint Point, widening : CastTest.java ColorPoint cp = new ColorPoint(... ); Point p = cp; p.move(1, -1); CastTest.java // // p = new Point(3, 4); ColorPoint cp2 = (ColorPoint)p; // cp2.color = "red"; cp2.print(); p ColorPoint ClassCastException testpoint? testpoint move print ColorPoint?

8 5 p.8 5 Q PointTest.java 3 (1). (11, 12)(13, 14)(15, 16) (2). (11, 12)<font color= green >(13, 14)</font>(((((15, 16))))) Java print (dynamic binding) (static) (dynamic) C++ Java Point, ColorPoint, DeepPoint //... Point* p = new Point(1, 2); ColorPoint* cp = new ColorPoint(3, 4, "green"); DeepPoint* dp = new DeepPoint(5, 6, 5); testpoint(p); testpoint(cp); testpoint(dp); //... Point print (11, 12)(13, 14)(15, 16) C++ Java print (virtual function) *p, *cp, *dp Java C++ virtual class Point { // : C++ public: int x, y; void move(int dx, int dy); virtual void print(void); ; C++

9 p.9 Point moveandprint public void moveandprint(int dx, int dy) { print(); move(dx, dy); print(); moveandprint ColorPoint DeepPoint print moveandprint Point move print Point print moveandprint print (polymorphism) 1 Poly 2 Morph 1 (GUI) Java / JButton, JLabel, JTextField, JTextArea GUI JComponent javax.swing.jcomponent JComponent setvisible, setenabled, setlocation HideShow.java import javax.swing.*; import java.awt.*; import java.awt.event.*; public class HideShow extends JPanel implements ActionListener { private JTextField input; private JLabel lbl; 1 2 =

10 5 p.10 5 private JButton b1, b2; public HideShow() { setpreferredsize(new Dimension(300, 50)); lbl = new JLabel("label"); input = new JTextField("text", 5); b1 = new JButton("Hide"); b2 = new JButton("Show"); b1.addactionlistener(this); b2.addactionlistener(this); setlayout(new FlowLayout()); add(lbl); add(input); add(b1); add(b2); public void actionperformed(actionevent e) { if (e.getsource() == b1) { lbl.setvisible(false); input.setvisible(false); b1.setvisible(false); else if (e.getsource() == b2) { lbl.setvisible(true); input.setvisible(true); b1.setvisible(true);... // main Hide setvisible JComponent JComponent add = setvisible setvisible repaint paintcomponent

11 p : OverloadTest.java public class OverloadTest { double x, y; // public void foo(double dx, double dy) { // foo-1 x += dx; y += dy; public void foo(int dx, int dy) { // foo-2 x *= dx; y *= dy; public void print() { System.out.printf("(%g, %g)", x, y); System.out.println(); /* 1 */ public static void main(string[] args) { OverloadTest o = new OverloadTest(1.1, 2.2); o.foo(3.3, 4.4); // foo-1 o.print(); o.foo(2, 3); // foo-2 o.print(); /* 2 */ : Q OverloadTest.java /* 1 */ OverloadTest.java bar public void bar(point p) { System.out.print("Point class: "); // bar-1

12 5 p.12 5 p.print(); System.out.println(); public void bar(colorpoint p) { System.out.print("ColorPoint class: "); p.print(); System.out.println(); // bar-2 OverloadTest.java /* 2 */ ColorPoint cp = new ColorPoint(0, 0, "red"); Point p = cp; o.bar(cp); // bar-2 o.bar(p); // bar-1 Q OverloadTest.java /* 1 */, /* 2 */ Java. 5.7 ColorPoint color "red", "green" 2 setcolor getcolor ColorPoint "black", "red", "green", "yellow","blue", "magenta", "cyan", "white" String String == == true equals true java.lang.string public boolean equals(object s)

13 p.13 public boolean equalsignorecase(string s) ColorPoint.java 2 public class ColorPoint extends Point { public String[] cs = {"black", "red", "green", "yellow", "blue", "magenta", "cyan", "white"; public String public void print() { // System.out.print("<font color= " + getcolor() + " >"); System.out.printf("(%d, %d)", x, y); // super.print(); System.out.print("</font>"); // public void setcolor(string c) { int i; for (i = 0; i < cs.length; i++) { if (c.equals(cs[i])) { color = c; return; // public ColorPoint(int x, int y, String c) { super(x, y); setcolor(c); if (color == null) color = "black"; public String getcolor() { return color; setcolor getcolor color cp.color = "NoSuchColor"; public 5.7.3

14 5 p.14 5 color ColorPoint... private String color; // color cs PointTest main cp.color = "NoSuchColor"; Q : public : protected private, public, protected public (encapsulation) ColorPoint color "black", "red" cs 2 private private

15 p color cs int ColorPoint DeepPoint depth 1 10 void setdepth(int d) depth int getdepth() setdepth depth depth setdepth SecretPoint Point 2 int a, b 2 print a x+b y = 1 (1, 2) (?,?) SecretPoint a, b print 5.8 < > Pair E1, E2 Pair.java public class Pair<E1, E2> { public E1 fst; public E2 snd; public Pair(E1 f, E2 s) { fst = f; snd = s; Triple.java public class Triple<E1, E2, E3> extends Pair<E1, E2> { public E3 thd; public Triple(E1 f, E2 s, E3 t) { super(f, s); thd = t; 3 color int

16 5 p.16 5 TripleTest.java public class TripleTest { public static void main(string[] args) { Triple<Integer, String, Double> test = new Triple<>(1, "abc", 1.4); System.out.printf("(%d, %s, %g)%n", test.fst, test.snd, test.thd); Player Enemy GenericEnemy Boss Enemy Alice Grace GenericEnemy Enemy attack GenericEnemy updatedamage : Player.java 1 public class Player { 2 private int hp; 3 4 public Player(int inithp) { 5 hp = inithp; public void damage(int damage) { 9 hp -= damage; 10 System.out.println(damage + " HP = " + hp); : Enemy.java 1 public class Enemy { 2 public void attack(player p) { 3 : GenericEnemy.java 1 public class GenericEnemy { 2 private String name; 3 public int damage; 4 5 public GenericEnemy(String n, int d) { 6 name = n; 7 damage = d; 8 9

17 p public void attack(player p) { 12 System.out.print(name + " : "); 13 p.damage(damage); 14 updatedamage(); public void updatedamage() { 18 : Alice.java 1 2 public class Alice { 3 private int init; 4 5 public Alice(int d) { 6 super("alice", d); 7 init = d; public void updatedamage() { 12 damage += init; // 13 // name += "!"; // : Grace.java 1 public class Grace { 2 private int ratio; 3 4 public Grace(int d, int r) { 5 super("grace", d); 6 ratio = r; public void updatedamage() { 11 damage *= ratio; // 12 // name += "?"; // : Boss.java 1 public class Boss { 2 public int count; 3 4 public Boss() { 5 count = 0;

18 5 p public void attack(player p) { 10 System.out.print("Boss : "); 11 if (++count >= 3) { 12 p.damage(1000); 13 else { 14 p.damage(0); main Main.java : Main.java 1 import java.util.arraylist; 2 3 public class Main { 4 public static void main(string[] args) { 5 ArrayList<Enemy> enemies = new ArrayList<>(); // ArrayList 6 Player p = new Player(3000); 7 8 Alice a = new Alice(100); 9 enemies.add(a); 10 Grace g = new Grace(100, 2); 11 enemies.add(g); 12 Boss b = new Boss(); 13 enemies.add(b); for (int i = 0; i < 3; i++) { 16 for (int j = 0; j < enemies.size(); j++) { 17 Enemy e = enemies.get(j); 18 e.attack(p); Main main

19 p.19,,,,

20

I. (i) Java? (A). Foo_Bar (B). G day (C). 999 (D). Golgo13 (ii)? (A). Java public (B). Java (C). Java JavaScript (D). Java C Java C (iii)? (A). Java (

I. (i) Java? (A). Foo_Bar (B). G day (C). 999 (D). Golgo13 (ii)? (A). Java public (B). Java (C). Java JavaScript (D). Java C Java C (iii)? (A). Java ( 2016 07 29 10:30 12:00 I. I V II. III. IV. ( a d) V. VI. 80 100 60 : A ActionListener aa addactionlistener AE ActionEvent K KeyListener ak addkeylistener KE KeyEvent M MouseListener am addmouselistener

More information

I. java.awt.rectangle java.lang.math random Java TM API java.awt Rectangle Rectangle (x,y)... public int x Rectangle X public int y Rectangle Y public

I. java.awt.rectangle java.lang.math random Java TM API java.awt Rectangle Rectangle (x,y)... public int x Rectangle X public int y Rectangle Y public 2018 08 03 10:30 12:00 I. IV III II. III. IV. ( a d) V. VI. 70 III 30 100 60 : A ActionListener aa addactionlistener AE ActionEvent K KeyListener ak addkeylistener KE KeyEvent M MouseListener am addmouselistener

More information

I. (i) Java? (A). 2Apples (B). Vitamin-C (C). Peach21 (D). Pine_Apple (ii) Java? (A). Java (B). Java (C). Java (D). JavaScript Java JavaScript Java (i

I. (i) Java? (A). 2Apples (B). Vitamin-C (C). Peach21 (D). Pine_Apple (ii) Java? (A). Java (B). Java (C). Java (D). JavaScript Java JavaScript Java (i 12 7 27 10:30 12:00 I. I VI II. III. IV. ( a d) V. VI. 80 100 60 : this==null, T == N A ActionListener A addactionlistener C class D actionperformed E ActionEvent G getsource I implements J JApplet K KeyListener

More information

:30 12:00 I. I V II. III. IV. ( a d) V. VI : A ActionListener aa addactionlistener AE ActionEvent K KeyListener ak addkeyliste

:30 12:00 I. I V II. III. IV. ( a d) V. VI : A ActionListener aa addactionlistener AE ActionEvent K KeyListener ak addkeyliste 2017 07 28 10:30 12:00 I. I V II. III. IV. ( a d) V. VI. 80 100 60 : A ActionListener aa addactionlistener AE ActionEvent K KeyListener ak addkeylistener KE KeyEvent M MouseListener am addmouselistener

More information

I HTML HashMap (i) (ii) :.java import java.net.*; import java.io.*; import java.util.hashmap; public class SimpleStopWatch { public static voi

I HTML HashMap (i) (ii) :.java import java.net.*; import java.io.*; import java.util.hashmap; public class SimpleStopWatch { public static voi II Java 10 2 12 10:30 12:00 I. I III II. III. IV. ( a d) V. : this==null, T == N A ActionListener C class D actionperformed G getsource I implements K KeyListener J JApplet L addmouselistener M MouseListener

More information

:30 12:00 I. I VII II. III. IV. ( a d) V. VI : this==null, T == N A ActionListener A addactionlistener C class D actionperforme

:30 12:00 I. I VII II. III. IV. ( a d) V. VI : this==null, T == N A ActionListener A addactionlistener C class D actionperforme 2015 7 31 10:30 12:00 I. I VII II. III. IV. ( a d) V. VI. 80 100 60 : this==null, T == N A ActionListener A addactionlistener C class D actionperformed E ActionEvent G getsource I implements J JApplet

More information

:30 12:00 I. I VII II. III. IV. ( a d) V. VI : this==null, T == N A ActionListener A addactionlistener C class D actionperformed

:30 12:00 I. I VII II. III. IV. ( a d) V. VI : this==null, T == N A ActionListener A addactionlistener C class D actionperformed 10 7 30 10:30 12:00 I. I VII II. III. IV. ( a d) V. VI. 80 100 60 : this==null, T == N A ActionListener A addactionlistener C class D actionperformed E ActionEvent G getsource I implements J JApplet K

More information

I. (i) Foo public (A). javac Foo.java java Foo.class (C). javac Foo java Foo (ii)? (B). javac Foo.java java Foo (D). javac Foo java Foo.class (A). Jav

I. (i) Foo public (A). javac Foo.java java Foo.class (C). javac Foo java Foo (ii)? (B). javac Foo.java java Foo (D). javac Foo java Foo.class (A). Jav 2018 06 08 11:00 12:00 I. I III II. III. IV. ( a d) V. VI. 80 40 40 100 60 : A ActionListener aa addactionlistener AE ActionEvent K KeyListener ak addkeylistener KE KeyEvent M MouseListener am addmouselistener

More information

II Java :30 12:00 I. I IV II. III. IV. ( a d) V. : this==null, T == N A ActionListener C class D actionperformed G getsource I implements K

II Java :30 12:00 I. I IV II. III. IV. ( a d) V. : this==null, T == N A ActionListener C class D actionperformed G getsource I implements K II Java 09 2 13 10:30 12:00 I. I IV II. III. IV. ( a d) V. : this==null, T == N A ActionListener C class D actionperformed G getsource I implements K KeyListener J JApplet L addmouselistener M MouseListener

More information

:30 12:00 I. I VII II. III. IV. ( a d) V. VI : this==null, T == N A ActionListener A addactionlistener C class D actionperformed

:30 12:00 I. I VII II. III. IV. ( a d) V. VI : this==null, T == N A ActionListener A addactionlistener C class D actionperformed 11 7 29 10:30 12:00 I. I VII II. III. IV. ( a d) V. VI. 80 100 60 : this==null, T == N A ActionListener A addactionlistener C class D actionperformed E ActionEvent G getsource I implements J JApplet K

More information

:30 12:00 I. I VII II. III. IV. ( a d) V. VI : this==null, T == N A ActionListener A addactionlistener C class D actionperforme

:30 12:00 I. I VII II. III. IV. ( a d) V. VI : this==null, T == N A ActionListener A addactionlistener C class D actionperforme 2014 8 01 10:30 12:00 I. I VII II. III. IV. ( a d) V. VI. 80 100 60 : this==null, T == N A ActionListener A addactionlistener C class D actionperformed E ActionEvent G getsource I implements J JApplet

More information

I 4 p.2 4 GUI java.awt.event.* import /* 1 */ import mouseclicked MouseListener implement /* 2 */ init addmouselistener(this) this /* 3 */ this mousec

I 4 p.2 4 GUI java.awt.event.* import /* 1 */ import mouseclicked MouseListener implement /* 2 */ init addmouselistener(this) this /* 3 */ this mousec I 4 p.1 4 GUI GUI GUI 4.1 4.1.1 MouseTest.java /* 1 */ public class MouseTest extends JApplet implements MouseListener /* 2 */ { int x=50, y=20; addmouselistener(this); /* 3 */ public void mouseclicked(mouseevent

More information

6 p.1 6 Java GUI GUI paintcomponent GUI mouseclicked, keypressed, actionperformed mouseclicked paintcomponent thread, 1 GUI 6.0.2, mutlithread C

6 p.1 6 Java GUI GUI paintcomponent GUI mouseclicked, keypressed, actionperformed mouseclicked paintcomponent thread, 1 GUI 6.0.2, mutlithread C 6 p.1 6 Java GUI GUI paintcomponent GUI mouseclicked, keypressed, actionperformed mouseclicked paintcomponent 6.0.1 thread, 1 GUI 6.0.2, mutlithread CPU 1 CPU CPU +----+ +----+ +----+ Java 1 CPU 6 p.2

More information

text_13.dvi

text_13.dvi C 13 2000 7 9 13 Java(8) { Swing(2)(, ) 1 13.1 13 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 1 13.2 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :

More information

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

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............................

More information

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("

More information

Java 3 p.2 3 Java : boolean Graphics draw3drect fill3drect C int C OK while (1) int boolean switch case C Calendar java.util.calendar A

Java 3 p.2 3 Java : boolean Graphics draw3drect fill3drect C int C OK while (1) int boolean switch case C Calendar java.util.calendar A Java 3 p.1 3 Java Java if for while C 3.1 if Java if C if if ( ) 1 if ( ) 1 else 2 1 1 2 2 1, 2 { Q 3.1.1 1. int n = 2; if (n

More information

Thread

Thread 14 2013 7 16 14.1....................................... 14 1 14.2 Thread................................... 14 1 14.3............................. 14 5 14.4....................................... 14 10

More information

untitled

untitled 2011 6 20 (sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2011/index.html tech.ac.jp/k1sakai/lecture/alg/2011/index.html html 1 O(1) O(1) 2 (123) () H(k) = k mod n

More information

Safari AppletViewer Web HTML Netscape Web Web 15-1 Applet Web Applet init Web paint Web start Web HTML stop destroy update init Web paint start Web up

Safari AppletViewer Web HTML Netscape Web Web 15-1 Applet Web Applet init Web paint Web start Web HTML stop destroy update init Web paint start Web up Safari AppletViewer Web HTML Netscape Web Web 15-1 Applet Web Applet init Web paint Web start Web HTML stop destroy update init Web paint start Web update Event Driven paint Signature Overwriting Overriding

More information

新・明解Java入門

新・明解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,

More information

ALG ppt

ALG ppt 2012 6 21 (sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2012/index.html 1 l l O(1) l l l 2 (123 ) l l l l () l H(k) = k mod n (k:, n: ) l l 3 4 public class MyHashtable

More information

2 p.2 2 Java Hello0.class JVM Hello0 java > java Hello0.class Hello World! javac Java JVM java JVM : Java > javac 2> Q Foo.java Java : Q B

2 p.2 2 Java Hello0.class JVM Hello0 java > java Hello0.class Hello World! javac Java JVM java JVM : Java > javac 2> Q Foo.java Java : Q B 2 p.1 2 Java Java JDK Sun Microsystems JDK javac Java java JVM appletviewer IDESun Microsystems NetBeans, IBM 1 Eclipse 2 IDE GUI JDK Java 2.1 Hello World! 2.1.1 Java 2.1.1 Hello World Emacs Hello0.java

More information

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

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 tutimura@mist.i.u-tokyo.ac.jp kaneko@ipl.t.u-tokyo.ac.jp 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

More information

r14.dvi

r14.dvi 2007 14 2008.1.29 1 1.1 (Ruby Java ) 1 (thread) 1 ( 1 ) main main 1: 1 ( 1 ) CPU CPU 1 while(true) { 0.1 0.1 GUI CPU 1 OS 1.2 Java Java Thread new start()? Thread 0 run() Thread run() run() start() Java

More information

Java演習(9) -- クラスとメソッド --

Java演習(9)   -- クラスとメソッド -- Java (9) Java (9) Java (9) 3 (x, y) x 1 30 10 (0, 50) 1 2 10 10 (width - 10, 80) -2 3 50 10 (width / 2, 110) 2 width 3 (RectMove4-1.java) import javax.swing.japplet; import javax.swing.timer; import java.awt.graphics;

More information

ガイダンス

ガイダンス プログラムの 1 行目に以下を入れること // vm12345 杉崎えり子 情報科学 B 第 10 回 GUI 情報科学 B Info2/3 info10 今日のフォルダー作成 Example10_1.java 1 今日やること Windows などで見られるウィンドウを作 成して (GUI プログラム ) そこに実行結 果を表示させる 2 ウィンドウの作成 Java を使用してウィンドウの作成をしたい

More information

r2.dvi

r2.dvi 2 /Fitzz 2012.10.16 1 Reading 1.1 HCI bit ( ) HCI ( ) ( ) ( ) HCI ( ) HCI ( ) ^_^; 1 1.2,,!,, 2000 1.3 D. A.,,?,, 1990 1? 1 (interface) ( ) ( / ) (User Interface, UI) 2 :? import java.awt.*; import java.awt.event.*;

More information

目 次 Java GUI 3 1 概要 クラス構成 ソースコード例 課題...7 i

目 次 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 の基本的なことを学びましょう 本サンプルは 図に示すようなひとつのメイン画面を使用します

More information

Object MenuComponent MenuBar MenuItem Menu CheckboxMenuItem

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

More information

ガイダンス

ガイダンス プログラムの 1 行目に以下のように自分の入れること // vm12345 杉崎えり子 情報科学 B 第 10 回 GUI 情報科学 B Info2/3 info10 今日のフォルダー作成 Example10_1.java 1 今日やること Windows などで見られるウィンドウを作 成して (GUI プログラム ) そこに実行結 果を表示させる 2 ウィンドウの作成 Java を使用してウィンドウの作成をしたい

More information

ガイダンス

ガイダンス プログラムの 1 行目に以下のように自分の入れること // vm12345 杉崎えり子 情報科学 B 第 10 回 GUI 情報科学 B Info2/3 info10 今日のフォルダー作成 Example10_1.java 1 今日やること Windows などで見られるウィンドウを作 成して (GUI プログラム ) そこに実行結 果を表示させる 2 ウィンドウの作成 Java を使用してウィンドウを作成をしたい

More information

1 Java Java GUI , 2 2 jlabel1 jlabel2 jlabel3 jtextfield1 jtextfield2 jtextfield3 jbutton1 jtextfield1 jtextfield2 jtextfield3

1 Java Java GUI , 2 2 jlabel1 jlabel2 jlabel3 jtextfield1 jtextfield2 jtextfield3 jbutton1 jtextfield1 jtextfield2 jtextfield3 1 2 2 1 2 2.1.................................................... 2 2.2.................................................... 2 2.3........................................ 2 2.4....................................................

More information

2 p.2 2 Java Hello0.class JVM Hello0 java > java Hello0.class Hello World! javac Java JVM java JVM : Java > javac 2> Q Foo.java Java : Q B

2 p.2 2 Java Hello0.class JVM Hello0 java > java Hello0.class Hello World! javac Java JVM java JVM : Java > javac 2> Q Foo.java Java : Q B 2 p.1 2 Java Java JDK Sun Microsystems Oracle JDK javac Java java JVM IDESun Microsystems Oracle NetBeans, IBM 1 Eclipse 2, JetBrains IntelliJ IDEA IDE GUI JDK Java 2.1 Hello World! 2.1.1 Java 2.1.1 GUI

More information

やさしいJavaプログラミング -Great Ideas for Java Programming サンプルPDF

やさしい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

More information

class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value =

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

More information

K227 Java 2

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

More information

10K pdf

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

More information

r2.dvi

r2.dvi 2002 2 2003.1.29 1 2.1-2.3 (1) (2) 2.4-2.6 (1)OO (2)OO / 2.7-2.10 (1)UML (2) Java 3.1-3.3 (1) (2)GoF (3)WebSphere (4) 3.4-3.5 3.6-3.9 Java (?) 2/12( ) 20:00 2 (2 ) 3 Java (?)1 java.awt.frame Frame 1 import

More information

Javaセキュアコーディングセミナー2013東京第1回 演習の解説

Javaセキュアコーディングセミナー2013東京第1回 演習の解説 Java セキュアコーディングセミナー東京 第 1 回オブジェクトの生成とセキュリティ 演習の解説 2012 年 9 月 9 日 ( 日 ) JPCERT コーディネーションセンター脆弱性解析チーム戸田洋三 1 演習 [1] 2 演習 [1] class Dog { public static void bark() { System.out.print("woof"); class Bulldog

More information

I java A

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..........................................

More information

Java演習(2) -- 簡単なプログラム --

Java演習(2)   -- 簡単なプログラム -- Java public class Hello Hello (class) (field)... (method)... Java main Hello World(Hello.java) public class Hello { public static void main(string[ ] args) { public() (package) Hello World(Hello.java)

More information

Local variable x y i paint public class Sample extends Applet { public void paint( Graphics gc ) { int x, y;... int i=10 ; while ( i < 100 ) {... i +=

Local variable x y i paint public class Sample extends Applet { public void paint( Graphics gc ) { int x, y;... int i=10 ; while ( i < 100 ) {... i += Safari AppletViewer Web HTML Netscape Web Web 13-1 Applet Web Applet init Web paint Web start Web HTML stop destroy update init Web paint start Web update Event Driven paint Signature Overwriting Overriding

More information

text_12.dvi

text_12.dvi C 12 2000 7 2 12 Java(7) { Swing(, ), 1 12.1 12 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 1 12.2 Swing : : : : : : : : : : : : : : : : : : : : : : : : : : : : :

More information

Microsoft Word - keisankigairon.ch doc

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

More information

public class Kadai _02 { public static void main(string[] args) { MyFrame frame = new MyFrame("Kadai _02"); (2) フレームのクラス名は MyFrame とし 以下

public class Kadai _02 { public static void main(string[] args) { MyFrame frame = new MyFrame(Kadai _02); (2) フレームのクラス名は MyFrame とし 以下 オブジェクト指向プログラミング演習課題 20071128 以下のような GUI 画面を表示するプログラムを完成させなさい 前回演習で作成したプログラムにイベント処理を追加します 注意 : ファイル名が同じものがあるので 課題毎にディレクトリーを分ける等してください 課題 20071128_01 講義資料内で紹介したイベント処理の例 2 を作成し 動作を確認せよ (1) コントロールクラス (main

More information

B02-095 2007 2 15 1 3 2 4 2.1............................. 4 2.2........................................ 5 2.3........................................ 6 3 7 3.1................................. 7 3.2..............................

More information

JAVA とテンプレート

JAVA とテンプレート JAVA とテンプレート 序論 : コンテナ 他のクラスのオブジェクトを保存するものをコンテナ (Container) と呼ぶ 集合 リスト 表 コンテナに求められる機能 追加 削除 参照 要素の比較 並べ替え 要素のクラスが不明では 比較できない 要素が想定しているクラスのものかの判定 テンプレート以前の対応方法 コンテナ設計時に 保存されるクラスを特定してコンテナをコードする 保存されるクラスごとに作成しなければならない

More information

r1.dvi

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

More information

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

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

More information

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

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

More information

class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value =

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

More information

r4.dvi

r4.dvi 00 4 2000.6.24 0 GUI GUI GUI GUI 1 1.1 3 2 1 import java.applet.applet; import java.awt.*; public class r3ex2 extends Applet { Figure[] figs = new Figure[]{ new Circle(Color.blue, 100.0, 100.0, 30.0, 1.1,

More information

r8.dvi

r8.dvi I 2005 8 2005.12.9 GUI GUI ( ) GUI try... catch 1 1.1 2 1 2 paint() run() 1 Y 1 2 sin/cos 2 2 Color.getHSBColor() ( Circle setpaint() getpaint() ) import java.awt.*; import javax.swing.*; public class

More information

r3.dvi

r3.dvi 10 3 2010.9.21 1 1) 1 ( 1) 1: 1) 1.0.1 : Java 1 import java.awt.*; import javax.swing.*; public class Sample21 extends JPanel { public void paintcomponent(graphics g) { g.setcolor(new Color(255, 180, 99));

More information

4 p.2 4 GUI return; public void mousepressed(mouseevent e) { /* 5 */ public void mousereleased(mouseevent e) { /* 5 */ public void mouseentered(mousee

4 p.2 4 GUI return; public void mousepressed(mouseevent e) { /* 5 */ public void mousereleased(mouseevent e) { /* 5 */ public void mouseentered(mousee 4 p.1 4 GUI GUI GUI Java Java try catch C 4.1 4.1.1 4.1.1 MouseTest.java import javax.swing.*; import java.awt.*; import java.awt.event.*; /* 1 */ public class MouseTest extends JPanel implements MouseListener

More information

2 p.2 2 Java Hello0.class JVM Hello0 java > java Hello0.class Hello World! javac Java JVM java JVM : Java > javac 2> Q Foo.java Java : Q B

2 p.2 2 Java Hello0.class JVM Hello0 java > java Hello0.class Hello World! javac Java JVM java JVM : Java > javac 2> Q Foo.java Java : Q B 2 p.1 2 Java Java JDK Sun Microsystems Oracle JDK javac Java java JVM appletviewer IDESun Microsystems NetBeans, IBM 1 Eclipse 2 IDE GUI JDK Java 2.1 Hello World! 2.1.1 Java 2.1.1 Hello World Emacs Hello0.java

More information

< F2D89BA8EE882C E6A7464>

< F2D89BA8EE882C E6A7464> 下手な鉄砲も数撃ちゃ当たる!! [Java アプレット ] [Java アプリケーション ] 1. はじめに 鉄砲を10 回撃つと1 回当たる腕前の人が鉄砲を撃ちます 下枠の [ 自動 10 回 ] または [ 自動 50 回 ] または [ 自動 100 回 ] をクリックすると それぞれ10 回 50 回 100 回 実験を繰り返します ただし 1 回の実験につき20 発の鉄砲を発射します シミュレーションソフト

More information

3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World");

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

More information

次の演習課題(1),(2)のプログラムを完成させよ

次の演習課題(1),(2)のプログラムを完成させよ 次の演習課題 (1),(2) のプログラムを作成せよ. 課題 (1) ボタン押下時の処理を追加し以下の実行結果となるようにプログラムを作成しなさい ( ボタン押下時の処理 ) import java.lang.*; class Figure extends JFrame implements ActionListener{ JPanel panel; JScrollPane scroll; JTextArea

More information

< F2D82518E9F8AD CC834F CC8CFC82AB82C68D4C>

< F2D82518E9F8AD CC834F CC8CFC82AB82C68D4C> 2 次関数のグラフの向きと広がり [Java アプレット ] [Java アプリケーション ] 1. はじめに 2 2 y=ax のグラフについて x の係数 aが正のときと負のときでは グラフにどのような違いがあるでしょうか 2 2 y=ax のグラフについて x の係数 aが正のとき 係数 aの値が大きくなるにつれて グラフの広がりはどうなるでしょうか 2 2 y=ax のグラフについて x の係数

More information

明解Javaによるアルゴリズムとデータ構造

明解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

More information

< F2D E E6A7464>

< F2D E E6A7464> ピタゴラス数 [Java アプレット ] [Java アプリケーション ] 1. はじめに 2 2 2 三平方の定理 a +b =c を満たす3つの自然数の組 ( a, b, c) をピタゴラス数と言います ピタゴラス数の最も簡単な例として (3,4,5) がありますね このピタゴラス数を求めるには ピタゴラスの方法とプラトンの方法の2つの方法があります 2 2 ピタゴラス数 (a,b,c) に対して

More information

ÿþ˜u#u·0¹0Æ0à0

ÿþ˜u#u·0¹0Æ0à0 応用プログラミング - イベント処理 - イベント : プログラムへの働きかけ (GUI のボタンをクリックする, キーボードよりデータを入力するなど ) イベント処理 ( イベントハンドリング ): イベントに対する応答及びそのプログラム処理 イベントを処理するプログラムは イベントが発生した場合にのみ 呼び出される ( イベントドリブン ) GUI イベント イベント処理のプログラム イベント処理の仕組みと流れ

More information

< F2D A839382CC906A2E6A7464>

< F2D A839382CC906A2E6A7464> ビュホンの針 1. はじめに [Java アプレット ] [Java アプリケーション ] ビュホン ( Buffon 1707-1788) は 針を投げて円周率 πを求めることを考えました 平面上に 幅 2aの間隔で 平行線を無数に引いておきます この平面上に長さ2bの針を落とすと この針が平行線と交わる確立 pは p=(2b) (aπ) 1 となります ただし b

More information

Microsoft PowerPoint ppt

Microsoft PowerPoint ppt 独習 Java ( 第 3 版 ) 6.7 変数の修飾子 6.8 コンストラクタの修飾子 6.9 メソッドの修飾子 6.10 Object クラスと Class クラス 6.7 変数の修飾子 (1/3) 変数宣言の直前に指定できる修飾子 全部で 7 種類ある キーワード final private protected public static transient volatile 意味定数として使える変数同じクラスのコードからしかアクセスできない変数サブクラスまたは同じパッケージ内のコードからしかアクセスできない変数他のクラスからアクセスできる変数インスタンス変数ではない変数クラスの永続的な状態の一部ではない変数不意に値が変更されることがある変数

More information

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 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]));

More information

oop1

oop1 public class Car{ int num; double gas; // double distance; String maker; // // // void drive(){ System.out.println(""); Car.java void curve(){ System.out.println(""); void stop(){ System.out.println("");

More information

Java 2 p.2 2 Java Hello0.class JVM Hello0 java > java Hello0.class Hello World! javac Java JVM java JVM : Java > javac 2> Q Foo.java Java : Q 2.

Java 2 p.2 2 Java Hello0.class JVM Hello0 java > java Hello0.class Hello World! javac Java JVM java JVM : Java > javac 2> Q Foo.java Java : Q 2. Java 2 p.1 2 Java Java JDK Sun Microsystems Oracle JDK javac Java java JVM appletviewer IDE Sun Microsystems NetBeans, IBM 1 Eclipse 2 IDE GUI JDK Java 2.1 Hello World! 2.1.1 Java 2.1.1 Hello World Emacs

More information

public class MyFrame { private JPanel panel1; private JPanel panel2; private JPanel panel3; private JPanel panel4; private JLabel label1; private JTex

public class MyFrame { private JPanel panel1; private JPanel panel2; private JPanel panel3; private JPanel panel4; private JLabel label1; private JTex ソフトウェア基礎演習課題 20061206 以下のような GUI 画面を表示するプログラムを完成させなさい 前回演習で作成したプログラムにイベント処理を追加します 注意 : ファイル名が同じものがあるので 課題毎にディレクトリーを分ける等してください ( 簡易レジスター ) 概略仕様 : 1. フレーム内にはパネルが4つあり レイアウトは GridLayout(4, 1)(4 行 1 列のレイアウト

More information

Java言語 第1回

Java言語 第1回 Java 言語 第 11 回ウインドウ型アプリケーション (2) 知的情報システム工学科 久保川淳司 kubokawa@me.it-hiroshima.ac.jp メニュー (1) メニューを組み込むときには,MenuBar オブジェクトに Menu オブジェクトを登録し, その Menu オブジェクトに MenuItem オブジェクトを登録する 2 つの Menu オブジェクト File New

More information

3 p.1 3 Java Java Java try catch C Java if for while C 3.1 boolean Java if C if ( ) 1 if ( ) 1 else , 2 { } boolean true false 2 boolean Gr

3 p.1 3 Java Java Java try catch C Java if for while C 3.1 boolean Java if C if ( ) 1 if ( ) 1 else , 2 { } boolean true false 2 boolean Gr 3 p.1 3 Java Java Java try catch C Java if for while C 3.1 boolean Java if C if ( ) 1 if ( ) 1 else 2 1 1 2 2 1, 2 { boolean true false 2 boolean Graphics draw3drect fill3drect C int C OK while (1)...

More information

Java演習(4) -- 変数と型 --

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

More information

Java 2 - Lesson01

Java 2 - Lesson01 Java2 第 4 回 高度な GUI デザインの作成 キーポイント FocusListener の作成 Exercise 3 and 4 今まで学んだ機能を組み合わせて 高度なデザインの GUI を作成します レイアウトやイベントの作成については各自で考えて 工夫して下さい 作成する GUI の動作を確認したい場合は Java2 コースの Web ページ上にある jar ファイルをダウンロード 起動して動作を確認して下さい

More information

< F2D834F838C A815B A CC>

< F2D834F838C A815B A CC> グレゴリー ライプニッツの公式 [Java アプレット ] [Java アプリケーション ] 1. はじめに 次のグレゴリー ライプニッツの公式を用いて π の近似値を求めてみましょう [ グレゴリー ライプニッツの公式 ] π 4 =1-1 3 + 1 5-1 7 + 1 9-1 + 11 シミュレーションソフト グレゴリー ライプニッツの公式による π の近似 を使って π の近似値が求まる様子を観察してみてください

More information

: : : TSTank 2

: : : 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);

More information

< F2D B838A835882CC8CF68EAE2E6A7464>

< F2D B838A835882CC8CF68EAE2E6A7464> ウォーリスの公式 [Java アプレット ] [Java アプリケーション ] 1. はじめに 次のウォーリスの公式を用いて π の近似値を求めてみましょう [ ウォーリスの公式 ] π=2{ 2 2 4 4 6 6 1 3 3 5 5 7 シミュレーションソフト ウォーリスの公式による π の近似 を使って π の近似値が求まる様子を観察してみてください 2.Java アプレット (1) Javaプログラムリスト

More information

ガイダンス

ガイダンス プログラムの 1 行目に以下を入れること // vm12345 杉崎えり子 情報科学 B 第 14 回課題作成 3 情報科学 B Info2/3 info14 今日のフォルダー作成 情報科学 B 第 14 回課題作成 3 Report14_1.java 1 教科書 資料 過去のプログラムを見ながらで OK 課題 3( 提出 ) ボタンとアニメーション ( 第 13 回 ) を組み合わせて オリ ジナルのウィンドウを作成する

More information

Microsoft PowerPoint - OOP.pptx

Microsoft PowerPoint - OOP.pptx 第 5 回 第 3 章継承 91 継承 ( インヘリタンス ): ウインドウシステムを例に説明 図 3.1: ウインドウの中にラベル, ボタン, リストの部品 各部品の属性と操作共通の属性と操作 ウインドウ内の左上を原点として (x, y) で場所指定 : 属性 (width, height) でサイズ指定 : 属性 識別のための名前 (name): 属性 置く位置の指定 (setlocation,

More information

アルゴリズムとデータ構造1

アルゴリズムとデータ構造1 1 2005 7 22 22 (sakai.keiichi@kochi sakai.keiichi@kochi-tech.ac.jp) 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) =

More information

解きながら学ぶJava入門編

解きながら学ぶ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

More information

2 p.2 2 Java Hello0.class JVM Hello0 java > java Hello0.class Hello World! javac Java JVM java JVM : Java > javac 2> Q Foo.java Java : Q B

2 p.2 2 Java Hello0.class JVM Hello0 java > java Hello0.class Hello World! javac Java JVM java JVM : Java > javac 2> Q Foo.java Java : Q B 2 p.1 2 Java Java JDK Sun Microsystems Oracle JDK javac Java java JVM appletviewer IDESun Microsystems NetBeans, IBM 1 Eclipse 2 IDE GUI JDK Java 2.1 Hello World! 2.1.1 Java 2.1.1 Hello World Emacs Hello0.java

More information

B 10 : N ip2003f10.tex B : 9/12/ :02 p.1/71

B 10 : N ip2003f10.tex B : 9/12/ :02 p.1/71 B 10 : ks91@sfc.wide.ad.jp N206 2003 ip2003f10.tex B : 9/12/2003 10:02 p.1/71 : / ip2003f10.tex B : 9/12/2003 10:02 p.2/71 ip2003f10.tex B : 9/12/2003 10:02 p.3/71 1 http://java.sun.com/j2se/1.4.1/docs/api/

More information

Java (9) 1 Lesson Java System.out.println() 1 Java API 1 Java Java 1

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

More information

Chapter 20. [ ] ; [ ] = new [ ] ; Color colors [ ] = new Color[ 20 ]; // 20 Button operations [ ] = new Button[ 10 ]; // 10 colors[ 3 ] = new Color( 1

Chapter 20. [ ] ; [ ] = new [ ] ; Color colors [ ] = new Color[ 20 ]; // 20 Button operations [ ] = new Button[ 10 ]; // 10 colors[ 3 ] = new Color( 1 Chapter 20. [ ] ; [ ] = new [ ] ; Color colors [ ] = new Color[ 20 ]; // 20 Button operations [ ] = new Button[ 10 ]; // 10 colors[ 3 ] = new Color( 10, 30, 40 ); gc.setcolor( colors[ 3 ] ); operations[

More information

明解Java入門編

明解Java入門編 1 Fig.1-1 4 Fig.1-1 1-1 1 Table 1-1 Ease of Development 1-1 Table 1-1 Java Development Kit 1 Java List 1-1 List 1-1 Chap01/Hello.java // class Hello { Java System.out.println("Java"); System.out.println("");

More information

ガイダンス

ガイダンス プログラムの 1 行目に自分の名前を入れること // vm12345 杉崎えり子 情報科学 B 第 14 回課題作成 3 情報科学 B Info2/3 info14 今日のフォルダー作成 情報科学 B 第 14 回課題作成 3 Report14_1.java 1 教科書 資料 過去のプログラムを見ながらで OK 課題 3( 提出 ) ボタンとアニメーション ( 第 13 回 ) を組み合わせて オリ

More information

GUIプログラムⅣ

GUIプログラムⅣ GUI プログラム Ⅳ 画像指定ウィンドウの生成 ファイル名 :awtimage.java import java.awt.*; import java.awt.event.*; public class awtimage extends Frame // コンポーネントクラスの宣言 Button btnbrowse; Label lblcaption7; TextField txtimage; //

More information

. 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

. 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

More information

2 1 Web Java Android Java 1.2 6) Java Java 7) 6) Java Java (Swing, JavaFX) (JDBC) 7) OS 1.3 Java Java

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

More information

データ構造とアルゴリズム論

データ構造とアルゴリズム論 15 11 11 Java 21 231-0811 32 152-0033 1 Java 3-5,55,63,39,87,48,70,35,77,59,44 3-5 3-7 score2.txt 75 15 11 11 5-1 3-7 jbuttonread jbuttondisplay jlabelmessage jtextfieldname jtextfieldtokuten

More information

Applet java.lang.object java.awt.component java.awt.container java.awt.panel java.applet.applet

Applet java.lang.object java.awt.component java.awt.container java.awt.panel java.applet.applet 13 Java 13.9 Applet 13.10 AppletContext 13.11 Applet java.lang.object java.awt.component java.awt.container java.awt.panel java.applet.applet Applet (1/2) Component GUI etc Container Applet (2/2) Panel

More information

Microsoft PowerPoint - prog12.ppt

Microsoft PowerPoint - prog12.ppt プログラミング言語 3 第 12 回 (2007 年 12 月 17 日 ) 1 今日の配布物 片面の用紙 1 枚 今日の課題が書かれています 本日の出欠を兼ねています 2/57 今日やること http://www.tnlab.ice.uec.ac.jp/~s-okubo/class/java06/ にアクセスすると 教材があります 2007 年 12 月 17 日分と書いてある部分が 本日の教材です

More information

CONTENTS 0 1 2 3 4 5 6 7 8 9 10 0 Java10 BaseFrame.java 1 import javax.swing.*; import java.awt.*; import java.awt.event.*; public class BaseFrame extends JFrame { public BaseFrame(String title) { super(title);

More information

2 p.2 2 Java > javac Hello0.java Hello0.class JVM Hello0 java > java Hello0.class Hello World! javac Java JVM java JVM : Java > javac 2> Q Foo.j

2 p.2 2 Java > javac Hello0.java Hello0.class JVM Hello0 java > java Hello0.class Hello World! javac Java JVM java JVM : Java > javac 2> Q Foo.j 2 p.1 2 Java Java JDK Sun Microsystems Oracle JDK javac Java java JVM appletviewer IDESun Microsystems Oracle NetBeans, IBM 1 Eclipse 2, JetBrains IntelliJ IDEA IDE GUI JDK Java 2.1 Hello World! 2.1.1

More information

KeyListener init addkeylistener addactionlistener addkeylistener addkeylistener( this ); this.addkeylistener( this ); KeyListener public void keytyped

KeyListener init addkeylistener addactionlistener addkeylistener addkeylistener( this ); this.addkeylistener( this ); KeyListener public void keytyped KeyListener keypressed(keyevent e) keyreleased(keyevent e) keytyped(keyevent e) MouseListener mouseclicked(mouseevent e) mousepressed(mouseevent e) mousereleased(mouseevent e) mouseentered(mouseevent e)

More information

Java (5) 1 Lesson 3: x 2 +4x +5 f(x) =x 2 +4x +5 x f(10) x Java , 3.0,..., 10.0, 1.0, 2.0,... flow rate (m**3/s) "flow

Java (5) 1 Lesson 3: x 2 +4x +5 f(x) =x 2 +4x +5 x f(10) x Java , 3.0,..., 10.0, 1.0, 2.0,... flow rate (m**3/s) flow Java (5) 1 Lesson 3: 2008-05-20 2 x 2 +4x +5 f(x) =x 2 +4x +5 x f(10) x Java 1.1 10 10 0 1.0 2.0, 3.0,..., 10.0, 1.0, 2.0,... flow rate (m**3/s) "flowrate.dat" 10 8 6 4 2 0 0 5 10 15 20 25 time (s) 1 1

More information

問1

問1 2008/12/10 OOP 同演習小テスト問題 問 1. 次のプログラムの出力結果を a~d の中から選べ public class Problem1 { public static void main(string[] args){ int i =2; int j =3; System.out.println( i + j ); a) 23 b) 5 c) ij d) i+j 問 2. 次のプログラムの出力結果を

More information

15 Java 15.5 15.6 15.7 Checkbox() Checkbox(String str) Checkbox(String str, boolean state) Checkbox(String str, boolean state, CheckboxGroup grp) Checkbox(String str, CheckboxGroup grp, boolean state)

More information

GUIプログラムⅤ

GUIプログラムⅤ GUI プログラム Ⅴ 前回課題の制作例 ファイル名 :awttest.java public class awttest public static void main(string arg[]) //=============================================== // ウィンドウ (Frame クラス ) のインスタンスを生成 //===============================================

More information