SWT/TIPS集
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
#topicpath
----
#contents
**スレッド [#qe271b91]
SWTはメインスレッド以外のスレッドがGUIコンポーネントにア...
**SashForm [#f24fc3e7]
ドラッグ可能なセパレータ(?)です。
SashForm sash_form = new SashForm(parent, SWT.HORIZONTAL...
treeViewer = new TreeViewer(sash_form);
tableViewer = new TableViewer(sash_form);
など。
**スニペット [#de59c3ba]
package kino.swt;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class Main {
/**
* Form上のコンポーネントを配置する
* @param display
* @return
*/
public Shell open(Display display) {
final Shell shell = new Shell(display);
// DESIGNER: Add controls before this line.
shell.setSize(500, 300);
shell.pack();
shell.open();
return shell;
}
public static void main(String[] args) {
Main main = new Main();
Display display = new Display();
Shell shell = main.open(display);
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
System.exit(0);
}
}
** アプリケーションのアイコンを使用する。 [#s6b87491]
ある拡張子に関連づけられたプログラムのアイコンを使用する...
Program program = Program.findProgram("pdf");
Image image = new Image(null, program.getImageData());
shell.setImage(image);
** 外部アプリケーションを起動する [#ccfe5930]
:使用クラス|org.eclipse.swt.program.Program
Program program=Program.findProgram("html"); <- この拡張...
program.execute("http://などURL"); <- アプリケーション起動
とすると、デフォルトのブラウザが起動し、指定したURLが開き...
** めいっぱい配置 [#ja1e0d12]
final GridData gridData = new GridData(GridData.FILL_HOR...
** グリッドの列を何列にするか? [#i70351ef]
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 3;
shell.setLayout(gridLayout);
** ShellのCloseのイベントで何かしたい [#nb266ab0]
shell.addListener(SWT.Close, new CloseCheck());
として内部クラスで
class CloseCheck implements Listener {
public void handleEvent(Event event) {
System.out.println("CloseCheck called");
MessageBox box =
new MessageBox(
shell,
SWT.APPLICATION_MODAL
| SWT.ICON_QUESTION
| SWT.YES
| SWT.NO);
box.setMessage("本当に終了する?");
box.setText("Application の終了");
int answer = box.open();
if (answer == SWT.NO) {
event.doit = false;
}
}
}
終了してよいかのダイアログを出す
*** LinuxでSWT [#m5094f2e]
http://www-6.ibm.com/jp/developerworks/java/030711/j_j-na...
cp -p *.so /usr/lib
export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH
java -cp .:lib/:lib/log4j-1.2.8.jar:lib/kino_javadocsear...
----
この記事は
#vote(おもしろかった[10],そうでもない[0])
-PDFが開かないみたい。。 [[program.executeでAdobeReaderが...
#comment
#topicpath
SIZE(10){現在のアクセス:&counter;}
終了行:
#topicpath
----
#contents
**スレッド [#qe271b91]
SWTはメインスレッド以外のスレッドがGUIコンポーネントにア...
**SashForm [#f24fc3e7]
ドラッグ可能なセパレータ(?)です。
SashForm sash_form = new SashForm(parent, SWT.HORIZONTAL...
treeViewer = new TreeViewer(sash_form);
tableViewer = new TableViewer(sash_form);
など。
**スニペット [#de59c3ba]
package kino.swt;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class Main {
/**
* Form上のコンポーネントを配置する
* @param display
* @return
*/
public Shell open(Display display) {
final Shell shell = new Shell(display);
// DESIGNER: Add controls before this line.
shell.setSize(500, 300);
shell.pack();
shell.open();
return shell;
}
public static void main(String[] args) {
Main main = new Main();
Display display = new Display();
Shell shell = main.open(display);
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
System.exit(0);
}
}
** アプリケーションのアイコンを使用する。 [#s6b87491]
ある拡張子に関連づけられたプログラムのアイコンを使用する...
Program program = Program.findProgram("pdf");
Image image = new Image(null, program.getImageData());
shell.setImage(image);
** 外部アプリケーションを起動する [#ccfe5930]
:使用クラス|org.eclipse.swt.program.Program
Program program=Program.findProgram("html"); <- この拡張...
program.execute("http://などURL"); <- アプリケーション起動
とすると、デフォルトのブラウザが起動し、指定したURLが開き...
** めいっぱい配置 [#ja1e0d12]
final GridData gridData = new GridData(GridData.FILL_HOR...
** グリッドの列を何列にするか? [#i70351ef]
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 3;
shell.setLayout(gridLayout);
** ShellのCloseのイベントで何かしたい [#nb266ab0]
shell.addListener(SWT.Close, new CloseCheck());
として内部クラスで
class CloseCheck implements Listener {
public void handleEvent(Event event) {
System.out.println("CloseCheck called");
MessageBox box =
new MessageBox(
shell,
SWT.APPLICATION_MODAL
| SWT.ICON_QUESTION
| SWT.YES
| SWT.NO);
box.setMessage("本当に終了する?");
box.setText("Application の終了");
int answer = box.open();
if (answer == SWT.NO) {
event.doit = false;
}
}
}
終了してよいかのダイアログを出す
*** LinuxでSWT [#m5094f2e]
http://www-6.ibm.com/jp/developerworks/java/030711/j_j-na...
cp -p *.so /usr/lib
export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH
java -cp .:lib/:lib/log4j-1.2.8.jar:lib/kino_javadocsear...
----
この記事は
#vote(おもしろかった[10],そうでもない[0])
-PDFが開かないみたい。。 [[program.executeでAdobeReaderが...
#comment
#topicpath
SIZE(10){現在のアクセス:&counter;}
ページ名: