Package hoverball

Class Application

java.lang.Object
hoverball.Application

public abstract class Application
extends java.lang.Object
The class Application administrates the outer window where all windows of a Hoverball application are displayed.

All Hoverball windows are represented as internal frames (class JInternalFrame). Only the application window is a top-level frame (class JFrame) that shows the Hoverball windows on its desktop (class JDesktopPane). Please note:

  • The standard windows (of the Simulator and the Controller together with Screen, as well as the Hovlet browser) are automatically put on the desktop. Only self-defined windows that are to be shown in the application window, must be added to the desktop by

    Application.desktop.add(...);

  • The position and size of the application window can be determined by the methods

    Application.setBounds(...);

    If you display only one single window in a Hoverball application (e.g. by launching only the Simulator), the application window can be adjusted directly to the dimensions of the second window by

    Application.setBounds();

    That is to say, the application window inherits the attributes of the inner window.

  • The application window opens automatically as soon as a standard window gets visible. If required, it can be opened "manually" by

    Application.show();

  • The automatic showing mechanism can be suppressed with

    Application.hide();

    at the beginning of the application.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static javax.swing.JDesktopPane desktop
      Desktop of the application window
      static javax.swing.JFrame frame
      Frame of the application window
    • Constructor Summary

      Constructors 
      Constructor Description
      Application()  
    • Method Summary

      Modifier and Type Method Description
      static void connect​(java.lang.String address)
      Connects the Hoverball application to the specified address.
      static void disconnect()
      Disconnects the Hoverball application.
      static void exit()
      Closes the application window and quits the program.
      static java.awt.Rectangle getBounds()
      Returns the application window bounds.
      static java.lang.String getTitle()
      Returns the application window title.
      static void hide()
      Hides the application window.
      static void setBounds()
      Adjusts the application window to a single displayed window.
      static void setBounds​(double ratio)
      Defines the application window bounds.
      static void setBounds​(java.awt.Dimension size)
      Defines the application window bounds.
      static void setBounds​(java.awt.Rectangle bounds)
      Defines the application window bounds.
      static void setTitle​(java.lang.String title)
      Defines the application window title.
      static void show()
      Shows the application window (explicit call not necessary).

      Methods inherited from class java.lang.Object

      clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Details

      • desktop

        public static final javax.swing.JDesktopPane desktop
        Desktop of the application window
      • frame

        public static final javax.swing.JFrame frame
        Frame of the application window
    • Constructor Details

    • Method Details

      • connect

        public static void connect​(java.lang.String address)
        Connects the Hoverball application to the specified address.
        Parameters:
        address - network address
      • disconnect

        public static void disconnect()
        Disconnects the Hoverball application.
      • getBounds

        public static java.awt.Rectangle getBounds()
        Returns the application window bounds.
        Returns:
        the bounds
      • setBounds

        public static void setBounds()
        Adjusts the application window to a single displayed window.

        When the application window is opened, it assumes the attributes of the first visible window in the list of the dektop.

      • setBounds

        public static void setBounds​(double ratio)
        Defines the application window bounds.
        Parameters:
        ratio - ratio frame bounds / full screen (between 0 and 1)
      • setBounds

        public static void setBounds​(java.awt.Dimension size)
        Defines the application window bounds.
        Parameters:
        size - frame size
      • setBounds

        public static void setBounds​(java.awt.Rectangle bounds)
        Defines the application window bounds.
        Parameters:
        bounds - frame bounds
      • getTitle

        public static java.lang.String getTitle()
        Returns the application window title.
        Returns:
        the title
      • setTitle

        public static void setTitle​(java.lang.String title)
        Defines the application window title.
        Parameters:
        title - title
      • exit

        public static void exit()
        Closes the application window and quits the program.
      • show

        public static void show()
        Shows the application window (explicit call not necessary).
      • hide

        public static void hide()
        Hides the application window. If this method is called at the beginning, the Application window will not be shown automatically and stays hidden.