Crossfire JXClient, Trunk  R20561
GUICommandText.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 
27 import java.awt.Color;
28 import java.awt.Font;
29 import java.awt.Image;
30 import org.jetbrains.annotations.NotNull;
31 import org.jetbrains.annotations.Nullable;
32 
37 public class GUICommandText extends GUIText {
38 
42  private static final long serialVersionUID = 1;
43 
47  @NotNull
49 
70  public GUICommandText(@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 CommandExecutor commandExecutor) {
71  super(commandCallback, commandHistory, tooltipManager, elementListener, name, activeImage, inactiveImage, font, inactiveColor, activeColor, margin, text);
72  this.commandExecutor = commandExecutor;
73  }
74 
78  @Override
79  protected void execute(@NotNull final String command) {
80  commandExecutor.executeCommand(command);
81  setText("");
82  }
83 
84 }
final TooltipManager tooltipManager
The TooltipManager to update.
void executeCommand(@NotNull final CharSequence commandLine)
Executes a command or a list of commands.
final GUIElementListener elementListener
The GUIElementListener to notify.
final CommandHistory commandHistory
The CommandHistory for this text field.
Definition: GUIText.java:81
final CommandExecutor commandExecutor
The CommandExecutor for executing entered commands.
final Font font
The font for rendering displayed text.
Definition: GUIText.java:111
static final long serialVersionUID
The serial version UID.
GUICommandText(@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 CommandExecutor commandExecutor)
Creates a new instance.
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
A GUIText element that executes the entered text as a command.
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
Manages a list of previously entered commands.
final int margin
The left margin in pixels.
Definition: GUIText.java:130
void setText(@NotNull final String text)
Sets the entered text.
Definition: GUIText.java:205
final CommandCallback commandCallback
The CommandCallback to use.
Definition: GUIText.java:74
Abstract base class for text input fields.
Definition: GUIText.java:57