忍者ブログ
[12]  [11]  [10]  [9]  [8]  [7]  [6]  [5]  [4]  [3]  [2
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

ボタンを押下したら別ウィンドウを表示させてみる。

まずは表示させるウィンドウのXMLを作成

SubDisp.xml

<?xml version="1.0" encoding="UTF-8"?>
<template xmlns="http://uruma.sandbox.seasar.org">
 <window title="メインメニュー" background="white" width="800" height="600">
  <gridLayout numColumns="1" >
   <gridData horizontalAlignment="FILL" widthHint="150"/>
  </gridLayout>

  <text id="title"/>
  <button id="button" text="ボタン"/>
 </window>
</template>


で表示させるためにEventListenerでボタンイベントを検出する。

MenuAction.java

package gui.test;

import org.eclipse.swt.widgets.Shell;
import org.seasar.framework.container.annotation.tiger.Component;
import org.seasar.uruma.annotation.EventListener;
import org.seasar.uruma.core.UrumaWindowManager;

@Component(name="menuAction")
public class MenuAction {
 public Shell shell;
 public UrumaWindowManager windowManager;
 

 @EventListener(id="button")
 public void button(){
  windowManager.openWindow("gui/test/subDisp.xml", true);
 }
}


UrumaWindowManager#openWIndowで新規画面が表示されます。

ちなみに画面を閉じると標準出力にエラーが表示されるけど今は無視。

PR
この記事にコメントする
お名前
タイトル
文字色
メールアドレス
URL
コメント
パスワード   Vodafone絵文字 i-mode絵文字 Ezweb絵文字
カレンダー
04 2024/05 06
S M T W T F S
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
ブログ内検索
忍者ブログ [PR]

Graphics by Lame Tea / designed by 26℃