Skip to content

scala.swing.dialog.Result - Duplicate id: 0 #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cestrand opened this issue Mar 17, 2018 · 2 comments
Closed

scala.swing.dialog.Result - Duplicate id: 0 #73

cestrand opened this issue Mar 17, 2018 · 2 comments

Comments

@cestrand
Copy link

is defined:

  object Result extends Enumeration {
    import JOptionPane._
    val Yes   : Result.Value = Value(YES_OPTION)
    val Ok    : Result.Value = Value(OK_OPTION)
    val No    : Result.Value = Value(NO_OPTION)
    val Cancel: Result.Value = Value(CANCEL_OPTION)
    val Closed: Result.Value = Value(CLOSED_OPTION)
  }

where

public static final int YES_OPTION = 0;
public static final int OK_OPTION = 0;
public static final int NO_OPTION = 1;
public static final int CANCEL_OPTION = 2;
public static final int CLOSED_OPTION = -1;

As you can see both YES_OPTION and OK_OPTION is bound to 0.

This causes:

Exception in thread "AWT-EventQueue-1" java.lang.AssertionError: assertion failed: Duplicate id: 0
	at scala.Enumeration$Val.<init>(Enumeration.scala:237)
	at scala.Enumeration.Value(Enumeration.scala:177)
	at scala.Enumeration.Value(Enumeration.scala:160)
	at scala.swing.Dialog$Result$.<init>(RichWindow.scala:124)
	at scala.swing.Dialog$Result$.<clinit>(RichWindow.scala)

when:

Dialog.showConfirmation(
            parent = null,
            message = "asdf",
            title = "asdf",
            optionType = Dialog.Options.Default,
            messageType = Dialog.Message.Question)
@Sciss
Copy link
Contributor

Sciss commented Mar 17, 2018

Thanks, the problem was introduced here, I think:

8b89af6#diff-baa539da718865646e5380596f62353cR121

I will submit a patch

@Sciss Sciss mentioned this issue Mar 17, 2018
@Sciss
Copy link
Contributor

Sciss commented Mar 17, 2018

@cestrand before the new version is published, you should revert to 2.0.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants