Skip to content

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

Closed
@cestrand

Description

@cestrand

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions