-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextBox.java
More file actions
32 lines (30 loc) · 799 Bytes
/
TextBox.java
File metadata and controls
32 lines (30 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* This class represents a canvas for a field in which the user can enter information
*
* @see Fixed
*
* @author Roșca Paul-Teodor
* @version 1.0 (22/12/2020)
*/
public class TextBox extends Fixed
{
/**
* Constructor for our TextBox. It just sets it's image.
*/
public TextBox()
{
setImage("TextBox.png");
}
/**
* Method that chnages the TextBox's image according to it's state (focused/unfocused)
* @param focused flag that tells us if the user is focused on this textbox
*/
public void setFocused(boolean focused)
{
if(focused)
setImage("TextBoxFocused.png");
else
setImage("TextBox.png");
}
}