public static class IntegerField extends JTextField { public IntegerField(String txt) { super(txt); setDocument(new IntegerDocument()); } public int getInt() { return this.getText().equals("") ? 0 : Integer.parseInt(this.getText()); } }
current = (current == null) ? new Insets(0, 0, 0, 0) : current; this.topValueEditor = new JTextField(new IntegerDocument(), "" + current.top, 0); this.leftValueEditor = new JTextField(new IntegerDocument(), "" + current.left, 0); this.bottomValueEditor = new JTextField(new IntegerDocument(), "" + current.bottom, 0); this.rightValueEditor = new JTextField(new IntegerDocument(), "" + current.right, 0);
current = (current == null) ? new Insets(0, 0, 0, 0) : current; this.topValueEditor = new JTextField(new IntegerDocument(), "" + current.top, 0); this.leftValueEditor = new JTextField(new IntegerDocument(), "" + current.left, 0); this.bottomValueEditor = new JTextField(new IntegerDocument(), "" + current.bottom, 0); this.rightValueEditor = new JTextField(new IntegerDocument(), "" + current.right, 0);
current = (current == null) ? new Insets(0, 0, 0, 0) : current; this.topValueEditor = new JTextField(new IntegerDocument(), "" + current.top, 0); this.leftValueEditor = new JTextField(new IntegerDocument(), "" + current.left, 0); this.bottomValueEditor = new JTextField(new IntegerDocument(), "" + current.bottom, 0); this.rightValueEditor = new JTextField(new IntegerDocument(), "" + current.right, 0);