+\r
+ public void textColour_actionPerformed(ActionEvent e)\r
+ {\r
+ final SequenceGroup sg = getGroup();\r
+\r
+ int original1 = sg.textColour.getRGB();\r
+ int original2 = sg.textColour2.getRGB();\r
+ int thresh = sg.thresholdTextColour;\r
+ final JSlider slider = new JSlider(0, 750,sg.thresholdTextColour);\r
+ final JButton col1 = new JButton("DARK");\r
+ col1.setBackground(sg.textColour);\r
+ col1.setForeground(sg.textColour);\r
+ final JButton col2 = new JButton("LIGHT");\r
+ col2.setBackground(sg.textColour2);\r
+ col2.setForeground(sg.textColour2);\r
+ final JPanel bigpanel = new JPanel(new BorderLayout());\r
+ JPanel panel = new JPanel();\r
+ bigpanel.add(panel, BorderLayout.CENTER);\r
+ bigpanel.add(new JLabel(\r
+ "<html><i>Select a dark and light text colour, then set the threshold to"\r
+ +"<br>switch between colours, based on background colour</i></html>"),\r
+ BorderLayout.NORTH);\r
+ panel.add(col1);\r
+ panel.add(slider);\r
+ panel.add(col2);\r
+\r
+ col1.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ Color col = JColorChooser.showDialog(bigpanel,\r
+ "Select Colour for Text",\r
+ sg.textColour);\r
+ if (col != null)\r
+ {\r
+ sg.textColour = col;\r
+ col1.setBackground(col);\r
+ col1.setForeground(col);\r
+ }\r
+ ap.repaint();\r
+ }\r
+ });\r
+\r
+ col2.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ Color col = JColorChooser.showDialog(bigpanel,\r
+ "Select Colour for Text",\r
+ sg.textColour);\r
+ if (col != null)\r
+ {\r
+ sg.textColour2 = col;\r
+ col2.setBackground(col);\r
+ col2.setForeground(col);\r
+ }\r
+ ap.repaint();\r
+ }\r
+ });\r
+\r
+\r
+ slider.addChangeListener(new ChangeListener()\r
+ {\r
+ public void stateChanged(ChangeEvent evt)\r
+ {\r
+ sg.thresholdTextColour = slider.getValue();\r
+ ap.repaint();\r
+ }\r
+ });\r
+\r
+ int reply = JOptionPane.showInternalOptionDialog(Desktop.desktop,\r
+ bigpanel,\r
+ "Adjust Foreground Text Colour Threshold",\r
+ JOptionPane.OK_CANCEL_OPTION,\r
+ JOptionPane.QUESTION_MESSAGE,\r
+ null,\r
+ null, null);\r
+\r
+ if(reply==JOptionPane.CANCEL_OPTION)\r
+ {\r
+ sg.textColour = new Color(original1);\r
+ sg.textColour2 = new Color(original2);\r
+ sg.thresholdTextColour = thresh;\r
+ }\r
+ }\r