JavaTM 2 Platform
Standard Ed. 6

javax.swing
類別 JPanel

java.lang.Object
  繼承者 java.awt.Component
      繼承者 java.awt.Container
          繼承者 javax.swing.JComponent
              繼承者 javax.swing.JPanel
所有已實作的介面:
ImageObserver, MenuContainer, Serializable, Accessible
直接已知子類別:
AbstractColorChooserPanel, JSpinner.DefaultEditor

public class JPanel
extends JComponent
implements Accessible

JPanel 是一般輕量級容器。有關 JPanel 的範例和導向任務的文檔,請參閱 The Java TutorialHow to Use Panels 一節。

警告:Swing 不是執行緒安全的。有關更多資訊,請參閱 Swing's Threading Policy

警告:此類別的序列化物件與以後的 Swing 版本不相容。當前序列化支持適用於短期存儲,或適用於在運行相同 Swing 版本的應用程序之間進行 RMI(Remote Method Invocation,遠端方法調用)。從 1.4 版本開始,已在 java.beans 套件中添加了支持所有 JavaBeansTM 長期存儲的功能。請參見 XMLEncoder


巢狀類別摘要
protected  class JPanel.AccessibleJPanel
          此類別實作對 JPanel 類別的可存取性支持。
 
從類別 javax.swing.JComponent 繼承的巢狀類別/介面
JComponent.AccessibleJComponent
 
從類別 java.awt.Container 繼承的巢狀類別/介面
Container.AccessibleAWTContainer
 
從類別 java.awt.Component 繼承的巢狀類別/介面
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
欄位摘要
 
從類別 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
 
建構子摘要
JPanel()
          創建具有雙緩衝和串流佈局的新 JPanel
JPanel(boolean isDoubleBuffered)
          創建具有 FlowLayout 和指定緩衝策略的新 JPanel
JPanel(LayoutManager layout)
          創建具有指定佈局管理器的新緩衝 JPanel。
JPanel(LayoutManager layout, boolean isDoubleBuffered)
          創建具有指定佈局管理器和緩衝策略的新 JPanel。
 
方法摘要
 AccessibleContext getAccessibleContext()
          獲取與此 JPanel 關聯的 AccessibleContext。
 PanelUI getUI()
          返回呈現此元件的外觀 (L&F) 物件。
 String getUIClassID()
          返回指定呈現此元件的 L&F 類別名的字元串。
protected  String paramString()
          返回此 JPanel 的字元串表示形式。
 void setUI(PanelUI ui)
          設置呈現此元件的外觀 (L&F) 物件。
 void updateUI()
          利用當前外觀的值重置 UI 屬性。
 
從類別 javax.swing.JComponent 繼承的方法
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
從類別 java.awt.Container 繼承的方法
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
從類別 java.awt.Component 繼承的方法
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
從類別 java.lang.Object 繼承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

建構子詳細資訊

JPanel

public JPanel(LayoutManager layout,
              boolean isDoubleBuffered)
創建具有指定佈局管理器和緩衝策略的新 JPanel。

參數:
layout - 要使用的 LayoutManager
isDoubleBuffered - boolean 值,true 表示雙緩衝,雙緩衝使用更多記憶體空間實作快速、無閃爍的更新

JPanel

public JPanel(LayoutManager layout)
創建具有指定佈局管理器的新緩衝 JPanel。

參數:
layout - 要使用的 LayoutManager

JPanel

public JPanel(boolean isDoubleBuffered)
創建具有 FlowLayout 和指定緩衝策略的新 JPanel。如果 isDoubleBuffered 為 true,則 JPanel 將使用雙緩衝。

參數:
isDoubleBuffered - boolean 值,true 表示雙緩衝,雙緩衝使用更多記憶體空間實作快速、無閃爍的更新

JPanel

public JPanel()
創建具有雙緩衝和串流佈局的新 JPanel

方法詳細資訊

updateUI

public void updateUI()
利用當前外觀的值重置 UI 屬性。

覆寫:
類別 JComponent 中的 updateUI
另請參見:
JComponent.updateUI()

getUI

public PanelUI getUI()
返回呈現此元件的外觀 (L&F) 物件。

返回:
呈現此元件的 PanelUI 物件
從以下版本開始:
1.4

setUI

public void setUI(PanelUI ui)
設置呈現此元件的外觀 (L&F) 物件。

參數:
ui - PanelUI L&F 物件
從以下版本開始:
1.4
另請參見:
UIDefaults.getUI(javax.swing.JComponent)

getUIClassID

public String getUIClassID()
返回指定呈現此元件的 L&F 類別名的字元串。

覆寫:
類別 JComponent 中的 getUIClassID
返回:
"PanelUI"
另請參見:
JComponent.getUIClassID(), UIDefaults.getUI(javax.swing.JComponent)

paramString

protected String paramString()
返回此 JPanel 的字元串表示形式。此方法僅在進行除錯的時候使用,對於各個實作,所返回字元串的內容和格式可能有所不同。返回的字元串可以為空,但不可以為 null

覆寫:
類別 JComponent 中的 paramString
返回:
此 JPanel 的字元串表示形式。

getAccessibleContext

public AccessibleContext getAccessibleContext()
獲取與此 JPanel 關聯的 AccessibleContext。對於 JPanel,AccessibleContext 採取 AccessibleJPanel 的形式。必要時要創建新的 AccessibleJPanel 實例。

指定者:
介面 Accessible 中的 getAccessibleContext
覆寫:
類別 JComponent 中的 getAccessibleContext
返回:
一個 AccessibleJPanel,它充當此 JPanel 的 AccessibleContext

JavaTM 2 Platform
Standard Ed. 6

提交錯誤或意見

版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only