org.vishia.gral.example

## Class ExampleSimpleButton

- java.lang.Object
- - org.vishia.gral.example.ExampleSimpleButton

- Direct Known Subclasses:
    ExampleContextMenu

      public class ExampleSimpleButton
      extends java.lang.Object

  This class contains a simple example with a switching button, an input text field and a output text field. When the button is pressed, the text of the input field will be read and an output will be written.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `(package private) static class` | `ExampleSimpleButton.Factory` This inner class creates this class with given parameter.
    `protected static class` | `ExampleSimpleButton.GuiElements`
    `protected class` | `ExampleSimpleButton.InitGuiCodeSimpleButton` Code snippet for initializing the GUI.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private GralUserAction` | `actionButtonCode` Code snippet for the action while the button is pressed.
    `protected ExampleSimpleButton.GuiElements` | `gui` Instance of inner class contains the graphical elements.
    `private GralGraphicTimeOrder` | `initGuiCode` Instance to initialize the graphic.
    `static int` | `version` Version, history and license.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExampleSimpleButton(GralMng gralMng)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) void` | `execute()` Main execute method for any other actions than the graphical actions.
    `(package private) void` | `initGui()` Initializes the graphical user interface.
    `static void` | `main(java.lang.String[] args)` The main routine.
    `protected static void` | `main(java.lang.String[] args, ExampleSimpleButton.Factory factoryExample)` Main routine with a factory class.
    `protected void` | `setInitGuiCode(GralGraphicTimeOrder initGuiCode)`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### version

          public static final int version

      Version, history and license.
      - 2011-06-00 Hartmut created
      Copyright/Copyleft:
      For this source the LGPL Lesser General Public License, published by the Free Software Foundation is valid. It means:
      1. You can use this source without any restriction for any desired purpose.
      2. You can redistribute copies of this source to everybody.
      3. Every user of this source, also the user of redistribute copies with or without payment, must accept this license for further using.
      4. But the LPGL is not appropriate for a whole software product, if this source is only a part of them. It means, the user must publish this part of source, but doesn't need to publish the whole source of the own product.
      5. You can study and modify (improve) this source for own using or for redistribution, but you have to license the modified sources likewise under this LGPL Lesser General Public License. You mustn't delete this Copyright/Copyleft inscription in this source file.
      If you intent to use this source without publishing its usage, you can get a second license subscribing a special contract with the author.
      See Also:
        Constant Field Values

    - #### gui

          protected final ExampleSimpleButton.GuiElements gui

      Instance of inner class contains the graphical elements.

    - #### initGuiCode

          private GralGraphicTimeOrder initGuiCode

      Instance to initialize the graphic.

    - #### actionButtonCode

          private final GralUserAction actionButtonCode

      Code snippet for the action while the button is pressed. This snippet will be executed if the left mouse key is released on the button. If the left mouse is pressed and then the mouse cursor is removed from the button while it is pressed, the action is not executed. This is important if a touch screen is used and the accuracy of target seeking of the finger is not sufficient, the action can be aborted. If the mouse is pressed respectively the button is sought, the button changes its appearance, it is marked. That actions are done by the gral implementation independing of the implementation layer.

  - ### Constructor Detail

    - #### ExampleSimpleButton

          ExampleSimpleButton(GralMng gralMng)

  - ### Method Detail

    - #### setInitGuiCode

          protected void setInitGuiCode(GralGraphicTimeOrder initGuiCode)

    - #### initGui

          void initGui()

      Initializes the graphical user interface.

    - #### execute

          void execute()

      Main execute method for any other actions than the graphical actions. The application may do some things beside.

    - #### main

          public static void main(java.lang.String[] args)

      The main routine. It creates the factory of this class and then calls `main(String[], Factory)`. With that pattern a derived class may have a simple main routine too.
      Parameters:
        `args` - command line arguments.

    - #### main

          protected static void main(java.lang.String[] args,
                                     ExampleSimpleButton.Factory factoryExample)

      Main routine with a factory class. That allows to use the same main routine for a derived class for further more complex examples.
      Parameters:
        `args` - command line arguments.
        `factoryExample` - The factory to create the current class which should be derived from this.