<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Yukun&#039;s Blog &#187; GUI</title>
	<atom:link href="http://www.yukun.info/blog/tag/gui/feed" rel="self" type="application/rss+xml" />
	<link>http://www.yukun.info</link>
	<description>難しいことは分かりやすく、簡単なことは面白く紹介</description>
	<lastBuildDate>Thu, 26 Jan 2012 03:33:59 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Java: イベント駆動によるModelとViewの分離 &#8211; Observer パターン</title>
		<link>http://www.yukun.info/blog/2009/03/java-observe-event-model-view.html</link>
		<comments>http://www.yukun.info/blog/2009/03/java-observe-event-model-view.html#comments</comments>
		<pubDate>Tue, 17 Mar 2009 11:30:38 +0000</pubDate>
		<dc:creator>yukun</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Design Pattern]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[Time]]></category>
		<category><![CDATA[UML]]></category>

		<guid isPermaLink="false">http://www.yukun.info/?p=1401</guid>
		<description><![CDATA[よくGUIやWebアプリの簡単なサンプルソースなどは、UIとアプリケーションのロジックが同じクラスまたはメソッドに書かれている場合が多いです。それはそのサンプルがある特定の機能や関数の紹介の為に簡潔に書いているのですが、 &#8230; <a href="http://www.yukun.info/blog/2009/03/java-observe-event-model-view.html">Continue reading <span class="meta-nav">&#8594;</span></a><p><a href="http://www.yukun.info/blog/2009/03/java-observe-event-model-view.html">Java: イベント駆動によるModelとViewの分離 &#8211; Observer パターン</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>よくGUIやWebアプリの簡単なサンプルソースなどは、UIとアプリケーションのロジックが同じクラスまたはメソッドに書かれている場合が多いです。それはそのサンプルがある特定の機能や関数の紹介の為に簡潔に書いているのですが、仮にいざそのソースを元にアプリを作りこんで機能の追加を行っていくとUIとアプリのロジックは分離したほうが保守・拡張と共に行いやすいです。</p>
<p>下記のプログラムは1秒毎に数値をカウントし、それを2進数と10進数でGUI上のラベルに出力する機能をモデルとビューに分けています。すなわち、数値のカウントをするモデルと数値をUIに表示するビューに。（いくつかの言語ではGUIの部品として<a href="http://www.yukun.info/blog/2008/02/csharp-timer.html">タイマーがある</a>ようですが。。）</p>
<h2>実行結果</h2>
<p><a href="http://www.yukun.info/wp-content/uploads/count_timer01.png"><img src="http://www.yukun.info/wp-content/uploads/count_timer01.png" alt="count_timer01" title="count_timer01" width="125" height="69" class="size-full wp-image-1485" /></a></p>
<h2>クラス図</h2>
<p><a href="http://www.yukun.info/wp-content/uploads/countmodel_view_class.png"><img src="http://www.yukun.info/wp-content/uploads/countmodel_view_class-e1271583675800.png" alt="countmodel_view_class" title="countmodel_view_class" width="400" height="236" class="size-full wp-image-1486" /></a></p>
<p>インスタンスの生成はコンストラクタで行うのがいいのですが、はしょっています。さて、これまでに何らかのフレームワークを使っていた方には上クラス図はMVCの説明図として見慣れているかもしれません。今回ModelとViewを繋ぐControllerの役割はCountListenerが担っています（下記コードではCountChangeEvent経由でModelインスタンスを渡すのみですが）。</p>
<h3>処理手順</h3>
<p>ビュー側で自身のインスタンスをモデルに登録し（モデル.addCountListener(ビュー)）、モデルのデータが更新された場合、モデル→ビューへイベントを送出。イベント内部にモデルのデータがあり、そのデータでビューがUIを更新します。イベントの発生順序等は下図のシーケンス図のようになります。</p>
<h2>シーケンス図</h2>
<p><a href="http://www.yukun.info/wp-content/uploads/countmodel_view_sequence.png"><img src="http://www.yukun.info/wp-content/uploads/countmodel_view_sequence.png" alt="countmodel_view_sequence" title="countmodel_view_sequence" width="372" height="312" class="size-full wp-image-1487" /></a></p>
<h3>無限ループに注意</h3>
<p>ビューを更新するイベントリスナーのメソッド（ここではcountChanged()）で再度モデルのプロパティ変更メソッド（ここではsetCount()）を用いると、再度イベント通知処理（notifyToListeners()）が発生することで、無限ループになるので注意が必要です。</p>
<h3>ビューの追加手順</h3>
<p>ビューを追加する際の手順は、ビューのインスタンスをモデルのリスナーに登録し（addCountListener()）、ビュー自身がリスナーのメソッドを実装することで（countChanged()）、モデルからのイベントを受け取ることが出来ます。</p>
<p>そういえば最近はIDEの方でバインド設定したり、ObservableList等があるのであまり意識することがなくなってきたなぁ。</p>
<h2>ソースコード</h2>
<pre>
import java.awt.Container;
import java.awt.GridLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;

class CountView extends JFrame implements CountListener{

	private final JLabel binaryLabel = new JLabel("0");
	private final JLabel decimalLabel = new JLabel("0");
	private CountModel cModel = new CountModel(0);

	public static void main(String[] args) {
		new CountView();
	}

	public CountView() {
		super("Counter");
		Container c = getContentPane();
		c.setLayout(new GridLayout(2, 2));
		c.add(new JLabel(" 2進数:"));
		c.add(binaryLabel);
		c.add(new JLabel("10進数:"));
		c.add(decimalLabel);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		cModel.addCountListener(this); // ModelにViewを登録

		pack();
		setVisible(true);
	}

	public void countChanged(CountChangeEvent e) {
		if (e.getSource() == cModel) {
			binaryLabel.setText(Integer.toString(cModel.getCount(), 2));
			decimalLabel.setText(Integer.toString(cModel.getCount(), 10));
		}
	}
}
</pre>
<pre>
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;

/**
 * カウントするModel
 */
public class CountModel {

	private int count;
	private final List&lt;CountListener&gt; listeners = new ArrayList&lt;CountListener&gt;();
	private Timer t = new Timer(&quot;Count Timer&quot;, false);

	CountModel(int i) {
		count = i;
		t.scheduleAtFixedRate(new CountTime(), 0, 1000);
	}

	// Viewを登録
	public void addCountListener(CountListener listener) {
		listeners.add(listener);
	}

	public int getCount() {
		return count;
	}

	public void setCount(int i) {
		count = i;
		notifyToListeners();
	}

	// Viewへの通知
	private void notifyToListeners() {
		for (CountListener listener : listeners) {
			listener.countChanged(new CountChangeEvent(this));
		}
	}

	class CountTime extends TimerTask {
		@Override
		public void run() {
			setCount(getCount() + 1);
		}
	}
}
</pre>
<pre>
/**
 * View側で実装する(Model側から呼び出し)
 */
public interface CountListener {
	public void countChanged(CountChangeEvent e);
}

/**
 * 通知内容を表すイベント(Modelが生成しViewが受け取る)
 */
public class CountChangeEvent {
	private final CountModel source;

	public CountChangeEvent(CountModel count) {
		this.source = count;
	}

	public CountModel getSource() {
		return source;
	}
}
</pre>
<h4>関連すると思われる記事：</h4>
<ul class="similar-posts">
<li><a href="http://www.yukun.info/blog/2008/10/android-integer-to-binary-string.html" rel="bookmark" title="2008年10月29日">Android: 10進数→2進数変換アプリ</a></li>
<li><a href="http://www.yukun.info/blog/2008/02/csharp-timer.html" rel="bookmark" title="2008年2月24日">C#でキッチンタイマーを作ろう</a></li>
<li><a href="http://www.yukun.info/blog/2008/11/actionscript-flash-load-server-image-file.html" rel="bookmark" title="2008年11月21日">ActionScript: 画像ファイルをダウンロードして表示 &#8211; Loaderクラス</a></li>
<li><a href="http://www.yukun.info/blog/2009/03/java-design-pattern-simple-factory.html" rel="bookmark" title="2009年3月15日">Java, デザインパターン: Simple Factory &#8211; インスタンスの生成方法を任せる</a></li>
<li><a href="http://www.yukun.info/blog/2010/05/java-networkinterface-ipv6-ipv4.html" rel="bookmark" title="2010年5月16日">Java: インターフェースとローカルのIPv6, IPv4アドレスの取得 &#8211; NetworkInterfaceクラス</a></li>
</ul>
<p><!-- Similar Posts took 8.089 ms --></p>
<p><a href="http://www.yukun.info/blog/2009/03/java-observe-event-model-view.html">Java: イベント駆動によるModelとViewの分離 &#8211; Observer パターン</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yukun.info/blog/2009/03/java-observe-event-model-view.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AIR: Webサーバ、Socketの接続状況を検知 &#8211; URLMonitor、SocketMonitorクラス</title>
		<link>http://www.yukun.info/blog/2008/12/actionscript-air-url-socket-monitor.html</link>
		<comments>http://www.yukun.info/blog/2008/12/actionscript-air-url-socket-monitor.html#comments</comments>
		<pubDate>Wed, 24 Dec 2008 14:45:08 +0000</pubDate>
		<dc:creator>yukun</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Socket]]></category>

		<guid isPermaLink="false">http://www.yukun.info/?p=1282</guid>
		<description><![CDATA[任意のアドレスのWebサイト[サービス]のネットワーク状況を検知するURLMonitorと、任意のサーバ＋ポートに接続可能か否かを検知するSocketMonitorクラスの動作サンプルを下記に示します。 ソースコード &#038; &#8230; <a href="http://www.yukun.info/blog/2008/12/actionscript-air-url-socket-monitor.html">Continue reading <span class="meta-nav">&#8594;</span></a><p><a href="http://www.yukun.info/blog/2008/12/actionscript-air-url-socket-monitor.html">AIR: Webサーバ、Socketの接続状況を検知 &#8211; URLMonitor、SocketMonitorクラス</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>任意のアドレスのWebサイト[サービス]のネットワーク状況を検知するURLMonitorと、任意のサーバ＋ポートに接続可能か否かを検知するSocketMonitorクラスの動作サンプルを下記に示します。</p>
<h2>ソースコード</h2>
<pre>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:WindowedApplication xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;absolute&quot;
  applicationComplete=&quot;startup()&quot;&gt;
  &lt;mx:Script&gt;
    &lt;![CDATA[
    import air.net.SocketMonitor
    import air.net.URLMonitor;
    import flash.net.URLRequest;
    import flash.events.StatusEvent;

    private var SERVER_URL:String = &quot;http://www.yukun.info/&quot;;
    private var SOCK_ADRR:String = &quot;yukun.info&quot;;
    private var PORT:int = 6667;
    private var INTERVAL_TIME:int = 3000; // ms
    private var serviceMonitor:URLMonitor = null;
    private var socketMonitor:SocketMonitor = null;

    private function startup():void {
      var endpoint:URLRequest = new URLRequest(SERVER_URL);
      serviceMonitor = new URLMonitor(endpoint);
      serviceMonitor.addEventListener(StatusEvent.STATUS, onStatusEvent);
      serviceMonitor.pollInterval = INTERVAL_TIME;
      serviceMonitor.start();

      socketMonitor = new SocketMonitor(SOCK_ADRR, PORT);
      socketMonitor.addEventListener(StatusEvent.STATUS, onSocketStatusChange);
      socketMonitor.pollInterval = INTERVAL_TIME;
      socketMonitor.start();
    }

    // ネットワークサービスの状態の検知
    private function onStatusEvent(e:StatusEvent):void {
      var date:Date = new Date();
      trace(date.toLocaleTimeString());
      trace(SERVER_URL + &quot;に&quot; + (serviceMonitor.available ? &quot;接続可&quot; : &quot;切断中&quot;));
    }

    private function onSocketStatusChange(e:StatusEvent):void {
      trace(SOCK_ADRR + &quot;のポート&quot; + PORT + &quot;は&quot; +
        (socketMonitor.available ? &quot;接続可&quot; : &quot;切断中&quot;));
    }
    ]]&gt;
  &lt;/mx:Script&gt;
&lt;/mx:WindowedApplication&gt;
</pre>
<h2>実行結果</h2>
<pre>

http://www.yukun.info/に接続可

yukun.infoのポート6667は切断中
</pre>
<p>URLMonitorはネットワーク状況を検知する為にサーバへGETリクエストを送出して、レスポンスのステイタスコードを確認して判断しているようです↓。</p>
<h3>リファレンス</h3>
<ul>
<li><a href="http://livedocs.adobe.com/flex/3_jp/langref/air/net/URLMonitor.html" title="URLMonitor - ActionScript 3.0 言語およびコンポーネントリファレンス" target="_blank">URLMonitor &#8211; ActionScript 3.0 言語およびコンポーネントリファレンス</a></li>
<li><a href="http://help.adobe.com/ja_JP/AIR/1.1/devappsflash/WS5b3ccc516d4fbf351e63e3d118666ade46-7fcc.html" title="Adobe AIR 1.1 * ネットワーク接続の監視" target="_blank">Adobe AIR 1.1 * ネットワーク接続の監視</a></li>
</ul>
<h4>関連すると思われる記事：</h4>
<ul class="similar-posts">
<li><a href="http://www.yukun.info/blog/2010/05/java-networkinterface-ipv6-ipv4.html" rel="bookmark" title="2010年5月16日">Java: インターフェースとローカルのIPv6, IPv4アドレスの取得 &#8211; NetworkInterfaceクラス</a></li>
<li><a href="http://www.yukun.info/blog/2008/12/air-actionscript-sqlite-statement.html" rel="bookmark" title="2008年12月22日">AIR: SQLiteでデータの挿入と検索 &#8211; SQLConnection、SQLStatementクラス</a></li>
<li><a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-write-text.html" rel="bookmark" title="2008年12月18日">AIR: テキストファイルに書き込み &#8211; openAsync()、writeMultiByte()</a></li>
<li><a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-read-text.html" rel="bookmark" title="2008年12月17日">AIR: テキストファイルを非同期に読み込む &#8211; openAsync()、readMultiByte()</a></li>
<li><a href="http://www.yukun.info/blog/2011/02/java-tcp-socket-echo.html" rel="bookmark" title="2011年2月12日">Java: TCP Socket Echo Server/Client サンプル</a></li>
</ul>
<p><!-- Similar Posts took 7.794 ms --></p>
<p><a href="http://www.yukun.info/blog/2008/12/actionscript-air-url-socket-monitor.html">AIR: Webサーバ、Socketの接続状況を検知 &#8211; URLMonitor、SocketMonitorクラス</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yukun.info/blog/2008/12/actionscript-air-url-socket-monitor.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AIR: SQLiteでデータの挿入と検索 &#8211; SQLConnection、SQLStatementクラス</title>
		<link>http://www.yukun.info/blog/2008/12/air-actionscript-sqlite-statement.html</link>
		<comments>http://www.yukun.info/blog/2008/12/air-actionscript-sqlite-statement.html#comments</comments>
		<pubDate>Mon, 22 Dec 2008 09:00:30 +0000</pubDate>
		<dc:creator>yukun</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.yukun.info/?p=1278</guid>
		<description><![CDATA[AIRアプリケーションからSQLiteのDBにアクセスするには主にSQLConnectionとSQLStatementクラスを用います。基本的な処理の流れは、 SQLConnection#openAsync(＜Fileオ &#8230; <a href="http://www.yukun.info/blog/2008/12/air-actionscript-sqlite-statement.html">Continue reading <span class="meta-nav">&#8594;</span></a><p><a href="http://www.yukun.info/blog/2008/12/air-actionscript-sqlite-statement.html">AIR: SQLiteでデータの挿入と検索 &#8211; SQLConnection、SQLStatementクラス</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>AIRアプリケーションからSQLiteのDBにアクセスするには主にSQLConnectionとSQLStatementクラスを用います。基本的な処理の流れは、</p>
<ol>
<li>SQLConnection#openAsync(＜Fileオブジェクト＞, ＜モード＞)でDBに接続</li>
<li>SQLStatement#textプロパティにSQL文を代入しexecute()で実行</li>
<li>その際、フィールド値はSQLStatement#parameters["@＜定義されたパラメータ＞"]で代入する</li>
<li>SELECT文の検索結果データははSQLStatement#getResult()で取得</li>
<li>結果データの型はSQLResultで、データそのものはdataプロパティ(Array型)に入っている。e.g. ＜SQLResult＞.data[i].＜フィールド名＞</li>
</ol>
<p>下のプログラムはDBに接続してテーブルの作成、レコードの追加、検索を行うサンプルです。</p>
<h2>ソースコード</h2>
<pre>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:WindowedApplication xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;
layout=&quot;absolute&quot; creationComplete=&quot;dbConnect()&quot;&gt;
&lt;mx:Script&gt;
  &lt;![CDATA[
  import flash.data.SQLConnection;
  import flash.filesystem.File;
  import flash.events.SQLErrorEvent;
  import flash.events.SQLEvent;

  private var conn:SQLConnection;
  private var dbFile:File;
  private var sql:SQLStatement;

  // DBに接続
  private function dbConnect():void {
    conn = new SQLConnection();
    conn.addEventListener(SQLEvent.OPEN, onDBOpen);
    conn.addEventListener(SQLErrorEvent.ERROR, onDBError);
    dbFile = File.desktopDirectory.resolvePath(&quot;test01.db&quot;);
    trace(&quot;フィアルは存在&quot; + (dbFile.exists ? &quot;します。：&quot; : &quot;しません。&quot;) + dbFile.nativePath);
    conn.openAsync(dbFile, SQLMode.CREATE);
  }

  // 接続完了
  private function onDBOpen(e:SQLEvent):void {
    trace(&quot;Connect DB&quot;);
    conn.removeEventListener(SQLEvent.OPEN, onDBOpen);
    conn.removeEventListener(SQLErrorEvent.ERROR, onDBError);
    createTable(); // テーブルを作成
  }

  private function onDBError(e:SQLErrorEvent):void {
    trace(&quot;Can&#039;t connect DB: &quot; + e.error.message);
    trace(&quot;Error detals: &quot; + e.error.details);
  }

  // テーブルを作成する関数
  private function createTable():void {
    sql = new SQLStatement();
    sql.sqlConnection = conn;
    var sqlTxt:String = &quot;CREATE TABLE IF NOT EXISTS addresses &quot; +
        &quot;(id INTEGER PRIMARY KEY, name TEXT, age INTEGER)&quot;;
    sql.text = sqlTxt;
    sql.addEventListener(SQLEvent.RESULT, onCreate);
    sql.addEventListener(SQLErrorEvent.ERROR, onCreateError);
    sql.execute();
  }

  // テーブル作成完了
  private function onCreate(e:SQLEvent):void {
    trace(&quot;Can create table&quot;);
    sql.removeEventListener(SQLEvent.RESULT, onCreate);
    sql.removeEventListener(SQLErrorEvent.ERROR, onCreateError);
    insertData(); // データを挿入
  }

  private function onCreateError(e:SQLErrorEvent):void {
    trace(&quot;Can&#039;t create table: &quot; + e.error.message);
    trace(&quot;Error details: &quot; + e.error.details);
  }

  private function insertData():void {
    sql = new SQLStatement();
    sql.sqlConnection = conn;
    var sqlTxt:String = &quot;INSERT INTO addresses (id, name, age) &quot; +
      &quot;VALUES (@id, @name, @age)&quot;;
    sql.text = sqlTxt;
    sql.parameters[&quot;@id&quot;] = 1;
    sql.parameters[&quot;@name&quot;] = &quot;名無し&quot;;
    sql.parameters[&quot;@age&quot;] = 18;
    sql.addEventListener(SQLEvent.RESULT, onInsert);
    sql.addEventListener(SQLErrorEvent.ERROR, onInsertError);
    sql.execute();
  }

  // データ挿入完了
  private function onInsert(e:SQLEvent):void {
    trace(&quot;Can insert data&quot;);
    sql.removeEventListener(SQLEvent.RESULT, onInsert);
    sql.removeEventListener(SQLErrorEvent.ERROR, onInsertError);
    selectData(); // データを検索
  }

  private function onInsertError(e:SQLErrorEvent):void {
    trace(&quot;Can&#039;t insert data: &quot; + e.error.message);
    trace(&quot;Error details: &quot; + e.error.details);
  }

  private function selectData():void {
    sql = new SQLStatement();
    sql.sqlConnection = conn;
    var sqlTxt:String = &quot;SELECT * FROM addresses&quot;;
    sql.text = sqlTxt;
    sql.addEventListener(SQLEvent.RESULT, onSelect);
    sql.addEventListener(SQLErrorEvent.ERROR, onSelectError);
    sql.execute();
  }

  // 検索結果を取得完了
  private function onSelect(e:SQLEvent):void {
    trace(&quot;Can select data&quot;);
    sql.removeEventListener(SQLEvent.RESULT, onSelect);
    sql.removeEventListener(SQLErrorEvent.ERROR, onSelectError);
    var result:SQLResult = sql.getResult();
    var num:int = result.data.length;
    var id:int;
    var name:String;
    var age:String;

    for (var i:int = 0; i &lt; num; i++) {
      var row:Object = result.data[i];
      id = row.id;
      name = row.name;
      age = row.age;
      var str:String = &quot;id=&quot; + id + &quot;, name=&quot; + name + &quot;, age=&quot; + age;
      trace(str);
    }
  }

  private function onSelectError(e:SQLErrorEvent):void {
    trace(&quot;Can&#039;t select data: &quot; + e.error.message);
    trace(&quot;Error details: &quot; + e.error.details);
  }

  ]]&gt;
&lt;/mx:Script&gt;

&lt;/mx:WindowedApplication&gt;
</pre>
<h2>実行結果</h2>
<pre>
フィアルは存在しません。/Users/yukun/Desktop/test01.db
Connect DB
Can create table
Can insert data
Can select data
id=1, name=名無し, age=18
</pre>
<h3>リファレンス</h3>
<ul>
<li><a href="http://help.adobe.com/ja_JP/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118676a5497-7fb4.html" title="Adobe AIR 1.5 * ローカル SQL データベースの操作" target="_blank">Adobe AIR 1.5 * ローカル SQL データベースの操作</a></li>
<li><a href="http://help.adobe.com/ja_JP/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7d32.html" title="Adobe AIR 1.5 * データベースへの接続" target="_blank">Adobe AIR 1.5 * データベースへの接続</a></li>
</ul>
<h4>関連すると思われる記事：</h4>
<ul class="similar-posts">
<li><a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-read-text.html" rel="bookmark" title="2008年12月17日">AIR: テキストファイルを非同期に読み込む &#8211; openAsync()、readMultiByte()</a></li>
<li><a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-write-text.html" rel="bookmark" title="2008年12月18日">AIR: テキストファイルに書き込み &#8211; openAsync()、writeMultiByte()</a></li>
<li><a href="http://www.yukun.info/blog/2008/12/actionscript-air-url-socket-monitor.html" rel="bookmark" title="2008年12月24日">AIR: Webサーバ、Socketの接続状況を検知 &#8211; URLMonitor、SocketMonitorクラス</a></li>
<li><a href="http://www.yukun.info/blog/2008/11/mysql-query-select-where-in-like-between.html" rel="bookmark" title="2008年11月13日">MySQL: データ検索クエリの基本 &#8211; SELECT文、WHERE句、LIKE、IN、BETWEENキーワード</a></li>
<li><a href="http://www.yukun.info/blog/2008/07/python-sqlite-insert.html" rel="bookmark" title="2008年7月14日">Python: SQLiteにデータを格納、検索、出力 &#8211; pysqlite</a></li>
</ul>
<p><!-- Similar Posts took 7.103 ms --></p>
<p><a href="http://www.yukun.info/blog/2008/12/air-actionscript-sqlite-statement.html">AIR: SQLiteでデータの挿入と検索 &#8211; SQLConnection、SQLStatementクラス</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yukun.info/blog/2008/12/air-actionscript-sqlite-statement.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AIR: テキストファイルに書き込み &#8211; openAsync()、writeMultiByte()</title>
		<link>http://www.yukun.info/blog/2008/12/actionscript-air-async-write-text.html</link>
		<comments>http://www.yukun.info/blog/2008/12/actionscript-air-async-write-text.html#comments</comments>
		<pubDate>Wed, 17 Dec 2008 15:00:26 +0000</pubDate>
		<dc:creator>yukun</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[File]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[write]]></category>

		<guid isPermaLink="false">http://www.yukun.info/?p=1272</guid>
		<description><![CDATA[AIRコンポーネントではローカルのファイルにアクセスすることができます。下記のコードは日本語を含むマルチバイトの文字列をテキストファイルに書き込む処理をします。 処理の手順 FileStream#openAsync()か &#8230; <a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-write-text.html">Continue reading <span class="meta-nav">&#8594;</span></a><p><a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-write-text.html">AIR: テキストファイルに書き込み &#8211; openAsync()、writeMultiByte()</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.yukun.info/wp-content/uploads/WriteTxtFile01_result.png"><img src="http://www.yukun.info/wp-content/uploads/WriteTxtFile01_result-e1273382752288.png" alt="AIR: テキストファイルに書き込み" title="WriteTxtFile01_result" width="400" height="328" class="size-full wp-image-1533" /></a></p>
<p>AIRコンポーネントではローカルのファイルにアクセスすることができます。下記のコードは日本語を含むマルチバイトの文字列をテキストファイルに書き込む処理をします。</p>
<h2>処理の手順</h2>
<ol>
<li>FileStream#openAsync()かopen()メソッドの引数にFileインスタンスとFileModeのプロパティを設定して実ファイルのパイプに接続</li>
<li>FileStream#writeMultiByte()でファイルに書き込み</li>
<li>FileStream#close()でストリームを閉じる</li>
</ol>
<h3>ソースコード</h3>
<pre>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:WindowedApplication xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;absolute&quot; title=&quot;シンプルテキストメイカー&quot;&gt;
&lt;mx:Script&gt;
  &lt;![CDATA[
  import mx.controls.Alert;

  private var choDir:File = File.documentsDirectory; // ダイアログの初期ディレクトリ
  private var saveFile:File;
  private var stream:FileStream;

  private function onSaveFileBut():void {
    choDir.addEventListener(Event.SELECT, onSelectSaveFile);
    choDir.browseForSave(&quot;テキストファイルに保存&quot;);
  }

  private function onSelectSaveFile(e:Event):void {
    saveFile = e.target as File; // 選択されたファイル
    choDir.removeEventListener(Event.SELECT, onSelectSaveFile);
    try {
      stream = new FileStream();
      stream.addEventListener(IOErrorEvent.IO_ERROR, onIOErrorWriteFile);
      stream.openAsync(saveFile, FileMode.WRITE); // 書き込みmodeで開く(フツーのopen()でもOK)
      var str:String = txtArea_.text;
      // 改行文字と文字コードをOS標準のものに置き換えて書き込み
      str = str.replace(/\n/g, File.lineEnding);
      stream.writeMultiByte(str, File.systemCharset); // 実際に書き込み
    } catch (err:IOError) {
      progLab_.text = &quot;IOError : &quot; + err;
    } finally {
      if (stream != null) {
        stream.close();
      }
    }
  }

  // ファイル書き込みに失敗した場合
  private function onIOErrorWriteFile(e:IOErrorEvent):void {
    Alert.show(&quot;ファイルの書き込みに失敗&quot;, &quot;エラー&quot;, Alert.OK, this);
    if (stream != null) {
      stream.close();
    }
  }
  ]]&gt;
&lt;/mx:Script&gt;
  &lt;mx:VBox x=&quot;0&quot; y=&quot;0&quot; height=&quot;100%&quot; width=&quot;100%&quot;&gt;
    &lt;mx:HBox width=&quot;100%&quot;&gt;
      &lt;mx:Button label=&quot;ファイルに保存&quot; id=&quot;saveBut_&quot; click=&quot;onSaveFileBut();&quot;/&gt;
      &lt;mx:Label id=&quot;progLab_&quot;/&gt;
    &lt;/mx:HBox&gt;
    &lt;mx:TextArea width=&quot;100%&quot; height=&quot;100%&quot; id=&quot;txtArea_&quot;/&gt;
  &lt;/mx:VBox&gt;
&lt;/mx:WindowedApplication&gt;
</pre>
<h3>リファレンス</h3>
<ul>
<li><a href="http://help.adobe.com/ja_JP/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7e4a.html" title="Adobe AIR 1.5 * ファイルシステムの操作" target="_blank">Adobe AIR 1.5 * ファイルシステムの操作</a></li>
<li><a href="http://help.adobe.com/ja_JP/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7dc2.html" title="Adobe AIR 1.5 * ファイルの読み取りと書き込み" target="_blank">Adobe AIR 1.5 * ファイルの読み取りと書き込み</a></li>
</ul>
<h4>関連すると思われる記事：</h4>
<ul class="similar-posts">
<li><a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-read-text.html" rel="bookmark" title="2008年12月17日">AIR: テキストファイルを非同期に読み込む &#8211; openAsync()、readMultiByte()</a></li>
<li><a href="http://www.yukun.info/blog/2008/09/python-file-write-writelines.html" rel="bookmark" title="2008年9月6日">Python: テキストファイルに書き込み &#8211; write()、writelines()メソッド</a></li>
<li><a href="http://www.yukun.info/blog/2008/06/python-csv-write.html" rel="bookmark" title="2008年6月18日">Python: CSVファイルに書き込み &#8211; csv.writerオブジェクト</a></li>
<li><a href="http://www.yukun.info/blog/2008/09/python-add-line-number-to-text-file.html" rel="bookmark" title="2008年9月8日">Python: テキストファイルの行頭に行番号を追加</a></li>
<li><a href="http://www.yukun.info/blog/2008/12/air-actionscript-sqlite-statement.html" rel="bookmark" title="2008年12月22日">AIR: SQLiteでデータの挿入と検索 &#8211; SQLConnection、SQLStatementクラス</a></li>
</ul>
<p><!-- Similar Posts took 13.811 ms --></p>
<p><a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-write-text.html">AIR: テキストファイルに書き込み &#8211; openAsync()、writeMultiByte()</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yukun.info/blog/2008/12/actionscript-air-async-write-text.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AIR: テキストファイルを非同期に読み込む &#8211; openAsync()、readMultiByte()</title>
		<link>http://www.yukun.info/blog/2008/12/actionscript-air-async-read-text.html</link>
		<comments>http://www.yukun.info/blog/2008/12/actionscript-air-async-read-text.html#comments</comments>
		<pubDate>Wed, 17 Dec 2008 03:30:27 +0000</pubDate>
		<dc:creator>yukun</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[File]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[read]]></category>

		<guid isPermaLink="false">http://www.yukun.info/?p=1269</guid>
		<description><![CDATA[AIRコンポーネントではローカルのファイルにアクセスすることができます。下記のコードは日本語を含むマルチバイトのテキストファイルを読み込み、画面い表示する処理を行います。 大まかな手順 FileStreamのコンストラク &#8230; <a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-read-text.html">Continue reading <span class="meta-nav">&#8594;</span></a><p><a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-read-text.html">AIR: テキストファイルを非同期に読み込む &#8211; openAsync()、readMultiByte()</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.yukun.info/wp-content/uploads/ReadTxtFile01_result.png"><img src="http://www.yukun.info/wp-content/uploads/ReadTxtFile01_result-e1273382664744.png" alt="AIR: テキストファイル読み込みの実行結果" title="ReadTxtFile01_result" width="400" height="328" class="size-full wp-image-1531" /></a></p>
<p>AIRコンポーネントではローカルのファイルにアクセスすることができます。下記のコードは日本語を含むマルチバイトのテキストファイルを読み込み、画面い表示する処理を行います。</p>
<h2>大まかな手順</h2>
<ol>
<li>FileStreamのコンストラクタの引数に対象のファイルへのパスが設定されたFileインスタンスを渡す。</li>
<li>FileStream#openAsyncで実ファイルへのパイプ接続。</li>
<li>この時、非同期の読み込み完了／エラーを取得するためにイベントを登録しておく。</li>
<li>実際の文字の読み取り（どれだけ読むか、文字コードの変換など）はFileStream#readMultiByteで行う。</li>
<li>ストリームのインスタンスには接続時にpositionプロパティ（何処読んでいるかのポインタみたいなもの）からファイル末尾までのサイズ（bytesAvailable）を取得してるので、読み込みサイズにそれを指定。</li>
<li>FileStream#close()でストリームを閉じる</li>
</ol>
<h3>ソースコード</h3>
<pre>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:WindowedApplication xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;absolute&quot;
  title=&quot;テキストビュワー&quot;&gt;
  &lt;mx:Script&gt;
    &lt;![CDATA[
    import flash.filesystem.*;
    import mx.events.*;
    import mx.controls.Alert;

    private var choDir:File = File.documentsDirectory; // 開くディレクトリを指す
    private var curFile:File; // 選択されたファイル
    private var stream:FileStream;

    private function onOpenFileBut():void {
      choDir.addEventListener(Event.SELECT, onSelectFile);
      choDir.browseForOpen(&quot;開く&quot;); // ファイル選択ダイアログの表示
    }

    // ファイルが選択されたイベント
    private function onSelectFile(e:Event):void {
      txtArea_.text = &quot;&quot;;
      stream = new FileStream();
      curFile = e.target as File;
      stream.addEventListener(Event.COMPLETE, onCompleteReadFile);
      stream.addEventListener(IOErrorEvent.IO_ERROR, onIOErrorReadFile);
      stream.addEventListener(ProgressEvent.PROGRESS, onProgReadFile);
      stream.openAsync(curFile, FileMode.READ); // 非同期読み込み
      curFile.removeEventListener(Event.SELECT, onSelectFile);
    }

    private function onCompleteReadFile(e:Event):void {
      try {
        // OS標準の文字コードで読み込み
        var str:String = stream.readMultiByte(stream.bytesAvailable, File.systemCharset);
        // OS標準の改行文字への変換
        var pat:RegExp = new RegExp(File.lineEnding, &quot;g&quot;);
        str = str.replace(pat, &quot;n&quot;);
        txtArea_.text = str; // テキストエリアに表示
        stream.removeEventListener(Event.COMPLETE, onCompleteReadFile);
        stream.removeEventListener(IOErrorEvent.IO_ERROR, onIOErrorReadFile);
        stream.removeEventListener(ProgressEvent.PROGRESS, onProgReadFile);
      } catch (err:Error) {
        progLab_.text = &quot;IOError: &quot; + err;
      }
      finally {
        // パイプのクローズ
        if (stream != null) {
          stream.close();
        }
      }
    }

    private function onIOErrorReadFile(e:IOErrorEvent):void {
      Alert.show(&quot;ファイルを読み込み不可&quot;, &quot;Error&quot;, Alert.OK, this); // 第4引数には親オブジェトを渡す
      if (stream != null) {
        stream.close();
      }
    }

    private function onProgReadFile(e:ProgressEvent):void {
      progLab_.text = &quot;Progress: &quot; +  e.bytesLoaded + &quot; / &quot; + e.bytesTotal + &quot; bytes&quot;;
    }
    ]]&gt;
  &lt;/mx:Script&gt;
  &lt;mx:VBox x=&quot;0&quot; y=&quot;0&quot; height=&quot;100%&quot; width=&quot;100%&quot;&gt;
    &lt;mx:HBox width=&quot;100%&quot;&gt;
      &lt;mx:Button label=&quot;ファイルを開く&quot; id=&quot;openBut_&quot; click=&quot;onOpenFileBut();&quot;/&gt;
      &lt;mx:Label id=&quot;progLab_&quot;/&gt;
    &lt;/mx:HBox&gt;
    &lt;mx:TextArea width=&quot;100%&quot; height=&quot;100%&quot; id=&quot;txtArea_&quot;/&gt;
  &lt;/mx:VBox&gt;

&lt;/mx:WindowedApplication&gt;
</pre>
<h3>リファレンス</h3>
<ul>
<li><a href="http://help.adobe.com/ja_JP/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7dc8.html" title="Adobe AIR 1.5 * ファイルの読み取りと書き込みのワークフロー" target="_blank">Adobe AIR 1.5 * ファイルの読み取りと書き込みのワークフロー</a></li>
<li><a href="http://help.adobe.com/ja_JP/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7dac.html" title="Adobe AIR 1.5 * 読み取りバッファと FileStream オブジェクトの bytesAvailable プロパティ" target="_blank">Adobe AIR 1.5 * 読み取りバッファと FileStream オブジェクトの bytesAvailable プロパティ</a></li>
</ul>
<h4>関連すると思われる記事：</h4>
<ul class="similar-posts">
<li><a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-write-text.html" rel="bookmark" title="2008年12月18日">AIR: テキストファイルに書き込み &#8211; openAsync()、writeMultiByte()</a></li>
<li><a href="http://www.yukun.info/blog/2008/06/python-csv-read.html" rel="bookmark" title="2008年6月17日">Python: CSVファイルの読み込み &#8211; csv.readerオブジェクト</a></li>
<li><a href="http://www.yukun.info/blog/2008/06/python-file.html" rel="bookmark" title="2008年6月9日">Python: テキストファイルの読み込み &#8211; read()、readlines()、readline()メソッド</a></li>
<li><a href="http://www.yukun.info/blog/2008/09/python-file-write-writelines.html" rel="bookmark" title="2008年9月6日">Python: テキストファイルに書き込み &#8211; write()、writelines()メソッド</a></li>
<li><a href="http://www.yukun.info/blog/2008/09/python-add-line-number-to-text-file.html" rel="bookmark" title="2008年9月8日">Python: テキストファイルの行頭に行番号を追加</a></li>
</ul>
<p><!-- Similar Posts took 14.597 ms --></p>
<p><a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-read-text.html">AIR: テキストファイルを非同期に読み込む &#8211; openAsync()、readMultiByte()</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yukun.info/blog/2008/12/actionscript-air-async-read-text.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android: 10進数→2進数変換アプリ</title>
		<link>http://www.yukun.info/blog/2008/10/android-integer-to-binary-string.html</link>
		<comments>http://www.yukun.info/blog/2008/10/android-integer-to-binary-string.html#comments</comments>
		<pubDate>Tue, 28 Oct 2008 15:00:46 +0000</pubDate>
		<dc:creator>yukun</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Number]]></category>

		<guid isPermaLink="false">http://www.yukun.info/?p=1226</guid>
		<description><![CDATA[試しに下図のような簡素な10進2進変換アプリを作ってみました。 以下は書いてみたコード。 ソースコード res/values/strings.xml &#60;?xml version=&#34;1.0&#34; en &#8230; <a href="http://www.yukun.info/blog/2008/10/android-integer-to-binary-string.html">Continue reading <span class="meta-nav">&#8594;</span></a><p><a href="http://www.yukun.info/blog/2008/10/android-integer-to-binary-string.html">Android: 10進数→2進数変換アプリ</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>試しに下図のような簡素な10進2進変換アプリを作ってみました。</p>
<p><a href="http://www.yukun.info/wp-content/uploads/android_itbcalc.gif"><img src="http://www.yukun.info/wp-content/uploads/android_itbcalc.gif" alt="" title="android_itbcalc" width="336" height="290" class="size-full wp-image-1489" /></a></p>
<p>以下は書いてみたコード。</p>
<h2>ソースコード</h2>
<h3>res/values/strings.xml</h3>
<pre>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;resources&gt;
    &lt;string name=&quot;app_name&quot;&gt;Integer to Binary Calculator&lt;/string&gt;
    &lt;string name=&quot;label_description&quot;&gt;10進数を2進数に変換表示&lt;/string&gt;
    &lt;string name=&quot;label_integer&quot;&gt;10進数：&lt;/string&gt;
    &lt;string name=&quot;label_binary&quot;&gt;2進数：&lt;/string&gt;
    &lt;string name=&quot;button_convert&quot;&gt;変換&lt;/string&gt;
&lt;/resources&gt;
</pre>
<h3>res/layout/main.xml</h3>
<pre>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;linearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    android:orientation=&quot;vertical&quot;
    android:layout_width=&quot;fill_parent&quot;
    android:layout_height=&quot;fill_parent&quot;
    &gt;
&lt;textView
    android:layout_width=&quot;fill_parent&quot;
    android:layout_height=&quot;wrap_content&quot;
    android:text=&quot;@string/label_description&quot;
    /&gt;

&lt;linearLayout
    android:orientation=&quot;horizontal&quot;
    android:layout_width=&quot;fill_parent&quot;
    android:layout_height=&quot;wrap_content&quot;
    &gt;
&lt;textView
    android:layout_width=&quot;wrap_content&quot;
    android:layout_height=&quot;wrap_content&quot;
    android:text=&quot;@string/label_integer&quot;
    /&gt;
&lt;editText android:id=&quot;@+id/text_integer&quot;
    android:layout_width=&quot;fill_parent&quot;
    android:layout_height=&quot;wrap_content&quot;
    android:numeric=&quot;integer&quot;
    android:maxLength=&quot;9&quot;
    android:text=&quot;&quot;
    /&gt;
&lt;/linearLayout&gt;

&lt;button android:id=&quot;@+id/button_convert&quot;
	android:layout_width=&quot;wrap_content&quot;
	android:layout_height=&quot;wrap_content&quot;
	android:text=&quot;@string/button_convert&quot;
	/&gt;
&lt;textView android:id=&quot;@+id/label_result&quot;
    android:layout_width=&quot;fill_parent&quot;
    android:layout_height=&quot;wrap_content&quot;
    android:text=&quot;&quot;
    /&gt;
&lt;/linearLayout&gt;
</pre>
<h3>ITBCalculatorActivity.java</h3>
<pre>
package info.yukun.android.itbcalc;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class ITBCalculatorActivity extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) { // アクティビティが生成される際に必ず呼び出される
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main); // UIのレイアウトを設定
    // 指定したリソース(R.java)インデックスからビュー(res/layout/main.xml)内のidのコンポーネント(ここではButton)インスタンスを取得
    Button button = (Button) findViewById(R.id.button_convert);
    button.setOnClickListener(convertToBinary); // ボタンが押された際のイベントを登録
  }

  // 登録するイベントリスナーはView.OnClickListenerを実装
  private View.OnClickListener convertToBinary = new View.OnClickListener() {
    public void onClick(View view) { // ボタンが押されたときに呼び出されるメソッド
      EditText textInteger = (EditText) findViewById(R.id.text_integer); // 入力値が入っているコンポーネントを取得
      String input = textInteger.getText().toString();
      if (input.equals("")) return;
      int intValue = Integer.parseInt(input);
      String binValue = Integer.toBinaryString(intValue); // 10進数整数を2進数文字列に変換
      TextView labelResult = (TextView) findViewById(R.id.label_result); // 結果を表示するTextViewを取得
      labelResult.setText("2進数：" + binValue);
    }
  };
}
</pre>
<h2>Androidアプリを書いてみて</h2>
<p>EditText android:id=&#8221;@+id/text_integer&#8221;の属性android:maxLengthを&#8221;9&#8243;としたのは、変換メソッドInteger.toBinaryString(int value)の引数が32bit整数の為です。本当は属性値を10としてonClickメソッド内で32bitの範囲内(-2 147 483 647 ～ 2 147 483 647 = (2^31) &#8211; 1)か否かを判定したほうが良いと思うのですが、今回は端折りました。</p>
<p>ビジュアルエディタやXMLでUIのレイアウトを作っていくというのはFlexのmxmlに似てて取っ掛かり易い感じです。<br />
<h4>関連すると思われる記事：</h4>
<ul class="similar-posts">
<li><a href="http://www.yukun.info/blog/2010/01/android-draw-image-resources.html" rel="bookmark" title="2010年1月2日">Android: リソースの画像ファイルの拡大・縮小描画 &#8211; drawBitmap()</a></li>
<li><a href="http://www.yukun.info/blog/2008/08/python-decimal-to-binary-conversion.html" rel="bookmark" title="2008年8月4日">Python: 10進数整数を2進数文字列に変換する関数</a></li>
<li><a href="http://www.yukun.info/blog/2009/03/java-observe-event-model-view.html" rel="bookmark" title="2009年3月17日">Java: イベント駆動によるModelとViewの分離 &#8211; Observer パターン</a></li>
<li><a href="http://www.yukun.info/blog/2008/02/csharp-timer.html" rel="bookmark" title="2008年2月24日">C#でキッチンタイマーを作ろう</a></li>
<li><a href="http://www.yukun.info/blog/2010/06/android-unable-to-open-sync-connection.html" rel="bookmark" title="2010年6月5日">Android: &#8220;Unable to open sync connection!&#8221; の対処例</a></li>
</ul>
<p><!-- Similar Posts took 13.253 ms --></p>
<p><a href="http://www.yukun.info/blog/2008/10/android-integer-to-binary-string.html">Android: 10進数→2進数変換アプリ</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yukun.info/blog/2008/10/android-integer-to-binary-string.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C#でキッチンタイマーを作ろう</title>
		<link>http://www.yukun.info/blog/2008/02/csharp-timer.html</link>
		<comments>http://www.yukun.info/blog/2008/02/csharp-timer.html#comments</comments>
		<pubDate>Sun, 24 Feb 2008 11:55:09 +0000</pubDate>
		<dc:creator>yukun</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[C Sharp]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[Time]]></category>

		<guid isPermaLink="false">http://www.yukun.info/trump/20080224/c%e3%81%a7%e3%82%ad%e3%83%83%e3%83%81%e3%83%b3%e3%82%bf%e3%82%a4%e3%83%9e%e3%83%bc%e3%82%92%e4%bd%9c%e3%82%8d%e3%81%86</guid>
		<description><![CDATA[カウントダウンタイマーとも言うのかな。 さて、今回学んだことは、 X秒からh:m:s形式での表示。 タイマースレッドの利用。 かな。 タイマーイベント毎に重い処理を行うと表示時間と実時間のずれが大きくなるので注意。そうい &#8230; <a href="http://www.yukun.info/blog/2008/02/csharp-timer.html">Continue reading <span class="meta-nav">&#8594;</span></a><p><a href="http://www.yukun.info/blog/2008/02/csharp-timer.html">C#でキッチンタイマーを作ろう</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>カウントダウンタイマーとも言うのかな。<br />
さて、今回学んだことは、</p>
<ul>
<li>X秒からh:m:s形式での表示。</li>
<li>タイマースレッドの利用。</li>
</ul>
<p>かな。<br />
タイマーイベント毎に重い処理を行うと表示時間と実時間のずれが大きくなるので注意。そういった場合はイベント発生間隔を長めに取ってみる。</p>
<h2>プログラムの実行結果</h2>
<h3>起動時</h3>
<p><a href="http://www.yukun.info/wp-content/uploads/timer01.png"><img src="http://www.yukun.info/wp-content/uploads/timer01.png" alt="C#カウントダウンタイマー1" title="timer01" width="188" height="156" class="alignnone size-full wp-image-2025" /></a></p>
<h3>実行時</h3>
<p><a href="http://www.yukun.info/wp-content/uploads/timer02.png"><img src="http://www.yukun.info/wp-content/uploads/timer02.png" alt="C#カウントダウンタイマー2" title="timer02" width="188" height="156" class="alignnone size-full wp-image-2026" /></a></p>
<p>ちなみにボタンをロックするにはボタンインスタンスのEnabledプロパティにfalseを代入します(ロック解除はture)。</p>
<p>例(butstartはボタンクラスのインスタンス変数)：</p>
<pre>butstart.Enabled = false; // スタートボタンをロック(スタートが押されたら場合)</pre>
<h2>ソースコード</h2>
<h3>FormTimer.cs</h3>
<pre>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
/**
 * キッチンタイマー
 * Web page: http://www.yukun.info/
 * license GPLv2
 */
namespace Sample
{
  public partial class FormTimer : Form
  {
    public FormTimer()
    {
      InitializeComponent();
      // マウスポインタの場所に表示
      this.DesktopLocation = new Point(System.Windows.Forms.Cursor.Position.X,
        System.Windows.Forms.Cursor.Position.Y);
    }
    int sec = 0; // 計測時間

    private void viewtime()
    {
      stLabel1.Text = "" + sec / 36000 % 10 + sec / 3600 % 10 +
                     ":" + sec / 600 % 6 + sec / 60 % 10 +
                     ":" + sec / 10 % 6 + sec % 10;
    }

    private void timer1_Tick(object sender, EventArgs e)
    {
      sec--;
      if (0 == sec)
      {
        sttimer.Enabled = false;
        System.Media.SystemSounds.Beep.Play();
        this.Activate();
      }
      viewtime();
    }

    private void butsec_Click(object sender, EventArgs e)
    {
      sec += 10;
      viewtime();
    }

    private void butmin_Click(object sender, EventArgs e)
    {
      sec += 60;
      viewtime();
    }

    private void buthour_Click(object sender, EventArgs e)
    {
      sec += 3600;
      if (sec >= 360000) sec = 0;
      viewtime();
    }

    private void butstart_Click(object sender, EventArgs e)
    {
      if (0 == sec) return;
      sttimer.Enabled = true;
      this.butstop.Enabled = true;
      this.butstart.Enabled = false;
      this.buthour.Enabled = false;
      this.butmin.Enabled = false;
      this.butsec.Enabled = false;
      this.butreset.Enabled = false;
    }

    private void butstop_Click(object sender, EventArgs e)
    {
      sttimer.Enabled = false;
      this.butstop.Enabled = false;
      this.butstart.Enabled = true;
      this.buthour.Enabled = true;
      this.butmin.Enabled = true;
      this.butsec.Enabled = true;
      this.butreset.Enabled = true;
    }

    private void butreset_Click(object sender, EventArgs e)
    {
      stLabel1.Text = "00:00:00";
      sec = 0;
    }

    private void 常に手前に表示ToolStripMenuItem_Click(object sender, EventArgs e)
    {
      //クリックするごとにこのフォームを常に手前または解除します。
      this.TopMost = !this.TopMost;
    }
  }
}
</pre>
<h3>FormTimer.Designer.cs</h3>
<pre>
namespace Sample
{
  partial class FormTimer
  {
    /// &lt;summary&gt;
    /// 必要なデザイナ変数です。
    /// &lt;/summary&gt;
    private System.ComponentModel.IContainer components = null;

    /// &lt;summary&gt;
    /// 使用中のリソースをすべてクリーンアップします。
    /// &lt;/summary&gt;
    /// &lt;param name=&quot;disposing&quot;&gt;マネージ リソースが破棄される場合 true、破棄されない場合は false です。&lt;/param&gt;
    protected override void Dispose(bool disposing)
    {
      if (disposing &amp;&amp; (components != null))
      {
        components.Dispose();
      }
      base.Dispose(disposing);
    }

    #region Windows フォーム デザイナで生成されたコード

    /// &lt;summary&gt;
    /// デザイナ サポートに必要なメソッドです。このメソッドの内容を
    /// コード エディタで変更しないでください。
    /// &lt;/summary&gt;
    private void InitializeComponent()
    {
      this.components = new System.ComponentModel.Container();
      this.sttimer = new System.Windows.Forms.Timer(this.components);
      this.buthour = new System.Windows.Forms.Button();
      this.butmin = new System.Windows.Forms.Button();
      this.butsec = new System.Windows.Forms.Button();
      this.butstart = new System.Windows.Forms.Button();
      this.stLabel1 = new System.Windows.Forms.Label();
      this.butstop = new System.Windows.Forms.Button();
      this.butreset = new System.Windows.Forms.Button();
      this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
      this.常に手前に表示ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
      this.contextMenuStrip1.SuspendLayout();
      this.SuspendLayout();
      //
      // sttimer
      //
      this.sttimer.Interval = 1000;
      this.sttimer.Tick += new System.EventHandler(this.timer1_Tick);
      //
      // buthour
      //
      this.buthour.Location = new System.Drawing.Point(6, 66);
      this.buthour.Name = &quot;buthour&quot;;
      this.buthour.Size = new System.Drawing.Size(50, 23);
      this.buthour.TabIndex = 0;
      this.buthour.Text = &quot;HOUR&quot;;
      this.buthour.UseVisualStyleBackColor = true;
      this.buthour.Click += new System.EventHandler(this.buthour_Click);
      //
      // butmin
      //
      this.butmin.Location = new System.Drawing.Point(62, 66);
      this.butmin.Name = &quot;butmin&quot;;
      this.butmin.Size = new System.Drawing.Size(50, 23);
      this.butmin.TabIndex = 1;
      this.butmin.Text = &quot;MIN&quot;;
      this.butmin.UseVisualStyleBackColor = true;
      this.butmin.Click += new System.EventHandler(this.butmin_Click);
      //
      // butsec
      //
      this.butsec.Location = new System.Drawing.Point(118, 66);
      this.butsec.Name = &quot;butsec&quot;;
      this.butsec.Size = new System.Drawing.Size(50, 23);
      this.butsec.TabIndex = 2;
      this.butsec.Text = &quot;SEC&quot;;
      this.butsec.UseVisualStyleBackColor = true;
      this.butsec.Click += new System.EventHandler(this.butsec_Click);
      //
      // butstart
      //
      this.butstart.Location = new System.Drawing.Point(6, 100);
      this.butstart.Name = &quot;butstart&quot;;
      this.butstart.Size = new System.Drawing.Size(50, 23);
      this.butstart.TabIndex = 3;
      this.butstart.Text = &quot;スタート&quot;;
      this.butstart.UseVisualStyleBackColor = true;
      this.butstart.Click += new System.EventHandler(this.butstart_Click);
      //
      // stLabel1
      //
      this.stLabel1.AutoSize = true;
      this.stLabel1.BackColor = System.Drawing.SystemColors.Control;
      this.stLabel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
      this.stLabel1.Font = new System.Drawing.Font(&quot;Times New Roman&quot;, 30F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
      this.stLabel1.Location = new System.Drawing.Point(6, 9);
      this.stLabel1.Name = &quot;stLabel1&quot;;
      this.stLabel1.Size = new System.Drawing.Size(163, 42);
      this.stLabel1.TabIndex = 4;
      this.stLabel1.Text = &quot;00:00:00&quot;;
      //
      // butstop
      //
      this.butstop.Location = new System.Drawing.Point(62, 100);
      this.butstop.Name = &quot;butstop&quot;;
      this.butstop.Size = new System.Drawing.Size(50, 23);
      this.butstop.TabIndex = 5;
      this.butstop.Text = &quot;ストップ&quot;;
      this.butstop.UseVisualStyleBackColor = true;
      this.butstop.Click += new System.EventHandler(this.butstop_Click);
      //
      // butreset
      //
      this.butreset.Location = new System.Drawing.Point(118, 100);
      this.butreset.Name = &quot;butreset&quot;;
      this.butreset.Size = new System.Drawing.Size(50, 23);
      this.butreset.TabIndex = 6;
      this.butreset.Text = &quot;リセット&quot;;
      this.butreset.UseVisualStyleBackColor = true;
      this.butreset.Click += new System.EventHandler(this.butreset_Click);
      //
      // contextMenuStrip1
      //
      this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
      this.常に手前に表示ToolStripMenuItem});
      this.contextMenuStrip1.Name = &quot;contextMenuStrip1&quot;;
      this.contextMenuStrip1.Size = new System.Drawing.Size(171, 26);
      //
      // 常に手前に表示ToolStripMenuItem
      //
      this.常に手前に表示ToolStripMenuItem.CheckOnClick = true;
      this.常に手前に表示ToolStripMenuItem.Name = &quot;常に手前に表示ToolStripMenuItem&quot;;
      this.常に手前に表示ToolStripMenuItem.Size = new System.Drawing.Size(170, 22);
      this.常に手前に表示ToolStripMenuItem.Text = &quot;常に Top に表示する&quot;;
      this.常に手前に表示ToolStripMenuItem.Click += new System.EventHandler(this.常に手前に表示ToolStripMenuItem_Click);
      //
      // FormTimer
      //
      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
      this.ClientSize = new System.Drawing.Size(180, 129);
      this.ContextMenuStrip = this.contextMenuStrip1;
      this.Controls.Add(this.butreset);
      this.Controls.Add(this.butstop);
      this.Controls.Add(this.stLabel1);
      this.Controls.Add(this.butstart);
      this.Controls.Add(this.butsec);
      this.Controls.Add(this.butmin);
      this.Controls.Add(this.buthour);
      this.Name = &quot;FormTimer&quot;;
      this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
      this.Text = &quot;タイマー&quot;;
      this.contextMenuStrip1.ResumeLayout(false);
      this.ResumeLayout(false);
      this.PerformLayout();

    }

    #endregion

    private System.Windows.Forms.Button buthour;
    private System.Windows.Forms.Button butmin;
    private System.Windows.Forms.Button butsec;
    private System.Windows.Forms.Button butstart;
    private System.Windows.Forms.Label stLabel1;
    private System.Windows.Forms.Button butstop;
    private System.Windows.Forms.Button butreset;
    private System.Windows.Forms.Timer sttimer;
    private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
    private System.Windows.Forms.ToolStripMenuItem 常に手前に表示ToolStripMenuItem;
  }
}
</pre>
<h4>関連すると思われる記事：</h4>
<ul class="similar-posts">
<li><a href="http://www.yukun.info/blog/2008/01/csharp-web-service-client.html" rel="bookmark" title="2008年1月2日">イースト辞書Webサービスを利用したC#(with .Net)クライアントプログラミング</a></li>
<li><a href="http://www.yukun.info/blog/2009/03/java-observe-event-model-view.html" rel="bookmark" title="2009年3月17日">Java: イベント駆動によるModelとViewの分離 &#8211; Observer パターン</a></li>
<li><a href="http://www.yukun.info/blog/2008/10/android-integer-to-binary-string.html" rel="bookmark" title="2008年10月29日">Android: 10進数→2進数変換アプリ</a></li>
<li><a href="http://www.yukun.info/blog/2008/12/air-actionscript-sqlite-statement.html" rel="bookmark" title="2008年12月22日">AIR: SQLiteでデータの挿入と検索 &#8211; SQLConnection、SQLStatementクラス</a></li>
<li><a href="http://www.yukun.info/blog/2008/11/actionscript-flash-load-server-image-file.html" rel="bookmark" title="2008年11月21日">ActionScript: 画像ファイルをダウンロードして表示 &#8211; Loaderクラス</a></li>
</ul>
<p><!-- Similar Posts took 9.217 ms --></p>
<p><a href="http://www.yukun.info/blog/2008/02/csharp-timer.html">C#でキッチンタイマーを作ろう</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yukun.info/blog/2008/02/csharp-timer.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>イースト辞書Webサービスを利用したC#(with .Net)クライアントプログラミング</title>
		<link>http://www.yukun.info/blog/2008/01/csharp-web-service-client.html</link>
		<comments>http://www.yukun.info/blog/2008/01/csharp-web-service-client.html#comments</comments>
		<pubDate>Tue, 01 Jan 2008 15:00:00 +0000</pubDate>
		<dc:creator>yukun</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[C Sharp]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.yukun.info/trump/19700101/%e3%82%a4%e3%83%bc%e3%82%b9%e3%83%88%e8%be%9e%e6%9b%b8web%e3%82%b5%e3%83%bc%e3%83%93%e3%82%b9%e3%82%92%e5%88%a9%e7%94%a8%e3%81%97%e3%81%9fcwith-net%e3%82%af%e3%83%a9%e3%82%a4%e3%82%a2%e3%83%b3</guid>
		<description><![CDATA[C#からWebサービスを扱う練習をしてみました。例として、イースト辞書Webサービスを利用しようと思い宇宙仮面の C# プログラミングのこちらのページのソースコードを参考にしました(謝々)。 SOAP版APIの最新バージ &#8230; <a href="http://www.yukun.info/blog/2008/01/csharp-web-service-client.html">Continue reading <span class="meta-nav">&#8594;</span></a><p><a href="http://www.yukun.info/blog/2008/01/csharp-web-service-client.html">イースト辞書Webサービスを利用したC#(with .Net)クライアントプログラミング</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>C#からWebサービスを扱う練習をしてみました。例として、<a href="http://www.btonic.com/ws/index.html">イースト辞書Webサービス</a>を利用しようと思い<a href="http://uchukamen.com/">宇宙仮面の C# プログラミング</a>の<a href="http://uchukamen.com/Programming4/WebDict/index.htm">こちらのページ</a>のソースコードを参考にしました(謝々)。<br />
SOAP版APIの最新バージョンがv10になり、仕様が変更になったので以下にそれに対応したソースコードを示します。</p>
<h3>実行結果</h3>
<p><a href="http://www.yukun.info/wp-content/uploads/re_webdict01.png"><img src="http://www.yukun.info/wp-content/uploads/re_webdict01.png" alt="C#でWeb辞書サービス" title="C#でWeb辞書サービス" width="370" height="400" class="alignnone size-full wp-image-1990" /></a></p>
<h2>ソースコード</h2>
<h3>Form1.cs</h3>
<pre>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using netdictist.jp.co.est.btonic; // Webサービスの名前空間を追加

namespace netdictist
{
  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();
    }

    private NetDicV10 netDicV10 = null; // Web Service インスタンス格納用変数
    private DicInfo[] dicInfoList = null; // 辞書情報の配列（出力）
    private DicInfo currentDict = null; // 辞書
    private DicItem[] itemList = null; // 辞書項目の配列（出力）

    private void Form1_Load(object sender, EventArgs e)
    {
      #region ComboBox に辞書リストを設定する。

      // Web辞書検索サービスのインスタンスを作成する。
      this.netDicV10 = new NetDicV10();
      // 辞書のリストを取得する。
      dicInfoList = netDicV10.GetDicList("");
      foreach (DicInfo dicInfo in dicInfoList)
      {
        // comboBox1に項目を追加
        int index = this.comboBox1.Items.Add(dicInfo.FullName);
        if (index == 2) break;
      }
      this.comboBox1.SelectedIndex = 0;

      #endregion
    }

    // 辞書が変更になった。
    private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
      this.currentDict = this.dicInfoList[this.comboBox1.SelectedIndex];
    }

    private void button1_Click(object sender, EventArgs e)
    {
      DicInfo d = this.currentDict; // 選択された辞書
      uint reqItemIndex = 0; // 取得する辞書項目の開始インデックス
      uint reqItemTitleCount = 10; // 取得する辞書項目の数
      uint reqItemContentCount = 10; // 内容も同時に取得する辞書項目の数
      uint itemCountTotal;  // 見つかった辞書項目数（出力）

      Cursor cursor = this.Cursor;
      this.Cursor = Cursors.WaitCursor; // Wait Cursor にする。
      Query[] qw = new Query[1]; // クエリ構造体
      qw[0] = new Query();
      qw[0].Words = this.tbSearchText.Text;
      qw[0].ScopeID = d.ScopeList[0].ID;
      //グローバル一意識別子(GUID)の作成
      Guid[] dicGuid = new Guid[1];
      dicGuid[0] = System.Guid.NewGuid();
      dicGuid[0] = d.DicID;
      ContentProfile cp = new ContentProfile();
      cp.CharsetOption = CharsetOption.UNICODE; // 使用文字セット指定
      cp.FormatType = "XHTML";
      cp.ResourceOption = ResourceOption.URI;

      itemCountTotal = netDicV10.SearchDicItem(
        "", // 認証チケット文字列
        dicGuid, // 辞書ID
        qw, // 検索語(クエリ構造体)
        cp, // ContentProfile構造体
        "", // ソート用(使用しない)
        reqItemIndex,  // 取得する辞書項目の開始インデックス
        reqItemTitleCount, // 取得する辞書項目の数
        reqItemContentCount, // 内容も同時に取得する辞書項目の数
        out itemList  // 辞書項目の配列（出力）
        );
      this.Cursor = cursor;   // Cursor を元に戻す。

      this.labelMessage.Text =
        itemCountTotal.ToString() +
          "件みつかりました。最大１０件まで表示します。";
      this.listBox1.Items.Clear();
      foreach (DicItem dicItem in itemList)
      {
        this.listBox1.Items.Add(dicItem.Title.InnerText);
      }
    }

    // 検索結果のリストをセレクトしたので、詳細を表示する。
    private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
      string dictext =
        this.itemList[this.listBox1.SelectedIndex].Body.InnerText;
      this.richTextBox1.Text = dictext;
    }
  }
}
</pre>
<h3>Form1.Designer.cs</h3>
<pre>
namespace netdictist
{
  partial class Form1
  {
    /// &lt;summary&gt;
    /// 必要なデザイナ変数です。
    /// &lt;/summary&gt;
    private System.ComponentModel.IContainer components = null;

    /// &lt;summary&gt;
    /// 使用中のリソースをすべてクリーンアップします。
    /// &lt;/summary&gt;
    /// &lt;param name=&quot;disposing&quot;&gt;マネージ リソースが破棄される場合 true、破棄されない場合は false です。&lt;/param&gt;
    protected override void Dispose(bool disposing)
    {
      if (disposing &amp;&amp; (components != null))
      {
        components.Dispose();
      }
      base.Dispose(disposing);
    }

    #region Windows フォーム デザイナで生成されたコード

    /// &lt;summary&gt;
    /// デザイナ サポートに必要なメソッドです。このメソッドの内容を
    /// コード エディタで変更しないでください。
    /// &lt;/summary&gt;
    private void InitializeComponent()
    {
      this.comboBox1 = new System.Windows.Forms.ComboBox();
      this.tbSearchText = new System.Windows.Forms.TextBox();
      this.button1 = new System.Windows.Forms.Button();
      this.labelMessage = new System.Windows.Forms.Label();
      this.listBox1 = new System.Windows.Forms.ListBox();
      this.richTextBox1 = new System.Windows.Forms.RichTextBox();
      this.SuspendLayout();
      //
      // comboBox1
      //
      this.comboBox1.FormattingEnabled = true;
      this.comboBox1.Location = new System.Drawing.Point(14, 12);
      this.comboBox1.Name = &quot;comboBox1&quot;;
      this.comboBox1.Size = new System.Drawing.Size(204, 20);
      this.comboBox1.TabIndex = 0;
      this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
      //
      // tbSearchText
      //
      this.tbSearchText.Location = new System.Drawing.Point(14, 51);
      this.tbSearchText.Name = &quot;tbSearchText&quot;;
      this.tbSearchText.Size = new System.Drawing.Size(204, 19);
      this.tbSearchText.TabIndex = 1;
      //
      // button1
      //
      this.button1.Location = new System.Drawing.Point(14, 87);
      this.button1.Name = &quot;button1&quot;;
      this.button1.Size = new System.Drawing.Size(204, 31);
      this.button1.TabIndex = 2;
      this.button1.Text = &quot;検索&quot;;
      this.button1.UseVisualStyleBackColor = true;
      this.button1.Click += new System.EventHandler(this.button1_Click);
      //
      // labelMessage
      //
      this.labelMessage.AutoSize = true;
      this.labelMessage.Location = new System.Drawing.Point(12, 136);
      this.labelMessage.Name = &quot;labelMessage&quot;;
      this.labelMessage.Size = new System.Drawing.Size(136, 12);
      this.labelMessage.TabIndex = 3;
      this.labelMessage.Text = &quot;最大１０件まで表示します。&quot;;
      //
      // listBox1
      //
      this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)));
      this.listBox1.FormattingEnabled = true;
      this.listBox1.ItemHeight = 12;
      this.listBox1.Location = new System.Drawing.Point(235, 12);
      this.listBox1.Name = &quot;listBox1&quot;;
      this.listBox1.Size = new System.Drawing.Size(160, 136);
      this.listBox1.TabIndex = 4;
      this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged);
      //
      // richTextBox1
      //
      this.richTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
      this.richTextBox1.Location = new System.Drawing.Point(14, 169);
      this.richTextBox1.Name = &quot;richTextBox1&quot;;
      this.richTextBox1.Size = new System.Drawing.Size(381, 241);
      this.richTextBox1.TabIndex = 5;
      this.richTextBox1.Text = &quot;&quot;;
      //
      // Form1
      //
      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
      this.ClientSize = new System.Drawing.Size(407, 422);
      this.Controls.Add(this.richTextBox1);
      this.Controls.Add(this.listBox1);
      this.Controls.Add(this.labelMessage);
      this.Controls.Add(this.button1);
      this.Controls.Add(this.tbSearchText);
      this.Controls.Add(this.comboBox1);
      this.Name = &quot;Form1&quot;;
      this.Text = &quot;Form1&quot;;
      this.Load += new System.EventHandler(this.Form1_Load);
      this.ResumeLayout(false);
      this.PerformLayout();

    }

    #endregion

    private System.Windows.Forms.ComboBox comboBox1;
    private System.Windows.Forms.TextBox tbSearchText;
    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.Label labelMessage;
    private System.Windows.Forms.ListBox listBox1;
    private System.Windows.Forms.RichTextBox richTextBox1;
  }
}
</pre>
<p>とりあえずこれで一応の動作はしますが、XMLの扱いがずさんなので、これから学んでいく必要があります。<br />
ともあれ、コーディング中感じたのは、Visual Studioのコード補正と宣言元へのジャンプ機能の強力さ。統合開発環境も使いこなしていきたいです。</p>
<h4>関連すると思われる記事：</h4>
<ul class="similar-posts">
<li><a href="http://www.yukun.info/blog/2008/02/csharp-timer.html" rel="bookmark" title="2008年2月24日">C#でキッチンタイマーを作ろう</a></li>
<li><a href="http://www.yukun.info/blog/2008/11/actionscript-flash-load-server-image-file.html" rel="bookmark" title="2008年11月21日">ActionScript: 画像ファイルをダウンロードして表示 &#8211; Loaderクラス</a></li>
<li><a href="http://www.yukun.info/blog/2008/06/python-dict2.html" rel="bookmark" title="2008年6月4日">Python: 辞書の全てのキーと値をたどる &#8211; items(), keys(), values()メソッド</a></li>
<li><a href="http://www.yukun.info/blog/2009/03/java-observe-event-model-view.html" rel="bookmark" title="2009年3月17日">Java: イベント駆動によるModelとViewの分離 &#8211; Observer パターン</a></li>
<li><a href="http://www.yukun.info/blog/2008/12/air-actionscript-sqlite-statement.html" rel="bookmark" title="2008年12月22日">AIR: SQLiteでデータの挿入と検索 &#8211; SQLConnection、SQLStatementクラス</a></li>
</ul>
<p><!-- Similar Posts took 8.682 ms --></p>
<p><a href="http://www.yukun.info/blog/2008/01/csharp-web-service-client.html">イースト辞書Webサービスを利用したC#(with .Net)クライアントプログラミング</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yukun.info/blog/2008/01/csharp-web-service-client.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

