public abstract class DisplayPanel
extends java.lang.Object
The programmer must always implement the function containerNotification in order to clear the display panel ahead of where the spectrogram is currently drawing.
There are two principle ways of drawing new data on the panel:
DisplayPanelContainer
,
DisplayPanelProvider
,
DisplayProviderList
Constructor and Description |
---|
DisplayPanel(DisplayPanelProvider displayPanelProvider,
DisplayPanelContainer displayPanelContainer)
Standard Display panel constructor
|
Modifier and Type | Method and Description |
---|---|
void |
clearImage()
Clear the entire image
|
void |
clearImage(int x1,
int x2)
Clear part of the image between x1 and x2
|
void |
clearImage(int x1,
int x2,
boolean drawLine)
Clear part of the image and draw a line just to the
right of the cleared section
|
abstract void |
containerNotification(DisplayPanelContainer displayContainer,
int noteType)
Called by the DisplayPanelContainer whenever the scales
change - e.g.
|
abstract void |
destroyPanel()
The displayPanelContainer should call destroyPanel
when the panel is no longer required so that the
displayPanel can unsubscribe to any data it was
observing.
|
java.awt.image.BufferedImage |
getDisplayImage() |
DisplayPanelContainer |
getDisplayPanelContainer() |
DisplayPanelProvider |
getDisplayPanelProvider() |
PamAxis |
getEastAxis() |
int |
getInnerHeight() |
javax.swing.JPanel |
getInnerPanel() |
int |
getInnerWidth() |
PamAxis |
getNorthAxis() |
javax.swing.JPanel |
getPanel()
Each display panel must be able to provide a JPanel for incoropation
into the display.
|
java.awt.Insets |
getPanelBorder() |
PamAxis |
getSouthAxis() |
PamAxis |
getWestAxis() |
void |
repaint()
repaints the display - needs to be called after any
changes to the image
|
void |
repaint(int t)
repaints the display - needs to be called after any
changes to the image
|
void |
setPanelBorder(java.awt.Insets panelInsets) |
void |
spectrogramMousePosition(int chan,
java.awt.Point point,
long mouseTime,
double mouseFreq)
Called when the mouse is clicked or dragged on a spectrogram display during viewer operation.
|
public DisplayPanel(DisplayPanelProvider displayPanelProvider, DisplayPanelContainer displayPanelContainer)
Creates two J Panels, one nested inside the other with a small border. The inner panel also has a BufferedImage drawn in it which can be used for any graphics.
displayPanelProvider
- displayPanelContainer
- public void clearImage()
public void clearImage(int x1, int x2)
x1
- x2
- public void clearImage(int x1, int x2, boolean drawLine)
x1
- x position of start of clearx2
- x position of end of cleardrawLine
- draw a vertical line to show cleared regionpublic int getInnerWidth()
public int getInnerHeight()
public java.awt.image.BufferedImage getDisplayImage()
public java.awt.Insets getPanelBorder()
public void setPanelBorder(java.awt.Insets panelInsets)
public final javax.swing.JPanel getPanel()
public javax.swing.JPanel getInnerPanel()
public void repaint()
public void repaint(int t)
t
- time delaypublic abstract void destroyPanel()
public abstract void containerNotification(DisplayPanelContainer displayContainer, int noteType)
The display panel can use this information in two ways:
Firstly, it should clear the region of the display just ahead of the current spectrogram x coordinate. Secondly, it may draw additional data on the display.
displayContainer
- noteType
- public PamAxis getNorthAxis()
public PamAxis getSouthAxis()
public PamAxis getEastAxis()
public PamAxis getWestAxis()
public DisplayPanelContainer getDisplayPanelContainer()
public DisplayPanelProvider getDisplayPanelProvider()
public void spectrogramMousePosition(int chan, java.awt.Point point, long mouseTime, double mouseFreq)
chan
- channel for that panelpoint
- point on the screen (from the mouse adapter)mouseTime
- time of the mouse position in millisecondsmouseFreq
- frequency of the mouse position in Hz.