Skip to content

Commit 9aecefe

Browse files
committed
added documentation to ProgramWindow
1 parent a1537a0 commit 9aecefe

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

src/main/java/org/teachingextensions/WindowUtils/ProgramWindow.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ public ProgramWindow(String title)
3838
getFrame().getContentPane().add(this);
3939
ProgramWindow.createStandardFrame(getFrame());
4040
}
41+
/**
42+
* Adds a button instance to a window
43+
* <p><b>Example:</b> {@code programWindow.addButton(myButton)}</p>
44+
*
45+
* @param button
46+
* A button instance
47+
*/
4148
public void addButton(JButton button)
4249
{
4350
this.add(button);
@@ -76,14 +83,35 @@ public void removePaintable()
7683
additional.clear();
7784
repaint();
7885
}
86+
/**
87+
* Adds a right mouse click listener instance to a window
88+
* <p><b>Example:</b> {@code programWindow.addMouseRightClickListener(myRightClickListener)}</p>
89+
*
90+
* @param listener
91+
* A listener instance
92+
*/
7993
public void addMouseRightClickListener(MouseRightClickListener listener)
8094
{
8195
addMouseListener(new RightClickMouseAdapter(listener));
8296
}
97+
/**
98+
* Adds a left mouse click listener instance to a window
99+
* <p><b>Example:</b> {@code programWindow.addMouseLeftClickListener(myLeftClickListener)}</p>
100+
*
101+
* @param listener
102+
* A listener instance
103+
*/
83104
public void addMouseLeftClickListener(MouseLeftClickListener listener)
84105
{
85106
addMouseListener(new LeftClickMouseAdapter(listener));
86107
}
108+
/**
109+
* Adds a background image to a window
110+
* <p><b>Example:</b> {@code programWindow.setBackgroundImage("http://www.coolpicture.com/sunshine.jpg")}</p>
111+
*
112+
* @param URL
113+
* A URL path to an image
114+
*/
87115
public void setBackgroundImage(String url)
88116
{
89117
addPaintable(new ImageBackground(url));

src/main/java/org/teachingextensions/logo/Tortoise.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public static void setPenWidth(Number width)
9797
* Gives you access to the window the
9898
* Tortoise is moving on so you can do things like change it's color. <br>
9999
* <b>Example:</b> {@code TurtlePanel panel = Tortoise.getBackgroundWindow()}
100-
* @return the window that the Tortoise is moving on
100+
* @return the (program) window that the Tortoise is moving on
101101
*/
102102
public static TurtlePanel getBackgroundWindow()
103103
{

0 commit comments

Comments
 (0)