public class JSplitPane extends JComponent implements Accessible
JSplitPane
是用来划分两(只有两个)
Component
s。两
Component
s图形分为基于感官实现,和两
Component
s可以进行交互式用户调整大小的。使用
JSplitPane
信息在java教程
How to Use Split Panes。
在拆分窗格的两Component
s可以左到右用JSplitPane.HORIZONTAL_SPLIT
,或上下使用JSplitPane.VERTICAL_SPLIT
。改变的Component
s大小的首选方法是调用setDividerLocation
哪里location
要么是新的X或Y的位置,根据不同的JSplitPane
取向。
调整Component
s他们优先尺寸调用resetToPreferredSizes
。
当用户调整Component
s的Components
的最小尺寸是用来确定Component
s可设定最大/最小的位置。如果两个组件的最小尺寸大于分割窗格的大小,分隔符将不允许您调整它的大小。要改变一个JComponent
最小尺寸,看JComponent.setMinimumSize(java.awt.Dimension)
。
当用户调整拆分窗格的新空间的分布是基于resizeWeight
财产两部件之间。默认值为0,表示右/底部组件得到所有的空间,其中一个值为1表示左/顶部组件得到所有的空间。
警告: Swing是线程不安全的。更多信息见Swing's Threading Policy。
警告:序列化该类的对象与以后的Swing版本不兼容。当前的序列化支持适用于短期贮藏或RMI运行相同Swing版本的应用程序之间。为1.4,为所有JavaBeans™长期存储的支持已被添加到java.beans
包。请看XMLEncoder
。
Modifier and Type | Class and Description |
---|---|
protected class |
JSplitPane.AccessibleJSplitPane
这个类实现了对
JSplitPane 类可访问性支持。
|
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static String |
BOTTOM
用于添加下面的另一
Component
Component 。
|
static String |
CONTINUOUS_LAYOUT_PROPERTY
绑定属性的名称continuouslayout。
|
protected boolean |
continuousLayout
不论观点不断重新显示在调整。
|
static String |
DIVIDER
用于添加
Component 表示器。
|
static String |
DIVIDER_LOCATION_PROPERTY
绑定属性的dividerlocation。
|
static String |
DIVIDER_SIZE_PROPERTY
边界的绑定属性名称。
|
protected int |
dividerSize
分压器尺寸。
|
static int |
HORIZONTAL_SPLIT
水平分裂表明
Component s沿X轴的分。
|
static String |
LAST_DIVIDER_LOCATION_PROPERTY
lastlocation绑定属性。
|
protected int |
lastDividerLocation
分割窗格的前位置。
|
static String |
LEFT
用于添加
Component 到其他
Component 左。
|
protected Component |
leftComponent
左或顶部组件。
|
static String |
ONE_TOUCH_EXPANDABLE_PROPERTY
onetouchexpandable绑定属性。
|
protected boolean |
oneTouchExpandable
是一个小部件提供,以迅速扩大/崩溃的分裂窗格?
|
protected int |
orientation
意见如何分裂。
|
static String |
ORIENTATION_PROPERTY
方向(水平或垂直)的绑定属性名称。
|
static String |
RESIZE_WEIGHT_PROPERTY
重量的束缚性质。
|
static String |
RIGHT
用于添加
Component 到其他
Component 权。
|
protected Component |
rightComponent
右或底部组件。
|
static String |
TOP
用于添加在另一
Component
Component 。
|
static int |
VERTICAL_SPLIT
垂直分割表示
Component s沿Y轴分。
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
JSplitPane()
创建一个新的
JSplitPane 配置安排孩子组成并列的水平,使用两个按钮组件。
|
JSplitPane(int newOrientation)
创建一个新的
JSplitPane 配置指定的方向。
|
JSplitPane(int newOrientation, boolean newContinuousLayout)
创建一个新的
JSplitPane 与指定的方向和重绘风格。
|
JSplitPane(int newOrientation, boolean newContinuousLayout, Component newLeftComponent, Component newRightComponent)
创建具有指定方向和重绘风格的新
JSplitPane ,并与指定的成分。
|
JSplitPane(int newOrientation, Component newLeftComponent, Component newRightComponent)
创建具有指定方向和指定的组件一个新的
JSplitPane 。
|
Modifier and Type | Method and Description |
---|---|
protected void |
addImpl(Component comp, Object constraints, int index)
将指定的组件添加到这个拆分窗格中。
|
AccessibleContext |
getAccessibleContext()
获取与此相关的accessiblecontext JSplitPane。
|
Component |
getBottomComponent()
返回下面的组件,或分隔符的右边。
|
int |
getDividerLocation()
返回最后一个值传递给
setDividerLocation 。
|
int |
getDividerSize()
返回分频器的大小。
|
int |
getLastDividerLocation()
返回分隔符的最后一个位置。
|
Component |
getLeftComponent()
返回到左(或以上)分隔符的组件。
|
int |
getMaximumDividerLocation()
返回从外观和感觉实现分压器的最大位置。
|
int |
getMinimumDividerLocation()
返回从外观和感觉实现的分压器的最小位置。
|
int |
getOrientation()
返回方向。
|
double |
getResizeWeight()
返回决定如何分配额外空间的数字。
|
Component |
getRightComponent()
返回到右(或以下)的组件。
|
Component |
getTopComponent()
返回上面的组件,或分隔符的左边。
|
SplitPaneUI |
getUI()
返回
SplitPaneUI 是提供电流的外观和感觉。
|
String |
getUIClassID()
返回呈现此组件的“L”和“F”类的名称。
|
boolean |
isContinuousLayout()
得到
continuousLayout 财产。
|
boolean |
isOneTouchExpandable()
得到
oneTouchExpandable 财产。
|
boolean |
isValidateRoot()
返回true,所以叫
revalidate 任何后裔的这
JSplitPane 将导致请求被排队,将验证
JSplitPane 及其子孙。
|
protected void |
paintChildren(Graphics g)
子类的消息
finishedPaintingChildren UI超级后已通知,以及绘画的边界。
|
protected String |
paramString()
返回该
JSplitPane 字符串表示形式。
|
void |
remove(Component component)
删除子组件,从窗格
component 。
|
void |
remove(int index)
删除指定索引处的
Component 。
|
void |
removeAll()
从拆分窗格中移除所有子组件。
|
void |
resetToPreferredSizes()
提出了基于组件的首选大小的孩子
JSplitPane 布局。
|
void |
setBottomComponent(Component comp)
设置下面的组件,或分隔符的右边。
|
void |
setContinuousLayout(boolean newContinuousLayout)
套的
continuousLayout 财产的价值,必须对孩子的组件被不断重新显示了在用户干预
true 。
|
void |
setDividerLocation(double proportionalLocation)
分频器的位置设置的
JSplitPane 的大小的百分比。
|
void |
setDividerLocation(int location)
设置分隔符的位置。
|
void |
setDividerSize(int newSize)
设置分隔符的大小。
|
void |
setLastDividerLocation(int newLastLocation)
集的最后位置是在
newLastLocation 分频器。
|
void |
setLeftComponent(Component comp)
将组件设置为左(或以上)分隔符。
|
void |
setOneTouchExpandable(boolean newValue)
套的
oneTouchExpandable 财产的价值,必须
true 为
JSplitPane 来迅速展开/折叠的分频器的分频器提供一个用户界面控件。
|
void |
setOrientation(int orientation)
设置方向,或分隔器是如何划分的。
|
void |
setResizeWeight(double value)
指定在拆分窗格大小更改时如何分配额外的空间。
|
void |
setRightComponent(Component comp)
将组件设置为右(或以下)分隔符。
|
void |
setTopComponent(Component comp)
设置上面的组件,或分隔符的左边。
|
void |
setUI(SplitPaneUI ui)
设置呈现此组件的“L”和F对象。
|
void |
updateUI()
从
UIManager ,L和F改变通知。
|
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, 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
add, add, add, add, add, addContainerListener, 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, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
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, 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, transferFocusBackward, transferFocusUpCycle
public static final int VERTICAL_SPLIT
Component
s沿Y轴分。例如,两
Component
s将分在另一个之上。
public static final int HORIZONTAL_SPLIT
Component
s沿X轴的分。例如,两
Component
s会裂开一个其他的左。
public static final String LEFT
Component
到其他
Component
左。
public static final String RIGHT
Component
到其他
Component
权。
public static final String TOP
Component
Component
。
public static final String BOTTOM
Component
Component
。
public static final String DIVIDER
Component
表示器。
public static final String ORIENTATION_PROPERTY
public static final String CONTINUOUS_LAYOUT_PROPERTY
public static final String DIVIDER_SIZE_PROPERTY
public static final String ONE_TOUCH_EXPANDABLE_PROPERTY
public static final String LAST_DIVIDER_LOCATION_PROPERTY
public static final String DIVIDER_LOCATION_PROPERTY
public static final String RESIZE_WEIGHT_PROPERTY
protected int orientation
protected boolean continuousLayout
protected Component leftComponent
protected Component rightComponent
protected int dividerSize
protected boolean oneTouchExpandable
protected int lastDividerLocation
public JSplitPane()
JSplitPane
配置安排孩子组成并列的水平,使用两个按钮组件。
@ConstructorProperties(value="orientation") public JSplitPane(int newOrientation)
JSplitPane
配置指定的方向。
newOrientation
-
JSplitPane.HORIZONTAL_SPLIT
或
JSplitPane.VERTICAL_SPLIT
IllegalArgumentException
-如果
orientation
不是一horizontal_split或vertical_split。
public JSplitPane(int newOrientation, boolean newContinuousLayout)
JSplitPane
与指定的方向和重绘风格。
newOrientation
-
JSplitPane.HORIZONTAL_SPLIT
或
JSplitPane.VERTICAL_SPLIT
newContinuousLayout
-布尔,如此不断重绘器位置变化的成分,假要等到分位置不变重绘
IllegalArgumentException
-如果
orientation
不是一horizontal_split或vertical_split
public JSplitPane(int newOrientation, Component newLeftComponent, Component newRightComponent)
JSplitPane
。
newOrientation
-
JSplitPane.HORIZONTAL_SPLIT
或
JSplitPane.VERTICAL_SPLIT
newLeftComponent
-
Component
将出现在一个水平拆分窗格的左侧,或在一个垂直拆分窗格顶部
newRightComponent
-
Component
将出现在一个水平拆分窗格的权利,或在一个垂直拆分窗格的底部
IllegalArgumentException
-如果
orientation
不一:horizontal_split或vertical_split
public JSplitPane(int newOrientation, boolean newContinuousLayout, Component newLeftComponent, Component newRightComponent)
JSplitPane
,并与指定的成分。
newOrientation
-
JSplitPane.HORIZONTAL_SPLIT
或
JSplitPane.VERTICAL_SPLIT
newContinuousLayout
-布尔,如此不断重绘器位置变化的成分,假要等到分位置不变重绘
newLeftComponent
-
Component
将出现在一个水平拆分窗格的左侧,或在一个垂直拆分窗格顶部
newRightComponent
-
Component
将出现在一个水平拆分窗格的权利,或在一个垂直拆分窗格的底部
IllegalArgumentException
-如果
orientation
不是一horizontal_split或vertical_split
public void setUI(SplitPaneUI ui)
ui
-
SplitPaneUI
L和F的对象
UIDefaults.getUI(javax.swing.JComponent)
public SplitPaneUI getUI()
SplitPaneUI
是提供电流的外观和感觉。
SplitPaneUI
对象,使得这部分
public void updateUI()
UIManager
,L和F改变通知。从
UIManager
最新版本替换当前的UI对象。
updateUI
方法重写,继承类
JComponent
JComponent.updateUI()
public String getUIClassID()
getUIClassID
方法重写,继承类
JComponent
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
public void setDividerSize(int newSize)
newSize
-一个整数分频器在像素大小
public int getDividerSize()
public void setLeftComponent(Component comp)
comp
-
Component
在那个位置显示
public Component getLeftComponent()
Component
public void setTopComponent(Component comp)
comp
-
Component
在那个位置显示
public Component getTopComponent()
Component
public void setRightComponent(Component comp)
comp
-
Component
在那个位置显示
public Component getRightComponent()
Component
public void setBottomComponent(Component comp)
comp
-
Component
在那个位置显示
public Component getBottomComponent()
Component
public void setOneTouchExpandable(boolean newValue)
oneTouchExpandable
财产的价值,必须对
JSplitPane
来迅速展开/折叠的分频器的分频器提供一个用户界面控件
true
。此属性的默认值是
false
。一些看起来和感觉可能不支持一个触摸扩大,他们会忽略这个属性。
newValue
-
true
指定拆分窗格应该提供一个折叠/展开部件
isOneTouchExpandable()
public boolean isOneTouchExpandable()
oneTouchExpandable
财产。
oneTouchExpandable
属性的值
setOneTouchExpandable(boolean)
public void setLastDividerLocation(int newLastLocation)
newLastLocation
分频器。
newLastLocation
-以像素为单位指定位置上分一个整数,从左(或上)的窗格的左边缘(或上)的分压边
public int getLastDividerLocation()
public void setOrientation(int orientation)
orientation
指定方向的整数
IllegalArgumentException
如果定位不一:horizontal_split或vertical_split。
public int getOrientation()
setOrientation(int)
public void setContinuousLayout(boolean newContinuousLayout)
continuousLayout
财产的价值,必须对孩子的组件被不断重新显示了在用户干预
true
。这个属性的默认值是外观和感觉依赖性的。一些外观和感觉可能不支持连续布局,他们会忽略这个属性。
newContinuousLayout
-
true
如果成分应不断被改写为分频器的位置变化
isContinuousLayout()
public boolean isContinuousLayout()
continuousLayout
财产。
continuousLayout
属性的值
setContinuousLayout(boolean)
public void setResizeWeight(double value)
value
-如上所述
IllegalArgumentException
-如果
value
是<0或>1
public double getResizeWeight()
public void resetToPreferredSizes()
JSplitPane
布局。这将可能会导致更改分隔符位置。
public void setDividerLocation(double proportionalLocation)
JSplitPane
的大小的百分比。
这种方法是从setDividerLocation(int)
实施。此方法立即改变了基于它当前大小的拆分窗格的大小。如果分裂窗格不正确认识和在屏幕上,此方法不会产生任何效果(新的分频器的位置将成为(电流大小* proportionallocation)这是0)。
proportionalLocation
-双精度浮点值,指定一个百分比,从零(左上)1(下右)
IllegalArgumentException
-如果指定的位置<0或>1
public void setDividerLocation(int location)
setLastDividerLocation
。
location
指定UI特定值int(典型的像素数)
public int getDividerLocation()
setDividerLocation
。此方法返回的值可能不同于实际的分频器的位置(如果
setDividerLocation
传递值大于当前大小)。
public int getMinimumDividerLocation()
null
public int getMaximumDividerLocation()
null
public void remove(Component component)
component
从窗格。重置
leftComponent
或
rightComponent
实例变量,是必要的。
remove
方法重写,继承类
Container
component
-
Component
删除
Container.add(java.awt.Component)
,
Container.invalidate()
,
Container.validate()
,
Container.remove(int)
public void remove(int index)
Component
。更新
leftComponent
和
rightComponent
实例变量是必要的,然后短信超。
remove
方法重写,继承类
Container
index
-指定要移除的组件的一个整数,其中1指定左/上组件和2指定底/右组件
Container.add(java.awt.Component)
,
Container.invalidate()
,
Container.validate()
,
Container.getComponentCount()
public void removeAll()
leftComonent
和
rightComponent
实例变量。
removeAll
方法重写,继承类
Container
Container.add(java.awt.Component)
,
Container.remove(int)
,
Container.invalidate()
public boolean isValidateRoot()
revalidate
任何后裔的这
JSplitPane
将导致请求被排队,将验证
JSplitPane
及其子孙。
isValidateRoot
方法重写,继承类
JComponent
JComponent.revalidate()
,
Container.isValidateRoot()
protected void addImpl(Component comp, Object constraints, int index)
constraints
标识左/右/子组件的顶部或底部,并且与标识符以前添加的组件,它将被删除,然后
comp
将会在它的地方。如果
constraints
不是一个已知的标识符的布局管理器,可以让一
IllegalArgumentException
。
可能的约束对象(字符串)是:
constraints
对象是
null
,组件是第一个可用的位置加入(左/上如果打开,其他的右/下)。
addImpl
方法重写,继承类
Container
comp
-添加组件
constraints
指定布局约束
Object
(位置)这个组件
index
在容器的列表中指定索引的整数。
IllegalArgumentException
-如果
constraints
对象不符合现有的组件
Container.addImpl(Component, Object, int)
protected void paintChildren(Graphics g)
finishedPaintingChildren
UI超级后已通知,以及绘画的边界。
paintChildren
方法重写,继承类
JComponent
g
-
Graphics
上下文内涂料
JComponent.paint(java.awt.Graphics)
,
Container.paint(java.awt.Graphics)
protected String paramString()
JSplitPane
字符串表示形式。此方法仅用于调试目的,返回的字符串的内容和格式可能会在实现过程中有所不同。返回的字符串是空的但可能不
null
。
paramString
方法重写,继承类
JComponent
JSplitPane
字符串表示形式。
public AccessibleContext getAccessibleContext()
getAccessibleContext
接口
Accessible
getAccessibleContext
方法重写,继承类
Component
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.