import java.awt.*;
import javax.swing.*;

public class TestIconify extends Frame {
    private JTextArea textArea;
    private final JFrame frame = new JFrame();

    // This Test is expected to bring up a frame without elements,
    // then iconify the frame and then set the elements visible.
    //
    // If the frame is deminimized by the user it should show the
    // elements.
    //
    // The actual behaviour varies over the operating systems:
    //
    // Linux:
    // The frame comes up with the textArea visible (a blinking
    // cursor can be seen).
    //
    // Mac before JDK-8139208
    // The frame comes up and minimizes immediately.
    // After deminimizing by the user the textArea is visible
    // (a blinking cursor can be seen).
    //
    // Mac after JDK-8139208
    // The frame comes up with the textArea NOT visible. It does
    // not minimize automatically.
    // Minimizing and deminimizing by the user makes the textArea
    // visible (a blinking cursor can be seen).
    //
    // Windows:
    // Only a minimized icon in the taskbar gets visible.
    // Deminimizing this by the user makes the textArea
    // visible.
    public TestIconify(String title) {
        // These two statements are just for convenience.
        frame.setSize(100,200);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        textArea = new JTextArea(10, 80);
        JScrollPane scrollPane = new JScrollPane(textArea,
                                                 ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                 ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        frame.add(scrollPane, BorderLayout.CENTER);

        frame.setExtendedState(JFrame.ICONIFIED);
        frame.setVisible(true);
    }

    public static void main(String[] argv) {
        new TestIconify("");
    }
}
