Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. Swing JDialog bug? [modified]

Swing JDialog bug? [modified]

Scheduled Pinned Locked Moved Java
helpjavaquestionannouncementcareer
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    amit ofer
    wrote on last edited by
    #1

    hi, I'm trying to create my own dialog by extending the JDialog class this is the code i used to start:

    import javax.swing.JDialog;

    public class ColorManager extends JDialog{

    private static final long serialVersionUID = 1L;
    public ColorManager(){
        super();
    this.setDefaultCloseOperation(JDialog.DISPOSE\_ON\_CLOSE);
        this.pack();
        this.setVisible(true);
    	
    }
    

    }

    when i try to run the code it works fine but i'm getting the following exception: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: defaultCloseOperation must be one of: DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, or DISPOSE_ON_CLOSE i read that there were problems with WINDOWS_EXIT or something like that but the parameter i pass should do the job. the thing that makes it even weirder is that when i change my class so it will contain a JDialog field instead of extending it, it seems to work just fine. I asked a friend to test this on his computer and the code did not throw the exception, he is using jre version 1.6.022 and I'm using 1.6.022 both of us are using 64 bit. so what did i do wrong? or is that a bug in the JRE? thank, Amit ofer Edit: forgot to mention, I'm using eclipse Edit2: i tried the same code in Netbeans and it works fine, what could be my problem??

    modified on Saturday, March 26, 2011 7:12 AM

    T 1 Reply Last reply
    0
    • A amit ofer

      hi, I'm trying to create my own dialog by extending the JDialog class this is the code i used to start:

      import javax.swing.JDialog;

      public class ColorManager extends JDialog{

      private static final long serialVersionUID = 1L;
      public ColorManager(){
          super();
      this.setDefaultCloseOperation(JDialog.DISPOSE\_ON\_CLOSE);
          this.pack();
          this.setVisible(true);
      	
      }
      

      }

      when i try to run the code it works fine but i'm getting the following exception: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: defaultCloseOperation must be one of: DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, or DISPOSE_ON_CLOSE i read that there were problems with WINDOWS_EXIT or something like that but the parameter i pass should do the job. the thing that makes it even weirder is that when i change my class so it will contain a JDialog field instead of extending it, it seems to work just fine. I asked a friend to test this on his computer and the code did not throw the exception, he is using jre version 1.6.022 and I'm using 1.6.022 both of us are using 64 bit. so what did i do wrong? or is that a bug in the JRE? thank, Amit ofer Edit: forgot to mention, I'm using eclipse Edit2: i tried the same code in Netbeans and it works fine, what could be my problem??

      modified on Saturday, March 26, 2011 7:12 AM

      T Offline
      T Offline
      TorstenH
      wrote on last edited by
      #2

      well, you did close the window - and wanted it to react afterwards. This must result in an exception. The IDE is never the problem - this is all native java code. regards Torsten

      I never finish anyth...

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups