简体   繁体   中英

How to show ColorPicker from my action in IntelliJ IDEA plugin DevKit?

How to show ColorPicker from my action in IntelliJ IDEA plugin DevKit? For example I have an action:

public class TextBoxes extends AnAction {
    public void actionPerformed(AnActionEvent event) {
        // Some code
    }
}

In which I want to display ColorPicker widget:

ColorPicker colorPicker = new ColorPicker(args); // Like that
ColorPicker.showDialog(args); // Or like that

In new ColorPicker(args) format there is a Disposable parent object required. Where should I get this one? In ColorPicker.showDialog(args); there is also a Component parent object required. And again I can't understand where should I get this object? And which one is the right way to display ColorPicker from com.intellij.ui.ColorPicker package?

Please do it like this:

public class TextBoxes extends AnAction {
  @Override
  public void actionPerformed(AnActionEvent event) {
    Color color = ColorPicker.showDialog(...)
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM