Solved

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

Posted on 2003-10-31
5
617 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mapAB Challlenge 35 123
Modeling a class in java 5 46
Which is the latest version of Apache Tomcatl 3 50
Strange loading of website behaviour 3 31
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

919 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