# Class AwtPanel

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
jspecview.java.AwtPanel

All Implemented Interfaces:
  `ImageObserver, MenuContainer, Printable, Serializable, Accessible, JSVPanel, JSVViewPanel`

public class AwtPanel extends JPanel implements JSVPanel, Printable
JSVPanel class represents a View combining one or more GraphSets, each with one or more JDXSpectra.

Author:
  Debbie-Ann Faceyf, Khari A. Bryan, Craig A.D. Walters, Prof Robert J. Lancashire, Bob Hanson hansonr@stolaf.edu
See Also:
  - Serialized Form

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`class`
`AwtPanel.RequestThread`

### Nested classes/interfaces inherited from class JPanel

`JPanel.AccessibleJPanel`

### Nested classes/interfaces inherited from class JComponent

`JComponent.AccessibleJComponent`

### Nested classes/interfaces inherited from class Container

`Container.AccessibleAWTContainer`

### Nested classes/interfaces inherited from class Component

`Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy`

## Field Summary

### Fields inherited from class JComponent

`listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

### Fields inherited from class Component

`accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

### Fields inherited from interface ImageObserver

`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

### Fields inherited from interface Printable

`NO_SUCH_PAGE, PAGE_EXISTS`

## Method Summary

Modifier and Type
Method
Description
`void`
`dispose()`
`void`
`doRepaint(boolean andTaintAll)`
`GenericPlatform`
`getApiPlatform()`
`GenericColor`
`getBackgroundColor()`
`static AwtPanel`
`getEmptyPanel(JSViewer viewer)`
Constructs a new JSVPanel
`void`
`getFocusNow(boolean asThread)`
// threading and focus
`int`
`getFontFaceID(String name)`
`String`
`getInput(String message, String title, String sval)`
`PanelData`
`getPanelData()`
`static AwtPanel`
`getPanelMany(JSViewer viewer, Lst<Spectrum> spectra)`
Constructs a `JSVPanel` with List of spectra and corresponding start and end indices of data points that should be displayed
`static AwtPanel`
`getPanelOne(JSViewer viewer, Spectrum spectrum)`
Constructs a new JSVPanel
`String`
`getTitle()`
`void`
`paintComponent(Graphics g)`
Overrides paintComponent in class JPanel in order to draw the spectrum
`void`
`paintComponent(Object display)`
`int`
`print(Graphics g, PageFormat pf, int pi)`
Implements method print in interface printable
`void`
`printPanel(PrintLayout pl, OutputStream os, String title)`
Send a print job of the spectrum to the default printer on the system
`void`
`processKeyEvent(Object event)`
`boolean`
`processMouseEvent(int id, int x, int y, int modifiers, long time)`
`void`
`processTwoPointGesture(float[][][] touches)`
`String`
`saveImage(String type, GenericFileInterface file, OC out, int width, int height)`
`void`
`setBackgroundColor(GenericColor color)`
`void`
`setColorOrFont(ColorParameters ds, ScriptToken st)`
`void`
`setTitle(String title)`
`void`
`showMenu(int x, int y)`
`void`
`showMessage(String msg, String title)`
`String`
`toString()`
////////
`void`
`update(Graphics g)`

### Methods inherited from class JPanel

`getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI`

### Methods inherited from class 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, 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`

### Methods inherited from class 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 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, transferFocus, transferFocusBackward, transferFocusUpCycle`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface JSVPanel

`hasFocus, repaint, setToolTipText`

### Methods inherited from interface JSVViewPanel

`getHeight, getWidth, isEnabled, isFocusable, isVisible, setEnabled, setFocusable`

## Method Details

### getApiPlatform

public GenericPlatform getApiPlatform()

Specified by:
  `getApiPlatform` in interface `JSVPanel`

### getPanelData

public PanelData getPanelData()

Specified by:
  `getPanelData` in interface `JSVPanel`

### getEmptyPanel

public static AwtPanel getEmptyPanel(JSViewer viewer)
Constructs a new JSVPanel

Parameters:
  `viewer` -
Returns:
  this

### getPanelOne

public static AwtPanel getPanelOne(JSViewer viewer, Spectrum spectrum)
Constructs a new JSVPanel

Parameters:
  `viewer` -
  `spectrum` - the spectrum
Returns:
  this

### getPanelMany

public static AwtPanel getPanelMany(JSViewer viewer, Lst<Spectrum> spectra)
Constructs a `JSVPanel` with List of spectra and corresponding start and end indices of data points that should be displayed

Parameters:
  `viewer` -
  `spectra` - the List of `Graph` instances
Returns:
  this

### getTitle

public String getTitle()

Specified by:
  `getTitle` in interface `JSVViewPanel`

### dispose

public void dispose()

Specified by:
  `dispose` in interface `JSVViewPanel`

### setTitle

public void setTitle(String title)

Specified by:
  `setTitle` in interface `JSVViewPanel`

### setColorOrFont

public void setColorOrFont(ColorParameters ds, ScriptToken st)

### setBackgroundColor

public void setBackgroundColor(GenericColor color)

Specified by:
  `setBackgroundColor` in interface `JSVPanel`

### getBackgroundColor

public GenericColor getBackgroundColor()

### doRepaint

public void doRepaint(boolean andTaintAll)

Specified by:
  `doRepaint` in interface `JSVPanel`

### update

public void update(Graphics g)

Overrides:
  `update` in class `JComponent`

### paintComponent

public void paintComponent(Object display)

Specified by:
  `paintComponent` in interface `JSVPanel`

### paintComponent

public void paintComponent(Graphics g)
Overrides paintComponent in class JPanel in order to draw the spectrum

Overrides:
  `paintComponent` in class `JComponent`
Parameters:
  `g` - the `Graphics` object

### getInput

public String getInput(String message, String title, String sval)

Specified by:
  `getInput` in interface `JSVPanel`

### showMessage

public void showMessage(String msg, String title)

Specified by:
  `showMessage` in interface `JSVPanel`

### printPanel

public void printPanel(PrintLayout pl, OutputStream os, String title)
Send a print job of the spectrum to the default printer on the system

Specified by:
  `printPanel` in interface `JSVPanel`
Parameters:
  `pl` - the layout of the print job
  `os` -
  `title` -

### print

public int print(Graphics g, PageFormat pf, int pi) throws PrinterException
Implements method print in interface printable

Specified by:
  `print` in interface `Printable`
Parameters:
  `g` - the `Graphics` object
  `pf` - the `PageFormat` object
  `pi` - the page index -- -1 for PDF creation
Returns:
  an int that depends on whether a print was successful
Throws:
  `PrinterException`

### getFontFaceID

public int getFontFaceID(String name)

Specified by:
  `getFontFaceID` in interface `JSVPanel`

### saveImage

public String saveImage(String type, GenericFileInterface file, OC out, int width, int height)

Specified by:
  `saveImage` in interface `JSVPanel`

### getFocusNow

public void getFocusNow(boolean asThread)
// threading and focus

Specified by:
  `getFocusNow` in interface `JSVPanel`

### toString

public String toString()
////////

Overrides:
  `toString` in class `Component`

### processMouseEvent

public boolean processMouseEvent(int id, int x, int y, int modifiers, long time)

Specified by:
  `processMouseEvent` in interface `JSVPanel`

### processKeyEvent

public void processKeyEvent(Object event)

Specified by:
  `processKeyEvent` in interface `JSVPanel`

### processTwoPointGesture

public void processTwoPointGesture(float[][][] touches)

Specified by:
  `processTwoPointGesture` in interface `JSVPanel`

### showMenu

public void showMenu(int x, int y)

Specified by:
  `showMenu` in interface `JSVPanel`