Class MainWindow

java.lang.Object
net.lenni0451.imnbt.ui.types.Window
net.lenni0451.imnbt.ui.windows.MainWindow

public class MainWindow extends Window
The main window of ImNbt.
  • Field Summary

    Fields inherited from class net.lenni0451.imnbt.ui.types.Window

    drawer
  • Constructor Summary

    Constructors
    Constructor
    Description
    MainWindow(ImNbtDrawer drawer, FontHandler fontHandler)
    Create a new main window.
    The font handler is required when using the font size menu.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    dragAndDrop(File file, byte[] data)
    Handle a file being dropped on the window.
    net.lenni0451.mcstructs.nbt.INbtTag
     
    net.lenni0451.mcstructs.nbt.INbtTag[]
     
    void
    open(byte[] data, String fileName, String filePath)
     
    void
    Redo the last undone action.
    If no action can be redone nothing will happen.
    void
    Render the window content.
    void
    Save the currently open tab.
    If the file has a path associated with it, it will be saved to that path.
    If the file has no path associated with it, a save dialog will be opened.
    If no tab is open or the current tag is not modified nothing will happen.
    void
     
    void
    Undo the last action.
    If no action can be undone nothing will happen.

    Methods inherited from class net.lenni0451.imnbt.ui.types.Window

    hide, show

    Methods inherited from class java.lang.Object

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

    • MainWindow

      public MainWindow(ImNbtDrawer drawer, @Nullable FontHandler fontHandler)
      Create a new main window.
      The font handler is required when using the font size menu. If you don't want to use it you can pass null.
      Parameters:
      drawer - The drawer instance
      fontHandler - The font handler to use
  • Method Details

    • getOpenTab

      @Nullable public net.lenni0451.mcstructs.nbt.INbtTag getOpenTab()
      Returns:
      The tag of the currently open tab
    • getTabs

      public net.lenni0451.mcstructs.nbt.INbtTag[] getTabs()
      Returns:
      The tags of all tabs
    • undo

      public void undo()
      Undo the last action.
      If no action can be undone nothing will happen.
    • redo

      public void redo()
      Redo the last undone action.
      If no action can be redone nothing will happen.
    • saveCurrent

      public void saveCurrent()
      Save the currently open tab.
      If the file has a path associated with it, it will be saved to that path.
      If the file has no path associated with it, a save dialog will be opened.
      If no tab is open or the current tag is not modified nothing will happen.
    • render

      public void render()
      Description copied from class: Window
      Render the window content.
      Specified by:
      render in class Window
    • chooseFile

      public void chooseFile()
    • dragAndDrop

      public void dragAndDrop(File file, byte[] data)
      Description copied from class: Window
      Handle a file being dropped on the window.
      Overrides:
      dragAndDrop in class Window
      Parameters:
      file - The file that was dropped
      data - The raw data of the file
    • open

      public void open(byte[] data, String fileName, String filePath)
    • saveFile

      public void saveFile()