所有类


javax.swing
类 JApplet

java.lang.Object
  继承者 java.awt.Component
      继承者 java.awt.Container
          继承者 java.awt.Panel
              继承者 java.applet.Applet
                  继承者 javax.swing.JApplet
所有已实现的接口:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer

public class JApplet
   
   
   
   
   
extends Applet
implements Accessible, RootPaneContainer

java.applet.Applet 的扩展版,它添加了对 JFC/Swing 组件架构的支持。有关使用 JApplet 的面向任务的文档,请参阅《The Java Tutorial》中的 How to Make Applets 一节。

JApplet 类与 java.applet.Applet 轻微不兼容。JApplet 包含一个 JRootPane 作为其惟一子类。contentPane 应该是 JApplet 任何子类的父类。作为一个便捷的 add 方法及其变体,removesetLayout 已被重写,以便在必要时转发给 contentPane。这意味着您可以编写:

       applet.add(child);
 
并且可以将子级添加到 contentPane 中。contentPane 始终是非 null 的。试图将它设置为 null 会导致 JApplet 抛出一个异常。默认 contentPane 将在其上设置 BorderLayout 管理器。有关添加、移除和设置 JAppletLayoutManager 的细节,请参阅 RootPaneContainer

有关 contentPaneglassPanelayeredPane 属性的完整描述,请参阅 JRootPane 文档。

警告:此类的序列化对象与以后的 Swing 版本不兼容。当前序列化支持适用于短期存储,或适用于在运行相同 Swing 版本的应用程序之间进行 RMI(Remote Method Invocation,远程方法调用)。从 1.4 版本开始,已在 java.beans 包中添加了支持所有 JavaBeansTM 长期存储的功能。请参见 XMLEncoder

另请参见:
RootPaneContainer

嵌套类摘要
protected  class JApplet.AccessibleJApplet
          此类实现对 JApplet 类的可访问性支持。
 
从类 java.applet.Applet 继承的嵌套类/接口
Applet.AccessibleApplet
 
从类 java.awt.Panel 继承的嵌套类/接口
Panel.AccessibleAWTPanel
 
从类 java.awt.Container 继承的嵌套类/接口
Container.AccessibleAWTContainer
 
从类 java.awt.Component 继承的嵌套类/接口
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
字段摘要
protected  AccessibleContext accessibleContext
           
protected  JRootPane rootPane
           
protected  boolean rootPaneCheckingEnabled
          如果为 true,则对 addsetLayout 的调用将转发给 contentPane
 
从类 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
 
构造方法摘要
JApplet()
          创建一个 swing applet 实例。
 
方法摘要
protected  void addImpl(Component comp, Object constraints, int index)
          添加指定的子 Component
protected  JRootPane createRootPane()
          由构造方法调用,以创建默认 rootPane。
 AccessibleContext getAccessibleContext()
          获取与此 JApplet 关联的 AccessibleContext。
 Container getContentPane()
          返回此 applet 的 contentPane 对象。
 Component getGlassPane()
          返回此 applet 的 glassPane 对象。
 JMenuBar getJMenuBar()
          返回此 applet 上的菜单栏设置。
 JLayeredPane getLayeredPane()
          返回此 applet 的 layeredPane 对象。
 JRootPane getRootPane()
          返回此 applet 的 rootPane 对象。
protected  boolean isRootPaneCheckingEnabled()
          返回是否将对 addsetLayout 的调用转发给 contentPane
protected  String paramString()
          返回此 JApplet 的字符串表示形式。
 void remove(Component comp)
          从容器中移除指定组件。
 void setContentPane(Container contentPane)
          设置 contentPane 属性。
 void setGlassPane(Component glassPane)
          设置 glassPane 属性。
 void setJMenuBar(JMenuBar menuBar)
          设置此 applet 的菜单栏。
 void setLayeredPane(JLayeredPane layeredPane)
          设置 layeredPane 属性。
 void setLayout(LayoutManager manager)
          设置 LayoutManager
protected  void setRootPane(JRootPane root)
          设置 rootPane 属性。
protected  void setRootPaneCheckingEnabled(boolean enabled)
          设置是否将对 addsetLayout 的调用转发给 contentPane
 void update(Graphics g)
          只调用 paint(g)
 
从类 java.applet.Applet 继承的方法
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, init, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
 
从类 java.awt.Panel 继承的方法
addNotify
 
从类 java.awt.Container 继承的方法
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
从类 java.awt.Component 继承的方法
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

字段详细信息

rootPane

protected JRootPane rootPane
另请参见:
getRootPane(), setRootPane(javax.swing.JRootPane)

rootPaneCheckingEnabled

protected boolean rootPaneCheckingEnabled
如果为 true,则对 addsetLayout 的调用将转发给 contentPane。该值最初为 false,但在构造 JApplet 时被设置为 true。

另请参见:
isRootPaneCheckingEnabled(), setRootPaneCheckingEnabled(boolean), RootPaneContainer

accessibleContext

protected AccessibleContext accessibleContext
构造方法详细信息

JApplet

public JApplet()
        throws HeadlessException
创建一个 swing applet 实例。

此构造方法将组件的 locale 属性设置为 JComponent.getDefaultLocale 返回的值。

抛出:
HeadlessException - 如果 GraphicsEnvironment.isHeadless() 返回 true。
另请参见:
GraphicsEnvironment.isHeadless(), JComponent.getDefaultLocale()
方法详细信息

createRootPane

protected JRootPane createRootPane()
由构造方法调用,以创建默认 rootPane。


update

public void update(Graphics g)
只调用 paint(g)。重写此方法来防止不必要地调用清除背景。

覆盖:
Container 中的 update
参数:
g - 指定的 Graphics 窗口
另请参见:
Component.update(Graphics)

setJMenuBar

public void setJMenuBar(JMenuBar menuBar)
设置此 applet 的菜单栏。

参数:
menuBar - 将放置在 applet 中的菜单栏
另请参见:
getJMenuBar()

getJMenuBar

public JMenuBar getJMenuBar()
返回此 applet 上的菜单栏设置。

另请参见:
setJMenuBar(javax.swing.JMenuBar)

isRootPaneCheckingEnabled

protected boolean isRootPaneCheckingEnabled()
返回是否将对 addsetLayout 的调用转发给 contentPane

返回:
如果转发 addsetLayout,则返回 true;否则返回 false
另请参见:
addImpl(java.awt.Component, java.lang.Object, int), setLayout(java.awt.LayoutManager), setRootPaneCheckingEnabled(boolean), RootPaneContainer

微信小程序

微信扫一扫体验

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部