tmp.dvi

Size: px
Start display at page:

Download "tmp.dvi"

Transcription

1 Part 2 Swing Chapter JWindow JWindow JWindow AWT JDialog JDialog JDialog AWT JOptionPane JOptionPane

2 JOptionPane JOptionPane JOptionPane AWT Chapter JInternalFrame JInternalFrame JInternalFrame JInternalFrame AWT JDesktopPane JDesktopPane JDesktopPane JDesktopPane AWT DesktopManager DefaultDesktopManager Chapter JFileChooser JFileChooser JFileChooser JFileChooser AWT 168

3 JColorChooser JColorChooser JColorChooser JColorChooser AWT Chapter AbstractListModel DefaultListModel JList JList JList JList AWT Chapter ComboBoxModel MutableComboBoxModel DefaultComboBoxModel

4 JComboBox JComboBox JComboBox JComboBox AWT Chapter TableModel AbstractTableModel DefaultTableModel DefaultTableColumnModel TableCellRenderer CellEditor TableCellEditor TableCellEditor

5 JTableHeader JTable JTable JTable TableModelEvent TableColumnModelEvent ListSelectionEvent JTable AWT Chapter TreeNode MutableTreeNode DefaultMutableTreeNode DefaultTreeModel DefaultTreeSelectionModel DefaultTreeCellRenderer Metal DefaultCellEditor DefaultTreeCellEditor 461

6 Test SelectableFile FileNode JTree JTree JTree JTree AWT Chapter Swing javax.swing.text / JTextComponent JTextComponent JTextComponent

7 11 Chapter JTextField JTextField JTextField JTextField AWT JPasswordField JPasswordField JPasswordField JTextArea JTextArea JTextArea AWT JEditorPane JEditorPane JEditorPane JEditorPane JTextPane JTextPane JTextPane AWT Chapter AttributeSet StyleConstants

8 StyleContext Appendix A 637 Appendix B

9

10 CHAPTER 14 JWindow - JWindow - JWindow JDialog - JDialog - JDialog JOptionPane - - JOptionPane

11 Window Frame Dialog Frame

12 20 Chapter 14 Frame Dialog Window Window JRootPane JFrame Frame Window Dialog JWindow java.awt.window JRootPane JWindow JWindow - JWindow JLabel - - JWindow JLabel

13 14.1 JWindow JWindow 14-1 JWindow import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Test extends JFrame { Toolkit toolkit = Toolkit.getDefaultToolkit(); JWindow window = new JWindow(); JLabel label = new JLabel(new ImageIcon("mandrill.jpg")); static public void main(string[] args) { JFrame frame = new Test(); public Test() { label.setborder(borderfactory.createraisedbevelborder()); window.getcontentpane().add(label, "Center"); centerwindow(); window.show(); window.addmouselistener(new MouseAdapter() { public void mousepressed(mouseevent e) { if(e.getclickcount() == 2) { window.dispose(); System.exit(0); ); private void centerwindow() { Dimension scrnsize = toolkit.getscreensize(); Dimension labelsize = label.getpreferredsize();

14 22 Chapter 14 int labelwidth = labelsize.width, labelheight = labelsize.height; window.setlocation(scrnsize.width/2 - (labelwidth/2), scrnsize.height/2 - (labelheight/2)); window.pack(); pack() show() pack() dispose() JWindow JComponent JWindow setborder() JWindow JWindow JRootPane - JWindow 14-2 JWindow

15 14.1 JWindow 23 - JFrame JWindow import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Test extends JApplet { JWindow window = new JWindow(); JMenuBar menubar = new JMenuBar(); JMenu filemenu = new JMenu("File"); JMenuItem quititem; public Test() { final Container contentpane = getcontentpane(); JButton button = new JButton("show window..."); JRootPane windowrootpane = window.getrootpane(); contentpane.setlayout(new FlowLayout()); contentpane.add(button); filemenu.add("new"); filemenu.add("open..."); filemenu.add("save"); filemenu.add("save As..."); filemenu.addseparator(); filemenu.add(quititem = new JMenuItem("Quit")); menubar.add(filemenu); window.getrootpane().setjmenubar(menubar); window.getrootpane().setborder(borderfactory.createraisedbevelborder()); button.addactionlistener(new ActionListener() { public void actionperformed(actionevent e) { Point pt = contentpane.getlocation(); SwingUtilities.convertPointToScreen(pt, contentpane); // window.setbounds(pt.x + 10, pt.y + 10, 200, 200); window.show(); quititem.addactionlistener(new ActionListener() { public void actionperformed(actionevent e) { window.dispose(); );

16 24 Chapter 14 ); JWindow JFrame JWindow JWindow JWindow java.awt.window - RootPane Container java.awt. Window A Accessible implements extends implements JRootPane rootpane JWindow rootpanecheckingenabled boolean 14-3 JWindow

17 14.1 JWindow 25 JWindow JWindow java.awt.window Accessible RootPaneContainer JWindow boolean protected JRootPane - JWindow 14-2 JWindow contentpane Container JPanel glasspane Component Component layeredpane JLayeredPane JLayeredPane rootpane JRootPane JRootPane contentpane JWindow glasspane layeredpane JLayeredPane rootpane JWindow JWindow AP I JWindow java.awt.window RootPaneContainer javax.accessibility.accessible

18 26 Chapter 14 public JWindow() public JWindow(Frame) public JWindow(GraphicsConfiguration) 1 public JWindow(Window) public JWindow(Window, GraphicsConfiguration) JWindow java.awt.frame JDialog JWindow SwingUtilities.getSharedOwnerFrame() protected void addimpl(component, Object, int) protected JRootPane createrootpane() protected boolean isrootpanecheckingenabled() protected void setrootpanecheckingenabled(boolean) protected void setrootpane(jrootpane) public void setlayout(layoutmanager) protected void windowinit() JWindow RootPaneContainer JWindow setrootpanecheckingenabled() isrootpanecheckingenabled() JWindow createrootpane() JRootPane JWindow protected setlayout() Window

19 14.1 JWindow 27 windowinit() JWindow JWindow protected RootPaneContainer public Container getcontentpane() public Component getglasspane() public JLayeredPane getlayeredpane() public JRootPane getrootpane() public void setcontentpane(container) public void setglasspane(component) public void setlayeredpane(jlayeredpane) RootPaneContainer RootPaneContainer JRootPane public AccessibleContext getaccessiblecontext() protected String paramstring() public void remove(component) 2 JWindow Accessible getaccessiblecontext() Accessible JComponent paramstring() JWindow java.awt.window Window Container remove()

20 28 Chapter 14 JWindow JDialog JRootPane JDialog JRootPane JDialog JOptionPane JDialog ConstraintsPanel

21 14.2 JDialog 29 ConstraintsPanel - JPanel Frame null true JDialog getcontentpane() ConstraintsPanel pack() NOTE pack() public class Test extends JApplet { private ConstraintsPanel cp = new ConstraintsPanel(); private JPanel buttonspanel = new JPanel(); private JButton showbutton = new JButton("show dialog..."), okbutton = new JButton("OK"), applybutton = new JButton("Apply"), cancelbutton = new JButton("Cancel"); private JButton[] buttons = new JButton[] { okbutton, applybutton, cancelbutton, ; private JDialog dialog = new JDialog((Frame)null, // "Constraints Dialog",// true); // public Test() { Container contentpane = getcontentpane(); Container dialogcontentpane = dialog.getcontentpane(); contentpane.setlayout(new FlowLayout()); contentpane.add(showbutton); dialogcontentpane.add(cp, BorderLayout.CENTER); dialogcontentpane.add(buttonspanel, BorderLayout.SOUTH); dialog.pack(); //... for(int i=0; i < buttons.length; ++i) { buttonspanel.add(buttons[i]); addbuttonlisteners(); //...

22 30 Chapter 14 dispose() dispose() //... private void addbuttonlisteners() { showbutton.addactionlistener(new ActionListener() { public void actionperformed(actionevent e) { // setlocationrelativeto() // dialog.setlocationrelativeto(test.this); dialog.show(); ); okbutton.addactionlistener(new ActionListener() { public void actionperformed(actionevent e) { showstatus("ok button Activated"); dialog.dispose(); ); // JDialog import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Test extends JApplet { private ConstraintsPanel cp = new ConstraintsPanel(); private JPanel buttonspanel = new JPanel(); private JButton showbutton = new JButton("show dialog..."), okbutton = new JButton("OK"), applybutton = new JButton("Apply"), cancelbutton = new JButton("Cancel"); private JButton[] buttons = new JButton[] { okbutton, applybutton, cancelbutton, ; private JDialog dialog = new JDialog((Frame)null, // "Constraints Dialog",// true); // public Test() { Container contentpane = getcontentpane();

23 14.2 JDialog 31 Container dialogcontentpane = dialog.getcontentpane(); contentpane.setlayout(new FlowLayout()); contentpane.add(showbutton); dialogcontentpane.add(cp, BorderLayout.CENTER); dialogcontentpane.add(buttonspanel, BorderLayout.SOUTH); dialog.pack(); // // setlocationrelativeto() pack() // // setlocationrelativeto() // setlocationrelativeto() // dialog.setlocationrelativeto(this); for(int i=0; i < buttons.length; ++i) { buttonspanel.add(buttons[i]); addbuttonlisteners(); private void addbuttonlisteners() { showbutton.addactionlistener(new ActionListener() { public void actionperformed(actionevent e) { // setlocationrelativeto() // dialog.setlocationrelativeto(test.this); dialog.show(); ); okbutton.addactionlistener(new ActionListener() { public void actionperformed(actionevent e) { showstatus("ok button Activated"); dialog.dispose(); ); applybutton.addactionlistener(new ActionListener() { public void actionperformed(actionevent e) { showstatus("apply button Activated"); ); cancelbutton.addactionlistener(new ActionListener() { public void actionperformed(actionevent e) { showstatus("cancel button Activated"); dialog.dispose(); ); JDialog -

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

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

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

ソフトウェア基礎演習 課題

ソフトウェア基礎演習 課題 オブジェクト指向プログラミング演習課題 20071205 以下のような GUI 画面を表示するプログラムを完成させなさい 前回演習で作成したプログラムにメニューを追加します 注意 : ファイル名が同じものがあるので 課題毎にディレクトリーを分ける等してください 課題 20071205_01 講義資料内で紹介したメニュー処理の例を完成し 動作を確認せよ (1) コントロールクラス (main メッソドを含むクラス

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

目 次 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

Microsoft Word - Java4.DOC

Microsoft Word - Java4.DOC Java 入門 ( 6) 科名 T u t o r i a l g r o u p 氏 名 2005.2 1 テキストフィールド (TextField) テキストフィールド (TextField) は 1 行だけの編集可能な文字列を表示 / 入力するためのコンポーネントである テキストフィールドは TextComponent を継承している 例題 1 P326password.java テキスト P325~P326

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

awt の主要なクラスを下記に示す クラス Component Container Button Label Panel Frame 説明画面にユーザインターフェイス要素として表示し, ユーザとのやり取りを行うコンポーネントを表すすべてのコンポーネントのスーパークラスになる ほかのコンポーネントを含

awt の主要なクラスを下記に示す クラス Component Container Button Label Panel Frame 説明画面にユーザインターフェイス要素として表示し, ユーザとのやり取りを行うコンポーネントを表すすべてのコンポーネントのスーパークラスになる ほかのコンポーネントを含 第 3 章 GUI による電卓の実装 GUI の基礎とイベント処理について理解し, 前章で作成した演算プログラムを組み込んで電卓を作成 ( 実装 ) する 3.1 インターフェイス 文字などのコマンドだけでやりとりするインターフェイスを CUI(Command User Interface) と呼び, マウスなどでウインドウを操作して行うインターフェイスを GUI(Graphical User Interface)

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

Microsoft PowerPoint - swing2.ppt

Microsoft PowerPoint - swing2.ppt Java/Swing について (2) 2005 年 10 月 11 日 海谷治彦 1 Adapterについて TextField TextArea Copy&Paste JList JComboBox JScrollPane レイアウトについて 目次 2 ソースコード 前回より抜粋 public class Listener1 { public static void main(string[]

More information

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;

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; 5 p.1 5 JPanel (toy example) 5.1 2 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, 5 p.2 5 5.2 Point int Java

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

2

2 問題 1 次の設問 1,2 に答えよ 設問 1 1 から 10 まで数えながら その数が偶数か奇数かを表示する JAVA プログラムの一部である 空欄に入るべき文字列は何か for( int i=1; 1 ; i++){ System.out.print(i); if( 2 == 0){ System.out.println(" is Even"); else{ System.out.println("

More information

Java 2 - Lesson01

Java 2 - Lesson01 第 2 回 GUI コンポーネントのイベント処理 GUI Component Event Handling キーポイント イベント イベントリスナー イベント処理とは何か? ActionEventとActionListenerについて ItemEventとItemListenerについて TextEventとTextListenerについて KeyEventとKeyListenerについて AdjustmentEventとadjustmentListenerについて

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

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

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

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),(2)のプログラムを完成させよ

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

More information

ガイダンス

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

More information

......() JButton............

......() JButton............ ......() JButton............ playerpanel (JPanel) (JScrollPane) playerlist (JList) Window(JFrame) resultlabel(jlabel) statuspanel(jpanel) dealerpanel (JPanel) (JScrollPane) dealerlist (JList) playerresult

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

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

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

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

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

アプレットⅢ

アプレットⅢ アプレット Ⅲ JV3 今回の課題項目 アプレット (GUI アプリケーション AWT Swing) アプレット (GUI コンポーネント GUI コントロールクラス ) アプレット (AWT コンポーネントの表示 ) アプレット ( レイアウト ) アプレット (GUI コンポーネントのイベント処理 ) 今回の重点項目 アプレット (GUI コンポーネント ) -1- アプレット GUI アプリケーションの概要

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

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

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

More information

最初に

最初に Graphical User Interface widget を使う オブジェクト指向プログラミング特論 2016 年度 只木進一 : 工学系研究科 Java と GUI 多くのプログラミング言語では GUI は言語とは別のライブラリ 例 :c/c++ と X11 GTK プラットフォーム依存 Java では GUI ライブラリが言語と同封されて配布 プラットフォーム独立 各プラットフォームのウィンドウマネージャ利用可

More information

Microsoft PowerPoint - swing3.ppt

Microsoft PowerPoint - swing3.ppt Java/Swing について (3) 2005 年 10 月 19 日 海谷治彦 1 目次 メニューと AbstractAction ダイアログ ファイルダイヤログ Inner Class ( 内部クラス ) Anonymous Inner Class ( 無名内部クラス ) GUI でもちっとはクラス図を使おう. 実行可能アーカイブ (jar) の作り方 エクリプス無しでも実行したい. 2 メニューと

More information

PowerPoint Presentation

PowerPoint Presentation 上級プログラミング 2( 第 3 回 ) 工学部情報工学科 木村昌臣 今日のテーマ GUI プログラミング入門 AWT Java で GUI を作る方法 (API) AWT Abstract Window Toolkit GUIをつくるクラス群を提供 ( 基本!) OSによらない外観 Swing 逆にいえば OS ネイティブな look and feel ではない AWT をもとに JavaFX JDK1.8

More information

<4D F736F F F696E74202D AC C8899E D834F E >

<4D F736F F F696E74202D AC C8899E D834F E > Java 簡単な応用プログラム ( その 2) Java は すでにある部品群を上手く使ってプログラムを組み立てます 前回と同様に Frame を使って ウインドウを表示するプログラムを作りましょう. Frameは ウインドウを作るための部品で フレーム ( 枠 ) とタイトルおよび, 決められた仕組みが入っています. java.awt パッケージは, ウインドウ関連の部品が多くあります. javax.swing

More information

vol.30.}...`.X...b.h

vol.30.}...`.X...b.h Manabu Nakamura mondo@its.hiroshima-cu.ac.jp q w e e e for (int i = 0; i < N; i++) { calculators[i] = new Calculator(); calculators[i].run(); 70 JAVA PRESS Vol.30 import java.math.biginteger; public class

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

: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

Java 2 - Lesson01

Java 2 - Lesson01 第 3 回 複雑なレイアウトのイベント処理 画像 データの読込み テーブルの使用 キーポイント レイアウトについて 前回までのレイアウト レイアウトの補足機能 固定座標を用いたレイアウト Grid Layout CardLayout について Card Layout Card Layout による複数ページ表示 ファイルの読み込み JFileChooser クラス java.awt.filedialog

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

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

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

Java - Visual Editor

Java - Visual Editor Visual Editor で Swing アプリケーションを作成 Swing プログラミングに慣れて居ても ソースコード上丈で思い通りの GUI を作成するのは 可成り骨の折れる作業で有る Visual Editor を使用すれば 試行錯誤し乍ら 非常に簡単に GUI アプリケーションを作成する事が出来る 此処では JFrame を拡張して 簡単なアプリケーションを作成して観る事にする Java

More information

Prog1_12th

Prog1_12th 2014 年 7 月 3 日 ( 木 ) 実施 GUIプログラミング今回の授業では,Java 言語での GUI(Graphical User Interface) プログラミングの基礎について学習する GUIツールキット Java 言語では,GUI プログラミング用のツールキットとして, 次のものが用意されている 1) AWT(Abstract Window Toolkit) 2) Swing AWT

More information

GUIプログラムⅤ

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

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

ガイダンス

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

More information

Java 2 - Lesson01

Java 2 - Lesson01 Welcome to プログラミング演習 2 Instructor: Jianhua MA TA: 池邉曜 and 李漠 (LI Mo) Course HP URL: https://cis.k.hosei.ac.jp/~jianhua/course/j2/ 1 第 1 回 GUI (Graphics User Interface) 基礎とコンポーネントの作成 キーポイント GUI コンポーネント

More information

Java プログラミング講習会 第 2 回 芝浦工業大学工学部情報工学科杉本徹 2017 年 3 月 27 日 public class Person { String familyname; String firstname; int age; } public void print() { Sy

Java プログラミング講習会 第 2 回 芝浦工業大学工学部情報工学科杉本徹 2017 年 3 月 27 日 public class Person { String familyname; String firstname; int age; } public void print() { Sy Java プログラミング講習会 第 2 回 芝浦工業大学工学部情報工学科杉本徹 2017 年 3 月 27 日 public class Person { String familyname; String firstname; int age; public void print() { System.out.println(familyName + firstname + " さんは " + age

More information

Java 2 - Lesson01

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

More information

LMNtal LMNtal LMNtal JAVA JAVA JAVA LMNtal LMNtal LMNtal

LMNtal LMNtal LMNtal JAVA JAVA JAVA LMNtal LMNtal LMNtal 2003 LMNtal GUI GUI : 2004 2 5 : : 1G00P024-3 LMNtal LMNtal LMNtal JAVA JAVA JAVA LMNtal LMNtal LMNtal 1 1 2 LMNtal 3 2.1 LMNtal.............................. 3 2.1.1 Atom........................ 3 2.1.2...............................

More information

自宅でJava言語の開発環境を作る方法

自宅でJava言語の開発環境を作る方法 ViralBanner の作成方法 2010 年 1 月 31 日更新 あいあいスクール代表 畠茂雄 ( はたけしげお ) もくじ 今回作成するツールの紹介... 3 ソースコードの作成... 5 (1)ViralBanner.html のソースコード... 6 (2)ViralBanner.java のソースコード... 7 (3) 参考 : レイアウトマネージャについて... 10-2 今回作成するツールの紹介

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

ガイダンス

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

More information

2

2 2014/01/15 プログラミング応用 b H24 年度期末テスト問題 問題 1 次の設問 1,2 に答えよ 設問 1 1 から 10 まで数えながら その数が偶数か奇数かを表示する JAVA プログラムの一部である 空欄に入るべき文字列は何か for( int i=1; 1 ; i++){ System.out.print(i); if( 2 == 0){ System.out.println("

More information

Microsoft PowerPoint - prog13.ppt

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

More information

Prog2_11th

Prog2_11th 2012 年 12 月 6 日 ( 木 ) 実施 GUIプログラミング今回及び次回の授業では,Java 言語での GUI プログラミングの基礎について学習する GUIツールキット Java 言語では,GUI プログラミング用のツールキットとして, 次のものが用意されている 1) AWT (Abstract Window Toolkit) 2) Swing AWT は Java 言語の当初から実装されていた標準の

More information

Java言語 第1回

Java言語 第1回 Java 言語 第 10 回ウインドウ型アプリケーション (1) 知的情報システム工学科 久保川淳司 kubokawa@me.it-hiroshima.ac.jp 前回の課題 (1) ボーダーレイアウト, グリッドレイアウト, パネルを使用して, 電卓風のボタンを実現する BorderLayout で NORTH, CENTER, SOUTH に分割 NORTHにはテキストフィールドを設定 CENTERにはパネルを使って9つのボタンを設定

More information

アジェンダ 1 グラフィカルなインタフェース GUI(Graphical User Interface) の基礎 2 Swing を利用する Swing の基礎知識 2

アジェンダ 1 グラフィカルなインタフェース GUI(Graphical User Interface) の基礎 2 Swing を利用する Swing の基礎知識 2 UML によるソフトウェア設計 Java プログラミング 2 1 アジェンダ 1 グラフィカルなインタフェース GUI(Graphical User Interface) の基礎 2 Swing を利用する Swing の基礎知識 2 1. グラフィカルなインタフェース ウィンドウの作成手順 1. ウィンドウ ( フレーム ) を作成する JFrame frame = new JFrame(); 2.

More information

Prog1_12th

Prog1_12th 2018 年 7 月 5 日 ( 木 ) 実施 GUIプログラミング今回の授業では,Java 言語での GUI(Graphical User Interface) プログラミングの基礎について学習する GUIツールキット Java 言語では,GUI プログラミング用のツールキットとして, 次のものが用意されている 1) AWT(Abstract Window Toolkit) 2) Swing AWT

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

r14.dvi

r14.dvi 2008 14 2009.1.30 3e/3f paint (0 n rn() ) 1 / import java.awt.*; import javax.swing.*; public class ex33ef extends JFrame { public ex33ef() { setdefaultcloseoperation(exit_on_close); setpreferredsize(new

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

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

Microsoft PowerPoint - prog13.ppt

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

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

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

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

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

PowerPoint Presentation

PowerPoint Presentation ソフトウェア演習 B GUI を持つ Java プログラムの 設計と実装 4.1 例題 :GUI を持った電卓を作ろう プロジェクトCalculator パッケージ名 :example ソースファイル : Calculator.java GUI.java EventProcessor.java 2 4.2 GUI とイベント処理 GUI の構成 :Swing GUI の場合 フレーム JFrame:

More information

Assignment_.java /////////////////////////////////////////////////////////////////////// // 課題 星の画像がマウスカーソルを追従するコードを作成しなさい 次 ///////////////////

Assignment_.java /////////////////////////////////////////////////////////////////////// // 課題 星の画像がマウスカーソルを追従するコードを作成しなさい 次 /////////////////// Assignment_.java 0 0 0 0 0 /////////////////////////////////////////////////////////// // 課題 次のようにマウスのカーソルに同期しメッセージを /////////////////////////////////////////////////////////// class Assignment_ extends

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

上達Java解答.doc

上達Java解答.doc //[1] (1) package kihonproj; import java.awt.*; import java.awt.event.*; import java.applet.*; import javax.swing.*; public class Sikakumenseki extends JApplet { // public void paint(graphics g){ int tate

More information

Microsoft PowerPoint - OOP.pptx

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

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

10/31 Java AWTの基本構造(Frameクラスの継承) 演習課題資料

10/31 Java AWTの基本構造(Frameクラスの継承) 演習課題資料 10/28 Java AWT の基本構造 (Frame クラスの継承 ) 演習課題資料以下のプログラムを完成せよ 共通課題 1.Frame を生成するプログラム // Frame クラスを継承して 終了ボタンのみを定義した クラスの定義 class WhiteWindow 1 { // Frame クラスの継承をする (Frame クラスの拡張 ) WhiteWindow (String title){

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

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

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

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

< 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

< 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

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

: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

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

GUIプログラムⅡ

GUIプログラムⅡ GUI プログラム Ⅱ 前回課題の制作例 ファイル名 :awtsave.java import java.awt.*; import java.awt.event.*; public class awtsave extends Frame // Button クラスの宣言 Button btnsave; Label lblcaption1, lblcaption2, lblcaption3; Label

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

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演習(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

< F2D B825082CC96E291E82E6A7464>

< F2D B825082CC96E291E82E6A7464> 3x+1 の問題 [Java アプレット ] [Java アプリケーション ] 1. はじめに どんな自然数から始めても良いので その数が偶数ならば2で割り 奇数ならば3 倍して1を加えることを繰り返します そうすると どんな自然数から始めても必ず1になるというのはほんとうなのでしょうか 例えば 11から始めると 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 となります

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

3. Java 2 3 Java C ( ) 4 java main 5 byte 1 128 +127 short 2 32768 +23767 int 4 2 31 2 31 1 long 8 2 63 2 63 1 float 4 7 double 8 15 char 2 ASCII Unic

3. Java 2 3 Java C ( ) 4 java main 5 byte 1 128 +127 short 2 32768 +23767 int 4 2 31 2 31 1 long 8 2 63 2 63 1 float 4 7 double 8 15 char 2 ASCII Unic 1. 1 B 1 ( ) ( ) ( [ ] ) A4 1 ( ) 1 1 2 NetBeans IDE Java Java Swing GUI 3. Java 2 3 Java C ( ) 4 java main 5 byte 1 128 +127 short 2 32768 +23767 int 4 2 31 2 31 1 long 8 2 63 2 63 1 float 4 7 double

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

< F2D82B682E182F182AF82F12E6A7464>

< F2D82B682E182F182AF82F12E6A7464> 3 人のじゃんけん [Java アプレット ] [Java アプリケーション ] 1. はじめに A 君 B 君 C 君の 3 人でじゃんけんを 1 回するときの勝ち負けを考えてみましょう あいこの場合は A 君 B 君 C 君の順に グー グー グー チョキ チョキ チョキ パー パー パー グー チョキ パー グー パー チョキ チョキ グー パー チョキ パー グー パー グー チョキ パー

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

< F2D92DE82E8914B82CC977088D32E6A7464>

< F2D92DE82E8914B82CC977088D32E6A7464> 釣り銭の用意の実験 [Java アプレット ] [Java アプリケーション ] 1. はじめに クラス会などの幹事を務めることはありませんか 幹事になったつもりで考えてみてください 仮に クラス会への参加者人数は 35 人で 会費は 3500 円であるとします また 参加者は 1000 円札 4 枚でお釣りを必要とする人と 1000 円札 3 枚と 500 円玉 1 個でお釣りの要らない人の 2

More information

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

データ構造とアルゴリズム論 15 11 18 A[0]A[4] 0 1 2 3 5 2 12 9 10 4 12 10 9 5 2 4 3 2 1 0 A 1,2,3,4,5 5,4,3,2,1 87 15 11 18 0 1 2 3 4 A 10 9 12 2 5 10 9 12 2 5 A[0]A[1] 9 10 12 2 5 A[1]A[2] 9 10 12 2 5 A[2]A[3] 9 10 2 12 5 A[3]A[4]

More information

Microsoft Word 年度情報コミュニケーション実験II(Ver0.9)c.docx

Microsoft Word 年度情報コミュニケーション実験II(Ver0.9)c.docx 学生証番号 : 名前 : 6. Java とインタラクション インタラクション (interaction) という英語は inter+action から合成されたものであり 相互作用とかやりとりと訳されることが多い その基本は 人間が何かアクション ( 操作 行動 ) をすると 相手側 ( 人間または機械システム ) がそのアクションに対応したリアクションをする という点にある 即ち アクションとリアクションの対

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