com.togethersoft.openapi.util.ui
Class ToggleButtonPanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--com.togethersoft.openapi.util.ui.ToggleButtonPanel

public class ToggleButtonPanel
extends JPanel

Represents panel which can contain following controls :
simlpe button, radio button, check box and any other controls.
These controls are layouted by GridBagLayout.

Author:
TogetherSoft
Since: Together 4.0

Field Summary
 final static intADD_TO_BUTTON_GROUP
          Parameter for radio button or check box.
 private ButtonGroupmyButtonGroup
           
 private GridBagLayoutmyGridBag
           
 final static intNONE
          Parameter for radio button or check box.
 final static intRECEIVE_EXTRA_VERTICAL_SPACE
          Parameter for radio button or check box.

Fields inherited from class javax.swing.JComponent
ui, listenerList, WHEN_FOCUSED, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_IN_FOCUSED_WINDOW, UNDEFINED_CONDITION, TOOL_TIP_TEXT_KEY, accessibleContext

Fields inherited from class java.awt.Component
TOP_ALIGNMENT, CENTER_ALIGNMENT, BOTTOM_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT

Constructor Summary
ToggleButtonPanel()
          Constructs new panel without controls.
ToggleButtonPanel(String title)
          Constructs new panel without controls and sets title.

Method Summary
 JToggleButtonaddCheckBox(String caption)
          Adds check box to this panel with specified caption.
 JToggleButtonaddCheckBox(String caption, int params)
          Adds check box to this panel with specified caption and layout parameters.
 voidaddComponent(JComponent component, GridBagConstraints gbc)
          Adds new component with specified GridBagConstraints to this panel.
 voidaddComponent(JComponent component)
          Adds new component with default GridBagConstraints to this panel.
 JToggleButtonaddRadioButton(String caption)
          Adds radio button to this panel with specified caption.
 JToggleButtonaddRadioButton(String caption, int params)
          Adds radio button to this panel with specified caption and layout parameters.
 private JToggleButtonaddToggleButton(String caption, boolean radioFlag)
           
 private JToggleButtonaddToggleButton(String caption, boolean radioFlag, int params)
           
 static voidadjustComponentHeight(JComponent component)
          Decrease preferred height of specified component to 5.
 protected javax.swing.border.AbstractBordercreateTitledBorder(String title)
           
 ButtonGroupgetButtonGroup()
          Returns ButtonGroup in this panel.

Methods inherited from class javax.swing.JPanel
updateUI, getUIClassID, paramString, getAccessibleContext

Methods inherited from class javax.swing.JComponent
setUI, getComponentGraphics, paintComponent, paintChildren, paintBorder, update, paint, printAll, print, printComponent, printChildren, printBorder, isPaintingTile, isFocusCycleRoot, isManagingFocus, setNextFocusableComponent, getNextFocusableComponent, setRequestFocusEnabled, isRequestFocusEnabled, requestFocus, grabFocus, setVerifyInputWhenFocusTarget, getVerifyInputWhenFocusTarget, setPreferredSize, getPreferredSize, setMaximumSize, getMaximumSize, setMinimumSize, getMinimumSize, isMinimumSizeSet, isPreferredSizeSet, isMaximumSizeSet, contains, setBorder, getBorder, getInsets, getInsets, getAlignmentY, setAlignmentY, getAlignmentX, setAlignmentX, setInputVerifier, getInputVerifier, getGraphics, setDebugGraphicsOptions, getDebugGraphicsOptions, registerKeyboardAction, registerKeyboardAction, unregisterKeyboardAction, getRegisteredKeyStrokes, getConditionForKeyStroke, getActionForKeyStroke, resetKeyboardActions, setInputMap, getInputMap, getInputMap, setActionMap, getActionMap, requestDefaultFocus, setVisible, hide, setEnabled, setForeground, setBackground, setFont, isFocusTraversable, processFocusEvent, processComponentKeyEvent, processKeyEvent, processKeyBinding, setToolTipText, getToolTipText, getToolTipText, getToolTipLocation, createToolTip, scrollRectToVisible, setAutoscrolls, getAutoscrolls, processMouseMotionEvent, enable, disable, getClientProperty, putClientProperty, isLightweightComponent, reshape, getBounds, getSize, getLocation, getX, getY, getWidth, getHeight, hasFocus, isOpaque, setOpaque, computeVisibleRect, getVisibleRect, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener, fireVetoableChange, addVetoableChangeListener, removeVetoableChangeListener, getTopLevelAncestor, addAncestorListener, removeAncestorListener, getListeners, addNotify, removeNotify, repaint, repaint, revalidate, isValidateRoot, isOptimizedDrawingEnabled, paintImmediately, paintImmediately, setDoubleBuffered, isDoubleBuffered, getRootPane

Methods inherited from class java.awt.Container
getComponentCount, countComponents, getComponent, getComponents, insets, add, add, add, add, add, addImpl, remove, remove, removeAll, getLayout, setLayout, doLayout, layout, invalidate, validate, validateTree, preferredSize, minimumSize, paintComponents, printComponents, addContainerListener, removeContainerListener, processEvent, processContainerEvent, deliverEvent, getComponentAt, locate, getComponentAt, findComponentAt, findComponentAt, isAncestorOf, list, list

Methods inherited from class java.awt.Component
getName, setName, getParent, getPeer, setDropTarget, getDropTarget, getGraphicsConfiguration, getTreeLock, getToolkit, isValid, isDisplayable, isVisible, isShowing, isEnabled, enable, enableInputMethods, show, show, getForeground, getBackground, getFont, getLocale, setLocale, getColorModel, getLocation, getLocationOnScreen, location, setLocation, move, setLocation, getSize, size, setSize, resize, setSize, resize, getBounds, bounds, setBounds, setBounds, isLightweight, getFontMetrics, setCursor, getCursor, paintAll, repaint, repaint, repaint, imageUpdate, createImage, createImage, prepareImage, prepareImage, checkImage, checkImage, inside, contains, dispatchEvent, postEvent, addComponentListener, removeComponentListener, addFocusListener, removeFocusListener, addHierarchyListener, removeHierarchyListener, addHierarchyBoundsListener, removeHierarchyBoundsListener, addKeyListener, removeKeyListener, addMouseListener, removeMouseListener, addMouseMotionListener, removeMouseMotionListener, addInputMethodListener, removeInputMethodListener, getInputMethodRequests, getInputContext, enableEvents, disableEvents, coalesceEvents, processComponentEvent, processMouseEvent, processInputMethodEvent, processHierarchyEvent, processHierarchyBoundsEvent, handleEvent, mouseDown, mouseDrag, mouseUp, mouseMove, mouseEnter, mouseExit, keyDown, keyUp, action, gotFocus, lostFocus, transferFocus, nextFocus, add, remove, toString, list, list, list, setComponentOrientation, getComponentOrientation

Methods inherited from class java.lang.Object
getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait, finalize

Field Detail

ADD_TO_BUTTON_GROUP

public final static int ADD_TO_BUTTON_GROUP
Parameter for radio button or check box.
If specified this control will be added to the button group.

myButtonGroup

private ButtonGroup myButtonGroup

myGridBag

private GridBagLayout myGridBag

NONE

public final static int NONE
Parameter for radio button or check box. Means "no parameter".

RECEIVE_EXTRA_VERTICAL_SPACE

public final static int RECEIVE_EXTRA_VERTICAL_SPACE
Parameter for radio button or check box.
Is specified this control will be vertically spreaded up to the highest control.
Constructor Detail

ToggleButtonPanel

public ToggleButtonPanel()
Constructs new panel without controls.

ToggleButtonPanel

public ToggleButtonPanel(String title)
Constructs new panel without controls and sets title.
Parameters:
title Title to be set.
Method Detail

addCheckBox

public JToggleButton addCheckBox(String caption)
Adds check box to this panel with specified caption.

addCheckBox

public JToggleButton addCheckBox(String caption, int params)
Adds check box to this panel with specified caption and layout parameters.
See public fields.

addComponent

public void addComponent(JComponent component, GridBagConstraints gbc)
Adds new component with specified GridBagConstraints to this panel.
Parameters:
component JComponent to be added.
gbc Custom constraints.

addComponent

public void addComponent(JComponent component)
Adds new component with default GridBagConstraints to this panel.


The default constraints are:
fill = HORIZONTAL;
gridwidth = 0;
wightx = 1;
anchor = NORTHWEST;
Parameters:
component JComponent to be added.

addRadioButton

public JToggleButton addRadioButton(String caption)
Adds radio button to this panel with specified caption.

addRadioButton

public JToggleButton addRadioButton(String caption, int params)
Adds radio button to this panel with specified caption and layout parameters.
See public fields.

addToggleButton

private JToggleButton addToggleButton(String caption, boolean radioFlag)

addToggleButton

private JToggleButton addToggleButton(String caption, boolean radioFlag, int params)

adjustComponentHeight

public static void adjustComponentHeight(JComponent component)
Decrease preferred height of specified component to 5.
Parameters:
component JComponent to be adjusted.

createTitledBorder

protected javax.swing.border.AbstractBorder createTitledBorder(String title)

getButtonGroup

public ButtonGroup getButtonGroup()
Returns ButtonGroup in this panel.

Association Links

to Class java.awt.GridBagLayout

to Class javax.swing.ButtonGroup