label.normalise_group_logo = Normalise Group Logo\r
label.show_histogram = Show Histogram\r
label.show_logo = Show Logo\r
-label.normalise_logo = Normalise Logo
\ No newline at end of file
+label.normalise_logo = Normalise Logo\r
+label.no_colour_selection_in_scheme = Please, make a colour selection before to apply colour scheme\r
+label.no_colour_selection_warn = Error saving colour scheme
\ No newline at end of file
@Override
protected void okButton_actionPerformed(ActionEvent e)
{
- applyButton_actionPerformed(null);
-
- try
- {
- frame.setClosed(true);
- } catch (Exception ex)
- {
- }
+ //Check if the user have done any selection
+ boolean showWarning = (upperCaseButtons==null) ||
+ ((upperCaseButtons!=null) && (upperCaseButtons.size()==0)) ||
+ (lowerCaseButtons==null) ||
+ ((lowerCaseButtons!=null) && (lowerCaseButtons.size()==0));
+ if (showWarning){
+ JOptionPane.showMessageDialog(Desktop.desktop,
+ MessageManager.getString("label.no_colour_selection_in_scheme"),MessageManager.getString("label.no_colour_selection_warn"),
+ JOptionPane.WARNING_MESSAGE);
+
+ }else{
+ applyButton_actionPerformed(null);
+
+ try
+ {
+ frame.setClosed(true);
+ } catch (Exception ex)
+ {
+ }
+ }
}
/**
@Override
protected void applyButton_actionPerformed(ActionEvent e)
{
- UserColourScheme ucs = getSchemeFromButtons();
+ //Check if the user have done any selection
+ boolean showWarning = (upperCaseButtons==null) ||
+ ((upperCaseButtons!=null) && (upperCaseButtons.size()==0)) ||
+ (lowerCaseButtons==null) ||
+ ((lowerCaseButtons!=null) && (lowerCaseButtons.size()==0));
+ if (showWarning){
+ JOptionPane.showMessageDialog(Desktop.desktop,
+ MessageManager.getString("label.no_colour_selection_in_scheme"),MessageManager.getString("label.no_colour_selection_warn"),
+ JOptionPane.WARNING_MESSAGE);
+
+ }
+ UserColourScheme ucs = getSchemeFromButtons();
ucs.setName(schemeName.getText());
if (seqGroup != null)
Color[] newColours = new Color[24];
- for (int i = 0; i < 24; i++)
- {
- JButton button = upperCaseButtons.get(i);
- newColours[i] = button.getBackground();
+ int length = upperCaseButtons.size();
+ if (length<24){
+ int i = 0;
+ for (JButton btn:upperCaseButtons){
+ newColours[i] = btn.getBackground();
+ i++;
+ }
+ }else{
+ for (int i = 0; i < 24; i++){
+ JButton button = (JButton) upperCaseButtons.get(i);
+ newColours[i] = button.getBackground();
+ }
}
UserColourScheme ucs = new UserColourScheme(newColours);
if (caseSensitive.isSelected())
{
newColours = new Color[23];
- for (int i = 0; i < 23; i++)
- {
- JButton button = lowerCaseButtons.get(i);
- newColours[i] = button.getBackground();
+ length = lowerCaseButtons.size();
+ if (length<23){
+ int i = 0;
+ for (JButton btn:lowerCaseButtons){
+ newColours[i] = btn.getBackground();
+ i++;
+ }
+ }else{
+ for (int i = 0; i < 23; i++){
+ JButton button = (JButton) lowerCaseButtons.get(i);
+ newColours[i] = button.getBackground();
+ }
}
ucs.setLowerCaseColours(newColours);
}