Package ca.cgjennings.apps.arkham
Class PortraitPanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- ca.cgjennings.apps.arkham.PortraitPanel
-
- All Implemented Interfaces:
FileChangeListener,java.awt.event.ActionListener,java.awt.event.FocusListener,java.awt.event.MouseListener,java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,java.util.EventListener,javax.accessibility.Accessible
public class PortraitPanel extends javax.swing.JPanel implements java.awt.event.ActionListener, java.awt.event.FocusListener, FileChangeListener, java.awt.event.MouseListener
A standard panel for adjusting portraits.- Since:
- 3.0
- Author:
- Chris Jennings
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
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
-
-
Field Summary
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description PortraitPanel()Creates new form PortraitPanel
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent evt)voideditFile(java.io.File file)Invokes the editing application associated with the given file in the operating system and instructs it to load the file.voidfileChanged(java.io.File f, FileChangeMonitor.ChangeType type)This method is called when a change is detected in a file being monitored by aFileChangeMonitor.protected voidfinalize()Deprecated.voidfocusGained(java.awt.event.FocusEvent evt)voidfocusLost(java.awt.event.FocusEvent evt)static java.util.LocalegetPanelLocale()java.lang.StringgetPanelTitle()Returns the title of the panel's border title.PortraitgetPortrait()java.lang.StringgetSource()Returns the current value of the portrait source field.static booleanisEditingSupported()Returnstrueif the invoking an editor application is supported.voidmouseClicked(java.awt.event.MouseEvent evt)voidmouseEntered(java.awt.event.MouseEvent evt)voidmouseExited(java.awt.event.MouseEvent evt)voidmousePressed(java.awt.event.MouseEvent evt)voidmouseReleased(java.awt.event.MouseEvent evt)static voidsetPanelLocale(java.util.Locale aPanelLocale)voidsetPanelTitle(java.lang.String title)Sets the title for this panel.voidsetParentPanel(PortraitPanel parent)Link this panel to another panel.voidsetPortrait(Portrait p)Sets the portrait that this panel will adjust.voidsetSource(java.lang.String newSource)Change the portrait source as if the user had typed a new file name into the field and pressed Enter.voidupdatePanel()Updates the panel with current numeric settings from the portrait.-
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, 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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Method Detail
-
setSource
public void setSource(java.lang.String newSource)
Change the portrait source as if the user had typed a new file name into the field and pressed Enter.- Parameters:
newSource- the new portrait source file
-
getSource
public java.lang.String getSource()
Returns the current value of the portrait source field.- Returns:
- the source text
-
isEditingSupported
public static boolean isEditingSupported()
Returnstrueif the invoking an editor application is supported.- Returns:
trueif editing is supported
-
editFile
public void editFile(java.io.File file)
Invokes the editing application associated with the given file in the operating system and instructs it to load the file.- Parameters:
file- the file to edit
-
getPanelLocale
public static java.util.Locale getPanelLocale()
-
setPanelLocale
public static void setPanelLocale(java.util.Locale aPanelLocale)
-
updatePanel
public void updatePanel()
Updates the panel with current numeric settings from the portrait.
-
setPanelTitle
public void setPanelTitle(java.lang.String title)
Sets the title for this panel. By default, portrait panels have a titled border with a default title ("Portrait Adjustment", or a localized variant thereof). Calling this method changes the title; if the border has been replaced with a different kind of border, a new titled border is installed with the title. Otherwise, the existing border's title is updated.- Parameters:
title- sets the panel title, creating a title border if necessary
-
getPanelTitle
public java.lang.String getPanelTitle()
Returns the title of the panel's border title. If the border is not longer a titled border, returns the default title.- Returns:
- the panel title
- See Also:
setPanelTitle(java.lang.String)
-
setPortrait
public void setPortrait(Portrait p)
Sets the portrait that this panel will adjust.
-
getPortrait
public Portrait getPortrait()
-
setParentPanel
public void setParentPanel(PortraitPanel parent)
Link this panel to another panel. The image to use will be determined by the linked parent panel, so image selection is disabled.- Parameters:
parent- the panel to link to
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent evt)
- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener
-
focusGained
public void focusGained(java.awt.event.FocusEvent evt)
- Specified by:
focusGainedin interfacejava.awt.event.FocusListener
-
focusLost
public void focusLost(java.awt.event.FocusEvent evt)
- Specified by:
focusLostin interfacejava.awt.event.FocusListener
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent evt)
- Specified by:
mouseClickedin interfacejava.awt.event.MouseListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent evt)
- Specified by:
mouseEnteredin interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent evt)
- Specified by:
mouseExitedin interfacejava.awt.event.MouseListener
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent evt)
- Specified by:
mousePressedin interfacejava.awt.event.MouseListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent evt)
- Specified by:
mouseReleasedin interfacejava.awt.event.MouseListener
-
fileChanged
public void fileChanged(java.io.File f, FileChangeMonitor.ChangeType type)Description copied from interface:FileChangeListenerThis method is called when a change is detected in a file being monitored by aFileChangeMonitor. Note that this method will typically be called from a different thread than the one that requested notification.- Specified by:
fileChangedin interfaceFileChangeListener- Parameters:
f- the file that has changed
-
finalize
@Deprecated protected void finalize() throws java.lang.ThrowableDeprecated.- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
-