A way to change the modality of a dialog box modal false after is displayed?

I have a dialog window for users to connect. The window also has a progress bar that updates while the program is loading. I was wondering if any of you can think of a way for me to keep this modal dialog box so that the user logs on (until they click on the button), but then treated her in a modeless way. The answer obvious is briefly hide it, change mode and show once again, but he produced a spark and in my case the positioning changes sometimes, it is not ideal.

I tried to change just the modality in the executed the button action method, but he don't seem to have any effect.

A NBS illustrating the behavior I want to avoid are:
public class ModalDialogExample
{
    public static void main(String[] args)
    {
        //make a modal dialog
        final JDialog dialog = new JDialog( );
        dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
        dialog.setSize(400,400);

        //put a button on it
        final JButton button = new JButton("Click here to change modality type!");
        dialog.setLayout(new BorderLayout());
        dialog.add(button, BorderLayout.SOUTH);

        //when the button is clicked, change modality
        button.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent event) {
                dialog.setModalityType( Dialog.ModalityType.MODELESS );
                System.out.println( "I have set Modality type to MODELESS" );
            }
        });

        dialog.setVisible(true);

        //we never get here because the dialog isn't closed.
        //Is there a way to progress to this point while keeping the dialog visible?
        System.out.println( "No longer modal!" );
    }
}
Basically I want the click on a button function in the same way that a modal dialog box from closing normally would, in fact, that make sense?

If you have any questions or need any clarification, please let me know! Thank you.

Edited by: Caryy on December 7, 2010 16:54

Hi Caryy,

According to the document entitled: http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/modality/ I think that you have no other choice than to hide and show it again...

Changing the type of modality during execution. Changing the type of modality for a visible dialog box can have no effect until the dialog box is hidden and then shown again.

But using the distribed mechanism of owner in the document, you can be modal compared to an owner and modeless compared to a new framework...

Hope this can help...

Tags: Java

Similar Questions

  • How to disable the "Insert smart card" dialog box keeps appearing after the connection?

    Running Windows 7 64 bit on a laptop Dell which includes and integrated smart card reader. My configuration does not require a smart card to log on. I was wondering if the smart card reader has worked, I plugged a card chip used on another system. The driver is installed automatically, so it appears the drive works.

    Now, whenever I log in, the "Insert smart card" dialog box is displayed. If I cancel or close the box, he continues to reappear every few seconds. How to disable this behavior?

    Update: this is somehow connected to Outlook 2003. I have 4 different e-mail accounts. The "Insert smart card" box appears only when checking for my att account (yahoo), which is configured by using POP3.

    Go to the Services.msc and check the settings for the smartcard (manual test) service.

    Tom

    PS 29 December 2011

    The position of the OP, have been reported since a lot of this problem on the some notebooks Dell and HP. There are a few reports that a replacement of the motherboard fixed the problem and the other that the relocation of a certain connector (no mention of exaclly one that) solves the problem. Direct contact with the manufacturer of the laptop computer, Dell or HP wether, might be useful. Try a follow-up if you have already made contact.

    Tom

  • Change the link of Action dialog box

    I'm following this tutorial ( Oracle JDeveloper 11 g Release 2 tutorials - creating a Web Application using EJB, JPA, and JavaServer Faces ) and step 2: create a workflow defined with two Pages JSF, step 21. In the dialog box change the binding Action, in the value field, enter #{pageFlowScope.sal} I'm lost - I do not know how to open the link Action Edit dialog. I looked on the internet and it seems that it should open automatically after the addition of data control, but it did not happen or I missed it somehow... How should I open this dialog box?

    User, please tell us your jdev version!

    If you do not get the dialog box (don't know why you don't get it) you can open it yourself. Switch to the links tab (the tab is below the editing area in jdev). You find the action, you need to edit on the left side in the section "links". Select the link of action that you want to change (getEmployeesFindBySal in your case) and click on the pencil icon on the top right. This opens the dialog box you are looking for.

    Timo

  • on the different ways to change the color of the skin

    I love this video and ever since I discovered it I used the technique of myself, but how it differs from Select / range of colors and using the pipette and replace the skin darker with lighter skin like that? I've experimented with colors and simple forms and I see no difference.

    https://www.YouTube.com/watch?v=3lL8XUUWg_Q

    There are several ways to do the same thing in Color PS. range just selects an area of the same color. Once you get this selection is to you what method you want to use to edit the selected pixels. The curves were a way to change the tone of a color box. This video is just brushes in this correction, where as selective color selects these areas for you and may or may not give you a more accurate choice - could be too specific and show the transition.

  • Is there a way to change the returning to the previous lock screen "click on" sound?  In the last update, the sound has changed.

    In the last update, lock/nattering screen changed, is there a way to change the click / sound, so that it is similar to the sound of the previous version?

    # Which is integrated into the iOS and there is no user input that can change.

  • Is there a way to change the default options when receiving the Images on parachuting on a mac?

    Is there a way to change the default options when png or JPEG received on a mac? I can choose between backup to the downloads folder, or open photos. I would like to open in preview instead. Any ideas?

    Problem solved. No apparent reason, the two choices (save downloads and open in photos) presented disappeared and now I have the only option I get is to open the image in preview. No idea how this happened, but my problem is solved.

  • Any way to change the screen, keyboard split in OS9.2 version? I hate it

    Any way to change the screen, keyboard split in OS9.2 version? I hate it

    Split keyboard is purely optional. You probably activated by accident.

    Settings > general > keyboard > turn off the keyboard Split option, so it does not happen.

  • Is there a way to change the color of a 5 c?

    Is there a way to change the color of a 5 c?

    N °

  • Is there a way to change the camera settings if you do not see your own face?

    It may be a stupid and obvious question, but is there a way to change the settings of the camera on Skype, so you can see the other person and not yourself? He kills sort of the illusion of a conversation face to face when you have a clumsy mirror of yourself that you can not get rid of! I looked online for help with this and found nothing, and minimizes the cheat only I understand Skype altogether and end up with only a tiny picture of the other person. Looks like there must be a better way!

    Thank you!

    There is no option to remove the image of P - P yourself, but if you click on this image it will reduce to a small thumbnail image.

  • Is there a way to change the font size in the comments to a readable/superior police box? I went into preferences and tried making it bigger, and it does not work. Thank you.

    Is there a way to change the font size in the comments to a readable/superior police box? I went to Keynote > Preferences > General and tried making it bigger, and it does not work. Keynote 6.6.1 thanks.

    The fonts themselves, or one of the font attributes cannot be changed; (size, color, tabs or alignment)

    Although it would be very helpful to change the font size, in normal circumstances, this should not be a problem; comments are designed as a personal note by the designer and should only ever be seen by them.

  • Is there really no way to change the spacing of grid icon?

    My new iPad Pro is pretty well what I was hoping, with the exception of the 4 x 5 grid incredibly Needless to the app icons. On all other devices I use, this big screen would be comfortably and readable display four times more items, or more, avoiding to go back between home pages. I already spent a lot of time wandering through my pages trying to find applications of interest, and I just started to charge this device with the stuff I use. I understand the desire for consistency on all platforms, but this seems extreme. In this logic, all iOS devices should all have the same resolution too. As far as I can see, the only way to change the icon spacing is to jailbreak the device. Is this true?

    There is no way to change the spacing of app icon. Have you tried to use folders on your home screen?

  • looking for a way to change the font color in the hotmail to chat Messenger?

    I am running windows internet explore 9 and you are looking for a way to change the color of the font in hotmail to chat Messenger, can anyone help with this. You can email me at * address email is removed from the privacy * where I am away from my computer.

    Hello
    The question you have posted is related to Windows Live and would be better suited to the Discussion Windows Live groups. Please visit the link below to find a community that will provide the support you want.
    Hotmail Portal
  • Y at - it an easy way to change the stacking order of the controls on the front panel

    I have two controls. I would like to place the smaller one on the largest. Is there an easy way to change the stacking order?

    Thank you

    Chuck

    On top of your LabVIEW façade, there is a button that looks like two arrows going in a circle.
    Select the control, and then press "Send backward".

  • Is there a way to change the default (shrink to fit) printing to a custom print size

    Original title; Print (shrink to fit) default question?

    Is there a way to change the default (shrink to fit) print at a size of print without having to manually change whenever you are going to print?

    Hello

    I suggest you to return the item and check if it helps:

    To set the properties of the printer

    http://www.Microsoft.com/resources/documentation/Windows/XP/all/proddocs/en-us/print_setting_printer_props.mspx?mfr=true

    To set the default values to print

    http://www.Microsoft.com/resources/documentation/Windows/XP/all/proddocs/en-us/print_setting_document_defaults.mspx?mfr=true

  • HP OFFICEJET PRO 6230: Best way to change the settings WIFI on HP OFFICEJET PRO 6230

    Hi all

    Just after some advice about this printer. It's the printer be mobile , so it can be taken with the Member of staff, connected to wifi where they are and then the group they present to can do impressions of him through their ipads (via AirPrint).

    This all works well 'in House' connected to our wireless network. Have set up the printer wireless via the software installed on their laptop computer (with a USB cable to transfer the settings of the printer), but y at - it an EASY way to change the SSID and password wifi when they are there in the area? I know you can hold down the button "wifi" on the printer for three seconds (until the wireless flashes) then hold down the button "WPS" about to access/reuter and they have a link but it's only if WPS is available and that the staff member can access the reuter/access point.

    They will have their laptops with them and USB cable in order to re - set the SSID and password, but seems a bit lengthy to go by "connect a new printer" for each site they visit. Is the right way to do it or there at - it another way 'over easy' I forgot. I guess also here the printer remembers SSID/passwords so that there be set up a time for a given location and then will be "auto-connect" if they come back? Is this correct?

    Any help on this is much appreciated.

    See you soon,.

    Andy

    Not the printer that you want to do.  Here is the Guide of the user for you to read on your wireless options.

    http://support.HP.com/us-en/product/HP-OfficeJet-Pro-6230-ePrinter-series/5390318/model/5390319/manuals/

    You will need to run the configuration each time to connect software.  You could try Direct another wireless to connect to the printer.  You need a printer with a Panel for configuration complete front so you can easily change the SSID.

    Whatever it is, everyone will have to load the software in order to use the printer.  It can automatically connect, but do not count on it.

Maybe you are looking for

  • HP 19-2113w security

    Computer came with McAfee SafeLife - Internet Security pre-installed. I would like to know if Windows Defender and Windows Firewall that came with the computer, but not installed would be the way to go since the McAfee free trial version is about to

  • I have 109 IRQ with the compliant ACPI Microsoft-system description

    Original title - IRQ I have 109 IRQ with the compatible ACPI Microsoft-system description. IS this normal or am I safe to remove/disable all but 1? I think this may be the cause or caused by my system freezing and the origin of my screen to go black

  • DHCP for several local area networks VIRTUAL via SG200 - 50 p

    Here's my scenario.  One of my clients is an executive suite.  Each office gets its own internet through a separate router.  It is a big mess of wiring and confusion.  I want to simplify this by using a single router that feeds a single DHCP subnet t

  • Is there a Windows 7 Ultimate 64 bit trial?

    is it possible to get the original windows 7 ultimate 64 bit iso for the trial I want to get windows 7 64 bit for the trial period I can find many sites, but I don't trust them so, is there any way to get windows 7 ultimate 64 bit iso official as you

  • BlackBerry smartphones lost data from calendar

    I downloaded an update on my BlackBerry over the weekend. At the end of the download, I got a message in my calendar events were not loaded. Omigod. My calendar is empty. Does anyone have an idea where things went? Are they saved somewhere in my Blac