Class PrivBotFrame

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

public class PrivBotFrame extends JFrame
Reusable main frame for PrivBot plugin GUIs.

Provides a CardLayout center with a navigation rail on the left, search/filter bar, and status bar at the bottom. Subclasses register sections in their constructor and the frame builds navigation automatically.

Usage:


 public class MyCombatUI extends PrivBotFrame {
     public MyCombatUI() {
         super("My Combat Bot", 900, 650);
         registerSection("general", "General", "Settings", new GeneralPanel());
         registerSection("gear", "Gear Switching", "Settings", new GearPanel());
         registerSection("status", "Status", "Monitoring", new StatusPanel());
         buildUI();
     }
 }
 
  • Constructor Details

    • PrivBotFrame

      public PrivBotFrame(String title, int width, int height)
      Creates the frame with the given title and default size.
      Parameters:
      title - frame title
      width - default width
      height - default height
  • Method Details

    • registerSection

      protected void registerSection(String key, String title, String group, JComponent content)
      Registers a section to be displayed in the frame. Call this before buildUI().
      Parameters:
      key - unique identifier for the section
      title - display title shown in the navigation rail
      group - group name for filtering (e.g., "Settings", "Monitoring")
      content - the panel to display when this section is selected
    • buildUI

      protected void buildUI()
      Builds the UI after all sections have been registered. Must be called once from the subclass constructor.
    • showSection

      public void showSection(String key)
      Switches to the specified section.
      Parameters:
      key - the section key
    • setStatus

      public void setStatus(String text)
      Sets the status bar text.
    • getSections

      public Map<String,PrivBotFrame.SectionInfo> getSections()
      Returns all registered sections.
    • startRefreshTimer

      protected void startRefreshTimer(int intervalMs)
      Starts a periodic refresh timer. Override onRefresh() to update panels.
      Parameters:
      intervalMs - refresh interval in milliseconds
    • stopRefreshTimer

      protected void stopRefreshTimer()
      Stops the refresh timer.
    • onRefresh

      protected void onRefresh()
      Called periodically by the refresh timer. Override to update live data.
    • collectProfileState

      public Map<String,Object> collectProfileState()
      Collects profile state from all sections that implement ProfileStateParticipant.
      Returns:
      map of all profile state
    • loadProfileState

      public void loadProfileState(Map<String,Object> state)
      Loads profile state into all sections that implement ProfileStateParticipant.
      Parameters:
      state - the profile state to load
    • dispose

      public void dispose()
      Stops the refresh timer, then disposes the frame.
      Overrides:
      dispose in class Window