jv.number

## Class PuInteger

- java.lang.Object
- - jv.object.PsObject
  - - jv.number.PuInteger

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, PsUpdateIf

      public final class PuInteger
      extends PsObject

  Basic integer class with update functionality and panel containing a slider. This class may always be used when a integer instance variable shall be modifiable by a slider in the info panel of its parent class. See the class `PjExprOde` as a sample application.

  Usage demonstrated in a sample class:

              public class PjExprOde {
          protected  PuInteger  m_length;
          public PjExprOde() {
             // Create a new instance of PuInteger and register 'this' as update listener
             // to receive update events whenever user has modified the slider.
             m_length  = new PuInteger("Length", this);
          }
          public void init() {
             // Set default min/max values and increments of slider.
             m_length.setDefBounds(1, 50, 1, 10);
             // Set default value to be assigned in m_length.init() or
             // when slider is reset.
             m_length.setDefValue(15);
             m_length.init();                   // Reset to default values.
          }
          public boolean update(Object event) {
             // Catch update events whenever user has modified slider.
             if (event == m_length) {
                solve(m_length.getValue());     // Do something application depended
                return true;
             }
          }
       }

  See Also:
    `PuDouble`, Serialized Form

- - ### Field Summary

    - ### Fields inherited from class jv.object.PsObject

      `HAS_BOUNDARY_PANEL, HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PuInteger(java.lang.String name)` Create new instance with given name.
    `PuInteger(java.lang.String name, PsUpdateIf parent)` Create new instance with given name and parent.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `blend(double a, PuInteger v, double b, PuInteger w)` Blend with other integers using `this = (int)(a*v + b*w +.5)`.
    `void` | `copy(PuInteger num)` Copy all instance variables of argument source into 'this'.
    `int` | `enforceBounds(int value)` Constrain value to lie within bounds of this slider.
    `java.awt.Color` | `getBackground()` Get color of background of info panel.
    `int` | `getDefLineIncr()` Get the default line increment which are used when slider is reset.
    `int` | `getDefMaximum()` Get the default maximum value which are used when slider is reset.
    `int` | `getDefMinimum()` Get the default minimum value which are used when slider is reset.
    `int` | `getDefPageIncr()` Get the default page increment which are used when slider is reset.
    `int` | `getDefValue()` Get the default value which is used when slider is reset.
    `int` | `getLineIncr()` Get line increment of slider.
    `int` | `getMax()` Get maximal value allowed in slider.
    `int` | `getMin()` Get minimal value allowed in slider.
    `int` | `getPageIncr()` Get block increment of slider.
    `int` | `getValue()` Get current integer value.
    `void` | `init()` Assign default values, and may be used to reset instance.
    `void` | `initWithDefaults(int min, int max, int lineIncr, int pageIncr, int defValue)` Sets the default values for this component and initializes it.
    `boolean` | `isEnabled()` Check whether slider is enabled or disabled.
    `boolean` | `isEnabledConfigButton()` Flag determines whether button for config panel is enabled or not, in this way permitting/prohibiting GUI control over bounds and increments.
    `boolean` | `isShowingEnabled()` Whether to show a checkbox in the info panel.
    `void` | `setBackground(java.awt.Color color)` Set color of background of info panel.
    `void` | `setBounds(int min, int max)` Set current min/max values and adjust value if current value lies outside the new min/max bounds.
    `void` | `setBounds(int min, int max, int lineIncr, int pageIncr)` Set current min/max values and slider increments.
    `void` | `setDefBounds(int min, int max, int lineIncr, int pageIncr)` Set default min/max values and slider increments to be assigned when `init()` is called as reset.
    `void` | `setDefValue(int value)` Set default value to be assigned when `init()` is called as reset.
    `void` | `setEnabled(boolean flag)` Enable or disable the slider for interactive use.
    `void` | `setEnabledConfigButton(boolean flag)` Flag determines whether button for config panel is enabled or not, in this way permitting/prohibiting GUI control over bounds and increments.
    `void` | `setValue(int value)` Set value of int, and adjust slider if visible.
    `void` | `showEnabled(boolean show)` Toggle whether to show a checkbox in the info panel.

    - ### Methods inherited from class jv.object.PsObject

      `addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, update, updatePanels`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### PuInteger

          public PuInteger(java.lang.String name)

      Create new instance with given name. The name appears as label on the slider.

      In order to receive update events of this slider one might either assign a parent or register an update listener.

      Parameters:
        `name` - Name of integer to appear as label in slider.
      Since:
        JavaView 2.47

    - #### PuInteger

          public PuInteger(java.lang.String name,
                   PsUpdateIf parent)

      Create new instance with given name and parent. The name appears as label on the slider, and the parent is informed whenever the slider has changed using `parent.update(this)`.
      Parameters:
        `name` - Name of integer to appear as label in slider.
        `parent` - Parent of integer to receive update events.

  - ### Method Detail

    - #### init

          public void init()

      Assign default values, and may be used to reset instance.
      Overrides:
        `init` in class `PsObject`

    - #### initWithDefaults

          public void initWithDefaults(int min,
                              int max,
                              int lineIncr,
                              int pageIncr,
                              int defValue)

      Sets the default values for this component and initializes it.
      See Also:
        `setDefBounds(int, int, int, int)`, `setDefValue(int)`, `init()`

    - #### copy

          public void copy(PuInteger num)

      Copy all instance variables of argument source into 'this'.

    - #### getDefValue

          public int getDefValue()

      Get the default value which is used when slider is reset.
      Since:
        JavaView 2.91.000
      See Also:
        `setDefValue(int)`, `getValue()`

    - #### setDefValue

          public void setDefValue(int value)

      Set default value to be assigned when `init()` is called as reset.

      If new value is outside the current bounds, then the bounds are enlarged.

      SetDefValue() should be assigned AFTER the default interval has been resized with setDefBounds() in order to avoid automatic defBound resize.

      See Also:
        `setDefBounds(int, int, int, int)`

    - #### getDefMinimum

          public int getDefMinimum()

      Get the default minimum value which are used when slider is reset.
      See Also:
        `setDefBounds(int, int, int, int)`, `setBounds(int, int)`

    - #### getDefMaximum

          public int getDefMaximum()

      Get the default maximum value which are used when slider is reset.
      See Also:
        `setDefBounds(int, int, int, int)`, `setBounds(int, int)`

    - #### getDefLineIncr

          public int getDefLineIncr()

      Get the default line increment which are used when slider is reset.
      See Also:
        `setDefBounds(int, int, int, int)`, `setBounds(int, int)`

    - #### getDefPageIncr

          public int getDefPageIncr()

      Get the default page increment which are used when slider is reset.
      See Also:
        `setDefBounds(int, int, int, int)`, `setBounds(int, int)`

    - #### setDefBounds

          public void setDefBounds(int min,
                          int max,
                          int lineIncr,
                          int pageIncr)

      Set default min/max values and slider increments to be assigned when `init()` is called as reset.

      Line and page increments are clipped if larger than range.

      Current default value of slider is clipped to lie within [min,max] bounds.

      Parameters:
        `min` - Default minimal value in slider, min must be smaller than max.
        `max` - Default maximal value in slider, min must be smaller than max.
        `lineIncr` - Default line increment used in slider.
        `pageIncr` - Default block increment used in slider.

    - #### enforceBounds

          public int enforceBounds(int value)

      Constrain value to lie within bounds of this slider.
      Parameters:
        `value` - number to be bracketed by allowable range.
      Returns:
        number constrained to the allowable range.
      Since:
        JavaView 2.75.000
      See Also:
        `setValue(int)`

    - #### setValue

          public void setValue(int value)

      Set value of int, and adjust slider if visible. If new value is outside the current bounds, then the bounds are enlarged.

      This routine called from outside to set the value. Only here we update the panel.

    - #### getValue

          public int getValue()

      Get current integer value.

    - #### getMin

          public int getMin()

      Get minimal value allowed in slider. May be interactively modified with config panel.

    - #### getMax

          public int getMax()

      Get maximal value allowed in slider. May be interactively modified with config panel.

    - #### getLineIncr

          public int getLineIncr()

      Get line increment of slider. May be interactively modified with config panel.

    - #### getPageIncr

          public int getPageIncr()

      Get block increment of slider. May be interactively modified with config panel.

    - #### setBounds

          public void setBounds(int min,
                       int max,
                       int lineIncr,
                       int pageIncr)

      Set current min/max values and slider increments. Adjust value if current value lies outside the new min/max bounds. These bounds will be overridden by default bounds if instance is reset using `init()`.

      Line and page increments are clipped if larger than range.

      Parameters:
        `min` - Minimal value in slider, min must be smaller than max.
        `max` - Maximal value in slider, min must be smaller than max.
        `lineIncr` - Line increment used in slider.
        `pageIncr` - Block increment used in slider.

    - #### setBounds

          public void setBounds(int min,
                       int max)

      Set current min/max values and adjust value if current value lies outside the new min/max bounds. These bounds will be overridden if instance is reset using `init()`. Line and block increments of slider are set to default values.
      Parameters:
        `min` - Minimal value in slider.
        `max` - Maximal value in slider.

    - #### isEnabled

          public boolean isEnabled()

      Check whether slider is enabled or disabled.

    - #### showEnabled

          public void showEnabled(boolean show)

      Toggle whether to show a checkbox in the info panel.

    - #### isShowingEnabled

          public boolean isShowingEnabled()

      Whether to show a checkbox in the info panel.

    - #### setEnabled

          public void setEnabled(boolean flag)

      Enable or disable the slider for interactive use. If disabled, the integer variable can still be modified by calls `setValue(integer)`, and the slider is always updated.

    - #### blend

          public void blend(double a,
                   PuInteger v,
                   double b,
                   PuInteger w)

      Blend with other integers using `this = (int)(a*v + b*w +.5)`.

    - #### setEnabledConfigButton

          public void setEnabledConfigButton(boolean flag)

      Flag determines whether button for config panel is enabled or not, in this way permitting/prohibiting GUI control over bounds and increments. Bounds and increments can still be changed by method calls.
      Since:
        JavaView 2.49.004

    - #### isEnabledConfigButton

          public boolean isEnabledConfigButton()

      Flag determines whether button for config panel is enabled or not, in this way permitting/prohibiting GUI control over bounds and increments. Bounds and increments can still be changed by method calls.
      Since:
        JavaView 2.49.004

    - #### getBackground

          public java.awt.Color getBackground()

      Get color of background of info panel.
      Since:
        JavaView 3.50.003

    - #### setBackground

          public void setBackground(java.awt.Color color)

      Set color of background of info panel.
      Since:
        JavaView 3.50.003

"

The software JavaView? is copyright protected. All Rights Reserved.
"