X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FTextColourChooser.java;h=1eba84ca991c36a9b679eeede700b2ad3df67cab;hb=80e3ac6ebcb27e0d13ce639d1c3105f7cd6f83fe;hp=a1b3caf9f259ab4154f9361652f7fdd02aa53172;hpb=217274a8e9ea2ae20d5a6d21989b8b16840ca6f0;p=jalview.git diff --git a/src/jalview/gui/TextColourChooser.java b/src/jalview/gui/TextColourChooser.java index a1b3caf..1eba84c 100644 --- a/src/jalview/gui/TextColourChooser.java +++ b/src/jalview/gui/TextColourChooser.java @@ -23,6 +23,7 @@ package jalview.gui; import jalview.datamodel.SequenceGroup; import jalview.gui.JalviewColourChooser.ColourChooserListener; import jalview.util.MessageManager; +import jalview.util.dialogrunner.RunResponse; import java.awt.BorderLayout; import java.awt.Color; @@ -33,7 +34,6 @@ import java.util.HashMap; import java.util.Map; import javax.swing.BorderFactory; -import javax.swing.JColorChooser; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSlider; @@ -85,7 +85,7 @@ public class TextColourChooser col2.setToolTipText(MessageManager.getString("label.light_colour")); col2.setBackground(original2); final JPanel bigpanel = new JPanel(new BorderLayout()); - JPanel panel = new JPanel(); + JPanel panel = new JPanel(new BorderLayout()); bigpanel.add(panel, BorderLayout.CENTER); bigpanel.add( new JLabel("" @@ -93,9 +93,9 @@ public class TextColourChooser "label.select_dark_light_set_threshold") + ""), BorderLayout.NORTH); - panel.add(col1); - panel.add(slider); - panel.add(col2); + panel.add(col1, BorderLayout.WEST); + panel.add(slider, BorderLayout.CENTER); + panel.add(col2, BorderLayout.EAST); col1.addMouseListener(new MouseAdapter() { @@ -146,16 +146,23 @@ public class TextColourChooser } }); - int reply = JvOptionPane.showInternalOptionDialog(alignPanel, bigpanel, - MessageManager.getString( - "label.adjunst_foreground_text_colour_threshold"), - JvOptionPane.OK_CANCEL_OPTION, JvOptionPane.QUESTION_MESSAGE, - null, null, null); - - if (reply == JvOptionPane.CANCEL_OPTION) + Object[] options = new Object[] { MessageManager.getString("action.ok"), + MessageManager.getString("action.cancel") }; + String title = MessageManager + .getString("label.adjunst_foreground_text_colour_threshold"); + RunResponse action = new RunResponse(JvOptionPane.NO_OPTION) // Cancel { - restoreInitialSettings(); - } + @Override + public void run() + { + restoreInitialSettings(); + } + }; + JvOptionPane.newOptionDialog(alignPanel).addResponse(action) + .showInternalDialog(bigpanel, title, + JvOptionPane.YES_NO_CANCEL_OPTION, + JvOptionPane.PLAIN_MESSAGE, null, options, + MessageManager.getString("action.ok")); } /** @@ -186,6 +193,8 @@ public class TextColourChooser group.textColour2 = groupColour2.get(group); group.thresholdTextColour = groupThreshold.get(group); } + + ap.paintAlignment(false, false); } /**