 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.mainactions;
22 import java.awt.Component;
23 import java.awt.Dialog.ModalityType;
24 import java.awt.event.WindowEvent;
25 import java.awt.event.WindowListener;
26 import java.util.StringTokenizer;
27 import javax.swing.Box;
28 import javax.swing.BoxLayout;
29 import javax.swing.JButton;
30 import javax.swing.JDialog;
31 import javax.swing.JOptionPane;
32 import javax.swing.JPanel;
33 import javax.swing.JTextField;
34 import javax.swing.event.DocumentEvent;
35 import javax.swing.event.DocumentListener;
36 import javax.swing.text.JTextComponent;
41 import net.
sf.japi.swing.action.ActionBuilder;
42 import net.
sf.japi.swing.action.ActionBuilderFactory;
43 import net.
sf.japi.swing.action.ActionMethod;
44 import net.
sf.japi.swing.action.ToggleAction;
45 import org.jetbrains.annotations.NotNull;
46 import org.jetbrains.annotations.Nullable;
59 private static final ActionBuilder
ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder(
"net.sf.gridarta");
65 private final JOptionPane
optionPane =
new JOptionPane();
108 final JPanel panel =
new JPanel();
109 panel.setLayout(
new BoxLayout(panel, BoxLayout.Y_AXIS));
115 panel.add(Box.createVerticalStrut(5));
116 final ToggleAction isAbsoluteAction = (ToggleAction)
ACTION_BUILDER.createToggle(
false,
"tileStretchingAbsolute",
this);
117 panel.add(isAbsoluteAction.createCheckBox());
124 final DocumentListener documentListener =
new DocumentListener() {
127 public void insertUpdate(@NotNull
final DocumentEvent e) {
132 public void removeUpdate(@NotNull
final DocumentEvent e) {
137 public void changedUpdate(@NotNull
final DocumentEvent e) {
154 public void windowOpened(
final WindowEvent e) {
159 public void windowClosing(
final WindowEvent e) {
164 public void windowClosed(
final WindowEvent e) {
169 public void windowIconified(
final WindowEvent e) {
174 public void windowDeiconified(
final WindowEvent e) {
179 public void windowActivated(
final WindowEvent e) {
186 public void windowDeactivated(
final WindowEvent e) {
206 final JDialog tmpDialog;
210 tmpDialog.getRootPane().setDefaultButton(
okButton);
212 tmpDialog.setModalityType(ModalityType.DOCUMENT_MODAL);
218 tmpDialog.setVisible(
true);
281 final StringTokenizer st =
new StringTokenizer(
subLayerTextField.getText(),
",");
282 final Integer[] subLayers =
new Integer[st.countTokens()];
284 for (
int i = 0; st.hasMoreTokens(); i++) {
static int parseInt(@NotNull final String s)
Parses an integer string.
final JTextComponent subLayerTextField
The text field for specifying the sub-layer value.
void tileStretchingCancel()
Action method to close the dialog with "Cancel".
Base package of all Gridarta classes.
Defines common UI constants used in different dialogs.
boolean isOkButtonEnabled()
Returns whether the "OK" button is enabled.
boolean showTileStretchingDialog(@NotNull final Component parent)
Displays the tile stretching dialog.
static JLabel newLabel(@NotNull final ActionBuilder actionBuilder, @NotNull final String key)
Creates a new JLabel from a resource key.
void setTileStretchingAbsolute(final boolean isAbsolute)
Action method for "absolute" action.
boolean isAbsolute
Whether adjacent squares are checked.
TileStretchingDialog()
Creates a new instance.
Graphical User Interface of Gridarta.
final JButton cancelButton
The "Cancel" button.
final JTextComponent heightValueTextField
The text field for specifying the height value.
Integer[] getSubLayers()
Returns the sub-layers to affect.
static boolean getBoolean(@NotNull final ActionBuilder actionBuilder, @NotNull final String key)
Returns the value of a key as a.
JDialog dialog
The JDialog instance or.
int getHeightValue()
Returns the height value.
boolean isTileStretchingAbsolute()
Action method for "absolute" action.
static String getString(@NotNull final ActionBuilder actionBuilder, @NotNull final String key, @NotNull final String defaultValue)
Returns the value of a key.
Displays a dialog asking for parameters for the "tile stretching set" function.
static final ActionBuilder ACTION_BUILDER
Action Builder to create Actions.
final WindowListener windowListener
The WindowListener attached to dialog to call {} after the dialog has been shown.
static void setAutoSelectOnFocus(@NotNull final JTextComponent textComponent)
Selects all text of a JTextComponent when the component gains the focus.
void updateOkButton()
Updates the enabled state of the "OK" button depending on the dialog's contents.
void tileStretchingOkay()
Action method to close the dialog with "OK".
Utility class for ActionBuilder related functions.
final JButton okButton
The "OK" button.
final JOptionPane optionPane
The JOptionPane instance used to create dialogs.
Utility class for JTextComponent related functions.
Border DIALOG_BORDER
The Border object to be used when creating dialogs.
Utility class for parsing strings into numbers.