Solved

How to remove the "X" closing button from a JDialog box?

Posted on 2003-10-31
5
600 Views
Last Modified: 2007-12-19
How to remove the "X" closing button from a JDialog box?
i don't want to just disable the closing action writing my own event handlers.
I don't want the 'X' button to be seen at all.
0
Comment
Question by:sharath_kulal
  • 4
5 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 9656438
0
 
LVL 35

Expert Comment

by:TimYates
ID: 9656446
Something like:

dlg.setUndecorated( true );
dlg.getRootPane().setWindowDecorationStyle ( JRootPane. PLAIN_DIALOG );
0
 
LVL 1

Author Comment

by:sharath_kulal
ID: 9656593
But i want the title bar to be displayed
0
 
LVL 35

Accepted Solution

by:
TimYates earned 250 total points
ID: 9656623
That should show the title dialog..

    JDialog dlg = new JDialog( new Frame(), true ) ;
    dlg.setUndecorated( true );
    dlg.getRootPane().setWindowDecorationStyle( JRootPane.PLAIN_DIALOG );
    dlg.setTitle( "Test Dialog" );
    dlg.setSize( new Dimension( 320, 200 ) ) ;
    dlg.show() ;

Shows the title bar...but no close button...

0
 
LVL 35

Expert Comment

by:TimYates
ID: 9656624
you mean the system title bar?

You can't get rid of the system close button...that's put there by the system...
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
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…

762 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

18 Experts available now in Live!

Get 1:1 Help Now