Package swingtree.api

Interface Peeker<C>

Type Parameters:
C - The component type which should be modified.

public interface Peeker<C>
Applies an action to the current component typically as part of UIForAnySwing through method UIForAnything.peek(Peeker) with the purpose of expose the underlying component to the user while preserving a declarative method chaining based builder API usage pattern.

Consider the following example of a JProgressBar in a JPanel:


        UI.panel("fill")
        .add("span, grow, wrap",
             progressBar(UI.Align.HORIZONTAL, 0, 100)
             .withValue(68)
             .peek( it -> {
                 it.setString("%");
                 it.setStringPainted(true);
             })
             .withBackground(Color.WHITE)
        )
 	
Here you can see that we can use the Peeker implementation to access the underlying JProgressBar component and set its string and string painted properties while still using the declarative method chaining based builder API.

Also consider taking a look at the living swing-tree documentation where you can browse a large collection of examples demonstrating how to use the API of Swing-Tree in general.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    accept(C component)
    Applies an action to the current component.
  • Method Details

    • accept

      void accept(C component)
      Applies an action to the current component.
      Parameters:
      component - The component to be modified.