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
Solved

JDialog minimizing

Posted on 2001-08-13
4
2,647 Views
Last Modified: 2012-06-21
Hello,

I was wondering if the top level JDialog can have a minimize button ? I found how to do it for a JInternalFrame but I don't think I can use this as my top level window for the application (is this correct ?)

------ code----------
ABConsole m_console = new ABConsole();
m_console.show();
------ end code------

where :

ABConsole is

------ code----------
public class ABConsole extends JDialog
{
.....
}
------ end code------

what do I need to do to enable the "minimize" button in the title bar?
0
Comment
Question by:tomschuring1
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
Sendoh earned 50 total points
ID: 6382698
hi !
dont think u can make it using JDialog...
since it has been design to be in this way...
in order to fulfill ur requirement...
u can try using a normal frame or window to sinmulate as a dialog...:)

hope it helps...
0
 
LVL 6

Expert Comment

by:kotan
ID: 6382719
try this,

public class ABConsole extends javax.swing.JDialog {

    public ABConsole(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

    private void initComponents() {
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                closeDialog(evt);
            }
        });
       
        pack();
    }

    /** Closes the dialog */
    private void closeDialog(java.awt.event.WindowEvent evt) {
        setVisible(false);
        dispose();
     System.exit(1);
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
     new ABConsole(new javax.swing.JFrame(), true).show();
    }
}
0
 

Author Comment

by:tomschuring1
ID: 6382736
Hi Kotan, that just kills the whole dialog. I was looking for a minimize button.
0
 

Author Comment

by:tomschuring1
ID: 6382740
perhaps it is 'abusing' the JDialog functionality. I decided to go with a Frame instead. thanks
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

860 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