|
Jedit 4.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JPanel | +--edu.bsu.cs.gui.JeditPanel
Renders a JavaGraph and allows the user to manipulate it with mouse events.
JPanel
,
MouseListener
,
MouseMotionListener
,
AdjustmentListener
,
ActionListener
,
Serialized FormNested Class Summary |
Nested classes inherited from class javax.swing.JPanel |
JPanel.AccessibleJPanel |
Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
static int |
ADDARC
A flag used with setMouseAction to indicate that mouse drags add Arcs to the panel's JavaGraph. |
static int |
ADDEDGE
A flag used with setMouseAction to indicate that mouse drags add Edges to the panel's JavaGraph. |
static int |
ADDVERTEX
A flag used with setMouseAction to indicate that mouse presses add Vertices to the panel's JavaGraph. |
static int |
AUTOMATICALGORITHM
A flag used with edu.bsu.cs.algorithm.setType and edu.bsu.cs.algorithm.getType to to indicate that the algorithm determined by getAlgorithm will start automatically. |
static int |
MOVETHINGS
A flag used with setMouseAction to indicate that mouse drags move Vertices, Edges, and Arcs in the panel's JavaGraph. |
static int |
NOTHING
A flag used with setMouseAction to indicate that mouse actions are ignored. |
static int |
ONECLICKALGORITHM
A flag used with setMouseAction and edu.bsu.cs.algorithm.setType and edu.bsu.cs.algorithm.getType to indicate that the next mouse click will launch the algorithm determined by getAlgorithm. |
static int |
TEXTINPUTALGORITHM
A flag used with edu.bsu.cs.algorithm.setType and edu.bsu.cs.algorithm.getType to to indicate that the algorithm determined by getAlgorithm requires text input. |
static int |
TWOCLICKALGORITHM
A flag used with setMouseAction and edu.bsu.cs.algorithm.setType and edu.bsu.cs.algorithm.getType to indicate that the next two mouse clicks will launch the algorithm determined by getAlgorithm. |
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 | |
JeditPanel(JeditFrame f)
Creates a new JavaGraph for the new JeditPanel. |
|
JeditPanel(JeditFrame f,
JeditPanel first)
This cloning constructor makes the new JeditPanel an exact copy of the JeditPanel first. |
Method Summary | |
void |
actionPerformed(ActionEvent e)
This method is used to act on the user's selections in the popup menus. |
void |
adjustmentValueChanged(AdjustmentEvent e)
This method is used when Scrollbars are moved. |
void |
autoLabelAllEdges()
This method sets the labels of all Edges/Arcs to reflect their endpoint Vertices. |
void |
backup()
Store a copy of the current JavaGraph as a backup. |
void |
doTextualAlgorithm(String inputText)
This method is used to run an algorithm that requires text input. |
void |
drawBackgroundGrid(Graphics g,
double unitX,
double unitY,
int maxX,
int maxY,
Color thecolor)
Draws the Background grid. |
Algorithm |
getAlgorithm()
Gets the Algorithm that will be run on the Panel. |
Color |
getBackgroundColor()
Get the Panel's background color. |
boolean |
getDelay()
Gets the flag that determines whether or not algorithms should be animated when run on the Panel. |
boolean |
getEdgeAutoLabel()
Get the flag that tells whether or not to label new Edges/Arcs with their Endpoint Vertices' labels (starting at zero) |
Color |
getEdgeColor()
Get the default Color for new Edges/Arcs |
String |
getEdgeLabel()
Get the default label for new Edes/Arcs that are not labeld with their endpoint vertices |
double |
getEdgeWeight()
Get the default weight for new Edges/Arcs |
double |
getEdgeWeight2()
Get the default second weight for new Edges/Arcs |
boolean |
getEnable()
Used to get the panel's state for accepting mouse input (true) or ignoring it (false). |
JeditFrame |
getFrame()
|
JavaGraph |
getGraph()
Retrieve the JavaGraph for this panel. |
String |
getInputTextString()
Gets the String that will appear by default in the window prompting a user for input to start an algorithm that requires text input. |
Color |
getLabelColor()
Get the Color of Edge/Arc labels and weights, Vertex weights, and the status string. |
int |
getMouseAction()
This method is used to determine the meaning of mouse actions on the canvas. |
Point |
getOffSet()
Return the coordinates for the upper left corner of the visible panel. |
boolean |
getShowEdgeLabel()
Get the flag determining whether or not to render Edge/Arc labels |
boolean |
getShowEdgeWeight()
Get the flag that determines whether or not to show Edge/Arc weights |
boolean |
getShowVertexLabel()
Get the flag determining whether or not to render Vertex labels |
boolean |
getShowVertexWeight()
Get the flag that determines whether or not to show Vertex weights |
boolean |
getVertexAutoLabel()
Get the flag that tells whether or not to label new Vertices with their number in the graph (starting at zero) |
Color |
getVertexColor()
Gets the default color for new Vertices |
String |
getVertexLabel()
Get the default label for new Vertices that are not automatically labeled with numbers |
int |
getVertexRadius()
Get the default radius for all Vertices. |
double |
getVertexWeight()
Get the default weight for new Vertices. |
void |
mouseClicked(MouseEvent e)
|
void |
mouseDragged(MouseEvent e)
This method is used for adding Edges/Arcs and moving objects around the panel. |
void |
mouseEntered(MouseEvent e)
Not implemented. |
void |
mouseExited(MouseEvent e)
Not implemented. |
void |
mouseMoved(MouseEvent e)
Not implemented. |
void |
mousePressed(MouseEvent e)
This method is used to add Vertices and start algorithms. |
void |
mouseReleased(MouseEvent e)
|
void |
paint(Graphics g)
Responsible for all of the JavaGraph rendering. |
void |
restoreBackup()
Change the panel's JavaGraph to the backed up version. |
void |
setAlgorithm(Algorithm newAlgorithm)
Sets the Algorithm that will be run on the Panel. |
void |
setBackgroundColor(Color newColor)
Set the Panel's background color. |
void |
setDelay(boolean newValue)
Sets the flag that determines whether or not algorithms should be animated when run on the Panel. |
void |
setEdgeAutoLabel(boolean toDo)
Set the flag that tells whether or not to label new Edges/Arcs with their Endpoint Vertices' labels (starting at zero) |
void |
setEdgeColor(Color newColor)
Set the default Color for new Edges/Arcs |
void |
setEdgeLabel(String newLabel)
Set the default label for new Edes/Arcs that are not labeld with their endpoint vertices |
void |
setEdgeWeight(double newValue)
Set the default weight for new Edges/Arcs |
void |
setEdgeWeight2(double newValue)
Set the default second weight for new Edges/Arcs |
void |
setEnable(boolean newvalue)
Used to set the panel in a state to accept mouse input (true) or ignore it (false). |
void |
setGraph(JavaGraph newGraph)
Set the JavaGraph for this panel. |
void |
setGridColor(Color newColor)
Sets the gridColor. |
void |
setGridUnitXY(double ux,
double uy)
Sets the gridUnitX and gridUnitY. |
void |
setGridX0Y0(int x,
int y)
Sets gridX0 and gridY0. |
void |
setInputTextString(String input)
Sets the String that will appear by default in the window prompting a user for input to start an algorithm that requires text input. |
void |
setLabelColor(Color newColor)
Set the Color of Edge/Arc labels and weights, Vertex weights, and the status string. |
void |
setMouseAction(int newAction)
This method is used to set the meaning of mouse actions on the canvas. |
void |
setOffSet(Point newPoint)
Set the coordinates for the upper left corner of the visible panel. |
void |
setShowEdgeLabel(boolean in)
Set the flag determining whether or not to render Edge/Arc labels |
void |
setShowEdgeWeight(boolean in)
Set the flag that determines whether or not to show Edge/Arc weights |
void |
setShowVertexLabel(boolean in)
Set the flag determining whether or not to render Vertex labels |
void |
setShowVertexWeight(boolean in)
Set the flag that determines whether or not to show Vertex weights |
void |
setStatus(String newStatus)
Set the text for the status written in the lower left corner of the panel. |
void |
setVertexAutoLabel(boolean toDo)
Set the flag that tells whether or not to label new Vertices with their number in the graph (starting at zero) |
void |
setVertexColor(Color newColor)
Set the default label for new Vertices that are not automatically labeled with numbers |
void |
setVertexLabel(String newString)
Sets the default color for new Vertices |
void |
setVertexRadius(int newRadius)
Set the default radius for all Vertices |
void |
setVertexWeight(double newWeight)
Set the default weight for new Vertices. |
void |
update(Graphics g)
Overridden for double-buffering. |
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 int ADDVERTEX
public static final int ADDEDGE
public static final int ADDARC
public static final int MOVETHINGS
public static final int NOTHING
public static final int ONECLICKALGORITHM
public static final int TEXTINPUTALGORITHM
public static final int TWOCLICKALGORITHM
public static final int AUTOMATICALGORITHM
Constructor Detail |
public JeditPanel(JeditFrame f)
public JeditPanel(JeditFrame f, JeditPanel first)
Method Detail |
public JeditFrame getFrame()
public void update(Graphics g)
update
in class JComponent
g
- The graphics to update.public void paint(Graphics g)
paint
in class JComponent
g
- The graphics to paint.public void setGridColor(Color newColor)
newColor
- The color to set the grid.public void setGridUnitXY(double ux, double uy)
ux
- Becomes the value of gridUnitX.uy
- Becomes the value of gridUnitY.public void setGridX0Y0(int x, int y)
x
- Becomes the value of gridX0.y
- Becomes the value of gridY0.public void drawBackgroundGrid(Graphics g, double unitX, double unitY, int maxX, int maxY, Color thecolor)
g
- The graphics.unitX
- unitY
- maxX
- maxY
- thecolor
- public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void adjustmentValueChanged(AdjustmentEvent e)
adjustmentValueChanged
in interface AdjustmentListener
public void setMouseAction(int newAction)
public int getMouseAction()
public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
public JavaGraph getGraph()
public void setGraph(JavaGraph newGraph)
public void setStatus(String newStatus)
public boolean getEnable()
public void setEnable(boolean newvalue)
public void backup()
public void restoreBackup()
public double getVertexWeight()
public void setVertexWeight(double newWeight)
public int getVertexRadius()
public void setVertexRadius(int newRadius)
public boolean getVertexAutoLabel()
public void setVertexAutoLabel(boolean toDo)
public boolean getEdgeAutoLabel()
public void setEdgeAutoLabel(boolean toDo)
public Color getVertexColor()
public void setVertexLabel(String newString)
public String getVertexLabel()
public void setVertexColor(Color newColor)
public double getEdgeWeight()
public void setEdgeWeight(double newValue)
public double getEdgeWeight2()
public void setEdgeWeight2(double newValue)
public String getEdgeLabel()
public void setEdgeLabel(String newLabel)
public void setEdgeColor(Color newColor)
public Color getEdgeColor()
public Color getBackgroundColor()
public void setBackgroundColor(Color newColor)
public Color getLabelColor()
public void setLabelColor(Color newColor)
public void setShowVertexLabel(boolean in)
public void setShowEdgeLabel(boolean in)
public boolean getShowVertexLabel()
public boolean getShowEdgeLabel()
public boolean getShowEdgeWeight()
public boolean getShowVertexWeight()
public void setShowEdgeWeight(boolean in)
public void setShowVertexWeight(boolean in)
public void setAlgorithm(Algorithm newAlgorithm)
public Algorithm getAlgorithm()
public boolean getDelay()
public void setDelay(boolean newValue)
public void doTextualAlgorithm(String inputText)
public void setInputTextString(String input)
public String getInputTextString()
public Point getOffSet()
public void setOffSet(Point newPoint)
public void autoLabelAllEdges()
|
Jedit 4.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |