return;
Color[] colors = new Color[] { Color.white,
Color.white, Color.white, Color.white,
Color.white, Color.white, Color.black };
SubstanceColorScheme newScheme = SubstanceColorSchemeUtilities
.getLightColorScheme(newName, colors);
schemes.add(newScheme);
schemeListModel.fireContentsChanged();
schemeList.setSelectedValue(newScheme, true);
setModified(true);
}
});
}
});
bottomButtonsPanel.add(addColorScheme);
bottomButtonsPanel.add(Box.createHorizontalStrut(10));
moveUpButton = new JButton();
moveUpButton
.setToolTipText("Moves the currently selected color scheme up");
moveUpButton.setEnabled(false);
moveUpButton.setIcon(new ImageIcon(JColorSchemeList.class
.getClassLoader().getResource("tools/jitterbug/arrow_up.png")));
moveUpButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
SubstanceColorScheme selected = (SubstanceColorScheme) schemeList
.getSelectedValue();
schemes.switchWithPrevious(selected.getDisplayName());
schemeListModel.fireContentsChanged();
schemeList.setSelectedValue(selected, true);
setModified(true);
}
});
}
});
bottomButtonsPanel.add(moveUpButton);
moveDownButton = new JButton();
moveDownButton
.setToolTipText("Moves the currently selected color scheme down");
moveDownButton.setEnabled(false);
moveDownButton
.setIcon(new ImageIcon(JColorSchemeList.class.getClassLoader()
.getResource("tools/jitterbug/arrow_down.png")));
moveDownButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
SubstanceColorScheme selected = (SubstanceColorScheme) schemeList
.getSelectedValue();
schemes.switchWithNext(selected.getDisplayName());
schemeListModel.fireContentsChanged();
schemeList.setSelectedValue(selected, true);
setModified(true);
}
});
}
});
bottomButtonsPanel.add(moveDownButton);
bottomButtonsPanel.add(Box.createHorizontalStrut(10));
renameButton = new JButton();
renameButton
.setToolTipText("Rename the currently selected color scheme");
renameButton.setEnabled(false);
renameButton.setIcon(new ImageIcon(JColorSchemeList.class
.getClassLoader().getResource(
"tools/jitterbug/chart_line_edit.png")));
renameButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
SubstanceColorScheme selected = (SubstanceColorScheme) schemeList
.getSelectedValue();
String newName = getNewColorSchemeName(selected
.getDisplayName());
if (newName == null)
return;
if (newName.equals(selected.getDisplayName()))
return;
boolean isLight = !selected.isDark();
Color ultraDark = selected.getUltraDarkColor();
Color dark = selected.getDarkColor();
Color mid = selected.getMidColor();
Color light = selected.getLightColor();
Color extraLight = selected.getExtraLightColor();
Color ultraLight = selected.getUltraLightColor();
Color foreground = selected.getForegroundColor();
Color[] colors = new Color[] { ultraLight, extraLight,
light, mid, dark, ultraDark, foreground };
SubstanceColorScheme renamedScheme = isLight ? SubstanceColorSchemeUtilities
.getLightColorScheme(newName, colors)
: SubstanceColorSchemeUtilities
.getDarkColorScheme(newName, colors);
schemes.replace(selected.getDisplayName(),
renamedScheme);
schemeListModel.fireContentsChanged();
schemeList.getSelectionModel().clearSelection();
schemeList.setSelectedValue(renamedScheme, true);
setModified(true);
}
});
}
});
bottomButtonsPanel.add(renameButton);
deleteButton = new JButton();
deleteButton
.setToolTipText("Removes the currently selected color scheme");
deleteButton.setEnabled(false);
deleteButton.setIcon(new ImageIcon(JColorSchemeList.class
.getClassLoader().getResource("tools/jitterbug/delete.png")));
deleteButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
SubstanceColorScheme selected = (SubstanceColorScheme) schemeList
.getSelectedValue();
schemes.delete(selected.getDisplayName());
schemeListModel.fireContentsChanged();
schemeList.getSelectionModel().clearSelection();
setModified(true);
}
});