コード例 #1
0
 public void setStatusByUseType(boolean enable) {
   // imgNotFocus.setVisible(!enable);
   // imgFocus.setVisible(enable);
   imgHor.setVisible(USE_HOR.equals(cbxUseType.getValue()));
   imgVer.setVisible(USE_VER.equals(cbxUseType.getValue()));
   imgNotUsed.setVisible(USE_NO_USE.equals(cbxUseType.getValue()));
   pnlTitle.repaint();
 }
コード例 #2
0
  public AbstractFieldProvider() {
    FPanel pnlTop = new FPanel();
    pnlTop.setLayout(new BorderLayout());
    pnlTitle = new FPanel();
    pnlTitle.setBorder();
    pnlTitle.setPreferredSize(new Dimension(90, 28));
    FlowLayout fl = new FlowLayout(FlowLayout.LEFT);

    // imgFocus = new ImagePanel(IMG_FOCUS);
    // imgFocus.transferFocusBackward();
    // imgFocus.setPreferredSize(new Dimension(20, 20));
    // imgFocus.setVisible(false);
    // pnlTitle.add(imgFocus);
    //
    // imgNotFocus = new ImagePanel(IMG_NOT_FOCUS);
    // imgNotFocus.transferFocusBackward();
    // imgNotFocus.setPreferredSize(new Dimension(20, 20));
    // pnlTitle.add(imgNotFocus);

    imgHor = new ImagePanel(IMG_HOR);
    imgHor.transferFocusBackward();
    imgHor.setPreferredSize(new Dimension(24, 24));
    imgHor.setVisible(false);
    pnlTitle.add(imgHor);

    imgVer = new ImagePanel(IMG_VER);
    imgVer.transferFocusBackward();
    imgVer.setPreferredSize(new Dimension(24, 24));
    pnlTitle.add(imgVer);

    imgNotUsed = new ImagePanel(IMG_NOT_USED);
    imgNotUsed.transferFocusBackward();
    imgNotUsed.setPreferredSize(new Dimension(24, 24));
    pnlTitle.add(imgNotUsed);

    pnlTitle.setLayout(fl);
    lblTitle = new FLabel();
    lblTitle.setText("数据");
    pnlTitle.add(lblTitle);
    pnlTitle.setBackground(colDisactived);

    cbxUseType = new FComboBox();
    cbxUseType.setTitle("使用状态");
    // cbxUseType.setTitleVisible(false);
    cbxUseType.setRefModel(TYPEREF);
    cbxUseType.setValue(USE_NO_USE);
    cbxUseType.setPreferredSize(new Dimension(200, 20));
    cbxUseType.addValueChangeListener(
        new ValueChangeListener() {

          public void valueChanged(ValueChangeEvent arg0) {
            setEnabled(USE_HOR.equals(arg0.getNewValue()));
            setStatusByUseType(!USE_NO_USE.equals(arg0.getNewValue()));
            focusListener.changeUseType(AbstractFieldProvider.this);
          }
        });

    pnlTop.add(pnlTitle, BorderLayout.NORTH);
    pnlTop.add(cbxUseType, BorderLayout.CENTER);

    this.setLayout(new BorderLayout());
    this.add(pnlTop, BorderLayout.NORTH);
    pnlBody = new FPanel();
    pnlBody.setLayout(new BorderLayout());
    this.add(pnlBody, BorderLayout.CENTER);
    this.setBorder(new LineBorder(new Color(127, 157, 185), 1));
    // this.setBorder(new BevelBorder(BevelBorder.LOWERED));
    this.setPreferredSize(PREFERRED_SIZE_ENABLE);

    cbxUseType.addMouseListener(comCick);
    cbxUseType.getEditor().addMouseListener(comCick);
    // Component[] subCmps = cbxUseType.getComponents();
    // if (subCmps != null && subCmps.length > 0) {
    // for (int i = 0; i < subCmps.length; i++) {
    // Component component = subCmps[i];
    // if (component != null)
    // component.addMouseListener(comCick);
    // }
    // }
    lblTitle.addMouseListener(comCick);
    // imgFocus.addMouseListener(comCick);
    // imgNotFocus.addMouseListener(comCick);
    imgHor.addMouseListener(comCick);
    imgVer.addMouseListener(comCick);
    imgNotUsed.addMouseListener(comCick);
    lblTitle.addMouseListener(comCick);
    pnlTitle.addMouseListener(comCick);
    pnlBody.addMouseListener(comCick);
    init();
  }