# Class JsPanel

java.lang.Object
jspecview.js2d.JsPanel

All Implemented Interfaces:
  `JSVPanel, JSVViewPanel`

public class JsPanel extends Object implements JSVPanel
The JavaScript extension of a JSVPanel.

Author:
  Debbie-Ann Facey, Khari A. Bryan, Craig A.D. Walters, Prof Robert J. Lancashire, Bob Hanson hansonr@stolaf.edu

## Method Summary

Modifier and Type
Method
Description
`void`
`dispose()`
`void`
`doRepaint(boolean andTaintAll)`
`GenericPlatform`
`getApiPlatform()`
`static JsPanel`
`getEmptyPanel(JSViewer viewer)`
Constructs a new JSVPanel
`void`
`getFocusNow(boolean asThread)`
`int`
`getFontFaceID(String name)`
`int`
`getHeight()`
`String`
`getInput(String message, String title, String sval)`
// threading and focus
`PanelData`
`getPanelData()`
`static JsPanel`
`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
`String`
`getTitle()`
`int`
`getWidth()`
`boolean`
`hasFocus()`
`boolean`
`isEnabled()`
`boolean`
`isFocusable()`
`boolean`
`isVisible()`
`void`
`paintComponent(Object context)`
Overrides paintComponent in class JPanel in order to draw the spectrum
`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)`
called only by JavaScript
`void`
`processTwoPointGesture(float[][][] touches)`
`void`
`repaint()`
`String`
`saveImage(String type, GenericFileInterface file, OC out, int width, int height)`
`void`
`setBackgroundColor(GenericColor color)`
`void`
`setColorOrFont(ColorParameters ds, ScriptToken st)`
`void`
`setEnabled(boolean b)`
`void`
`setFocusable(boolean b)`
`void`
`setTitle(String title)`
`void`
`setToolTipText(String s)`
`void`
`showMenu(int x, int y)`
`void`
`showMessage(String msg, String title)`
`String`
`toString()`

### Methods inherited from class Object

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

## 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 JsPanel getEmptyPanel(JSViewer viewer)
Constructs a new JSVPanel

Parameters:
  `viewer` -
Returns:
  this

### getPanelMany

public static JsPanel 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`

### getInput

public String getInput(String message, String title, String sval)
// threading and focus

Specified by:
  `getInput` in interface `JSVPanel`

### showMessage

public void showMessage(String msg, String title)

Specified by:
  `showMessage` in interface `JSVPanel`

### getFocusNow

public void getFocusNow(boolean asThread)

Specified by:
  `getFocusNow` in interface `JSVPanel`

### getFontFaceID

public int getFontFaceID(String name)

Specified by:
  `getFontFaceID` in interface `JSVPanel`

### doRepaint

public void doRepaint(boolean andTaintAll)

Specified by:
  `doRepaint` in interface `JSVPanel`

### paintComponent

public void paintComponent(Object context)
Overrides paintComponent in class JPanel in order to draw the spectrum

Specified by:
  `paintComponent` in interface `JSVPanel`
Parameters:
  `context` - the canvas's context

### 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` -

### saveImage

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

Specified by:
  `saveImage` in interface `JSVPanel`

### hasFocus

public boolean hasFocus()

Specified by:
  `hasFocus` in interface `JSVPanel`

### repaint

public void repaint()

Specified by:
  `repaint` in interface `JSVPanel`

### setToolTipText

public void setToolTipText(String s)

Specified by:
  `setToolTipText` in interface `JSVPanel`

### getHeight

public int getHeight()

Specified by:
  `getHeight` in interface `JSVViewPanel`

### getWidth

public int getWidth()

Specified by:
  `getWidth` in interface `JSVViewPanel`

### isEnabled

public boolean isEnabled()

Specified by:
  `isEnabled` in interface `JSVViewPanel`

### isFocusable

public boolean isFocusable()

Specified by:
  `isFocusable` in interface `JSVViewPanel`

### isVisible

public boolean isVisible()

Specified by:
  `isVisible` in interface `JSVViewPanel`

### setEnabled

public void setEnabled(boolean b)

Specified by:
  `setEnabled` in interface `JSVViewPanel`

### setFocusable

public void setFocusable(boolean b)

Specified by:
  `setFocusable` in interface `JSVViewPanel`

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### processMouseEvent

public boolean processMouseEvent(int id, int x, int y, int modifiers, long time)
called only by JavaScript

Specified by:
  `processMouseEvent` in interface `JSVPanel`
Parameters:
  `id` -
  `x` -
  `y` -
  `modifiers` -
  `time` -
Returns:
  t/f

### processTwoPointGesture

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

Specified by:
  `processTwoPointGesture` in interface `JSVPanel`

### processKeyEvent

public void processKeyEvent(Object event)

Specified by:
  `processKeyEvent` in interface `JSVPanel`

### showMenu

public void showMenu(int x, int y)

Specified by:
  `showMenu` in interface `JSVPanel`