|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
ikayaki.gui.MagnetometerStatusPanel
public class MagnetometerStatusPanel
Picture of current magnetometer status, with sample holder position and rotation. Status is updated according to MeasurementEvents received by MeasurementControlsPanel. And, manual controls in ManualControlsPanel inner class. Now that I got over myself and painfully merged the two classes.
Nested Class Summary | |
---|---|
private class |
MagnetometerStatusPanel.MagnetometerStatusAnimator
Deprecated. replaced by a simple Timer in constructor |
class |
MagnetometerStatusPanel.ManualControlsPanel
Magnetometer manual controls. |
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
private boolean |
demagnetizing
|
static Color |
DEMAGNETIZING_COLOR
|
static Color |
IDLE_COLOR
|
(package private) MagnetometerStatusPanel.ManualControlsPanel |
manualControlsPanel
ManualControlsPanel whose move-radiobuttons to show. |
private int |
maxposition
|
private int |
maxrotation
|
private boolean |
measuring
|
static Color |
MEASURING_COLOR
|
private TreeMap<Integer,JComponent> |
moveButtons
Sorted map for move-radiobuttons' positions. |
private boolean |
moving
|
static Color |
MOVING_COLOR
|
private int |
posBG
|
private int |
posDemagY
|
private int |
posDemagZ
|
private int |
posHome
|
private int |
position
|
private int |
posLeft
|
private int |
posMeasure
|
private int |
posMove
|
private int |
posRight
|
private boolean |
rotating
|
private int |
rotation
|
private Squid |
squid
Squid to read the device's state and command the handler to move and rotateto. |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
MagnetometerStatusPanel()
Sets magnetometer status to current position. |
Method Summary | |
---|---|
private void |
drawArrow(Graphics2D g2,
int x,
int y,
int length,
int rotation)
Draws the rotation arrow. |
private void |
drawFillOval(Graphics2D g2,
Color fill,
int x,
int y,
int width,
int height)
Draws a filled oval with line. |
private void |
drawFillSideRect(Graphics2D g2,
Color fill,
int x,
int y,
int width,
int height)
Draws a filled rectangle with lines on left and right side. |
void |
measurementUpdated(MeasurementEvent e)
Updates magnetometer status picture; called by MeasurementControlsPanel when it receives MeasurementEvent. |
protected void |
paintComponent(Graphics g)
Paints the magnetometer status picture. |
void |
setSquid(Squid squid)
Sets our Squid to command; called by MainViewPanel. |
private void |
updateButtonPositions()
Updates moveButtons' positions. |
private void |
updatePositions()
Reads handler positions from Settings, posLeft and posRight are hard-coded. |
void |
updateStatus()
Updates magnetometer status picture. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Color DEMAGNETIZING_COLOR
public static final Color MEASURING_COLOR
public static final Color MOVING_COLOR
public static final Color IDLE_COLOR
final MagnetometerStatusPanel.ManualControlsPanel manualControlsPanel
private Squid squid
private int position
private int rotation
private boolean moving
private boolean rotating
private boolean demagnetizing
private boolean measuring
private int maxposition
private int maxrotation
private int posMove
private int posLeft
private int posHome
private int posDemagZ
private int posDemagY
private int posBG
private int posMeasure
private int posRight
private TreeMap<Integer,JComponent> moveButtons
Constructor Detail |
---|
public MagnetometerStatusPanel()
Method Detail |
---|
public void setSquid(Squid squid)
private void updatePositions()
private void updateButtonPositions()
public void updateStatus()
public void measurementUpdated(MeasurementEvent e)
measurementUpdated
in interface MeasurementListener
e
- the event that happened.protected void paintComponent(Graphics g)
paintComponent
in class JComponent
g
- mursu.private void drawFillOval(Graphics2D g2, Color fill, int x, int y, int width, int height)
private void drawFillSideRect(Graphics2D g2, Color fill, int x, int y, int width, int height)
private void drawArrow(Graphics2D g2, int x, int y, int length, int rotation)
g2
- marsu.x
- x-center.y
- y-center.length
- arrow length; arrow pointing lines' length will be length/4.rotation
- rotation angle as 0..maxrotation (meaning 0..360 degrees).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |