UIForEditorPane.java

  1. package swingtree;

  2. import javax.swing.*;
  3. import java.util.Objects;

  4. /**
  5.  *  A SwingTree builder node designed for configuring {@link JEditorPane} instances.
  6.  *  <p>
  7.  *  <b>Take a look at the <a href="https://globaltcad.github.io/swing-tree/">living swing-tree documentation</a>
  8.  *  where you can browse a large collection of examples demonstrating how to use the API of this class or other classes.</b>
  9.  */
  10. public final class UIForEditorPane<P extends JEditorPane> extends UIForAnyEditorPane<UIForEditorPane<P>, P>
  11. {
  12.     private final BuilderState<P> _state;

  13.     /**
  14.      * {@link UIForAnySwing} (sub)types always wrap
  15.      * a single component for which they are responsible.
  16.      *
  17.      * @param state The {@link BuilderState} containing the component which will be managed by this builder.
  18.      */
  19.     UIForEditorPane( BuilderState<P> state ) {
  20.         Objects.requireNonNull(state, "state");
  21.         _state = state;
  22.     }

  23.     @Override
  24.     protected BuilderState<P> _state() {
  25.         return _state;
  26.     }
  27.    
  28.     @Override
  29.     protected UIForEditorPane<P> _newBuilderWithState(BuilderState<P> newState ) {
  30.         return new UIForEditorPane<>(newState);
  31.     }
  32. }