public PatternBackgroundQuickPane() {
    this.setLayout(new BorderLayout(0, 4));

    JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
    this.add(contentPane, BorderLayout.NORTH);
    contentPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5));

    JPanel typePane2 = new JPanel();
    contentPane.add(typePane2);
    typePane2.setLayout(new GridLayout(0, 8, 1, 1));
    typePane2.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
    ButtonGroup patternButtonGroup = new ButtonGroup();
    patternButtonArray = new PatternButton[PatternBackground.PATTERN_COUNT];
    for (int i = 0; i < PatternBackground.PATTERN_COUNT; i++) {
      patternButtonArray[i] = new PatternButton(i);
      patternButtonGroup.add(patternButtonArray[i]);
      typePane2.add(patternButtonArray[i]);
    }

    JPanel colorPane = new JPanel(new GridLayout(0, 2));
    foregroundColorPane = new ColorSelectBox(70);
    backgroundColorPane = new ColorSelectBox(70);
    foregroundColorPane.setSelectObject(Color.lightGray);
    backgroundColorPane.setSelectObject(Color.black);

    colorPane.add(
        this.createLabelColorPane(Inter.getLocText("Foreground") + ":", foregroundColorPane));
    colorPane.add(
        this.createLabelColorPane(Inter.getLocText("Background") + ":", backgroundColorPane));
    this.add(colorPane, BorderLayout.CENTER);
    foregroundColorPane.addSelectChangeListener(colorChangeListener);
    backgroundColorPane.addSelectChangeListener(colorChangeListener);
  }
        public void stateChanged(ChangeEvent e) {
          for (int i = 0; i < patternButtonArray.length; i++) {
            patternButtonArray[i].setPatternForeground(foregroundColorPane.getSelectObject());
            patternButtonArray[i].setPatternBackground(backgroundColorPane.getSelectObject());
          }

          PatternBackgroundQuickPane.this.repaint(); // repaint
        }
  public void populateBean(Background background) {
    PatternBackground patternBackground = (PatternBackground) background;
    int patternIndex = patternBackground.getPatternIndex();

    if (patternIndex >= 0 && patternIndex < this.patternButtonArray.length) {
      this.patternButtonArray[patternIndex].setSelected(true);
      this.patternIndex = patternIndex;
    } else {
      this.patternIndex = 0;
    }

    foregroundColorPane.setSelectObject(patternBackground.getForeground());
    backgroundColorPane.setSelectObject(patternBackground.getBackground());
  }
 /**
  * 给组件登记一个观察者监听事件
  *
  * @param listener 观察者监听事件
  */
 public void registerChangeListener(final UIObserverListener listener) {
   foregroundColorPane.addSelectChangeListener(
       new ChangeListener() {
         public void stateChanged(ChangeEvent e) {
           listener.doChange();
         }
       });
   backgroundColorPane.addSelectChangeListener(
       new ChangeListener() {
         public void stateChanged(ChangeEvent e) {
           listener.doChange();
         }
       });
   for (int i = 0, count = patternButtonArray.length; i < count; i++) {
     patternButtonArray[i].addChangeListener(
         new ChangeListener() {
           public void stateChanged(ChangeEvent e) {
             listener.doChange();
           }
         });
   }
 }
 public Background updateBean() {
   return new PatternBackground(
       patternIndex, foregroundColorPane.getSelectObject(), backgroundColorPane.getSelectObject());
 }