@Override
        public void changedUpdate(DocumentEvent e) {
            this.lastTimeStamp = System.currentTimeMillis();

            if (ColorPicker.this.adjustingHexField > 0) {
                return;
            }

            String s = ColorPicker.this.hexField.getText();
            s = stripToHex(s);
            if (s.length() == 6) {
                // the user typed 6 digits: we can work with this:
                try {
                    int i = Integer.parseInt(s, 16);
                    setRGB(((i >> 16) & 0xff), ((i >> 8) & 0xff), ((i) & 0xff));
                    return;
                } catch (NumberFormatException e2) {
                    // this shouldn't happen, since we already stripped out non-hex characters.
                    e2.printStackTrace();
                }
            }
            Thread thread = new HexUpdateThread(this.lastTimeStamp, s);
            thread.start();
            while ((System.currentTimeMillis() - this.lastTimeStamp) == 0) {
                Thread.yield();
            }
        }