import jalview.datamodel.features.FeatureMatcherI;
import jalview.datamodel.features.FeatureMatcherSet;
import jalview.datamodel.features.FeatureMatcherSetI;
+import jalview.gui.JalviewColourChooser.ColourChooserListener;
import jalview.schemes.FeatureColour;
import jalview.util.ColorUtils;
import jalview.util.MessageManager;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
-import javax.swing.JColorChooser;
import javax.swing.JComboBox;
-import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
/*
* the view panel to update when settings change
*/
- private final AlignmentViewPanel ap;
+ final AlignmentViewPanel ap;
private final String featureType;
* set flag to true when setting values programmatically,
* to avoid invocation of action handlers
*/
- private boolean adjusting = false;
+ boolean adjusting = false;
/*
* minimum of the value range for graduated colour
/*
* scale factor for conversion between absolute min-max and slider
*/
- private float scaleFactor;
+ float scaleFactor;
/*
* radio button group, to select what to colour by:
* simple colour, by category (text), or graduated
*/
- private JRadioButton simpleColour = new JRadioButton();
+ JRadioButton simpleColour = new JRadioButton();
- private JRadioButton byCategory = new JRadioButton();
+ JRadioButton byCategory = new JRadioButton();
- private JRadioButton graduatedColour = new JRadioButton();
+ JRadioButton graduatedColour = new JRadioButton();
- private JPanel singleColour = new JPanel();
+ JPanel singleColour = new JPanel();
- private JPanel minColour = new JPanel();
+ JPanel minColour = new JPanel();
- private JPanel maxColour = new JPanel();
+ JPanel maxColour = new JPanel();
private JComboBox<String> threshold = new JComboBox<>();
- private JSlider slider = new JSlider();
+ JSlider slider = new JSlider();
- private JTextField thresholdValue = new JTextField(20);
+ JTextField thresholdValue = new JTextField(20);
private JCheckBox thresholdIsMin = new JCheckBox();
/*
* filters for the currently selected feature type
*/
- private List<FeatureMatcherI> filters;
+ List<FeatureMatcherI> filters;
// set white normally, black to debug layout
private Color debugBorderColour = Color.white;
showColourChooser(singleColour, "label.select_colour");
}
}
-
});
singleColour.setFont(JvSwingUtils.getLabelFont());
* @param key
* message bundle key for the dialog title
*/
- private void showColourChooser(JPanel colourPanel, String key)
+ void showColourChooser(JPanel colourPanel, String key)
{
- // TODO 'final' is (currently) required here for SwingJS to work
- JColorChooser colorChooser = new JColorChooser();
- colorChooser.setColor(colourPanel.getBackground());
-
- ActionListener listener = new ActionListener()
+ ColourChooserListener listener = new ColourChooserListener()
{
@Override
- public void actionPerformed(ActionEvent e)
+ public void colourSelected(Color col)
{
- Color col = colorChooser.getColor();
colourPanel.setBackground(col);
colourPanel.setForeground(col);
colourPanel.repaint();
colourChanged(true);
}
};
-
- JDialog dialog = JColorChooser.createDialog(this,
- MessageManager.getString(key), true, colorChooser, listener,
- null);
- dialog.setVisible(true);
+ JalviewColourChooser.showColourChooser(this, MessageManager.getString(key),
+ colourPanel.getBackground(), listener);
}
/**
* @param condCombo
* @param patternField
*/
- private void populateConditions(String attName, Condition cond,
+ void populateConditions(String attName, Condition cond,
JComboBox<Condition> condCombo, JTextField patternField)
{
Datatype type = FeatureAttributes.getInstance().getDatatype(featureType,