graduated feature schemes (with visual indication of thresholding)
[jalview.git] / src / jalview / gui / FeatureColourChooser.java
index 1e26a3a..1898113 100644 (file)
@@ -23,6 +23,7 @@ import java.util.*;
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
+import javax.swing.border.LineBorder;
 import javax.swing.event.*;
 
 import jalview.datamodel.*;
@@ -145,7 +146,7 @@ public class FeatureColourChooser extends JPanel
                         (max - min) / 2f,
                         "Threshold", Color.black);
       
-    }
+    } 
 
     adjusting = false;
 
@@ -180,7 +181,7 @@ public class FeatureColourChooser extends JPanel
   {
     
     minColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
-    minColour.setBorder(BorderFactory.createEtchedBorder());
+    minColour.setBorder(BorderFactory.createLineBorder(Color.black));
     minColour.setPreferredSize(new Dimension(40, 20));
     minColour.setToolTipText("Minimum Colour");
     minColour.addMouseListener(new MouseAdapter()
@@ -194,7 +195,7 @@ public class FeatureColourChooser extends JPanel
       }
     });
     maxColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
-    maxColour.setBorder(BorderFactory.createEtchedBorder());
+    maxColour.setBorder(BorderFactory.createLineBorder(Color.black));
     maxColour.setPreferredSize(new Dimension(40, 20));
     maxColour.setToolTipText("Maximum Colour");
     maxColour.addMouseListener(new MouseAdapter()
@@ -207,6 +208,11 @@ public class FeatureColourChooser extends JPanel
         }
       }
     });
+    maxColour.setBorder(new LineBorder(Color.black));
+    minText.setText("Min:");
+    minText.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+    maxText.setText("Max:");
+    maxText.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
     ok.setOpaque(false);
     ok.setText("OK");
     ok.addActionListener(new ActionListener()
@@ -278,11 +284,14 @@ public class FeatureColourChooser extends JPanel
         colourByLabel_actionPerformed(actionEvent);
       }
     });
+    colourPanel.setBackground(Color.white);
     jPanel1.add(ok);
     jPanel1.add(cancel);
     jPanel2.add(colourByLabel,java.awt.BorderLayout.WEST);
     jPanel2.add(colourPanel,java.awt.BorderLayout.EAST);
+    colourPanel.add(minText);
     colourPanel.add(minColour);
+    colourPanel.add(maxText);
     colourPanel.add(maxColour);
     this.add(jPanel3, java.awt.BorderLayout.CENTER);
     jPanel3.add(threshold);
@@ -294,6 +303,8 @@ public class FeatureColourChooser extends JPanel
   }
 
 
+  JLabel minText = new JLabel();
+  JLabel maxText = new JLabel();
   JPanel minColour = new JPanel();
 
   JPanel maxColour = new JPanel();
@@ -393,6 +404,7 @@ public class FeatureColourChooser extends JPanel
       slider.setEnabled(false);
       thresholdValue.setEnabled(false);
       thresholdValue.setText("");
+      thresholdIsMin.setEnabled(false);
     }
     else if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD
             && threshline == null)
@@ -418,6 +430,7 @@ public class FeatureColourChooser extends JPanel
       slider.setMajorTickSpacing((int) (range / 10f));
       slider.setEnabled(true);
       thresholdValue.setEnabled(true);
+      thresholdIsMin.setEnabled(!colourByLabel.isSelected());
       adjusting = false;
     }