Class MainWindow

java.lang.Object
org.collebol.engine.gui.MainWindow
All Implemented Interfaces:
Runnable

public class MainWindow extends Object implements Runnable
The MainWindow class represents the main window of the EJGEngine application. It is responsible for initializing and managing the window, handling input events, and rendering the panels.

This class provides methods to register and switch between different panels, set window properties such as title and size, and display development tools.

By default, the Main class extended to EJGEngine instance has already a MainWindow object made.

Usage:

     MainWindow mainWindow = new MainWindow(engine);
     mainWindow.run();
 

For more information, please refer to the EJGEngine Wiki.

Since:
1.0-dev
Author:
ColleBol - contact@collebol.org
  • Constructor Details

    • MainWindow

      public MainWindow(EJGEngine e)
      Constructs a MainWindow instance with the specified engine.
      Parameters:
      e - the EJGEngine instance
  • Method Details

    • run

      public void run()
      Runs the main loop of the window, initializing and rendering the panels.
      Specified by:
      run in interface Runnable
    • showDevelopmentTools

      public void showDevelopmentTools()
      There will be development tools rendered on the panel.
      • Grid lines
      • Coordinates
      • Origin-point
      • Screen details
    • registerPanel

      public void registerPanel(Panel panel)
      Add a panel to the window where you can switch between.
      Parameters:
      panel - A panel in the main window
    • setPanel

      public void setPanel(int i)
      Display the given panel.
      Parameters:
      i - Panel id.
    • getCurrentPanel

      public Panel getCurrentPanel()
      Gives the current panel of the window.
      Returns:
      The panel that is displaying!
    • getTitle

      public String getTitle()
    • setTitle

      public void setTitle(String title)
    • getRefreshInterval

      public int getRefreshInterval()
    • setRefreshInterval

      public void setRefreshInterval(int refreshInterval)
    • getTileSize

      public int getTileSize()
    • setTileSize

      public void setTileSize(int tileSize)
    • getScale

      public int getScale()
    • setScale

      public void setScale(int scale)
    • getMaxTileWidth

      public int getMaxTileWidth()
    • setMaxTileWidth

      public void setMaxTileWidth(int maxTileWidth)
    • getMaxTileHeight

      public int getMaxTileHeight()
    • setMaxTileHeight

      public void setMaxTileHeight(int maxTileHeight)
    • getWidth

      public int getWidth()
    • setWidth

      public void setWidth(int width)
    • getHeight

      public int getHeight()
    • setHeight

      public void setHeight(int height)
    • getMouseHandler

      public MouseHandler getMouseHandler()