20 package net.sf.gridarta.gui.utils;
22 import java.awt.Component;
23 import java.awt.GridBagConstraints;
24 import java.awt.GridBagLayout;
25 import java.awt.Insets;
26 import java.awt.event.FocusEvent;
27 import java.awt.event.FocusListener;
28 import javax.swing.AbstractButton;
29 import javax.swing.ImageIcon;
30 import javax.swing.JButton;
31 import javax.swing.JPanel;
32 import javax.swing.JTextField;
35 import org.jetbrains.annotations.NotNull;
52 private final JTextField
textField =
new JTextField();
70 super(
new GridBagLayout());
72 textField.setText(animationName);
73 textField.setColumns(8);
74 final AbstractButton label =
new JButton();
75 label.setMargin(
new Insets(0, 0, 0, 0));
76 animTreeChooseAction =
new AnimTreeChooseAction(
"...", textField, label, animationObjects, faceObjectProviders, noFaceSquareIcon, unknownSquareIcon);
77 label.addActionListener(animTreeChooseAction);
78 final AbstractButton button =
new JButton(animTreeChooseAction);
79 button.setMargin(
new Insets(0, 1, 0, 1));
80 textField.addFocusListener(
new FocusListener() {
83 public void focusGained(
final FocusEvent e) {
88 public void focusLost(
final FocusEvent e) {
93 final GridBagConstraints gbc =
new GridBagConstraints();
94 gbc.anchor = GridBagConstraints.CENTER;
95 gbc.gridx = GridBagConstraints.RELATIVE;
98 gbc.fill = GridBagConstraints.NONE;
102 gbc.fill = GridBagConstraints.HORIZONTAL;
106 gbc.fill = GridBagConstraints.NONE;
117 return textField.getText();
125 textField.setText(animName);
131 super.setEnabled(enabled);
132 textField.setEnabled(enabled);
void setAnimName(@NotNull final String animName)
Sets the current animation name.
Component getInputComponent()
Returns the input field component.
A JPanel that allows the user to select an animation name.
Gridarta can handle frame information of animations and allow the selection of an animation using a t...
String getAnimName()
Returns the current animation name.
final void updateIconLabel()
Updates the icon of icon to reflect the current animation name.
AnimationComponent(@NotNull final String animationName, @NotNull final AnimationObjects animationObjects, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final ImageIcon noFaceSquareIcon, @NotNull final ImageIcon unknownSquareIcon)
Creates a new instance.
Base package of all Gridarta classes.
void setEnabled(final boolean newValue)
AnimationObjects is a container for AnimationObjects.
final JTextField textField
The JTextField that displays the animation name.
A TreeChooseAction that updates an animation label.
void setEnabled(final boolean enabled)
Provider for faces of GameObjects and Archetypes.
The face is the appearance of an object.
final AnimTreeChooseAction animTreeChooseAction
The associated AnimTreeChooseAction.
static final long serialVersionUID
The serial version UID.