Class CodeBlockRenderer

java.lang.Object
uno.anahata.ai.swing.render.CodeBlockRenderer

public final class CodeBlockRenderer extends Object
A utility class responsible for creating syntax-highlighted code block components.
Author:
anahata
  • Method Details

    • render

      public static JComponent render(String language, String code, EditorKitProvider editorKitProvider)
      Creates a syntax-highlighted JEditorPane for the given code, wraps it in a JScrollPane, and returns the component.
      Parameters:
      language - The programming language for syntax highlighting.
      code - The source code to render.
      editorKitProvider - The provider to get the correct EditorKit from.
      Returns:
      A JComponent (a JScrollPane containing the JEditorPane) ready to be displayed.