public class BackgroundPanel
extends javax.swing.JPanel
Rob, if you somehow ever get wind of your class being used here: Thank you, thank you, thank
you, thank you, thank you so very much! You seriously made my day here.
Rob, you rule.
javax.swing.JPanel.AccessibleJPaneljavax.swing.JComponent.AccessibleJComponent| Modifier and Type | Field and Description |
|---|---|
static int |
ACTUAL |
static int |
SCALED |
static int |
TILED |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW| Constructor and Description |
|---|
BackgroundPanel(java.awt.Image image)
Constructor
Set image as the background with the SCALED style. |
BackgroundPanel(java.awt.Image image,
int style)
Constructor
Set image as the background with the specified style. |
BackgroundPanel(java.awt.Image image,
int style,
float alignmentX,
float alignmentY)
Constructor
Set image as the background with the specified style and alignment. |
BackgroundPanel(java.awt.Paint painter)
Constructor
Use the Paint interface to paint a background. |
| Modifier and Type | Method and Description |
|---|---|
void |
addComponent(javax.swing.JComponent component)
Override method so we can make the component transparent.
|
void |
addComponent(javax.swing.JComponent component,
java.lang.Object constraints)
Override method so we can make the component transparent.
|
java.awt.Dimension |
getPreferredSize()
Override to provide a preferred size equal to the image size.
|
protected void |
paintComponent(java.awt.Graphics g)
Add custom painting.
|
void |
setImage(java.awt.Image image)
Setter for the image used as the background.
|
void |
setImageAlignmentX(float alignmentX)
Setter for the horizontal alignment of the image when using ACTUAL style.
|
void |
setImageAlignmentY(float alignmentY)
Setter for the horizontal alignment of the image when using ACTUAL style.
|
void |
setPaint(java.awt.Paint painter)
Setter for the Paint object used to paint the background.
|
void |
setStyle(int style)
Setter the style used to paint the background image.
|
void |
setTransparentAdd(boolean isTransparentAdd)
Controls whether components added to this panel should automatically be made transparent.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, 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, 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, isValidateRoot, paint, paintBorder, paintChildren, 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, updateadd, 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, transferFocusDownCycle, validate, validateTreeaction, 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, transferFocusUpCyclepublic static final int SCALED
public static final int TILED
public static final int ACTUAL
public BackgroundPanel(java.awt.Image image)
image - Pass an image to the constructor to be used in the new JPanel.public BackgroundPanel(java.awt.Image image,
int style)
public BackgroundPanel(java.awt.Image image,
int style,
float alignmentX,
float alignmentY)
public BackgroundPanel(java.awt.Paint painter)
painter - Pass a painter to be used as the background in the new JPanel.public void setImage(java.awt.Image image)
image - Image to be set as the background.public void setStyle(int style)
style - Sets the style with which the image should be painted.public void setImageAlignmentX(float alignmentX)
alignmentX - Sets the alignment along the x-axis.public void setImageAlignmentY(float alignmentY)
alignmentY - Sets the alignment along the y-axis.public void setPaint(java.awt.Paint painter)
painter - Sets the painter with which the background should be painted.public void addComponent(javax.swing.JComponent component)
component - JComponent to add to the panel.public void addComponent(javax.swing.JComponent component,
java.lang.Object constraints)
component - JComponent to add to the panel.constraints - Constraints with which the panel should be added.public void setTransparentAdd(boolean isTransparentAdd)
isTransparentAdd - Whether to automatically make components transparent.protected void paintComponent(java.awt.Graphics g)
paintComponent in class javax.swing.JComponentg - Received from parent.public java.awt.Dimension getPreferredSize()
getPreferredSize in class javax.swing.JComponent