Crossfire JXClient, Trunk  R20561
GUITextField.java
Go to the documentation of this file.
1 /*
2  * This file is part of JXClient, the Fullscreen Java Crossfire Client.
3  *
4  * JXClient is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * JXClient is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with JXClient; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * Copyright (C) 2005-2008 Yann Chachkoff.
19  * Copyright (C) 2006-2011 Andreas Kirschbaum.
20  */
21 
22 package com.realtime.crossfire.jxclient.gui.textinput;
23 
28 import java.awt.Color;
29 import java.awt.Font;
30 import java.awt.Image;
31 import org.jetbrains.annotations.NotNull;
32 import org.jetbrains.annotations.Nullable;
33 
39 public class GUITextField extends GUIText {
40 
44  private static final long serialVersionUID = 1;
45 
49  @NotNull
50  private final CommandList commandList;
51 
71  public GUITextField(@NotNull final CommandCallback commandCallback, @Nullable final CommandHistory commandHistory, @NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, @NotNull final Image activeImage, @NotNull final Image inactiveImage, @NotNull final Font font, @NotNull final Color inactiveColor, @NotNull final Color activeColor, final int margin, @NotNull final String text, @NotNull final CommandList commandList) {
72  super(commandCallback, commandHistory, tooltipManager, elementListener, name, activeImage, inactiveImage, font, inactiveColor, activeColor, margin, text);
73  this.commandList = commandList;
74  }
75 
79  @Override
80  protected void execute(@NotNull final String command) {
81  commandList.execute();
82  }
83 
84 }
GUITextField(@NotNull final CommandCallback commandCallback, @Nullable final CommandHistory commandHistory, @NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, @NotNull final Image activeImage, @NotNull final Image inactiveImage, @NotNull final Font font, @NotNull final Color inactiveColor, @NotNull final Color activeColor, final int margin, @NotNull final String text, @NotNull final CommandList commandList)
Creates a new instance.
final TooltipManager tooltipManager
The TooltipManager to update.
final GUIElementListener elementListener
The GUIElementListener to notify.
final CommandHistory commandHistory
The CommandHistory for this text field.
Definition: GUIText.java:81
final Font font
The font for rendering displayed text.
Definition: GUIText.java:111
static final long serialVersionUID
The serial version UID.
final CommandList commandList
The CommandList for executing commands.
final StringBuilder text
The entered text.
Definition: GUIText.java:136
final Color activeColor
The color for rendering displayed text when the element is active.
Definition: GUIText.java:125
final Color inactiveColor
The color for rendering displayed text when the element is inactive.
Definition: GUIText.java:118
Interface that defines callback functions needed by commands.
final Image activeImage
The element's background image when it is active.
Definition: GUIText.java:87
final Image inactiveImage
The element's background image when it is inactive.
Definition: GUIText.java:93
A text input field which executes a CommandList when ENTER is pressed.
Manages a list of previously entered commands.
final int margin
The left margin in pixels.
Definition: GUIText.java:130
final CommandCallback commandCallback
The CommandCallback to use.
Definition: GUIText.java:74
void execute()
Execute the command list by calling GUICommand#execute() for each command in order.
Abstract base class for text input fields.
Definition: GUIText.java:57