org.opensha.commons.gui
Class LabeledBoxPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.opensha.commons.gui.LabeledBoxPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
AddEditCumDisplacement, AddEditNumEvents, AddEditSequence, AddEditSlipRate, IMCorrRel_MultiGuiBean, IMR_MultiGuiBean, ParameterListEditor, TimeGuiBean, ViewCumDisplacement, ViewIndividualEvent, ViewNumEvents, ViewSequences, ViewSlipRate, ViewTimeSpan

public class LabeledBoxPanel
extends JPanel

Title: LabeledBoxPanel

Description: GUI Widget that contains a Header panel with a title lable and an editor panel withing a scroll pane. Is the base class for the ParameterListEditor. This is a generic component so it was useful to pull this functionality out of the ParameterListEditor and make that a subclass.

The main use is to add any component to the editor panel, and the results will be scrollable. See the add() functions below.

Version:
1.0
Author:
Steven W. Rock
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  boolean addDefault
           
protected  Color borderColor
           
protected static String C
           
protected static boolean D
           
protected  JPanel editorPanel
           
protected static GridBagLayout GBL
           
protected  JLabel headerLabel
           
protected  JPanel headerPanel
           
protected  Color headerPanelBackgroundColor
           
protected  JScrollPane jScrollPane1
           
protected  String title
           
 
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
LabeledBoxPanel()
          Creates a new JPanel with a double buffer and a flow layout.
LabeledBoxPanel(boolean isDoubleBuffered)
          Creates a new JPanel with FlowLayout and the specified buffering strategy.
LabeledBoxPanel(LayoutManager layout)
          Create a new buffered JPanel with the specified layout manager
LabeledBoxPanel(LayoutManager layout, boolean isDoubleBuffered)
          Creates a new JPanel with the specified layout manager and buffering strategy.
 
Method Summary
 Component add(Component comp)
          Appends the specified component to the end of this container.
 Component add(Component comp, int index)
          Adds the specified component to this container at the given position.
 void add(Component comp, Object constraints)
          Adds the specified component to the end of this container.
 void add(Component comp, Object constraints, int index)
          Adds the specified component to this container with the specified constraints at the specified index.
 Component add(String name, Component comp)
          Adds the specified component to this container.
 void addPanel(JPanel panel)
           
 Color getBorderColor()
          Gets the borderColor of this boxPanel
 Color getHeaderPanelBackgroundColor()
           
 String getTitle()
          Gets the title in this boxPanel
protected  void jbInit()
          Initializes the GUI components and layout
 void remove(Component comp)
          Removes the specified component from this container.
 void remove(int index)
          Removes the component, specified by index, from this container
 void removeAll()
          Removes all the components from this container.
 void setHeaderPanelBackgroundColor(Color background)
           
 void setLayout(LayoutManager mgr)
          Sets the layout manager for this container.
 void setTitle(String newTitle)
          Sets the title in this boxPanel
 
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, 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
 
Methods inherited from class java.awt.Container
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, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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
 

Field Detail

C

protected static final String C
See Also:
Constant Field Values

D

protected static final boolean D
See Also:
Constant Field Values

jScrollPane1

protected JScrollPane jScrollPane1

editorPanel

protected JPanel editorPanel

headerPanel

protected JPanel headerPanel

headerLabel

protected JLabel headerLabel

GBL

protected static GridBagLayout GBL

title

protected String title

borderColor

protected Color borderColor

headerPanelBackgroundColor

protected Color headerPanelBackgroundColor

addDefault

protected boolean addDefault
Constructor Detail

LabeledBoxPanel

public LabeledBoxPanel(LayoutManager layout,
                       boolean isDoubleBuffered)
Creates a new JPanel with the specified layout manager and buffering strategy.

Parameters:
layout - the LayoutManager to use
isDoubleBuffered - a boolean, true for double-buffering, which uses additional memory space to achieve fast, flicker-free updates

LabeledBoxPanel

public LabeledBoxPanel(LayoutManager layout)
Create a new buffered JPanel with the specified layout manager

Parameters:
layout - the LayoutManager to use

LabeledBoxPanel

public LabeledBoxPanel(boolean isDoubleBuffered)
Creates a new JPanel with FlowLayout and the specified buffering strategy. If isDoubleBuffered is true, the JPanel will use a double buffer.

Parameters:
layout - the LayoutManager to use
isDoubleBuffered - a boolean, true for double-buffering, which uses additional memory space to achieve fast, flicker-free updates

LabeledBoxPanel

public LabeledBoxPanel()
Creates a new JPanel with a double buffer and a flow layout.

Method Detail

setLayout

public void setLayout(LayoutManager mgr)
Sets the layout manager for this container.

Overrides:
setLayout in class Container
Parameters:
mgr - the specified layout manager
See Also:
Container.doLayout(), Container.getLayout()

setTitle

public void setTitle(String newTitle)
Sets the title in this boxPanel

Parameters:
newTitle - The new title value

setHeaderPanelBackgroundColor

public void setHeaderPanelBackgroundColor(Color background)

getHeaderPanelBackgroundColor

public Color getHeaderPanelBackgroundColor()

getTitle

public String getTitle()
Gets the title in this boxPanel

Returns:
The title value

getBorderColor

public Color getBorderColor()
Gets the borderColor of this boxPanel

Returns:
The borderColor value

jbInit

protected void jbInit()
               throws Exception
Initializes the GUI components and layout

Throws:
Exception

addPanel

public void addPanel(JPanel panel)

add

public Component add(Component comp)
Appends the specified component to the end of this container. This is a convenience method for Container.addImpl(java.awt.Component, java.lang.Object, int).

Overrides:
add in class Container
Parameters:
comp - the component to be added
Returns:
the component argument
See Also:
Container.addImpl(java.awt.Component, java.lang.Object, int)

add

public Component add(String name,
                     Component comp)
Adds the specified component to this container. This is a convenience method for Container.addImpl(java.awt.Component, java.lang.Object, int).

This method is obsolete as of 1.1. Please use the method add(Component, Object) instead.

Overrides:
add in class Container

add

public Component add(Component comp,
                     int index)
Adds the specified component to this container at the given position. This is a convenience method for Container.addImpl(java.awt.Component, java.lang.Object, int).

Overrides:
add in class Container
Parameters:
comp - the component to be added
index - the position at which to insert the component, or -1 to append the component to the end
Returns:
the component comp
See Also:
Container.addImpl(java.awt.Component, java.lang.Object, int), remove(int)

add

public void add(Component comp,
                Object constraints)
Adds the specified component to the end of this container. Also notifies the layout manager to add the component to this container's layout using the specified constraints object. This is a convenience method for Container.addImpl(java.awt.Component, java.lang.Object, int).

Overrides:
add in class Container
Parameters:
comp - the component to be added
constraints - an object expressing layout contraints for this component
Since:
JDK1.1
See Also:
Container.addImpl(java.awt.Component, java.lang.Object, int), LayoutManager

remove

public void remove(int index)
Removes the component, specified by index, from this container

Overrides:
remove in class Container
Parameters:
index - the index of the component to be removed

remove

public void remove(Component comp)
Removes the specified component from this container.

Overrides:
remove in class Container
Parameters:
comp -

removeAll

public void removeAll()
Removes all the components from this container.

Overrides:
removeAll in class Container

add

public void add(Component comp,
                Object constraints,
                int index)
Adds the specified component to this container with the specified constraints at the specified index. Also notifies the layout manager to add the component to the this container's layout using the specified constraints object. This is a convenience method for Container.addImpl(java.awt.Component, java.lang.Object, int).

Overrides:
add in class Container
Parameters:
comp - the component to be added
constraints - an object expressing layout contraints for this
index - the position in the container's list at which to insert the component. -1 means insert at the end. component
See Also:
Container.addImpl(java.awt.Component, java.lang.Object, int), remove(int), LayoutManager