X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationColourChooser.java;h=b748c85c01c57390eb0631a225890b0227aaaef8;hb=cca1d315fd19ddcc7c67a5aba91dafa98be097cf;hp=0209d764985044a049e8d13e7500af04cd9e4bdb;hpb=b01c4edc00dbeedd6b53777310d4232a4104a9ec;p=jalview.git diff --git a/src/jalview/gui/AnnotationColourChooser.java b/src/jalview/gui/AnnotationColourChooser.java index 0209d76..b748c85 100755 --- a/src/jalview/gui/AnnotationColourChooser.java +++ b/src/jalview/gui/AnnotationColourChooser.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer -* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle +* Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -26,6 +26,8 @@ import jalview.schemes.*; import javax.swing.event.*; import java.util.*; import jalview.datamodel.SequenceGroup; +import java.awt.Dimension; +import javax.swing.BorderFactory; public class AnnotationColourChooser extends JPanel @@ -49,7 +51,8 @@ public class AnnotationColourChooser for (int g = 0; g < allGroups.size(); g++) { sg = (SequenceGroup) allGroups.get(g); - oldgroupColours.put(sg, sg.cs); + if(sg.cs!=null) + oldgroupColours.put(sg, sg.cs); } } this.av = av; @@ -126,24 +129,27 @@ public class AnnotationColourChooser throws Exception { minColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - minColour.setToolTipText(""); - minColour.setMargin(new Insets(2, 2, 2, 2)); - minColour.setText("Min Colour"); - minColour.addActionListener(new ActionListener() + minColour.setBorder(BorderFactory.createEtchedBorder()); + minColour.setPreferredSize(new Dimension(40, 20)); + minColour.setToolTipText("Minimum Colour"); + minColour.addMouseListener(new MouseAdapter() { - public void actionPerformed(ActionEvent e) + public void mousePressed(MouseEvent e) { - minColour_actionPerformed(e); + if (minColour.isEnabled()) + minColour_actionPerformed(); } }); maxColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - maxColour.setMargin(new Insets(2, 2, 2, 2)); - maxColour.setText("Max Colour"); - maxColour.addActionListener(new ActionListener() + maxColour.setBorder(BorderFactory.createEtchedBorder()); + maxColour.setPreferredSize(new Dimension(40, 20)); + maxColour.setToolTipText("Maximum Colour"); + maxColour.addMouseListener(new MouseAdapter() { - public void actionPerformed(ActionEvent e) + public void mousePressed(MouseEvent e) { - maxColour_actionPerformed(e); + if (maxColour.isEnabled()) + maxColour_actionPerformed(); } }); ok.setOpaque(false); @@ -224,8 +230,8 @@ public class AnnotationColourChooser } JComboBox annotations = new JComboBox(); - JButton minColour = new JButton(); - JButton maxColour = new JButton(); + JPanel minColour = new JPanel(); + JPanel maxColour = new JPanel(); JButton ok = new JButton(); JButton cancel = new JButton(); JPanel jPanel1 = new JPanel(); @@ -239,7 +245,7 @@ public class AnnotationColourChooser JTextField thresholdValue = new JTextField(20); JCheckBox currentColours = new JCheckBox(); - public void minColour_actionPerformed(ActionEvent e) + public void minColour_actionPerformed() { Color col = JColorChooser.showDialog(this, "Select Colour for Minimum Value", @@ -250,7 +256,7 @@ public class AnnotationColourChooser changeColour(); } - public void maxColour_actionPerformed(ActionEvent e) + public void maxColour_actionPerformed() { Color col = JColorChooser.showDialog(this, "Select Colour for Maximum Value",