|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLayeredPane
javax.swing.JDesktopPane
public class JDesktopPane
用於創建多文檔介面或虛擬桌面的容器。使用者可創建 JInternalFrame 物件並將其添加到 JDesktopPane。JDesktopPane 擴展了 JLayeredPane,以管理可能的重疊內部窗體。它還維護了對 DesktopManager 實例的參考,這是由 UI 類別為當前的外觀 (L&F) 所設置的。注意,JDesktopPane 不支持邊界。
此類別通常用作 JInternalFrames 的父類別,為 JInternalFrames 提供一個可插入的 DesktopManager 物件。特定於 L&F 的實作 installUI 負責正確設置 desktopManager 變數。JInternalFrame 的父類別是 JDesktopPane 時,它應該將其大部分行為(關閉、調整大小等)委託給 desktopManager。
有關此內容更多的文檔和範例,請參閱 The Java Tutorial 的 How to Use Internal Frames 一節。
警告: Swing 不是執行緒安全的。有關更多資訊,請參閱 Swing's Threading Policy。
警告:此類別的序列化物件與以後的 Swing 版本不相容。當前序列化支持適用於短期存儲,或適用於在運行相同 Swing 版本的應用程序之間進行 RMI(Remote Method Invocation,遠端方法調用)。從 1.4 版本開始,已在 java.beans 套件中添加了支持所有 JavaBeansTM 長期存儲的功能。請參見 XMLEncoder。
JInternalFrame,
JInternalFrame.JDesktopIcon,
DesktopManager| 巢狀類別摘要 | |
|---|---|
protected class |
JDesktopPane.AccessibleJDesktopPane
此類別實作對 JDesktopPane 類別的可存取性支持。 |
| 從類別 javax.swing.JLayeredPane 繼承的巢狀類別/介面 |
|---|
JLayeredPane.AccessibleJLayeredPane |
| 從類別 javax.swing.JComponent 繼承的巢狀類別/介面 |
|---|
JComponent.AccessibleJComponent |
| 從類別 java.awt.Container 繼承的巢狀類別/介面 |
|---|
Container.AccessibleAWTContainer |
| 從類別 java.awt.Component 繼承的巢狀類別/介面 |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| 欄位摘要 | |
|---|---|
static int |
LIVE_DRAG_MODE
指示正在被拖動項的所有內容是否應該出現在桌面窗格內部。 |
static int |
OUTLINE_DRAG_MODE
指示桌面窗格是否只應該出現正在被拖動項的輪廓。 |
| 從類別 javax.swing.JLayeredPane 繼承的欄位 |
|---|
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER |
| 從類別 javax.swing.JComponent 繼承的欄位 |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| 從類別 java.awt.Component 繼承的欄位 |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| 從介面 java.awt.image.ImageObserver 繼承的欄位 |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| 建構子摘要 | |
|---|---|
JDesktopPane()
創建一個新的 JDesktopPane。 |
|
| 方法摘要 | |
|---|---|
protected void |
addImpl(Component comp,
Object constraints,
int index)
將指定元件添加到此容器的指定索引所在的位置上。 |
AccessibleContext |
getAccessibleContext()
獲取與此 JDesktopPane 關聯的 AccessibleContext。 |
JInternalFrame[] |
getAllFrames()
返回桌面中當前顯示的所有 JInternalFrames。 |
JInternalFrame[] |
getAllFramesInLayer(int layer)
返回桌面指定層中當前所顯示的所有 JInternalFrames。 |
DesktopManager |
getDesktopManager()
返回處理特定於桌面 UI 操作的 DesktopManger。 |
int |
getDragMode()
獲取桌面窗格當前使用的“拖動樣式”。 |
JInternalFrame |
getSelectedFrame()
返回此 JDesktopPane 中當前活動的 JInternalFrame,如果當前沒有活動的 JInternalFrame,則返回 null。 |
DesktopPaneUI |
getUI()
返回呈現此元件的 L&F 物件。 |
String |
getUIClassID()
返回呈現此元件的 L&F 類別名。 |
protected String |
paramString()
返回此 JDesktopPane 的字元串表示形式。 |
void |
remove(int index)
從此窗格中移除已索引的元件。 |
void |
removeAll()
從此容器中移除所有元件。 |
JInternalFrame |
selectFrame(boolean forward)
選擇此桌面窗格中的下一個 JInternalFrame。 |
void |
setComponentZOrder(Component comp,
int index)
將指定元件移動到容器中指定的 z 順序索引。 |
void |
setDesktopManager(DesktopManager d)
設置處理特定於桌面 UI 操作的 DesktopManger。 |
void |
setDragMode(int dragMode)
設置桌面窗格使用的“拖動樣式”。 |
void |
setSelectedFrame(JInternalFrame f)
設置此 JDesktopPane 中當前活動的 JInternalFrame。 |
void |
setUI(DesktopPaneUI ui)
設置呈現此元件的 L&F 物件。 |
void |
updateUI()
UIManager 發出的關於 L&F 已更改的通知。 |
| 從類別 java.lang.Object 繼承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 欄位詳細資訊 |
|---|
public static final int LIVE_DRAG_MODE
OUTLINE_DRAG_MODE,
setDragMode(int),
常數欄位值public static final int OUTLINE_DRAG_MODE
LIVE_DRAG_MODE,
setDragMode(int),
常數欄位值| 建構子詳細資訊 |
|---|
public JDesktopPane()
JDesktopPane。
| 方法詳細資訊 |
|---|
public DesktopPaneUI getUI()
DesktopPaneUI 物件public void setUI(DesktopPaneUI ui)
ui - DesktopPaneUI L&F 物件UIDefaults.getUI(javax.swing.JComponent)public void setDragMode(int dragMode)
dragMode - 為 Desktop 中各項所用的拖動樣式LIVE_DRAG_MODE,
OUTLINE_DRAG_MODEpublic int getDragMode()
Live_DRAG_MODE 或 OUTLINE_DRAG_MODEsetDragMode(int)public DesktopManager getDesktopManager()
DesktopManger。
public void setDesktopManager(DesktopManager d)
DesktopManger。
d - 所使用的 DesktopManagerpublic void updateUI()
UIManager 發出的關於 L&F 已更改的通知。用來自 UIManager 的最新版本 UI 物件替換當前的 UI 物件。
JComponent 中的 updateUIJComponent.updateUI()public String getUIClassID()
JComponent 中的 getUIClassIDJComponent.getUIClassID(),
UIDefaults.getUI(javax.swing.JComponent)public JInternalFrame[] getAllFrames()
JInternalFrames。返回圖標化的窗體和擴展的窗體。
JInternalFrame 物件的陣列public JInternalFrame getSelectedFrame()
JDesktopPane 中當前活動的 JInternalFrame,如果當前沒有活動的 JInternalFrame,則返回 null。
JInternalFrame 或 nullpublic void setSelectedFrame(JInternalFrame f)
JDesktopPane 中當前活動的 JInternalFrame。此方法用於連接JDesktopPane 和平臺實作程式碼,不應該直接調用。要可視化地選擇窗體,客戶端必須調用 JInternalFrame.setSelected(true) 啟動窗體。
f - 當前選中的內部窗體JInternalFrame.setSelected(boolean)public JInternalFrame[] getAllFramesInLayer(int layer)
JInternalFrames。返回圖標化的窗體和擴展的窗體。
layer - 指定桌面層的 int 值
JInternalFrame 物件的陣列JLayeredPanepublic JInternalFrame selectFrame(boolean forward)
JInternalFrame。
forward - 一個 boolean 值,指示選擇的方向;true 表示向前,false 表示向後
null
protected void addImpl(Component comp,
Object constraints,
int index)
addLayoutComponent 方法,使用指定的約束物件將元件添加到此容器的佈局中。
這些約束是由正使用的特定佈局管理器定義的。例如,BorderLayout 類別定義了五個約束:BorderLayout.NORTH、BorderLayout.SOUTH、BorderLayout.EAST、BorderLayout.WEST 和 BorderLayout.CENTER。
GridBagLayout 類別需要一個 GridBagConstraints 物件。如果傳遞正確的約束物件型別時失敗,則會導致 IllegalArgumentException。
如果當前佈局管理器實作了 LayoutManager2,則在其上調用 LayoutManager2.addLayoutComponent(Component,Object)。如果當前佈局管理器沒有實作 LayoutManager2,並且約束是一個 String,則在其上調用 LayoutManager.addLayoutComponent(String,Component)。
如果該元件不是此容器的祖先容器,並且有一個非 null 父元件,則在將該元件添加到此容器之前,從其當前父元件中移除它。
在其他所有添加方法參考此方法時,如果某個程序需要追蹤每個添加到容器的請求,那麼這就是要覆寫的方法。被覆寫的方法通常應該套件括一個對該方法的父級類別版本的調用:
super.addImpl(comp, constraints, index)
JLayeredPane 中的 addImplcomp - 要添加的元件constraints - 表示此元件的佈局約束的物件Container.add(Component),
Container.add(Component, int),
Container.add(Component, java.lang.Object),
LayoutManager,
LayoutManager2public void remove(int index)
JLayeredPane 中的 removeindex - 指定要移除元件的 int 值JLayeredPane.getIndexOf(java.awt.Component)public void removeAll()
JLayeredPane 中的 removeAllContainer.add(java.awt.Component),
Container.remove(int)
public void setComponentZOrder(Component comp,
int index)
如果元件是其他某個 container 的子元件,則在將它添加到此容器之前,從該容器中移除它。此方法與 java.awt.Container.add(Component, int) 之間的重要不同是,在將元件從其以前的容器中移除時,此方法不對該元件調用 removeNotify,除非有此必要,並且基礎本機視窗系統允許這樣做。因此,如果元件擁有鍵盤焦點,那麼在移動到新的位置上時,它會維持該焦點。
要保證此屬性只應用於輕量級的非 Container 元件。
注:並不是所有的平臺都支持在不調用 removeNotify 的情況下,將重量級元件的 z 順序從一個容器更改到另一個容器中。無法檢測某個平臺是否支持這一點,因此開發人員不應該作出任何假設。
Container 中的 setComponentZOrdercomp - 要移動的元件index - 在容器的列表中插入元件的位置,其中 getComponentCount() 指追加到尾部Container.getComponentZOrder(java.awt.Component)protected String paramString()
JDesktopPane 的字元串表示形式。此方法僅在進行除錯時使用,對於各個實作,所返回字元串的內容和格式可能有所不同。返回的字元串可能為空,但不可能為 null。
JLayeredPane 中的 paramStringJDesktopPane 的字元串表示形式public AccessibleContext getAccessibleContext()
JDesktopPane 關聯的 AccessibleContext。對於桌面窗格,AccessibleContext 採用 AccessibleJDesktopPane 的形式。如有必要,可以創建一個新的 AccessibleJDesktopPane 實例。
Accessible 中的 getAccessibleContextJLayeredPane 中的 getAccessibleContextJDesktopPane 的 AccessibleContext 的 AccessibleJDesktopPane
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。