Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

JDialog minimizing

Posted on 2001-08-13
4
Medium Priority
?
2,657 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 150 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
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 …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

916 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