X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPopupMenu.java;h=21be0862f92c7ca30958833b05554da194e57c3b;hb=6c4bc68ae8b1c5005e79661bb2d8246515cb787d;hp=206a969d106b2993521607c4f7883fdad9e01701;hpb=f62b380e6e3cdbce3af5730f682aad99116509c9;p=jalview.git diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 206a969..21be086 100755 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -32,8 +32,6 @@ import javax.swing.*; import java.util.Vector; import jalview.io.FormatAdapter; -import javax.swing.event.ChangeListener; -import javax.swing.event.ChangeEvent; /** @@ -1360,86 +1358,8 @@ public class PopupMenu extends JPopupMenu public void textColour_actionPerformed(ActionEvent e) { - final SequenceGroup sg = getGroup(); - - int original1 = sg.textColour.getRGB(); - int original2 = sg.textColour2.getRGB(); - int thresh = sg.thresholdTextColour; - final JSlider slider = new JSlider(0, 750,sg.thresholdTextColour); - final JButton col1 = new JButton("DARK"); - col1.setBackground(sg.textColour); - col1.setForeground(sg.textColour); - final JButton col2 = new JButton("LIGHT"); - col2.setBackground(sg.textColour2); - col2.setForeground(sg.textColour2); - final JPanel bigpanel = new JPanel(new BorderLayout()); - JPanel panel = new JPanel(); - bigpanel.add(panel, BorderLayout.CENTER); - bigpanel.add(new JLabel( - "Select a dark and light text colour, then set the threshold to" - +"
switch between colours, based on background colour
"), - BorderLayout.NORTH); - panel.add(col1); - panel.add(slider); - panel.add(col2); - - col1.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - Color col = JColorChooser.showDialog(bigpanel, - "Select Colour for Text", - sg.textColour); - if (col != null) - { - sg.textColour = col; - col1.setBackground(col); - col1.setForeground(col); - } - ap.repaint(); - } - }); - - col2.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - Color col = JColorChooser.showDialog(bigpanel, - "Select Colour for Text", - sg.textColour); - if (col != null) - { - sg.textColour2 = col; - col2.setBackground(col); - col2.setForeground(col); - } - ap.repaint(); - } - }); - - - slider.addChangeListener(new ChangeListener() - { - public void stateChanged(ChangeEvent evt) - { - sg.thresholdTextColour = slider.getValue(); - ap.repaint(); - } - }); - - int reply = JOptionPane.showInternalOptionDialog(Desktop.desktop, - bigpanel, - "Adjust Foreground Text Colour Threshold", - JOptionPane.OK_CANCEL_OPTION, - JOptionPane.QUESTION_MESSAGE, - null, - null, null); - - if(reply==JOptionPane.CANCEL_OPTION) - { - sg.textColour = new Color(original1); - sg.textColour2 = new Color(original2); - sg.thresholdTextColour = thresh; - } + SequenceGroup sg = getGroup(); + if (sg != null) + new TextColourChooser().chooseColour(ap, sg); } }