/*
 * Copyright 2000-2013 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.intellij.ui;

import javax.swing.*;

public class PortField extends JSpinner {
  public PortField() {
    this(0);
  }

  public PortField(int number) {
    setModel(new SpinnerNumberModel(number, 0, 65535, 1));
    setEditor(new NumberEditor(this, "#"));
  }

  public void setEditable(boolean value) {
    ((NumberEditor)getEditor()).getTextField().setEditable(value);
  }

  public void setNumber(int number) {
    setValue(number);
  }

  public int getNumber() {
    return ((SpinnerNumberModel)getModel()).getNumber().intValue();
  }

  public boolean isSpecified() {
    return getNumber() != 0;
  }
}
@@ -745,30 +745,190 @@
 rtField(int 
-number
+value) %7B%0A    this(value, 0);%0A  %7D%0A%0A  public void setMin(int value) %7B%0A    ((SpinnerNumberModel)getModel()).setMinimum(value);%0A  %7D%0A%0A  public PortField(int value, int min
 ) %7B%0A    setM
@@ -959,17 +959,18 @@
 del(
-number, 0
+value, min
 , 65
@@ -1171,22 +1171,21 @@
 ber(int 
-number
+value
 ) %7B%0A    
@@ -1197,14 +1197,13 @@
 lue(
-number
+value
 );%0A 

use PortField