Class SwingExamples

java.lang.Object
net.jrodolfo.java_evolution.java02.swing.SwingExamples

public class SwingExamples extends Object
Demonstrates headless-safe Swing concepts from the Java 2 platform.
  • Constructor Details

    • SwingExamples

      public SwingExamples()
  • Method Details

    • listModelSnapshot

      public List listModelSnapshot()
      Uses Swing's list model without creating a visible list component.
      Returns:
      ordered snapshot of model values
    • tableModelValue

      public String tableModelValue()
      Uses Swing's table model as a data model separate from visible rendering.
      Returns:
      value stored in the first table row
    • buttonActionClicks

      public int buttonActionClicks()
      Triggers a Swing action through a button model without showing a window.
      Returns:
      number of times the action was invoked
    • runsOnEventDispatchThread

      public boolean runsOnEventDispatchThread() throws InvocationTargetException, InterruptedException
      Runs code on Swing's Event Dispatch Thread (EDT).
      Returns:
      true when the callback ran on the EDT
      Throws:
      InvocationTargetException - when the callback fails
      InterruptedException - when interrupted while waiting for the EDT