JMenuItem generate = new JMenuItem(NbBundle.getMessage(PartitionColorTransformerPanel.class, "PalettePopup.generate"));
generate.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
PaletteGeneratorPanel pgn = new PaletteGeneratorPanel();
pgn.setup(colorsCount);
NotifyDescriptor nd = new NotifyDescriptor(pgn,
NbBundle.getMessage(PartitionColorTransformerPanel.class, "PartitionColorTransformerPanel.generatePalettePanel.title"),
NotifyDescriptor.OK_CANCEL_OPTION,
NotifyDescriptor.DEFAULT_OPTION, null, null);
if (DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.OK_OPTION) {
Palette pl = pgn.getSelectedPalette();
if (pl != null) {
applyPalette(pl);
}
}
}