Solved

JDialog minimizing

Posted on 2001-08-13
4
2,643 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
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 …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This video teaches viewers about errors in exception handling.

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now