コード例 #1
0
  public IECheckBoxWidgetView(
      IEController ieController,
      IECheckBoxWidget model,
      boolean addDnDSupport,
      IEWOComponentView view) {
    super(ieController, model, addDnDSupport, view);
    FlowLayout layout = new FlowLayout(FlowLayout.LEFT, 0, 0);
    setLayout(layout);
    _jCheckBox = new JCheckBox();
    _jCheckBox.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            isUpdatingModel = true;
            getCheckBoxModel().setValue(((JCheckBox) e.getSource()).isSelected());
            isUpdatingModel = false;
          }
        });
    _jCheckBox.setFont(TEXTFIELD_FONT);
    container = new JPanel(new FlowLayout(FlowLayout.CENTER, 4, 4));
    container.setOpaque(false);
    container.add(_jCheckBox);
    add(container);
    _jCheckBox.setEnabled(true);
    _jCheckBox.setFocusable(false);
    _jCheckBox.setOpaque(false);
    if (getCheckBoxModel().getDescription() != null) {
      _jCheckBox.setToolTipText(getCheckBoxModel().getDescription());
    }
    TransparentMouseListener tml = new TransparentMouseListener(_jCheckBox, this);
    _jCheckBox.addMouseListener(tml);
    _jCheckBox.addMouseMotionListener(tml);
    _jCheckBox.setSelected(getCheckBoxModel().getValue());
    _jCheckBox.setBackground(getBackgroundColor());
    setBackground(getBackgroundColor());
    revalidate();
  }