From b560524924d0f8c45c2eadd26293844493dbf625 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 9 Feb 2017 10:39:22 +0000 Subject: [PATCH] JAL-2401 change 'Lower Case Colour' to checkbox with tooltip --- resources/lang/Messages.properties | 3 ++- src/jalview/gui/UserDefinedColours.java | 29 +--------------------------- src/jalview/jbgui/GUserDefinedColours.java | 12 +++--------- src/jalview/schemes/UserColourScheme.java | 2 +- 4 files changed, 7 insertions(+), 39 deletions(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index c451f07..070dc5f 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -721,7 +721,8 @@ label.mark_unlinked_leaves = Mark Unlinked Leaves label.associate_leaves_with = Associate Leaves With label.save_colour_scheme_with_unique_name_added_to_colour_menu = Save your colour scheme with a unique name and it will be added to the Colour menu label.case_sensitive = Case Sensitive -label.lower_case_colour = Lower Case Colour +label.lower_case_colour = Colour All Lower Case +label.lower_case_tip = Apply colour choice to all lower case symbols label.index_by_host = Index by Host label.index_by_type = Index by Type label.enable_jabaws_services = Enable JABAWS Services diff --git a/src/jalview/gui/UserDefinedColours.java b/src/jalview/gui/UserDefinedColours.java index 10a9687..83a8d24 100755 --- a/src/jalview/gui/UserDefinedColours.java +++ b/src/jalview/gui/UserDefinedColours.java @@ -124,7 +124,6 @@ public class UserDefinedColours extends GUserDefinedColours implements { caseSensitive.setSelected(true); lcaseColour.setEnabled(true); - lcaseColour.setForeground(Color.GRAY); resetButtonPanel(true); } else @@ -283,9 +282,8 @@ public class UserDefinedColours extends GUserDefinedColours implements button.setBackground(newColour); button.setForeground(ColorUtils.brighterThan(newColour)); } - if (button == lcaseColour) + if (lcaseColour.isSelected()) { - button.setForeground(Color.black); for (int i = 0; i < lowerCaseButtons.size(); i++) { button = lowerCaseButtons.get(i); @@ -636,7 +634,6 @@ public class UserDefinedColours extends GUserDefinedColours implements { caseSensitive.setSelected(true); lcaseColour.setEnabled(true); - lcaseColour.setForeground(Color.GRAY); resetButtonPanel(true); for (int i = 0; i < lowerCaseButtons.size(); i++) { @@ -855,29 +852,5 @@ public class UserDefinedColours extends GUserDefinedColours implements boolean selected = caseSensitive.isSelected(); resetButtonPanel(selected); lcaseColour.setEnabled(selected); - lcaseColour.setForeground(Color.GRAY); - } - - /** - * Action on clicking 'Lower case colour', which results in changing colour of - * all lower-case buttons when a colour is picked. A second click of the - * button turns off this behaviour. - */ - @Override - public void lcaseColour_actionPerformed(ActionEvent e) - { - boolean enable = !selectedButtons.contains(lcaseColour); - selectedButtons.clear(); - if (enable) - { - selectedButtons.add(lcaseColour); - lcaseColour.setForeground(lowerCaseButtons.get(0).getForeground()); - lcaseColour.setForeground(Color.black); - } - else - { - lcaseColour.setBackground(Color.white); - lcaseColour.setForeground(Color.gray); - } } } diff --git a/src/jalview/jbgui/GUserDefinedColours.java b/src/jalview/jbgui/GUserDefinedColours.java index fe20baf..aa5319c 100755 --- a/src/jalview/jbgui/GUserDefinedColours.java +++ b/src/jalview/jbgui/GUserDefinedColours.java @@ -104,7 +104,7 @@ public class GUserDefinedColours extends JPanel protected JCheckBox caseSensitive = new JCheckBox(); - protected JButton lcaseColour = new JButton(); + protected JCheckBox lcaseColour = new JCheckBox(); protected List selectedButtons; @@ -223,14 +223,8 @@ public class GUserDefinedColours extends JPanel }); lcaseColour .setText(MessageManager.getString("label.lower_case_colour")); - lcaseColour.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - lcaseColour_actionPerformed(e); - } - }); + lcaseColour.setToolTipText(MessageManager + .getString("label.lower_case_tip")); saveLoadPanel.add(savebutton); saveLoadPanel.add(loadbutton); diff --git a/src/jalview/schemes/UserColourScheme.java b/src/jalview/schemes/UserColourScheme.java index 85bf54e..8e58c20 100755 --- a/src/jalview/schemes/UserColourScheme.java +++ b/src/jalview/schemes/UserColourScheme.java @@ -73,7 +73,7 @@ public class UserColourScheme extends ResidueColourScheme schemeName = from.schemeName; if (from.lowerCaseColours != null) { - lowerCaseColours = new Color[lowerCaseColours.length]; + lowerCaseColours = new Color[from.lowerCaseColours.length]; System.arraycopy(from.lowerCaseColours, 0, lowerCaseColours, 0, from.lowerCaseColours.length); } -- 1.7.10.2