|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
de.sciss.gui.SpringPanel
public class SpringPanel
A subclass of JPanel
that is linked
to a SpringLayout
. Components must be
added using one of the gridAdd
methods
which define the component's space in terms of a
virtual grid. When all components have been added,
the actual layout contraints are calculated by calling
either makeGrid
(for equal cell size grid)
or makeCompactGrid
. Just like GridBagLayout
,
the grid positions need not be "compact", i.e.
you may omit complete columns or rows and start at
an arbitrary offset.
Nested Class Summary | |
---|---|
static class |
SpringPanel.ComponentHeightRatioSpring
|
static class |
SpringPanel.ComponentWidthRatioSpring
|
static class |
SpringPanel.RatioSpring
|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary |
---|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
SpringPanel()
Creates a new panel with zero padding and offset |
|
SpringPanel(int initialX,
int initialY,
int xPad,
int yPad)
Creates a new panel with given padding and offset (in pixels). |
Method Summary | |
---|---|
void |
gridAdd(javax.swing.JComponent c,
int x,
int y)
Add a component to the panel and store its placement information for use in makeGrid. |
void |
gridAdd(javax.swing.JComponent c,
int x,
int y,
int width,
int height)
Add a component to the panel and store its placement information for use in makeGrid. |
void |
gridAdd(javax.swing.JComponent c,
java.awt.Rectangle r)
Add a component to the panel and store its placement information for use in makeGrid. |
void |
makeCompactGrid()
Aligns all the gadgets in a compact grid whose virtual cells are as small as possible (calculated from the maximum width of a column and maximum height of a row). |
void |
makeCompactGrid(boolean hElastic,
boolean vElastic)
Aligns all the gadgets in a compact grid whose virtual cells are as small as possible (calculated from the maximum width of a column and maximum height of a row). |
void |
makeGrid(boolean elastic)
Aligns all the gadgets in a regular grid whose virtual cells are all of the same size (calculated from the maximum dimensions of all cells). |
void |
setInitialX(int x)
Changes the horizontal offset. |
void |
setInitialY(int y)
Changes the vertical offset. |
void |
setPadding(int initialX,
int initialY,
int xPad,
int yPad)
Changes the padding and offset for the panel. |
void |
setTitle(java.lang.String title)
Adds a titled border to the panel. |
void |
setXPad(int x)
Changes the horizontal padding. |
void |
setYPad(int y)
Changes the vertical padding. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, 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, 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 |
Methods inherited from class 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 |
Methods inherited from class 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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SpringPanel()
public SpringPanel(int initialX, int initialY, int xPad, int yPad)
initialX
- the spacing for gadgets from the left border of the panelinitialY
- the spacing for gadgets from the top border of the panelxPad
- the spacing between a gadget and its horizontal neighbouryPad
- the spacing between a gadget and its vertical neighbourMethod Detail |
---|
public void setInitialX(int x)
x
- the spacing for gadgets from the left border of the panelpublic void setInitialY(int y)
y
- the spacing for gadgets from the top border of the panelpublic void setXPad(int x)
x
- the spacing between a gadget and its horizontal neighbourpublic void setYPad(int y)
y
- the spacing between a gadget and its vertical neighbourpublic void setPadding(int initialX, int initialY, int xPad, int yPad)
initialX
- the spacing for gadgets from the left border of the panelinitialY
- the spacing for gadgets from the top border of the panelxPad
- the spacing between a gadget and its horizontal neighbouryPad
- the spacing between a gadget and its vertical neighbourpublic void gridAdd(javax.swing.JComponent c, int x, int y)
c
- the componentx
- the horizontal grid positiony
- the vertical grid positionpublic void gridAdd(javax.swing.JComponent c, int x, int y, int width, int height)
c
- the componentx
- the horizontal grid positiony
- the vertical grid positionwidth
- the number of columns to occupy
(a negative width means the width is
not elastic)height
- the number of rows to occupy
(a negative height means the height is
not elastic)public void gridAdd(javax.swing.JComponent c, java.awt.Rectangle r)
c
- the componentr
- the grid location and extent.
(a negative width or height means the width or height is
not elastic)public void setTitle(java.lang.String title)
title
- the text to display in the titled borderpublic void makeGrid(boolean elastic)
elastic
- not yet fully working, has to be false for now(?)public void makeCompactGrid()
public void makeCompactGrid(boolean hElastic, boolean vElastic)
hElastic
- whether the layout should be horizontally stretched
as to use additional space when the panel is horizontally resizedvElastic
- whether the layout should be vertically stretched
as to use additional space when the panel is vertically resized
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |