+ if (selectedButtons != null)\r
+ {\r
+ JButton button=null;\r
+ for(int i=0; i<selectedButtons.size(); i++)\r
+ {\r
+ button = (JButton)selectedButtons.elementAt(i);\r
+ button.setBackground(colorChooser.getColor());\r
+ button.setForeground( button.getBackground().brighter().brighter().brighter());\r
+ }\r
+ if(button==lcaseColour)\r
+ {\r
+ for(int i=0; i<lowerCaseButtons.size(); i++)\r
+ {\r
+ button = (JButton)lowerCaseButtons.elementAt(i);\r
+ button.setBackground(colorChooser.getColor());\r
+ button.setForeground( button.getBackground().brighter().brighter().brighter());\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void colourButtonPressed(MouseEvent e)\r
+ {\r
+ if(selectedButtons == null)\r
+ selectedButtons = new Vector();\r
+\r
+ JButton pressed = (JButton) e.getSource();\r
+\r
+ if(e.isShiftDown())\r
+ {\r
+ JButton start, end = (JButton) e.getSource();\r
+ if(selectedButtons.size()>0)\r
+ start = (JButton)selectedButtons.elementAt(selectedButtons.size()-1);\r
+ else\r
+ start = (JButton) e.getSource();\r
+\r
+ int startIndex=0, endIndex=0;\r
+ for(int b=0; b<buttonPanel.getComponentCount(); b++)\r
+ {\r
+ if(buttonPanel.getComponent(b)==start)\r
+ startIndex = b;\r
+ if(buttonPanel.getComponent(b)==end)\r
+ endIndex = b;\r
+ }\r
+\r
+ if(startIndex > endIndex)\r
+ {\r
+ int temp = startIndex;\r
+ startIndex = endIndex;\r
+ endIndex = temp;\r
+ }\r
+\r
+ for(int b=startIndex; b<=endIndex; b++)\r
+ {\r
+ JButton button = (JButton)buttonPanel.getComponent(b);\r
+ if(!selectedButtons.contains(button))\r
+ {\r
+ button.setForeground(button.getBackground().brighter().brighter());\r
+ selectedButtons.add(button);\r
+ }\r
+ }\r
+ }\r
+ else if(!e.isControlDown())\r
+ {\r
+ for(int b=0; b<selectedButtons.size(); b++)\r
+ {\r
+ JButton button = (JButton)selectedButtons.elementAt(b);\r
+ button.setForeground(button.getBackground().darker().darker());\r
+ }\r
+ selectedButtons.clear();\r
+ pressed.setForeground( pressed.getBackground().brighter().brighter());\r
+ selectedButtons.addElement(pressed);\r
+\r
+ }\r
+ else if(e.isControlDown())\r
+ {\r
+ if(selectedButtons.contains(pressed))\r
+ {\r
+ pressed.setForeground(pressed.getBackground().darker().darker());\r
+ selectedButtons.remove(pressed);\r
+ }\r
+ else\r
+ {\r
+ pressed.setForeground( pressed.getBackground().brighter().brighter());\r
+ selectedButtons.addElement(pressed);\r
+ }\r
+ }\r
+\r
+ if(selectedButtons.size()>0)\r
+ colorChooser.setColor( ((JButton)selectedButtons.elementAt(0)).getBackground());\r