Can't have multiple modal dialogs?  What am I doing wrong?

The following applet is a VERY stripped down version of what I am writing. I have an applet which creates modal dialog in which a user will enter data, then if the user tries to close without saving, I pop up another modal dialog to ask the user to save. Everything is fine that far, then, when the user dismisses that dialog, for example (with Cancel) or pressing the X, things look fine, it goes back to the first modal dialog, but that dialog is no longer modal! I can access the underlying applet. Here is a VERY stripped down version. What am I doing wrong? Help! Thanks!
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.lang.*;
import java.net.*;
import javax.help.*;
import javax.swing.*;
import java.util.*;
public class SherlockApplet extends JApplet
     public void init()
     // get root frame of applet
Component component = this;
while (component.getParent() != null)
component = component.getParent();
Frame appletFrame = (Frame) component;
// create a modal dialog with the root frame as the parent
JDialog firstModalDialog = new JDialog(appletFrame);
     firstModalDialog.setModal(true);
     firstModalDialog.setSize(200, 200);
     // create another modal dialog with the first dialog as the parent
     final JDialog secondModalDialog = new JDialog(firstModalDialog);
     secondModalDialog.setModal(true);
     secondModalDialog.setSize(100, 100);
     // add a listener to pop up the second modal dialog when we try to close the first
     firstModalDialog.addWindowListener(
new WindowAdapter()
public void windowClosing(WindowEvent e)
secondModalDialog.show();
// make sure not to close the first dialog if the user clicks the X
firstModalDialog.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
     // show the first dialog
     firstModalDialog.show();
}

Good call dchsw, I tried 1.4.1_01 jre and it worked. If you run it with 1.3.0_01 jre you will see my problem. The problem for us is, we are stuck with 1.3.0_01 for our next release at least, due to Sun's decision to change event handling for java 1.4 jre and not make it backward compatible. I might have to hack my way around this one. Any other suggestions?
Thanks

Similar Messages

  • I'm trying to sync a 4s so that it can be activated w ATT...my computer says that I need to have 11.1 or higher in order to do that but when I download from the itunes site nothing happens and I still can't sync phone...what am I doing wrong?

    I'm trying to sync a 4s so that it can be activated w ATT...my computer says that I need to have 11.1 or higher in order to do that but when I download from the itunes site nothing happens and I still can't sync phone...what am I doing wrong?

    The screen that says "Download Now" also shows the proposed iTunes version number (in the box below):
    Be sure it indicates 11.1.3.
    If it is, here's further troubleshooting:
    http://support.apple.com/kb/TS1538

  • I have a pc and am using the trial version for now.  I have readabout and seen  on other computers, but no matter where i look or follow the dirrections i can not find the mini bridge what am i doing wrong.  thank yo

    i have a pc and am using the trial version for now.  I have readabout and seen  on other computers, but no matter where i look or follow the dirrections i can not find the mini bridge what am i doing wrong.  thank you

    CC and CC2014 are the current versions of Photoshop.  CC stands for Creative Cloud.
    That being cleared up, a respectful request:
    Topic or subject titles should be clear, pertinent and concise so that individual users can tell at a glance if they can help or not.
    That field is not for attempting to fit your entire question in there.
    Please keep this in mind next time you post.  Thank you.

  • I'm reading a pdf in ibook and it takes up the whole screen so I can't manage it... what am I doing wrong?

    I'm reading a pdf in ibook and it takes up the whole screen so I can't manage it... what am I doing wrong?

    its ok now...

  • I purchased Lion and installed it my first Mac.  I then went back to the apple store using my laptop to install Lion.  Under purchases it tells me I have no purchases.  What am I doing wrong?

    I purchased Lion and installed it my first Mac.  I then went back to the apple store using my laptop to install Lion.  Under purchases it tells me I have no purchases.  What am I doing wrong?

    Another option is to DL with the first Mac and save a copy of the installer app. Then, just copy it to the other machines and stop wasting resources DLing for each machine.

  • I was able to hook up my ATV with HDMI. The picture came out fine and i can navigate fine however i have no sound. What am I doing wrong?

    I was able to hook up my ATV with HDMI. The picture came out fine and I can navagate but I get no sound. What am I doing wrong?

    Thank you for all your responses to my questions really appreciate it.
    I have the HDMI cable hooked up directly to the TV and I do not have an optical hook up directly on the tv. The receiver is in a separate room. Not close enough to connect to the receiver. Can I connect the apple TV though my DVD player which has a HDMI port and in the same room as the receiver?

  • [SOLVED] Can't get GDM to run - what am I doing wrong?

    Alright, I'm running a fresh, up to date install of Arch in a virtual machine, and I'm consistently unable to get GDM to work properly. I pretty much followed the beginners' guide, and tried reinstalling from scratch several times. I've installed gdm, gnome, gnome-extra, dbus, and anything else the wiki recommends, like virtualbox-archlinux-additions. I edited /etc/inittab and /etc/rc.conf accordingly.
    Relevant lines in /etc/inittab:
    #Boot to X11
    id:5:initdefault:
    x:5:respawn:/usr/sbin/gdm -nodaemon
    Relevant lines in /etc/rc.conf:
    MODULES=(vboxguest vboxsf vboxvideo)
    DAEMONS=(syslog-ng dbus network crond)
    When I start the virtual machine, it displays the CLI login interface along with a bunch of warnings:
    Arch Linux 3.4.4-2-ARCH (tty1)
    vbox login: gdm-binary[388]: WARNING: GdmDisplay: display lasted 0.271335 seconds
    gdm-binary[388]: WARNING: GdmDisplay: display lasted 0.011053 seconds
    gdm-binary[388]: WARNING: GdmDisplay: display lasted 0.011250 seconds
    gdm-binary[388]: WARNING: GdmDisplay: display lasted 0.010699 seconds
    gdm-binary[388]: WARNING: GdmDisplay: display lasted 0.010361 seconds
    gdm-binary[388]: WARNING: GdmDisplay: display lasted 0.010921 seconds
    gdm-binary[388]: WARNING: GdmDisplay: GdmLocalDisplayFactory: maximum number of X display failures reached: check X server log for errors
    After that, I can still log in just fine, though I obviously never get into any desktop environment because of it. I have no idea where to find the X server log. I skimmed through /var/log, but couldn't find any log file with remotely helpful contents besides 'gdm'. The contents of the 'gdm' file:
    ** (gdm-binary:519): WARNING **: Failed to acquire org.gnome.DisplayManager
    ** (gdm-binary:519): WARNING **: Could not acquire name; bailing out
    I've been bashing my head against this problem for several days now, but been unable to actually fix it. Anyone feel like pointing out what I'm doing wrong or how to proceed?
    Last edited by Caelum (2012-07-11 19:44:04)

    Aaaand figured it out thanks to that one. I skipped starting it manually in this VM; got it to work when started manually on a previous install, and hence assumed it'd be fine.
    Turns out, I was doing the installations of the base packages - # pacman -S xorg-server xorg-xinit xorg-server-utils - wrong somehow. I think I must've missed that step or something; installing xorg-server and xorg-server-utils through Pacman just now solved my problem.
    Thanks for the help. Much appreciated.
    EDIT: Wonder, you ninja you.
    Last edited by Caelum (2012-07-11 19:45:28)

  • Can not use my backup photos, what am I doing wrong?

    I am having problems using the photos from my external hard drive. I switch library, and get all the thumbs up in iphoto. When I try to edit them or export in any way, I am not allowed to. This is very frustrating, can anyone tell me what I am doing wrong?

    n555:
    Welcome to the Apple Discussions. The "!" in the edit window indicates that iPhoto has lost the link to the original file in the Originals folder. Check in the Originals folder to make sure you have the full sized image files in there.
    Did you rename or move any files/folders in the iPhoto Library folder from the Finder? That's one way to get the situation you're experiencing but it would be only for those you tampered with. Since it's the entire library then you've probably fallen victim to the damaged database file problem that hit a lot of users.
    If the full sized image files are there you can try to rebuild the library as follows: launch iPhoto with the Command+Option keys depressed and follow the instructions to rebuild the library. Select all of the options. I'm not optimistic that the rebuild will recover your library but it's worth a try.
    If the rebuild does not work you'll have to start a new library and import the image files from the damaged one as follows:
    1 - rename the iPhoto Library folder that's on the external HD.
    2 - launch iPhoto with the Option key depressed and, when asked, select Create a new library, navigate to the external HD and do so.
    3 - with the new library open, drag the Originals folder from the old library into the open iPhoto window.
    This will give you a new library with the same rolls as the old one. However you'll lose your albums, slideshows, keywords, etc.
    To help protect from this type of problem in the future check out the tip at the end of my signature.
    Do you Twango?
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.

  • Hello like would anyone like to help me. I can,t get the control pallete to open so that I can chose a theme background ect. what am I doing wrong

    i CAN,T GET THE CONT PALETTE TO OPEN SO THAT i CAN CHOSE A THEME,BACKGROUND BORDER ETC.WHAT AM I DOING WRONG
    PLEASE HELP

    Duplicate post
    See my reply in other post

  • HT204380 When I contact someone with FaceTime, they can see me but not hear me.  I can see and hear them.  What am I doing wrong?

    When I contact someone on FaceTime, they can see me but not hear me.  I can see and hear them.  No one has ever been able to hear me.  What am I doing wrong?

    Using FaceTime http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime: Set-up, Use, and Troubleshooting Problems
    http://tinyurl.com/32drz3d
    I saw one post where a user said dust got inside the small microphone hole. Using a vacuum cleaner removed the dust and restored the audio.
     Cheers, Tom

  • HT2515 My cam works fine with every program except yahoo.  If I just sign into yahoo or even if I use ichat for yahoo, the webcam button will not highlight up.  How can I fix this and/or what am I doing wrong?

    Hello, my father recently passed (using his ID) and I took over the payments on his mac and took his computer.  I am not that familiar with mac, but am usually computer savy.  However, this one has me stumped.  I have no problem starting the built in cam and it seems to work fine with all other programs I've tried using it with.  However, it will not work with yahoo.  Whether I use normal yahoo messenger or if I try using Yahoo through I chat.  The cam button will not light up, therefore, it is not clickable.  Which ultimately means I cannot use my cam on yahoo, which is something I use 99% of the time compared to other programs.  So why is this happening and what solutions can I take to try and fix this?  The mac I am using is: Mac OS X, Version 10.7.4
    Thank you for any and all help, it is much appreciated. 

    Welcome to Apple Discussions!
    1) If the iTunes preference window is open when you connect your iPod, the iPod will not be recognized by iTunes.
    Also, iPods can work with many iTunes libraries, so that is not the problem here.
    Is all the software on your computer up to date?
    iTunes
    iPod Updater
    Updating iPod's Software
    Does the iPod show up in My Computer when connected to your computer? Does it say Do Not Disconnect?
    Try the steps listed here...
    iPod shows up in Windows but not in iTunes
    If you are going to use your iPod with multiple iTunes libraries (home and school)...
    Using iPod with multiple computers
    2) What part aren't you understanding. Here are a couple of free programs you can use to convert videos...
    MPEG Streamclip
    Videora iPod Converter
    The programs should come with documentation and instructions to convert videos.
    3) You can go to file-->add file to library, file-->add folder to library, or have iTunes open and drag the files into the iTunes library while viewing the library.. You can also import from CDs.
    iTunes needs to be adding the songs to the iPod. You cannot just add the song files to the iPod.
    btabz

  • Can somebody please explain to me what I'm doing wrong (RE: PPI)

    I have a file that I have rasterized and saved as a PDF, in Illustrator. It's perfect as is, but I want to lower the PPI so the PDF can also be easily sent in an email without it being a large file. (The current file is around 7mb.)
    I used the Effects > Doc Raster Effects Setting to lower the PPI, and the only thing that happened is the file size only became few kb less than the original. I tried again, this time lowering the PPI all the way to a measely 7 (can I even do that?), and the file this time managed to get larger than the original. Not by much, mind you, but it's still baffling.
    I don't particularly care how I acheive the effect, but I'd like to lower the file size. Also, can someone explain to me what I am obviously not understanding about PPI? Freakin' PPI, how does THAT work?
    Thanks!
    Jen

    esaisquoi wrote:
    I have a file that I have rasterized and saved as a PDF, in Illustrator. It's perfect as is, but I want to lower the PPI so the PDF can also be easily sent in an email without it being a large file. (The current file is around 7mb.)
    Rasterizing usually increases the size of Illustrator files. A circle, for example, requires very little data to be drawn. There are a total of twelve points, each with X,Y coordinates, a fill, and a stroke. This circle is stored as a mathematically defined path and will always be drawn sharply at all sizes and print sharply at all resolutions. This is called a vector graphic.
    When you rasterize it you convert it to a large grid of pixels, each with its own colour value. Even a small circle at low resolution (say, 1 inch diameter at 72 ppi or pixels per inch) requires at least 15,552 bytes of data: 72 pixels across times 72 pixels down times three bytes to store the RGB colour information for each pixel. There is also some data required to identify the type of object (a bitmap graphic) and its position on the page. THis circle will only look good if viewed at a specific size and will always print poorly. It is also much harder to edit since it is no longer seen as a circle with a fill and a stroke in Illustrator. Making the fill a different colour will be extremely difficult. Fortunately for our example, the shape is simple to recreate. This is called a raster image.
    In the above example rasterizing has made the file larger, harder to edit, and print poorly. All of these are bad.
    Some very elaborate and complex vector graphics may be saved with less data by being rasterized, but these are rare, and they will still be impossible to edit and still print poorly because the resolution of the graphic is fixed. The advantage of vectors is the resolution is infinite. Print on a crummy inkjet and you get the best quality output of that printer. Print on an offset press and you get the best possible output on the press. View on your monitor and you get the best possible display your monitor can produce.
    I used the Effects > Doc Raster Effects Setting to lower the PPI, and the only thing that happened is the file size only became few kb less than the original. I tried again, this time lowering the PPI all the way to a measely 7 (can I even do that?), and the file this time managed to get larger than the original. Not by much, mind you, but it's still baffling.
    This did nothing. Document Raster Effects Settings applies to any effect in the Effects menu that produce a raster image rather than a vector, which only applies to a few commands. Effect > Stylize > Drop Shadow, Inner Glow, Outer Glow, and Feather are some, as are all the effects below Photoshop Effects. The setting has no effects on anything that has already been rasterized.
    Raster effects are effects that Illustrator cannot easily reproduce without using some bitmapped or raster data rather than drawing it entirely with vectors. Effect > Distort & Transform > Roughen, for example, applies some mathematical transformation to the selected paths, so does not need rasterization. But Effect > Stylize > Drop Shadow produces a blurry transparent shadow that looks best if it is a raster. The Photoshop Effects only work on graphics that are already rasterized, so Illustrator rasterizes them in the background first. Document Raster Effects Settings lets you globally define the resolution of all such effects in the document. Higher values produce smoother effects when enlarging or scaling, at the expense of speed and file size.
    I don't particularly care how I acheive the effect, but I'd like to lower the file size.
    I don’t know what effect you are trying to produce. Use the camera icon at the top of a reply to attach a screen grab of what you have drawn. If this is not exactly what you want, but you can find it somewhere else on the web, post a screen grab of that, too.
    Also, can someone explain to me what I am obviously not understanding about PPI? Freakin' PPI, how does THAT work?
    PPI stands for Pixels Per Inch. A pixel is the smallest part of data in a bitmapped or raster image. If you never rasterize anything in Illustrator, never use a raster effect, and never rasterize anything, then pixels per inch means nothing to your file because nothing is saved as a pixel. If you rasterize something, import a raster image, or use a raster effect, then you have introduced some feature to your file that cannot be completely defined using mathematical paths. This is instead saved as a two dimensional grid of coloured squares. Each of these squares is a pixel. The more pixels you use to define a graphic, the more detail that graphic contains and the larger the file.
    By definition a pixel has no size. But Illustrator uses a physical measurement like inches, centimetres, or points to define the size of everything. This means the pixels in your file must have a size, too. Pixels are not defined by size because one does not manipulate single pixels like they are objects. One generally refers to the density of pixels in a unit of measure. So a pixel is not .0033 inches, or 1/300 of an inch, rather a raster image is defined as being 300 pixels per inch. if that same image is enlarged to 200% its pixels are enlarged, so it becomes 150 pixels per inch. If this is an Illustrator path with a raster effect, the effect is recalculated after the drawing is enlarged and is still 300 pixels per inch, but now contains four times as many pixels (twice as many across, twice and many top to bottom).

  • I installed win 8.1 on my iMac on the bootcamp partition and can't access OSX anymore. What am I doing wrong?

    Ever since I installed Windows I don't have an option to switch to Mac.I installed it on the bootcamp partition with the lastest OSX and Windows versions. I did this a few years ago with an older Mac and Vista and remembered a prompt to choose OS during boot. I get nothing but Windows now. Any ideas?

    if you restsrt and hold down alt, what boot options do you see
    try restarting holding down command+R, choose disk utility and tell me what you see on the upper left hand side under the name of your physical drive

  • HT201364 I just installed more memory and I still can't install OS X mavericks what am I doing wrong?

    I installed more memory becase I got a message that I didn't have enough how I went from 4g to 16g and still not enough?????

    Okay,
    It would help us to help you if we could have some more technical info about your iMac.
    If you so choose, Please download, install and run Etrecheck.
    Etrecheck was developed as a simple Mac diagnostic reporting tool by a regular Apple Support forum user and technical support contributor named Etresoft.
    Etrecheck is a small, unobstrusive app that compiles a static snapshot of your entire Mac hardware system and installed software.
    This is a free app that has been honestly created to provided help in diagnosing issues with Macs running the new OS X 10.9 Mavericks.
    It is not malware and can be safely downloaded and installed onto your Mac.
    http://www.etresoft.com/etrecheck
    Copy/paste and post its report here in another reply thread so that we have a complete profile of your Mac's hardware and installed software so we can all help with your Mac performance issues.
    Thank You.

  • I can't seem to figure out what I am doing wrong any suggestions?

    I will admit right off that I am a newb. I have done some programming with C++ but I have just started with JAVA.
    here is the problem. I am writing a program for a course I am in and I have it basically put together but no matter what I do I cant seem to figure out the correct input command to retrieve keystrokes.
    I will post the source code and then the error from netbeans 4.1 debug report:
    package assignment_one;
    import java.io.*;
    import java.util.*;
    /* @author Justin Jackson
    * a program to calculate total gross earnings
    * for one week*/
    public class Main {
    public Main() {
    public static void main(String[] args) {
    InputStreamReader charReader = new
    InputStreamReader(System.in);
    BufferedReader keyboard=new
    BufferedReader(charReader);
    int i; //test to see if loop or end
    int iBasePay; //base pay rate
    int iTotRegHr; //total hours up to 40
    int iTotOtHr; //total hours over 40
    float fTotPay; //total pay
    float fOtRate; //calculated overtime rate
    System.out.println("To calculate a paycheck, please press 1");
    System.out.println("To exit, please press 2");
    i = keyboard.read();
    if (i == 1){
    System.out.println("Please enter the base pay: ");
    iBasePay = keyboard.read();
    System.out.println("Thank you.");
    System.out.println("Please enter the total hours up to 40: ");
    iTotRegHr =keyboard.read();
    System.out.println("Thank you.");
    System.out.println("Please enter any hours over 40: ");
    iTotOtHr = keyboard.read();
    System.out.println("Thank you.");
    fOtRate = (iBasePay * 1.5f);
    fTotPay = (iBasePay * iTotRegHr) + (iTotOtHr * fOtRate);
    System.out.print("The total wage is: " + fTotPay);
    if (i == 2){
    System.out.println("Thank you for using this program ... Goodbye.");
    else {
    System.out.println("I am sorry, that is not a valid option");
    error report:
    init:
    deps-jar:
    Compiling 1 source file to /home/justin/Assignment_One/build/classes
    /home/justin/Assignment_One/src/assignment_one/Main.java:32: unreported exception java.io.IOException; must be caught or declared to be thrown
    i = keyboard.read();
    /home/justin/Assignment_One/src/assignment_one/Main.java:36: unreported exception java.io.IOException; must be caught or declared to be thrown
    iBasePay = keyboard.read();
    /home/justin/Assignment_One/src/assignment_one/Main.java:39: unreported exception java.io.IOException; must be caught or declared to be thrown
    iTotRegHr =keyboard.read();
    /home/justin/Assignment_One/src/assignment_one/Main.java:42: unreported exception java.io.IOException; must be caught or declared to be thrown
    iTotOtHr = keyboard.read();
    4 errors
    BUILD FAILED (total time: 1 second)

    Just like the message says you need to
    1) Declare it to be thrown or
    2) Catch java.io.IOException.
    For case one add throws java.io.IOException to your main:
    public static void main(String[] args) throws java.io.IOException {For case two put your code inside of
    public static void main(String[] args) {
      try {
         //your code here
       } catch (java.io.IOException ex) {
          ex.printStackTrace();
    }

Maybe you are looking for