public class Window
extends java.lang.Object
Constructor | Description |
---|---|
Window() |
Default constructor, uses window.title from properties file for title, if
available.
|
Window(java.lang.String title) |
Constructor, creates window and sets window title
|
Modifier and Type | Method | Description |
---|---|---|
void |
addButton(Button b,
WindowSide w) |
Adds a button to the window on the appropriate side.
|
void |
addShape(Shape s) |
Adds shape s to the window.
|
void |
clickButton(WindowSide side,
java.lang.String buttonName) |
simulates clicking the specified Button, for use in testing by students.
|
static java.awt.Color |
getColorProperty(java.lang.String key) |
Given a 'key', return a Color object as value of the property.
|
int |
getGraphPanelHeight() |
gets the graph panel's height
|
int |
getGraphPanelWidth() |
gets the graph panel's width
|
int |
getHeight() |
gets the graph panel's height
|
static java.lang.String |
getProperty(java.lang.String key) |
Given a 'key', return the value of the property stored in the
default.properties file.
|
java.util.Iterator<Shape> |
getShapesIterator() |
Returns an iterator for all the shapes in the window.
|
java.lang.String |
getTitle() |
Getter for the title of the window.
|
int |
getWidth() |
gets the window's width
|
void |
hideInfoPanel() |
Hides the InfoPanel
|
boolean |
isInfoPanelVisible() |
Returns true/false indicating whether the Infolabel is visible or not
|
void |
moveToBack(Shape s) |
Changes the z-order of shapes, moving s behind all other shapes.
|
void |
moveToFront(Shape s) |
Changes the z-order of shapes, moving s to the front of all other shapes.
|
void |
removeAllShapes() |
Removes all shapes from this window.
|
void |
removeButton(Button b,
WindowSide w) |
Removes the button given from the side indicated of this window.
|
void |
removeShape(Shape s) |
Removes Shape s from this Window.
|
void |
repaint() |
Requests a repaint of the whole window.
|
void |
setInfoText(java.lang.String info) |
Sets the info label's text to be the info given.
|
void |
setSize(int windowWidth,
int windowHeight) |
sets the window's size
|
void |
setTitle(java.lang.String title) |
Setter for the window title.
|
void |
showInfoPanel() |
Shows the InfoPanel
|
void |
toggleInfoPanel() |
Toggles the visibility of the InfoPanel
|
public Window()
public Window(java.lang.String title)
title
- String indicating this Window's title.public void clickButton(WindowSide side, java.lang.String buttonName)
side
- the WindowSide in which your button is locatedbuttonName
- the string which you gave your button namepublic void setSize(int windowWidth, int windowHeight)
public int getWidth()
public int getHeight()
public int getGraphPanelWidth()
public int getGraphPanelHeight()
public static java.lang.String getProperty(java.lang.String key)
key
- String indicating the desired propertypublic static java.awt.Color getColorProperty(java.lang.String key)
key
- String indicating the property containing this window's colorpublic void setTitle(java.lang.String title)
title
- the String to use for setting the window's titlepublic java.lang.String getTitle()
public void repaint()
public void addButton(Button b, WindowSide w)
b
- button to addw
- side of windowpublic void removeButton(Button b, WindowSide w)
b
- remove this buttonw
- from this side of the windowpublic void addShape(Shape s)
s
- the Shape to add to this Windowpublic void removeShape(Shape s)
s
- the shape to remove from this Window.public void removeAllShapes()
public void moveToFront(Shape s)
s
- the Shape to move to the frontpublic void moveToBack(Shape s)
s
- the Shape to move to the backpublic java.util.Iterator<Shape> getShapesIterator()
public boolean isInfoPanelVisible()
public void setInfoText(java.lang.String info)
info
- String of informationpublic void showInfoPanel()
public void hideInfoPanel()
public void toggleInfoPanel()