|
||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Object jp.hishidama.win32.JWnd
public class JWnd
Windowsウィンドウクラス.
VisualC++MFCのCWndを模したクラス。
中身はただWin32APIを呼び出しているだけなので、Win32APIの使用上の注意をよく読み用法・用量を守って正しくお使い下さい。
使用するには以下の設定が必要。
当クラスでは、Win32API呼び出しでGetLastError()が0以外だった場合、Win32Exception
をcatchして0やnullを返す。
setThrowLastError(boolean)
にtrueをセットすることにより、その例外をそのままスローするようになる。
フィールドの概要 | |
---|---|
static JWnd |
wndBottom
Zオーダーの最後尾 |
static JWnd |
wndNoTopMost
最上位でない全てのウィンドウの先頭 |
static JWnd |
wndTop
Zオーダーの先頭 |
static JWnd |
wndTopMost
最上位でない全てのウィンドウの上 |
コンストラクタの概要 | |
---|---|
JWnd(long hWnd)
コンストラクター |
メソッドの概要 | |
---|---|
boolean |
CheckDlgButton(int nIDButton,
int uCheck)
ダイアログボックス:チェックボタン設定. |
boolean |
CheckRadioButton(int nIDFirstButton,
int nIDLastButton,
int nIDCheckButton)
ダイアログボックス:ラジオボタン設定. |
JWnd |
childWindowFromPoint(int x,
int y)
指定位置子ウィンドウ取得. |
JWnd |
ChildWindowFromPoint(Point pt)
指定位置子ウィンドウ取得. |
JWnd |
ChildWindowFromPointEx(Point pt,
int flags)
指定位置子ウィンドウ取得. |
Point |
clientToScreen(int x,
int y)
スクリーン座標変換. |
void |
ClientToScreen(Point pt)
スクリーン座標変換. |
void |
ClientToScreen(Rectangle r)
スクリーン座標変換. |
boolean |
EnableScrollBar(int bar,
int arrowFlags)
スクロールバー状態設定. |
boolean |
EnableWindow(boolean enable)
入力可否設定. |
List |
enumChildWindows()
子ウィンドウ列挙. |
static List |
enumWindows()
ウィンドウ列挙. |
boolean |
equals(Object obj)
|
static JWnd |
FindWindow(String className,
String windowName)
ウィンドウ探索. |
JWnd |
GetActiveWindow()
アクティブウィンドウ取得. |
JWnd |
GetAncestor(int flags)
祖先ウィンドウ取得. |
int |
GetCheckedRadioButton(int nIDFirstButton,
int nIDLastButton)
ダイアログボックス:ラジオボタン取得. |
String |
getClassName()
ウィンドウクラス名取得. |
Rectangle |
getClientRect()
クライアント領域取得. |
static JWnd |
GetDesktopWindow()
デスクトップウィンドウ取得. |
int |
GetDlgCtrlID()
ダイアログボックス:コントロール識別子取得. |
JWnd |
GetDlgItem(int id)
ダイアログボックスコントロール取得. |
int |
GetDlgItemInt(int id,
boolean[] translated,
boolean signed)
ダイアログボックス:コントロール数値取得. |
String |
GetDlgItemText(int id)
ダイアログボックス:コントロールテキスト取得. |
int |
GetExStyle()
ウィンドウの拡張スタイル取得. |
static JWnd |
GetFocus()
フォーカスのあるウィンドウ取得. |
static JWnd |
GetForegroundWindow()
最前面ウィンドウ取得. |
Win32Exception |
getLastError()
Win32Exception取得. |
static Win32Exception |
getLastErrorStatic()
Win32Exception取得(staticメソッド用). |
JWnd |
GetNextDlgGroupItem(JWnd ctl,
boolean previous)
ダイアログボックス:グループ内の次コントロール取得. |
JWnd |
GetNextDlgTabItem(JWnd ctl,
boolean previous)
ダイアログボックス:タブ移動可能な次コントロール取得. |
JWnd |
GetNextWindow()
次ウィンドウ取得. |
JWnd |
GetNextWindow(int flag)
次ウィンドウ取得. |
JWnd |
GetOwner()
オーナー取得. |
JWnd |
GetParent()
親ウィンドウ取得. |
long |
GetSafeHwnd()
ウィンドウハンドル取得. |
int |
GetStyle()
ウィンドウのスタイル取得. |
JWnd |
GetTopWindow()
トップレベル子ウィンドウ取得. |
JWnd |
GetWindow(int cmd)
ウィンドウ取得. |
Rectangle |
getWindowRect()
ウィンドウ範囲取得. |
String |
GetWindowText()
ウィンドウタイトル取得. |
int |
GetWindowTextLength()
ウィンドウタイトル長取得. |
boolean |
IsChild(JWnd wnd)
直系子ウィンドウ判断. |
int |
IsDlgButtonChecked(int nIDButton)
ダイアログボックス:チェックボタン状態取得. |
boolean |
IsIconic()
最小化判断. |
boolean |
isWindow()
ウィンドウ存在判断. |
boolean |
IsWindowEnabled()
入力可否判断. |
boolean |
IsWindowVisible()
可視状態判断. |
boolean |
IsZoomed()
最大化判断. |
int |
MessageBox(String text)
メッセージ出力. |
int |
MessageBox(String text,
String caption)
メッセージ出力. |
int |
MessageBox(String text,
String caption,
int type)
メッセージ出力. |
boolean |
ModifyStyle(int remove,
int add)
ウィンドウのスタイル変更. |
boolean |
ModifyStyle(int remove,
int add,
int flags)
ウィンドウのスタイル変更. |
boolean |
ModifyStyleEx(int remove,
int add)
ウィンドウの拡張スタイル変更. |
boolean |
ModifyStyleEx(int remove,
int add,
int flags)
ウィンドウの拡張スタイル変更. |
void |
MoveWindow(int x,
int y,
int width,
int height)
ウィンドウ移動. |
void |
MoveWindow(int x,
int y,
int width,
int height,
boolean repaint)
ウィンドウ移動. |
void |
MoveWindow(Rectangle r)
ウィンドウ移動. |
void |
MoveWindow(Rectangle r,
boolean repaint)
ウィンドウ移動. |
boolean |
PostMessage(int message,
int wParam,
int lParam)
メッセージ送信(post). |
Point |
screenToClient(int x,
int y)
クライアント座標変換. |
void |
ScreenToClient(Point pt)
クライアント座標変換. |
void |
ScreenToClient(Rectangle r)
クライアント座標変換. |
int |
SendMessage(int message,
int wParam,
int lParam)
メッセージ送信(sned). |
int |
SendMessage(int message,
int wParam,
String lParam)
メッセージ送信(sned). |
int |
SendMessageGetString(int message,
int wParam,
byte[] lParam)
メッセージ送信(sned). |
String |
SendMessageGetString(int message,
int wParam,
int buf_len)
メッセージ送信(sned). |
JWnd |
SetActiveWindow()
アクティブウィンドウ化. |
boolean |
SetDlgItemInt(int id,
int value,
boolean signed)
ダイアログボックス:コントロール数値設定. |
boolean |
SetDlgItemText(int id,
String text)
ダイアログボックス:コントロールテキスト設定. |
JWnd |
SetFocus()
フォーカス設定. |
boolean |
SetForegroundWindow()
最前面移動. |
void |
SetOwner(JWnd owner)
オーナー設定. |
JWnd |
SetParent(JWnd newParent)
親ウィンドウ設定. |
static void |
setThrowLastError(boolean thr)
Win32Exceptionスロー有無設定. |
boolean |
SetWindowPos(JWnd wndInsertAfter,
int x,
int y,
int cx,
int cy,
int flags)
ウィンドウ位置変更. |
boolean |
SetWindowText(String string)
ウィンドウタイトル設定. |
void |
ShowScrollBar(int bar,
boolean show)
スクロールバー表示設定. |
boolean |
ShowWindow(int cmdShow)
ウィンドウ表示状態設定. |
String |
toString()
|
static JWnd |
WindowFromPoint(Point pt)
指定位置ウィンドウ取得. |
クラス java.lang.Object から継承されたメソッド |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
フィールドの詳細 |
---|
public static final JWnd wndTop
SetWindowPos(JWnd, int, int, int, int, int)
public static final JWnd wndBottom
SetWindowPos(JWnd, int, int, int, int, int)
public static final JWnd wndTopMost
SetWindowPos(JWnd, int, int, int, int, int)
public static final JWnd wndNoTopMost
SetWindowPos(JWnd, int, int, int, int, int)
コンストラクタの詳細 |
---|
public JWnd(long hWnd)
hWnd
- ウィンドウハンドル(HWND)メソッドの詳細 |
---|
public static void setThrowLastError(boolean thr)
thr
- true:Win32Exception発生時にそれをスローするgetLastError()
により取得する。public Win32Exception getLastError()
JWndのインスタンスメソッド呼び出し時に発生したWin32Exceptionを返す。
public static Win32Exception getLastErrorStatic()
JWndのスタティックメソッド呼び出し時に発生したWin32Exceptionを返す。
public int GetStyle()
public int GetExStyle()
public boolean ModifyStyle(int remove, int add)
remove
- 除去するスタイルadd
- 追加するスタイル
public boolean ModifyStyle(int remove, int add, int flags)
remove
- 除去するスタイルadd
- 追加するスタイルflags
- SetWindowPosに渡すフラグ
public boolean ModifyStyleEx(int remove, int add)
remove
- 除去する拡張スタイルadd
- 追加する拡張スタイル
public boolean ModifyStyleEx(int remove, int add, int flags)
remove
- 除去する拡張スタイルadd
- 追加する拡張スタイルflags
- SetWindowPosに渡すフラグ
public long GetSafeHwnd()
内部で保持しているm_hWndを返す。
public boolean IsWindowEnabled()
EnableWindow(boolean)
public boolean EnableWindow(boolean enable)
enable
- true:マウスやキーボードからの入力を許可する
IsWindowEnabled()
public JWnd GetActiveWindow()
SetActiveWindow()
public JWnd SetActiveWindow()
自分のウィンドウをアクティブにする。
GetActiveWindow()
public static JWnd GetFocus()
SetFocus()
public JWnd SetFocus()
自分のウィンドウに入力フォーカスを要求する。
GetFocus()
public static JWnd GetDesktopWindow()
public static JWnd GetForegroundWindow()
public boolean SetForegroundWindow()
自分のウィンドウを最前面に出す。
public boolean IsIconic()
public boolean IsZoomed()
public void MoveWindow(int x, int y, int width, int height)
ウィンドウの位置とサイズを変更し、再描画する。
x
- Xy
- Ywidth
- 幅height
- 高さpublic void MoveWindow(int x, int y, int width, int height, boolean repaint)
ウィンドウの位置とサイズを変更する。
x
- Xy
- Ywidth
- 幅height
- 高さrepaint
- true:再描画するpublic void MoveWindow(Rectangle r)
ウィンドウの位置とサイズを変更し、再描画する。
r
- 範囲public void MoveWindow(Rectangle r, boolean repaint)
ウィンドウの位置とサイズを変更する。
r
- 範囲repaint
- true:再描画するpublic boolean SetWindowPos(JWnd wndInsertAfter, int x, int y, int cx, int cy, int flags)
ウィンドウの位置・サイズ・Zオーダーを変更する。
wndInsertAfter
- 通常のJWndオブジェクト またはwndTop
, wndBottom
,
wndTopMost
, wndNoTopMost
x
- Xy
- Ycx
- 幅cy
- 高さflags
- 位置変更オプション及びサイズ変更オプション
public Rectangle getWindowRect()
getClientRect()
public Rectangle getClientRect()
getWindowRect()
,
ClientToScreen(Rectangle)
public static JWnd FindWindow(String className, String windowName)
ウィンドウタイトルだけで探す場合、classNameにnullを指定し、windowNameに正確なタイトルを指定する。
ウィンドウタイトルの一部で探したい場合はenumWindows()
を使用する。
className
- Windowsの“ウィンドウクラス”windowName
- ウィンドウのタイトル
public JWnd GetNextWindow()
public JWnd GetNextWindow(int flag)
flag
- 方向(GW_HWNDNEXT または GW_HWNDPREV)
public static List enumWindows()
全ウィンドウを列挙する。
一覧の中からGetWindowText()
等を使って目的のウィンドウを探す。
public List enumChildWindows()
public JWnd GetOwner()
public void SetOwner(JWnd owner)
owner
- オーナーpublic JWnd GetTopWindow()
public JWnd GetWindow(int cmd)
cmd
- 要求
public boolean isWindow()
public boolean IsChild(JWnd wnd)
wnd
- 調査対象ウィンドウ
public JWnd GetParent()
public JWnd SetParent(JWnd newParent)
newParent
- 親ウィンドウ
public JWnd GetAncestor(int flags)
flags
- パラメータ(GA_*)
public static JWnd WindowFromPoint(Point pt)
pt
- 位置
ChildWindowFromPoint(Point)
public JWnd ChildWindowFromPoint(Point pt)
pt
- 位置
public JWnd childWindowFromPoint(int x, int y)
x
- y
-
public JWnd ChildWindowFromPointEx(Point pt, int flags)
pt
- 位置flags
- CWPフラグの論理和(WinUserConst.CWP_ALL
等)
public JWnd GetDlgItem(int id)
id
- コントロールの識別子
public int GetDlgCtrlID()
public boolean ShowWindow(int cmdShow)
cmdShow
- 表示方法
public boolean IsWindowVisible()
public boolean EnableScrollBar(int bar, int arrowFlags)
スクロールバーの有効無効を切り替える。
bar
- スクロールバー(SBフラグ)arrowFlags
- 状態(ESBフラグ)
ShowScrollBar(int, boolean)
public Point clientToScreen(int x, int y)
x
- クライアント座標y
- クライアント座標
public void ClientToScreen(Point pt)
pt
- クライアント座標public void ClientToScreen(Rectangle r)
r
- クライアント座標public Point screenToClient(int x, int y)
x
- スクリーン座標y
- スクリーン座標
public void ScreenToClient(Point pt)
pt
- スクリーン座標public void ScreenToClient(Rectangle r)
r
- スクリーン座標public boolean SetWindowText(String string)
string
- タイトル
public String GetWindowText()
public int GetWindowTextLength()
public String getClassName()
public void ShowScrollBar(int bar, boolean show)
bar
- スクロールバー(SBフラグ)show
- true:表示EnableScrollBar(int, int)
public boolean CheckDlgButton(int nIDButton, int uCheck)
nIDButton
- コントロールの識別子uCheck
- 値(WinUserConst.BST_CHECKED
等)
public int IsDlgButtonChecked(int nIDButton)
nIDButton
- ボタンの識別子
WinUserConst.BST_CHECKED
等public boolean CheckRadioButton(int nIDFirstButton, int nIDLastButton, int nIDCheckButton)
nIDFirstButton
- グループ内の最初のボタンの識別子nIDLastButton
- グループ内の最後のボタンの識別子nIDCheckButton
- 選択したいボタンの識別子
public int GetCheckedRadioButton(int nIDFirstButton, int nIDLastButton)
nIDFirstButton
- グループ内の最初のボタンの識別子nIDLastButton
- グループ内の最後のボタンの識別子
public boolean SetDlgItemInt(int id, int value, boolean signed)
id
- コントロールの識別子value
- 値signed
- 符号を付けるかどうか
public int GetDlgItemInt(int id, boolean[] translated, boolean signed)
id
- コントロールの識別子translated
- 0番に、成功したかどうかの状態を返す(nullの場合は何も返さない)signed
- true:符号付きとして扱う
public boolean SetDlgItemText(int id, String text)
id
- コントロールの識別子text
- 文字列
public String GetDlgItemText(int id)
id
- コントロールの識別子
public JWnd GetNextDlgGroupItem(JWnd ctl, boolean previous)
ctl
- コントロールprevious
- 方向フラグ(true:前のコントロール、false:次のコントロール)
public JWnd GetNextDlgTabItem(JWnd ctl, boolean previous)
ctl
- コントロールprevious
- 方向フラグ(true:前のコントロール、false:次のコントロール)
public int MessageBox(String text)
text
- メッセージ
public int MessageBox(String text, String caption)
text
- メッセージcaption
- タイトル
public int MessageBox(String text, String caption, int type)
text
- メッセージcaption
- タイトルtype
- タイプ
public int SendMessage(int message, int wParam, int lParam)
message
- メッセージwParam
- パラメータlParam
- パラメータ
public int SendMessage(int message, int wParam, String lParam)
message
- メッセージwParam
- パラメータlParam
- パラメータ(文字列)
public int SendMessageGetString(int message, int wParam, byte[] lParam)
message
- メッセージwParam
- パラメータlParam
- パラメータ(バイト配列)
public String SendMessageGetString(int message, int wParam, int buf_len)
LPARAMが文字列取得用のバッファで戻り値が文字数であるメッセージで使用可能。
例:WM_GETTEXT
message
- メッセージwParam
- パラメータbuf_len
- バッファサイズ
public boolean PostMessage(int message, int wParam, int lParam)
message
- メッセージwParam
- パラメータlParam
- パラメータ
public boolean equals(Object obj)
Object
内の equals
public String toString()
Object
内の toString
|
||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |