Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


oracle.javatools.ui.ghost
Class GhostPalette

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JLayeredPane
                  extended by oracle.javatools.ui.ghost.GhostPalette

All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
Direct Known Subclasses:
GhostBuilder.GhostBuiltPalette, GhostPointingPalette

public class GhostPalette
extends javax.swing.JLayeredPane

A semi-transparent container that floats above and the contents of a frame or window. Intended as a basis for a palette or other smaller non-modal window like container. By default the GhostPalette and its child components have a modified look and feel from the conponents elsewhere in the application. It manages it's size and location via mouse manipulation, much like a window. The panel obeys the maximum and minimum sizes and is bound fully within it's parent component. It has an optional close button which will hide the panel (see below) Much like JFrame since Java 1.5 the add, remove and setLayout calls are automatically routed to the content pane. Other calls such as removeAll() are not. The content pane is available via getContentPane() When the GhostPalette or its contents lose focus or the close button is pressed, the GhostPalette is hidden by calling setVisible(false) on itself. Clients can add a componentListener to listen for this state and perform any cleanup if this GhostPalette is not going to be shown again. Just before the GhostPalette is first displayed its contents are automatically converted to a 'ghost' look by the ComponentConverter. Components can opt out of this, and components added after will have to be manually ghosted see ComponentConverter.

See Also:
Serialized Form

Nested Class Summary
protected  class GhostPalette.ContentPanel
           

 

Nested classes/interfaces inherited from class javax.swing.JLayeredPane
javax.swing.JLayeredPane.AccessibleJLayeredPane

 

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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy

 

Field Summary
protected  javax.swing.JPanel container
           
protected  float fadeAmount
           
protected  UIConstants.Look look
           

 

Fields inherited from class javax.swing.JLayeredPane
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER

 

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
GhostPalette()
           
GhostPalette(javax.swing.JComponent owningComponent)
           
GhostPalette(java.lang.String title)
           

 

Method Summary
 void add(java.awt.Component comp, java.lang.Object constraints)
           
protected  void addImpl(java.awt.Component comp, java.lang.Object constraints, int index)
          Adds the specified child Component.
 void allowTemporaryHide()
          Gives the GhostPalette the ability to go temporarily almost-completely invisible via a key press (e.g.
protected  void dispose()
          Remove the panel from the layer and clean up the panel, it can not be shown again.
 void fadeInOut(boolean visible)
          Fade the panel in or out.
 javax.swing.JComponent getContentPanel()
           
 UIConstants.Look getLook()
           
 javax.swing.JComponent getOwningComponent()
           
 boolean getReceivesFocus()
           
 java.lang.String getTitle()
           
 void hidePanel()
           
 boolean isCloseVisible()
           
 boolean isHideOnLoseFocus()
           
 boolean isMovable()
           
 boolean isResizable()
           
protected  void makeVisible(boolean fadeIn)
           
 void pack()
          Causes this Panel to be sized to fit the preferred size and layouts of its subcomponents.
 void paint(java.awt.Graphics g)
           
protected  void positionPanel(javax.swing.JLayeredPane layeredPane, boolean positionInLayer)
           
 void registerTransparentComponent(javax.swing.JComponent comp)
          notify this GhostPanel of another component.
 void remove(java.awt.Component comp)
          Removes the specified component from the container.
 void removeNotify()
           
protected  void repaintVisible()
           
 void setBounds(int x, int y, int w, int h)
           
 void setCloseVisible(boolean visible)
           
 void setHideOnControlUp(boolean hide)
           
 void setHideOnLoseFocus(boolean newhideOnLoseFocus)
           
 void setLayout(java.awt.LayoutManager manager)
          Sets the LayoutManager.
 void setLook(UIConstants.Look look)
          Set the look used
 void setMovable(boolean isMovable)
           
 void setOwningComponent(javax.swing.JComponent owningComponent)
          The GhostPalette will be removed when the owning component is removed
 void setReceivesFocus(boolean receivesFocus)
           
 void setResizable(boolean isResizable)
           
 void setTitle(java.lang.String title)
          Set the title text.
 void show(javax.swing.JLayeredPane layeredPane, boolean positionInLayer, boolean fadeIn)
          Display this ghost panel in the given JLayeredPane.
 void unregisterTransparentComponent(javax.swing.JComponent comp)
           

 

Methods inherited from class javax.swing.JLayeredPane
getAccessibleContext, getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paramString, putLayer, remove, removeAll, setLayer, setLayer, setPosition

 

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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, 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, updateUI

 

Methods inherited from class java.awt.Container
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, 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, 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

fadeAmount

protected float fadeAmount

container

protected final javax.swing.JPanel container

look

protected UIConstants.Look look

Constructor Detail

GhostPalette

public GhostPalette()

GhostPalette

public GhostPalette(java.lang.String title)

GhostPalette

public GhostPalette(javax.swing.JComponent owningComponent)
Parameters:
owningComponent - ties this GhostPalette to another component. The GhostPalette will be removed from view when the owning component is removed.

Method Detail

allowTemporaryHide

public void allowTemporaryHide()
Gives the GhostPalette the ability to go temporarily almost-completely invisible via a key press (e.g. by holding down Alt). this allows the user to see the content below without dismissing the GhostPalette.

getOwningComponent

public javax.swing.JComponent getOwningComponent()
Returns:
the owner of the GhostPalette. The GhostPalette is removed from view when the owning component is removed.

setOwningComponent

public void setOwningComponent(javax.swing.JComponent owningComponent)
The GhostPalette will be removed when the owning component is removed
Parameters:
owningComponent -

setHideOnControlUp

public void setHideOnControlUp(boolean hide)

hidePanel

public void hidePanel()

registerTransparentComponent

public void registerTransparentComponent(javax.swing.JComponent comp)
notify this GhostPanel of another component. The GhostPanel will not render a background under the bounds of the other component. This enables stacking of partially transparent components without the cumulative effect of becoming murky as the stack increases.
Parameters:
comp -

unregisterTransparentComponent

public void unregisterTransparentComponent(javax.swing.JComponent comp)

setBounds

public void setBounds(int x,
                      int y,
                      int w,
                      int h)
Overrides:
setBounds in class java.awt.Component

setCloseVisible

public void setCloseVisible(boolean visible)

isCloseVisible

public boolean isCloseVisible()

setLook

public void setLook(UIConstants.Look look)
Set the look used

getLook

public UIConstants.Look getLook()

getContentPanel

public javax.swing.JComponent getContentPanel()

show

public void show(javax.swing.JLayeredPane layeredPane,
                 boolean positionInLayer,
                 boolean fadeIn)
Display this ghost panel in the given JLayeredPane. This call triggers the fade in effect and the panel is visible and ready to recieve input as soon as this method returns. Panel size should be set before this call, either explicitly or via a call to pack(); Similarly location can either be determined beforehand or automatically set with the positionInLayer parameter.
Parameters:
layeredPane - in which to add the ghost panel. This is usually a JFrame.getLayeredPane()
positionInLayer - true if this component is automatically positioned in the provided layeredPane.
fadeIn - true if the component will fade in, false will show it immediately

positionPanel

protected void positionPanel(javax.swing.JLayeredPane layeredPane,
                             boolean positionInLayer)

makeVisible

protected void makeVisible(boolean fadeIn)

removeNotify

public void removeNotify()
Overrides:
removeNotify in class javax.swing.JComponent

dispose

protected void dispose()
Remove the panel from the layer and clean up the panel, it can not be shown again.

fadeInOut

public void fadeInOut(boolean visible)
Fade the panel in or out. Once the panel has faded out completely it is automatically removed from the layer with a call to dispose.
Parameters:
visible -

repaintVisible

protected void repaintVisible()

addImpl

protected void addImpl(java.awt.Component comp,
                       java.lang.Object constraints,
                       int index)
Adds the specified child Component. This method is overridden to forward calls to the contentPane.
Overrides:
addImpl in class javax.swing.JLayeredPane
Parameters:
comp - the component to be enhanced
constraints - the constraints to be respected
index - the index
Throws:
java.lang.IllegalArgumentException
See Also:
RootPaneContainer

remove

public void remove(java.awt.Component comp)
Removes the specified component from the container.
Overrides:
remove in class java.awt.Container
Parameters:
comp - the component to be removed
Throws:
java.lang.NullPointerException - if comp is null

pack

public void pack()
Causes this Panel to be sized to fit the preferred size and layouts of its subcomponents. The Panel will be validated after the preferredSize is calculated.
See Also:
Component.isDisplayable()

setLayout

public void setLayout(java.awt.LayoutManager manager)
Sets the LayoutManager. Overridden to conditionally forward the call to the contentPane.
Overrides:
setLayout in class java.awt.Container
Parameters:
manager - the LayoutManager
See Also:
RootPaneContainer

add

public void add(java.awt.Component comp,
                java.lang.Object constraints)
Overrides:
add in class java.awt.Container

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class javax.swing.JLayeredPane

setTitle

public void setTitle(java.lang.String title)
Set the title text.
Parameters:
title - the title text, or use null to signify no title

getTitle

public java.lang.String getTitle()

setReceivesFocus

public void setReceivesFocus(boolean receivesFocus)

getReceivesFocus

public boolean getReceivesFocus()

setHideOnLoseFocus

public void setHideOnLoseFocus(boolean newhideOnLoseFocus)

isHideOnLoseFocus

public boolean isHideOnLoseFocus()

setMovable

public void setMovable(boolean isMovable)

isMovable

public boolean isMovable()

setResizable

public void setResizable(boolean isResizable)

isResizable

public boolean isResizable()

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


Copyright © 1997, 2012, Oracle. All rights reserved.