Рефакторинг: добавлен метод MapValue set(String, Value)

This commit is contained in:
Victor 2016-07-29 18:49:53 +03:00
parent c5bd92cb0f
commit 134e0fe4ca
9 changed files with 146 additions and 148 deletions

View File

@ -48,6 +48,10 @@ public class MapValue implements Value, Iterable<Map.Entry<Value, Value>> {
return map.get(key);
}
public void set(String key, Value value) {
set(new StringValue(key), value);
}
public void set(Value key, Value value) {
map.put(key, value);
}

View File

@ -25,49 +25,49 @@ public final class forms implements Module {
// SwinfConstants
final MapValue swing = new MapValue(20);
swing.set(new StringValue("BOTTOM"), NumberValue.of(SwingConstants.BOTTOM));
swing.set(new StringValue("CENTER"), NumberValue.of(SwingConstants.CENTER));
swing.set(new StringValue("EAST"), NumberValue.of(SwingConstants.EAST));
swing.set(new StringValue("HORIZONTAL"), NumberValue.of(SwingConstants.HORIZONTAL));
swing.set(new StringValue("LEADING"), NumberValue.of(SwingConstants.LEADING));
swing.set(new StringValue("LEFT"), NumberValue.of(SwingConstants.LEFT));
swing.set(new StringValue("NEXT"), NumberValue.of(SwingConstants.NEXT));
swing.set(new StringValue("NORTH"), NumberValue.of(SwingConstants.NORTH));
swing.set(new StringValue("NORTH_EAST"), NumberValue.of(SwingConstants.NORTH_EAST));
swing.set(new StringValue("NORTH_WEST"), NumberValue.of(SwingConstants.NORTH_WEST));
swing.set(new StringValue("PREVIOUS"), NumberValue.of(SwingConstants.PREVIOUS));
swing.set(new StringValue("RIGHT"), NumberValue.of(SwingConstants.RIGHT));
swing.set(new StringValue("SOUTH"), NumberValue.of(SwingConstants.SOUTH));
swing.set(new StringValue("SOUTH_EAST"), NumberValue.of(SwingConstants.SOUTH_EAST));
swing.set(new StringValue("SOUTH_WEST"), NumberValue.of(SwingConstants.SOUTH_WEST));
swing.set(new StringValue("TOP"), NumberValue.of(SwingConstants.TOP));
swing.set(new StringValue("TRAILING"), NumberValue.of(SwingConstants.TRAILING));
swing.set(new StringValue("VERTICAL"), NumberValue.of(SwingConstants.VERTICAL));
swing.set(new StringValue("WEST"), NumberValue.of(SwingConstants.WEST));
swing.set("BOTTOM", NumberValue.of(SwingConstants.BOTTOM));
swing.set("CENTER", NumberValue.of(SwingConstants.CENTER));
swing.set("EAST", NumberValue.of(SwingConstants.EAST));
swing.set("HORIZONTAL", NumberValue.of(SwingConstants.HORIZONTAL));
swing.set("LEADING", NumberValue.of(SwingConstants.LEADING));
swing.set("LEFT", NumberValue.of(SwingConstants.LEFT));
swing.set("NEXT", NumberValue.of(SwingConstants.NEXT));
swing.set("NORTH", NumberValue.of(SwingConstants.NORTH));
swing.set("NORTH_EAST", NumberValue.of(SwingConstants.NORTH_EAST));
swing.set("NORTH_WEST", NumberValue.of(SwingConstants.NORTH_WEST));
swing.set("PREVIOUS", NumberValue.of(SwingConstants.PREVIOUS));
swing.set("RIGHT", NumberValue.of(SwingConstants.RIGHT));
swing.set("SOUTH", NumberValue.of(SwingConstants.SOUTH));
swing.set("SOUTH_EAST", NumberValue.of(SwingConstants.SOUTH_EAST));
swing.set("SOUTH_WEST", NumberValue.of(SwingConstants.SOUTH_WEST));
swing.set("TOP", NumberValue.of(SwingConstants.TOP));
swing.set("TRAILING", NumberValue.of(SwingConstants.TRAILING));
swing.set("VERTICAL", NumberValue.of(SwingConstants.VERTICAL));
swing.set("WEST", NumberValue.of(SwingConstants.WEST));
Variables.define("SwingConstants", swing);
// LayoutManagers constants
final MapValue border = new MapValue(13);
border.set(new StringValue("AFTER_LAST_LINE"), new StringValue(BorderLayout.AFTER_LAST_LINE));
border.set(new StringValue("AFTER_LINE_ENDS"), new StringValue(BorderLayout.AFTER_LINE_ENDS));
border.set(new StringValue("BEFORE_FIRST_LINE"), new StringValue(BorderLayout.BEFORE_FIRST_LINE));
border.set(new StringValue("BEFORE_LINE_BEGINS"), new StringValue(BorderLayout.BEFORE_LINE_BEGINS));
border.set(new StringValue("CENTER"), new StringValue(BorderLayout.CENTER));
border.set(new StringValue("EAST"), new StringValue(BorderLayout.EAST));
border.set(new StringValue("LINE_END"), new StringValue(BorderLayout.LINE_END));
border.set(new StringValue("LINE_START"), new StringValue(BorderLayout.LINE_START));
border.set(new StringValue("NORTH"), new StringValue(BorderLayout.NORTH));
border.set(new StringValue("PAGE_END"), new StringValue(BorderLayout.PAGE_END));
border.set(new StringValue("PAGE_START"), new StringValue(BorderLayout.PAGE_START));
border.set(new StringValue("SOUTH"), new StringValue(BorderLayout.SOUTH));
border.set(new StringValue("WEST"), new StringValue(BorderLayout.WEST));
border.set("AFTER_LAST_LINE", new StringValue(BorderLayout.AFTER_LAST_LINE));
border.set("AFTER_LINE_ENDS", new StringValue(BorderLayout.AFTER_LINE_ENDS));
border.set("BEFORE_FIRST_LINE", new StringValue(BorderLayout.BEFORE_FIRST_LINE));
border.set("BEFORE_LINE_BEGINS", new StringValue(BorderLayout.BEFORE_LINE_BEGINS));
border.set("CENTER", new StringValue(BorderLayout.CENTER));
border.set("EAST", new StringValue(BorderLayout.EAST));
border.set("LINE_END", new StringValue(BorderLayout.LINE_END));
border.set("LINE_START", new StringValue(BorderLayout.LINE_START));
border.set("NORTH", new StringValue(BorderLayout.NORTH));
border.set("PAGE_END", new StringValue(BorderLayout.PAGE_END));
border.set("PAGE_START", new StringValue(BorderLayout.PAGE_START));
border.set("SOUTH", new StringValue(BorderLayout.SOUTH));
border.set("WEST", new StringValue(BorderLayout.WEST));
Variables.define("BorderLayout", border);
final MapValue box = new MapValue(4);
box.set(new StringValue("LINE_AXIS"), NumberValue.of(BoxLayout.LINE_AXIS));
box.set(new StringValue("PAGE_AXIS"), NumberValue.of(BoxLayout.PAGE_AXIS));
box.set(new StringValue("X_AXIS"), NumberValue.of(BoxLayout.X_AXIS));
box.set(new StringValue("Y_AXIS"), NumberValue.of(BoxLayout.Y_AXIS));
box.set("LINE_AXIS", NumberValue.of(BoxLayout.LINE_AXIS));
box.set("PAGE_AXIS", NumberValue.of(BoxLayout.PAGE_AXIS));
box.set("X_AXIS", NumberValue.of(BoxLayout.X_AXIS));
box.set("Y_AXIS", NumberValue.of(BoxLayout.Y_AXIS));
Variables.define("BoxLayout", box);
}

View File

@ -30,47 +30,47 @@ public abstract class ComponentValue extends MapValue {
}
private void init() {
set(new StringValue("onKeyAction"), new FunctionValue(this::addKeyListener));
set(new StringValue("addKeyListener"), new FunctionValue(this::addKeyListener));
set(new StringValue("getFocusTraversalKeysEnabled"), voidToBoolean(component::getFocusTraversalKeysEnabled));
set(new StringValue("getHeight"), voidToInt(component::getHeight));
set(new StringValue("getIgnoreRepaint"), voidToBoolean(component::getIgnoreRepaint));
set(new StringValue("getLocation"), new FunctionValue(this::getLocation));
set(new StringValue("getLocationOnScreen"), new FunctionValue(this::getLocationOnScreen));
set(new StringValue("getMinimumSize"), dimensionFunction(component::getMinimumSize));
set(new StringValue("getMaximumSize"), dimensionFunction(component::getMaximumSize));
set(new StringValue("getName"), voidToString(component::getName));
set(new StringValue("getPreferredSize"), dimensionFunction(component::getPreferredSize));
set(new StringValue("getSize"), dimensionFunction(component::getSize));
set(new StringValue("getWidth"), voidToInt(component::getWidth));
set(new StringValue("getX"), voidToInt(component::getX));
set(new StringValue("getY"), voidToInt(component::getY));
set(new StringValue("hasFocus"), voidToBoolean(component::hasFocus));
set(new StringValue("invalidate"), voidToVoid(component::invalidate));
set("onKeyAction", new FunctionValue(this::addKeyListener));
set("addKeyListener", new FunctionValue(this::addKeyListener));
set("getFocusTraversalKeysEnabled", voidToBoolean(component::getFocusTraversalKeysEnabled));
set("getHeight", voidToInt(component::getHeight));
set("getIgnoreRepaint", voidToBoolean(component::getIgnoreRepaint));
set("getLocation", new FunctionValue(this::getLocation));
set("getLocationOnScreen", new FunctionValue(this::getLocationOnScreen));
set("getMinimumSize", dimensionFunction(component::getMinimumSize));
set("getMaximumSize", dimensionFunction(component::getMaximumSize));
set("getName", voidToString(component::getName));
set("getPreferredSize", dimensionFunction(component::getPreferredSize));
set("getSize", dimensionFunction(component::getSize));
set("getWidth", voidToInt(component::getWidth));
set("getX", voidToInt(component::getX));
set("getY", voidToInt(component::getY));
set("hasFocus", voidToBoolean(component::hasFocus));
set("invalidate", voidToVoid(component::invalidate));
set(new StringValue("isDisplayable"), voidToBoolean(component::isDisplayable));
set(new StringValue("isDoubleBuffered"), voidToBoolean(component::isDoubleBuffered));
set(new StringValue("isEnabled"), voidToBoolean(component::isEnabled));
set(new StringValue("isFocusOwner"), voidToBoolean(component::isFocusOwner));
set(new StringValue("isFocusable"), voidToBoolean(component::isFocusable));
set(new StringValue("isLightweight"), voidToBoolean(component::isLightweight));
set(new StringValue("isOpaque"), voidToBoolean(component::isOpaque));
set(new StringValue("isShowing"), voidToBoolean(component::isShowing));
set(new StringValue("isValid"), voidToBoolean(component::isValid));
set(new StringValue("isVisible"), voidToBoolean(component::isVisible));
set("isDisplayable", voidToBoolean(component::isDisplayable));
set("isDoubleBuffered", voidToBoolean(component::isDoubleBuffered));
set("isEnabled", voidToBoolean(component::isEnabled));
set("isFocusOwner", voidToBoolean(component::isFocusOwner));
set("isFocusable", voidToBoolean(component::isFocusable));
set("isLightweight", voidToBoolean(component::isLightweight));
set("isOpaque", voidToBoolean(component::isOpaque));
set("isShowing", voidToBoolean(component::isShowing));
set("isValid", voidToBoolean(component::isValid));
set("isVisible", voidToBoolean(component::isVisible));
set(new StringValue("requestFocus"), voidToVoid(component::requestFocus));
set(new StringValue("requestFocusInWindow"), voidToBoolean(component::requestFocusInWindow));
set(new StringValue("repaint"), voidToVoid(component::repaint));
set(new StringValue("revalidate"), voidToVoid(component::revalidate));
set(new StringValue("setMaximumSize"), voidDimensionFunction(component::setMaximumSize));
set(new StringValue("setMinimumSize"), voidDimensionFunction(component::setMinimumSize));
set(new StringValue("setName"), stringToVoid(component::setName));
set(new StringValue("setPreferredSize"), voidDimensionFunction(component::setPreferredSize));
set(new StringValue("setSize"), voidDimensionFunction(component::setSize));
set(new StringValue("setVisible"), booleanOptToVoid(component::setVisible));
set(new StringValue("setLocation"), new FunctionValue(this::setLocation));
set(new StringValue("validate"), voidToVoid(component::validate));
set("requestFocus", voidToVoid(component::requestFocus));
set("requestFocusInWindow", voidToBoolean(component::requestFocusInWindow));
set("repaint", voidToVoid(component::repaint));
set("revalidate", voidToVoid(component::revalidate));
set("setMaximumSize", voidDimensionFunction(component::setMaximumSize));
set("setMinimumSize", voidDimensionFunction(component::setMinimumSize));
set("setName", stringToVoid(component::setName));
set("setPreferredSize", voidDimensionFunction(component::setPreferredSize));
set("setSize", voidDimensionFunction(component::setSize));
set("setVisible", booleanOptToVoid(component::setVisible));
set("setLocation", new FunctionValue(this::setLocation));
set("validate", voidToVoid(component::validate));
}
private Value addKeyListener(Value... args) {
@ -99,19 +99,19 @@ public abstract class ComponentValue extends MapValue {
private void handleKeyEvent(String type, final KeyEvent e) {
final MapValue map = new MapValue(15);
map.set(new StringValue("extendedKeyCode"), NumberValue.of(e.getExtendedKeyCode()));
map.set(new StringValue("keyChar"), NumberValue.of(e.getKeyChar()));
map.set(new StringValue("keyCode"), NumberValue.of(e.getKeyCode()));
map.set(new StringValue("keyLocation"), NumberValue.of(e.getKeyLocation()));
map.set(new StringValue("id"), NumberValue.of(e.getID()));
map.set(new StringValue("isActionKey"), NumberValue.fromBoolean(e.isActionKey()));
map.set(new StringValue("isAltDown"), NumberValue.fromBoolean(e.isAltDown()));
map.set(new StringValue("isAltGraphDown"), NumberValue.fromBoolean(e.isAltGraphDown()));
map.set(new StringValue("isConsumed"), NumberValue.fromBoolean(e.isConsumed()));
map.set(new StringValue("isControlDown"), NumberValue.fromBoolean(e.isControlDown()));
map.set(new StringValue("isMetaDown"), NumberValue.fromBoolean(e.isMetaDown()));
map.set(new StringValue("isShiftDown"), NumberValue.fromBoolean(e.isShiftDown()));
map.set(new StringValue("modifiers"), NumberValue.of(e.getModifiers()));
map.set("extendedKeyCode", NumberValue.of(e.getExtendedKeyCode()));
map.set("keyChar", NumberValue.of(e.getKeyChar()));
map.set("keyCode", NumberValue.of(e.getKeyCode()));
map.set("keyLocation", NumberValue.of(e.getKeyLocation()));
map.set("id", NumberValue.of(e.getID()));
map.set("isActionKey", NumberValue.fromBoolean(e.isActionKey()));
map.set("isAltDown", NumberValue.fromBoolean(e.isAltDown()));
map.set("isAltGraphDown", NumberValue.fromBoolean(e.isAltGraphDown()));
map.set("isConsumed", NumberValue.fromBoolean(e.isConsumed()));
map.set("isControlDown", NumberValue.fromBoolean(e.isControlDown()));
map.set("isMetaDown", NumberValue.fromBoolean(e.isMetaDown()));
map.set("isShiftDown", NumberValue.fromBoolean(e.isShiftDown()));
map.set("modifiers", NumberValue.of(e.getModifiers()));
action.execute(new StringValue(type), map);
}
});

View File

@ -4,7 +4,6 @@ import com.annimon.ownlang.lib.Arguments;
import static com.annimon.ownlang.lib.Converters.*;
import com.annimon.ownlang.lib.FunctionValue;
import com.annimon.ownlang.lib.NumberValue;
import com.annimon.ownlang.lib.StringValue;
import com.annimon.ownlang.lib.Types;
import com.annimon.ownlang.lib.Value;
import java.awt.Component;
@ -22,15 +21,15 @@ public abstract class ContainerValue extends ComponentValue {
}
private void init() {
set(new StringValue("add"), new FunctionValue(this::add));
set(new StringValue("remove"), new FunctionValue(this::remove));
set(new StringValue("removeAll"), voidToVoid(container::removeAll));
set(new StringValue("getAlignmentX"), voidToFloat(container::getAlignmentX));
set(new StringValue("getAlignmentY"), voidToFloat(container::getAlignmentY));
set(new StringValue("getComponentCount"), voidToInt(container::getComponentCount));
set(new StringValue("isFocusCycleRoot"), voidToBoolean(container::isFocusCycleRoot));
set(new StringValue("isValidateRoot"), voidToBoolean(container::isValidateRoot));
set(new StringValue("setLayout"), new FunctionValue(this::setLayout));
set("add", new FunctionValue(this::add));
set("remove", new FunctionValue(this::remove));
set("removeAll", voidToVoid(container::removeAll));
set("getAlignmentX", voidToFloat(container::getAlignmentX));
set("getAlignmentY", voidToFloat(container::getAlignmentY));
set("getComponentCount", voidToInt(container::getComponentCount));
set("isFocusCycleRoot", voidToBoolean(container::isFocusCycleRoot));
set("isValidateRoot", voidToBoolean(container::isValidateRoot));
set("setLayout", new FunctionValue(this::setLayout));
}
private Value add(Value... args) {

View File

@ -5,7 +5,6 @@ import com.annimon.ownlang.lib.Arguments;
import com.annimon.ownlang.lib.Function;
import com.annimon.ownlang.lib.FunctionValue;
import com.annimon.ownlang.lib.NumberValue;
import com.annimon.ownlang.lib.StringValue;
import com.annimon.ownlang.lib.Types;
import com.annimon.ownlang.lib.Value;
import javax.swing.JButton;
@ -21,8 +20,8 @@ public class JButtonValue extends JComponentValue {
}
private void init() {
set(new StringValue("onClick"), new FunctionValue(this::addActionListener));
set(new StringValue("addActionListener"), new FunctionValue(this::addActionListener));
set("onClick", new FunctionValue(this::addActionListener));
set("addActionListener", new FunctionValue(this::addActionListener));
}
private Value addActionListener(Value... args) {

View File

@ -1,7 +1,6 @@
package com.annimon.ownlang.lib.modules.functions.forms;
import static com.annimon.ownlang.lib.Converters.*;
import com.annimon.ownlang.lib.StringValue;
import javax.swing.JComponent;
public abstract class JComponentValue extends ContainerValue {
@ -15,7 +14,7 @@ public abstract class JComponentValue extends ContainerValue {
}
private void init() {
set(new StringValue("getToolTipText"), voidToString(jComponent::getToolTipText));
set(new StringValue("setToolTipText"), stringToVoid(jComponent::setToolTipText));
set("getToolTipText", voidToString(jComponent::getToolTipText));
set("setToolTipText", stringToVoid(jComponent::setToolTipText));
}
}

View File

@ -1,7 +1,6 @@
package com.annimon.ownlang.lib.modules.functions.forms;
import static com.annimon.ownlang.lib.Converters.*;
import com.annimon.ownlang.lib.StringValue;
import javax.swing.JFrame;
public class JFrameValue extends ContainerValue {
@ -15,14 +14,14 @@ public class JFrameValue extends ContainerValue {
}
private void init() {
set(new StringValue("dispose"), voidToVoid(frame::dispose));
set(new StringValue("getTitle"), voidToString(frame::getTitle));
set(new StringValue("getDefaultCloseOperation"), voidToInt(frame::getDefaultCloseOperation));
set(new StringValue("pack"), voidToVoid(frame::pack));
set(new StringValue("setAlwaysOnTop"), booleanOptToVoid(frame::setAlwaysOnTop));
set(new StringValue("setDefaultCloseOperation"), intToVoid(frame::setDefaultCloseOperation));
set(new StringValue("setLocationByPlatform"), booleanOptToVoid(frame::setLocationByPlatform));
set(new StringValue("setResizable"), booleanOptToVoid(frame::setResizable));
set(new StringValue("setTitle"), stringToVoid(frame::setTitle));
set("dispose", voidToVoid(frame::dispose));
set("getTitle", voidToString(frame::getTitle));
set("getDefaultCloseOperation", voidToInt(frame::getDefaultCloseOperation));
set("pack", voidToVoid(frame::pack));
set("setAlwaysOnTop", booleanOptToVoid(frame::setAlwaysOnTop));
set("setDefaultCloseOperation", intToVoid(frame::setDefaultCloseOperation));
set("setLocationByPlatform", booleanOptToVoid(frame::setLocationByPlatform));
set("setResizable", booleanOptToVoid(frame::setResizable));
set("setTitle", stringToVoid(frame::setTitle));
}
}

View File

@ -1,7 +1,6 @@
package com.annimon.ownlang.lib.modules.functions.forms;
import static com.annimon.ownlang.lib.Converters.*;
import com.annimon.ownlang.lib.StringValue;
import javax.swing.JLabel;
public class JLabelValue extends JComponentValue {
@ -15,22 +14,22 @@ public class JLabelValue extends JComponentValue {
}
private void init() {
set(new StringValue("getDisplayedMnemonic"), voidToInt(label::getDisplayedMnemonic));
set(new StringValue("getDisplayedMnemonicIndex"), voidToInt(label::getDisplayedMnemonicIndex));
set(new StringValue("getHorizontalAlignment"), voidToInt(label::getHorizontalAlignment));
set(new StringValue("getHorizontalTextPosition"), voidToInt(label::getHorizontalTextPosition));
set(new StringValue("getIconTextGap"), voidToInt(label::getIconTextGap));
set(new StringValue("getVerticalAlignment"), voidToInt(label::getVerticalAlignment));
set(new StringValue("getVerticalTextPosition"), voidToInt(label::getVerticalTextPosition));
set("getDisplayedMnemonic", voidToInt(label::getDisplayedMnemonic));
set("getDisplayedMnemonicIndex", voidToInt(label::getDisplayedMnemonicIndex));
set("getHorizontalAlignment", voidToInt(label::getHorizontalAlignment));
set("getHorizontalTextPosition", voidToInt(label::getHorizontalTextPosition));
set("getIconTextGap", voidToInt(label::getIconTextGap));
set("getVerticalAlignment", voidToInt(label::getVerticalAlignment));
set("getVerticalTextPosition", voidToInt(label::getVerticalTextPosition));
set(new StringValue("getText"), voidToString(label::getText));
set(new StringValue("setDisplayedMnemonic"), intToVoid(label::setDisplayedMnemonic));
set(new StringValue("setDisplayedMnemonicIndex"), intToVoid(label::setDisplayedMnemonicIndex));
set(new StringValue("setHorizontalAlignment"), intToVoid(label::setHorizontalAlignment));
set(new StringValue("setHorizontalTextPosition"), intToVoid(label::setHorizontalTextPosition));
set(new StringValue("setIconTextGap"), intToVoid(label::setIconTextGap));
set(new StringValue("setVerticalAlignment"), intToVoid(label::setVerticalAlignment));
set(new StringValue("setVerticalTextPosition"), intToVoid(label::setVerticalTextPosition));
set(new StringValue("setText"), stringToVoid(label::setText));
set("getText", voidToString(label::getText));
set("setDisplayedMnemonic", intToVoid(label::setDisplayedMnemonic));
set("setDisplayedMnemonicIndex", intToVoid(label::setDisplayedMnemonicIndex));
set("setHorizontalAlignment", intToVoid(label::setHorizontalAlignment));
set("setHorizontalTextPosition", intToVoid(label::setHorizontalTextPosition));
set("setIconTextGap", intToVoid(label::setIconTextGap));
set("setVerticalAlignment", intToVoid(label::setVerticalAlignment));
set("setVerticalTextPosition", intToVoid(label::setVerticalTextPosition));
set("setText", stringToVoid(label::setText));
}
}

View File

@ -6,7 +6,6 @@ import static com.annimon.ownlang.lib.Converters.*;
import com.annimon.ownlang.lib.Function;
import com.annimon.ownlang.lib.FunctionValue;
import com.annimon.ownlang.lib.NumberValue;
import com.annimon.ownlang.lib.StringValue;
import com.annimon.ownlang.lib.Types;
import com.annimon.ownlang.lib.Value;
import javax.swing.JTextField;
@ -22,22 +21,22 @@ public class JTextFieldValue extends JComponentValue {
}
private void init() {
set(new StringValue("onAction"), new FunctionValue(this::addActionListener));
set(new StringValue("addActionListener"), new FunctionValue(this::addActionListener));
set(new StringValue("getCaretPosition"), voidToInt(textField::getCaretPosition));
set(new StringValue("getColumns"), voidToInt(textField::getColumns));
set(new StringValue("getHorizontalAlignment"), voidToInt(textField::getHorizontalAlignment));
set(new StringValue("getSelectionEnd"), voidToInt(textField::getSelectionEnd));
set(new StringValue("getSelectionStart"), voidToInt(textField::getSelectionStart));
set(new StringValue("getScrollOffset"), voidToInt(textField::getScrollOffset));
set(new StringValue("getText"), voidToString(textField::getText));
set(new StringValue("setCaretPosition"), intToVoid(textField::setCaretPosition));
set(new StringValue("setColumns"), intToVoid(textField::setColumns));
set(new StringValue("setHorizontalAlignment"), intToVoid(textField::setHorizontalAlignment));
set(new StringValue("setScrollOffset"), intToVoid(textField::setScrollOffset));
set(new StringValue("setSelectionEnd"), intToVoid(textField::setSelectionEnd));
set(new StringValue("setSelectionStart"), intToVoid(textField::setSelectionStart));
set(new StringValue("setText"), stringToVoid(textField::setText));
set("onAction", new FunctionValue(this::addActionListener));
set("addActionListener", new FunctionValue(this::addActionListener));
set("getCaretPosition", voidToInt(textField::getCaretPosition));
set("getColumns", voidToInt(textField::getColumns));
set("getHorizontalAlignment", voidToInt(textField::getHorizontalAlignment));
set("getSelectionEnd", voidToInt(textField::getSelectionEnd));
set("getSelectionStart", voidToInt(textField::getSelectionStart));
set("getScrollOffset", voidToInt(textField::getScrollOffset));
set("getText", voidToString(textField::getText));
set("setCaretPosition", intToVoid(textField::setCaretPosition));
set("setColumns", intToVoid(textField::setColumns));
set("setHorizontalAlignment", intToVoid(textField::setHorizontalAlignment));
set("setScrollOffset", intToVoid(textField::setScrollOffset));
set("setSelectionEnd", intToVoid(textField::setSelectionEnd));
set("setSelectionStart", intToVoid(textField::setSelectionStart));
set("setText", stringToVoid(textField::setText));
}
private Value addActionListener(Value... args) {