Class DocsFrame

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class DocsFrame extends JFrame
The DocsFrame class represents a JFrame for displaying documentation within the J3Engine. It can display a list of available documentation files or the content of a specific document, including formatted text, images, and navigable headers.

This frame dynamically parses J3Engine's custom markdown-like documentation files (.j3.md) and renders them using Swing components. It supports hierarchical navigation through headers via a JTree and handles internal and external links.

Author:
yetnt
See Also:
  • Field Details

  • Constructor Details

    • DocsFrame

      public DocsFrame()
      Creates a new HelpFrame that displays a list of available help documents.
    • DocsFrame

      public DocsFrame(String fileIdentifier)
      Creates a new HelpFrame that displays the content of a specific help document.
      Parameters:
      fileIdentifier - The identifier of the help document to display.
  • Method Details

    • colors

      private void colors()
    • setTree

      private void setTree(String title)
      Initializes the JTree component for displaying help document headers. It sets up the tree's UI, creates a root node, and adds a mouse listener to handle double-click events for navigating to header content.
      Parameters:
      title - The title for the root node of the help tree.
    • expandAll

      private void expandAll(JTree tree, TreePath parent)
    • addTreeNode

      private void addTreeNode(HeaderIdentifier parent, HeaderIdentifier child)
      Adds a child node to the tree under a specified parent node.
      Parameters:
      parent - The HeaderIdentifier representing the parent node.
      child - The HeaderIdentifier representing the child node to be added.
    • addHeader

      private void addHeader(HeaderIdentifier child)
      Adds a header to the tree structure, maintaining the hierarchical order based on header levels. This method also updates the internal tempHeaderHierachy to keep track of the current path in the tree.
      Parameters:
      child - The HeaderIdentifier representing the header to be added.
    • scrollToHeader

      public DocsFrame scrollToHeader(String header)
    • parse

      private void parse(JarPath file) throws FileNotFoundException
      Throws:
      FileNotFoundException
    • lineSeparator

      private void lineSeparator()
    • addLinks

      private void addLinks(ArrayList<TLink> linksPerParagraph)
    • testStuff

      private void testStuff()
    • initComponents

      private void initComponents()
      This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
    • main

      public static void main(String[] args)
      Parameters:
      args - the command line arguments