Skip to main content

named label options

Comments

3 comments

  • Richard Moir

    It is a bit weird but I recommend the following:

    Option labelOption = addCustomComponent(new JLabel("hello world"));

    You can then use labelOption.getComponent() to get your JLabel.

    0
  • Sean Johnson

    Thanks for the response. I'm not sure that works for me though.

    I specifically want to give labels names and be able to retrieve them using options.getValueAsString

    This is because I want to be able to set their value in the getOptions method and get it back in the performOperation method. As far as I know the only way to pass information between those two methods is through the "options" variable returned by getOptions.

    As a last resort I was thinking of making shadow string options to track the label values, for example using something like:

    options.addStringOption("Label_1_value", "",labelOption.getValue()).setHidden(true);

    But that seems clunky and I'd like to avoid it if possible.

    0
  • Richard Moir

    Right, in that case I think you can use:

    addCustomOption(new LabelOption("name", "label"));

    then getValueAsString("name") should work to retrieve "label".

    0

Please sign in to leave a comment.