Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Deiconify a Frame from within the application

Posted on 2000-05-12
Last Modified: 2008-02-01
Does anyone know how to deiconify an iconified frame from within the Java Application?
Question by:lvantine
  • 2
LVL 19

Accepted Solution

Jim Cakalic earned 75 total points
ID: 2805164
You can use Frame.setState(Frame.NORMAL) to restore an iconified frame programatically. Here is a simple example which will restore a frame to normal 5 seconds after it has been iconified.

---------- IconifiedTest.java ----------
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

class RestoreFrame implements Runnable {
    JFrame frame;

    public RestoreFrame(JFrame frame) {
        this.frame = frame;
    public void run() {
        try {
        } catch (InterruptedException e) {
        } finally {

public class IconifiedTest {
    JFrame frame;

    public IconifiedTest() {
        frame = new JFrame("Background test");
        frame.getContentPane().setLayout(new GridBagLayout());
        frame.addWindowListener(new WindowAdapter() {
            public void windowIconified(WindowEvent e) {
                Runnable r = new RestoreFrame(frame);
                new Thread(r).start();
            public void windowClosing(WindowEvent e) {
        JButton iconify = new JButton("Iconify");
        iconify.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {

    public static void main(String[] args) {
        IconifiedTest app = new IconifiedTest();

---------- end ----------

Best regards,
Jim Cakalic

Expert Comment

ID: 2805277
LOL, Jim, a complementary example on using Runnable, threads and listeners! I say you should give Jim some more points, lvantine.
LVL 19

Expert Comment

by:Jim Cakalic
ID: 2805312
I do what I can :-)

Expert Comment

ID: 2805436
And that's a lot!!!

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
replace a word with other 1 45
couple of eclipse 5 45
How to execute a Python program and gather return output in Java 2 40
throw exception 21 58
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question