|
|||||||||
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
uk.ac.ed.ph.signal.Diagram2DPanel
public class Diagram2DPanel
Class to implement a DiagramPanel, being an extended JPanel with internal Mouse control allowing for interactive zooming.
Nested Class Summary |
---|
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.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected Rectangle2D |
bounds
|
Diagram2D |
diagram
|
protected boolean |
drag
|
protected Point |
endDrag
|
protected Point |
startDrag
|
protected AffineTransform |
transform
|
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 | |
---|---|
Diagram2DPanel()
Default constructor to DiagramPanel containg a blank Diagram. |
|
Diagram2DPanel(Diagram2D diagram)
Default constructor to DiagramPanel containg the spefied Daigram default white background. |
Method Summary | |
---|---|
void |
add(Diagram2DComponent obj)
Method to add Component to the Diagram |
void |
clear()
Method to clear the DiagramPanel |
Diagram2D |
getDiagram2D()
Method to get the Diagram object |
BufferedImage |
getImage(int w,
int h)
Method to get to Diagram as a coloured BuffererImage |
void |
mouseClicked(MouseEvent e)
|
void |
mouseDragged(MouseEvent e)
|
void |
mouseEntered(MouseEvent e)
|
void |
mouseExited(MouseEvent e)
|
void |
mouseMoved(MouseEvent e)
|
void |
mousePressed(MouseEvent e)
|
void |
mouseReleased(MouseEvent e)
|
void |
paintComponent(Graphics g)
Overload method to repaint the JPanel |
void |
resetBounds()
Internal method to reset the bounds to |
void |
setFontSize(double h)
Method to set the fontsize (defaults to 18pt) |
void |
setPenWidth(double w)
Method to set the default penwidth (defaults to 1.0) |
boolean |
writeImage(int w,
int h,
File output)
Method to write the the Diagram to a filea as a image with type specified by filename suffix |
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 Diagram2D diagram
protected Rectangle2D bounds
protected AffineTransform transform
protected Point startDrag
protected Point endDrag
protected boolean drag
Constructor Detail |
---|
public Diagram2DPanel(Diagram2D diagram)
public Diagram2DPanel()
Method Detail |
---|
public void add(Diagram2DComponent obj)
obj
- the DiagramObjectpublic Diagram2D getDiagram2D()
Diagram
the panel Diagrampublic void clear()
public void setPenWidth(double w)
w
- the penwidthpublic void setFontSize(double h)
h
- the fontsizepublic void resetBounds()
public boolean writeImage(int w, int h, File output)
w
- image widthh
- image heightoutput
- the File to be written to
boolean
true if successful, false for failure.public BufferedImage getImage(int w, int h)
w
- image widthh
- image height
BufferedImage
image of the panelpublic void paintComponent(Graphics g)
paintComponent
in class JComponent
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |