From 7542c09a302d40313e8c112a556b9cdd7ef160ea Mon Sep 17 00:00:00 2001 From: jprocter Date: Wed, 28 Apr 2010 17:01:17 +0000 Subject: [PATCH 1/1] osx button colouring issue --- src/jalview/appletgui/FeatureColourChooser.java | 33 +++++++++++++++++------ 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/jalview/appletgui/FeatureColourChooser.java b/src/jalview/appletgui/FeatureColourChooser.java index 6569186..cb8f23b 100644 --- a/src/jalview/appletgui/FeatureColourChooser.java +++ b/src/jalview/appletgui/FeatureColourChooser.java @@ -80,6 +80,8 @@ public class FeatureColourChooser extends Panel implements } minColour.setBackground(cs.getMinColor()); maxColour.setBackground(cs.getMaxColor()); + minColour.setForeground(cs.getMinColor()); + maxColour.setForeground(cs.getMaxColor()); colourFromLabel.setState(cs.isColourByLabel()); adjusting = true; @@ -124,13 +126,18 @@ public class FeatureColourChooser extends Panel implements private void jbInit() throws Exception { - minColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - minColour.setLabel("Min Colour"); - minColour.addActionListener(this); + Label minLabel = new Label("Min:"),maxLabel=new Label("Max:"); + minLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + maxLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + //minColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + //minColour.setLabel("Min Colour"); + + minColour.setBounds(0,0,40,27); + maxColour.setBounds(0,0,40,27); + minColour.addMouseListener(this); maxColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - maxColour.setLabel("Max Colour"); - maxColour.addActionListener(this); + maxColour.addMouseListener(this); thresholdIsMin.addItemListener(this); @@ -163,7 +170,9 @@ public class FeatureColourChooser extends Panel implements thresholdIsMin.setLabel("Threshold is min/max"); thresholdIsMin.setSize(new Dimension(135,23)); //thresholdIsMin.setBounds(new Rectangle(328, 3, 135, 23)); + jPanel1.add(minLabel); jPanel1.add(minColour); + jPanel1.add(maxLabel); jPanel1.add(maxColour); jPanel1.add(colourFromLabel); jPanel2.add(threshold); @@ -176,9 +185,9 @@ public class FeatureColourChooser extends Panel implements this.add(jPanel4);//, java.awt.BorderLayout.CENTER); } - Button minColour = new Button(); + Panel minColour = new Panel(); - Button maxColour = new Button(); + Panel maxColour = new Panel(); Panel jPanel1 = new Panel(); @@ -258,6 +267,7 @@ public class FeatureColourChooser extends Panel implements UserDefinedColours udc = new UserDefinedColours(this,minColour.getBackground(),owner, "Select Colour for Minimum Value"); // frame.owner, } else { minColour.setBackground(newCol); + minColour.setForeground(newCol); minColour.repaint(); changeColour(); } @@ -273,6 +283,7 @@ public class FeatureColourChooser extends Panel implements UserDefinedColours udc = new UserDefinedColours(this, maxColour.getBackground(), owner, "Select Colour for Maximum Value"); } else { maxColour.setBackground(newCol); + maxColour.setForeground(newCol); maxColour.repaint(); changeColour(); } @@ -371,7 +382,13 @@ public class FeatureColourChooser extends Panel implements public void mouseReleased(MouseEvent evt) { - PaintRefresher.Refresh(this, fr.av.getSequenceSetId()); + if (evt.getSource()==minColour || evt.getSource()==maxColour) + { + // relay the event + actionPerformed(new ActionEvent(evt.getSource(), 1, "Clicked")); + } else { + PaintRefresher.Refresh(this, fr.av.getSequenceSetId()); + } // ap.paintAlignment(true); } -- 1.7.10.2