private JTextField createColorField(boolean hex) {
    NumberDocument doc = new NumberDocument(hex);
    JTextField field = new JTextField("");
    field.setDocument(doc);

    doc.setSource(field);
    field.getDocument().addDocumentListener(this);
    field.addFocusListener(new FocusAdapter() {
      @Override
      public void focusGained(final FocusEvent e) {
        field.selectAll();
      }

      @Override
      public void focusLost(FocusEvent event) {
        myUpdateQueue.cancelAllRequests();
        validateAndUpdatePreview(field);
      }
    });
    return field;
  }
private JTextField createColorField(boolean hex)