javax.swing.JCheckBox.addMouseListener()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中javax.swing.JCheckBox.addMouseListener()方法的一些代码示例,展示了JCheckBox.addMouseListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JCheckBox.addMouseListener()方法的具体详情如下:
包路径:javax.swing.JCheckBox
类名称:JCheckBox
方法名:addMouseListener

JCheckBox.addMouseListener介绍

暂无

代码示例

代码示例来源:origin: zzz40500/GsonFormat

public TristateCheckBox(String text, Icon icon, Boolean initial) {
  super(text, icon);
  // Add a listener for when the mouse is pressed
  super.addMouseListener(new MouseAdapter() {
    @Override
    public void mousePressed(MouseEvent e) {
      grabFocus();
      decorator.nextState();
    }
  });
  // Reset the keyboard action map
  ActionMap map = new ActionMapUIResource();
  map.put("pressed", new AbstractAction() {      //NOI18N
    public void actionPerformed(ActionEvent e) {
      grabFocus();
      decorator.nextState();
    }
  });
  map.put("released", null);                     //NOI18N
  SwingUtilities.replaceUIActionMap(this, map);
  // set the model to the adapted model
  decorator = new TristateDecorator(getModel());
  setModel(decorator);
  setState(initial);
}

代码示例来源:origin: robward-scisys/sldeditor

/**
 * Sets the checkbox mouse listener.
 *
 * @param mouseAdapter the new checkbox mouse listener
 */
public void setCheckboxMouseListener(MouseAdapter mouseAdapter) {
  checkBox.addMouseListener(mouseAdapter);
}

代码示例来源:origin: de.richtercloud/reflection-form-builder

protected JComponent createComponentForModelValue(Object value) {
  final JCheckBox newElement = new JCheckBox("", (boolean) value);
  newElement.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseReleased(MouseEvent e) {
      int row = BooleanListPanel.this.getMainList().getSelectedRow();
      if(row > -1) {
        for(EditableListPanelItemListener<Boolean> listener : BooleanListPanel.this.getItemListeners()) {
          listener.onItemChanged(new ListPanelItemEvent<>(ListPanelItemEvent.EVENT_TYPE_CHANGED,
              row,
              BooleanListPanel.this.getMainListModel().getData()));
        }
      }
    }
  });
  return newElement;
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

public MethodSignatureTypeSettingsForm(Project project) {
  this.project = project;
  this.tableView = new TableView<>();
  this.modelList = new ListTableModel<>(
    new CallToColumn(),
    new MethodColumn(),
    new IndexColumn(),
    new ProviderColumn()
  );
  this.attachItems();
  this.tableView.setModelAndUpdateColumns(this.modelList);
  this.tableView.getModel().addTableModelListener(e -> MethodSignatureTypeSettingsForm.this.changed = true);
  buttonHelp.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      super.mouseClicked(e);
      IdeHelper.openUrl(Symfony2ProjectComponent.HELP_URL + "extension/signature_type.html");
    }
  });
  enableCustomSignatureTypesCheckBox.setSelected(getSettings().objectSignatureTypeProvider);
  enableCustomSignatureTypesCheckBox.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      super.mouseClicked(e);
      MethodSignatureTypeSettingsForm.this.changed = true;
    }
  });
}

代码示例来源:origin: stackoverflow.com

JCheckBox checkbox = new JCheckBox(text);
checkbox.addMouseMotionListener(scroller);
checkbox.addMouseListener(scroller);

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

public PainelPluginItem() {
  initComponents();
  seletorPlugin.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      if(!eCompativelComSistema())
      {
        seletorPlugin.setSelected(false);
        QuestionDialog.getInstance().showMessage("O plugin não é compatível com seu sistema!", JOptionPane.ERROR_MESSAGE);
      }
    }
  });
  configurarCores();
}

代码示例来源:origin: Exslims/MercuryTrade

public JCheckBox getCheckBox(String tooltip) {
    JCheckBox checkBox = new JCheckBox();
    checkBox.setFocusPainted(false);
    checkBox.setBackground(AppThemeColor.TRANSPARENT);
//        checkBox.setUI(new WindowsButtonUI());
    checkBox.addMouseListener(new TooltipMouseListener(tooltip));
    return checkBox;
  }

代码示例来源:origin: edu.stanford.protege/org.coode.owlviz

panel.setBorder(BorderFactory.createTitledBorder("Popup"));
displayPopupCheckBox = new JCheckBox("Display popup information");
displayPopupCheckBox.addMouseListener(new MouseAdapter() {
  public void mouseClicked(MouseEvent e) {
    setComponentState();

代码示例来源:origin: kabutz/javaspecialists

public TristateCheckBox(String text, Icon icon,
            TristateState initial) {
  super(text, icon);
  //Set default single model
  setModel(new TristateButtonModel(initial));
  // override action behaviour
  super.addMouseListener(new MouseAdapter() {
    public void mousePressed(MouseEvent e) {
      TristateCheckBox.this.iterateState();
    }
  });
  ActionMap actions = new ActionMapUIResource();
  actions.put("pressed", new AbstractAction() {
    public void actionPerformed(ActionEvent e) {
      TristateCheckBox.this.iterateState();
    }
  });
  actions.put("released", null);
  SwingUtilities.replaceUIActionMap(this, actions);
}

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core

TristateCheckBox(String text, Icon icon, TristateState initial, boolean original) {
  super(text, icon);
  //Set default single model
  setModel(new TristateButtonModel(initial, this, original));
  // override action behaviour
  super.addMouseListener(new MouseAdapter() {
    @Override
    public void mousePressed(MouseEvent e) {
      TristateCheckBox.this.iterateState();
    }
  });
  ActionMap actions = new ActionMapUIResource();
  actions.put("pressed", new AbstractAction() {
    private static final long serialVersionUID = 1L;
    @Override
    public void actionPerformed(ActionEvent e) {
      TristateCheckBox.this.iterateState();
    }
  });
  actions.put("released", null);
  SwingUtilities.replaceUIActionMap(this, actions);
}

代码示例来源:origin: com.numdata/numdata-swing

public TristateCheckBox( final String text, final Icon icon, final TristateState initial )
{
  super( text, icon );
  //Set default single model
  setModel( new TristateButtonModel( initial ) );
  // override action behaviour
  super.addMouseListener( new MouseAdapter()
  {
    @Override
    public void mousePressed( final MouseEvent e )
    {
      iterateState();
    }
  } );
  final ActionMap actions = new ActionMapUIResource();
  actions.put( "pressed", new AbstractAction()
  {
    public void actionPerformed( final ActionEvent e )
    {
      iterateState();
    }
  } );
  actions.put( "released", null );
  SwingUtilities.replaceUIActionMap( this, actions );
}

代码示例来源:origin: Vhati/Slipstream-Mod-Manager

public TristateCheckBox( String text, Icon icon, TristateState initial ) {
  super( text, icon );
  setModel( new TristateButtonModel( initial ) );
  enableListener = new ChangeListener() {
    @Override
    public void stateChanged( ChangeEvent e ) {
      TristateCheckBox.this.setFocusable( TristateCheckBox.this.getModel().isEnabled() );
    }
  };
  // Add a listener for when the mouse is pressed.
  super.addMouseListener(new MouseAdapter() {
    @Override
    public void mousePressed( MouseEvent e ) {
      TristateCheckBox.this.iterateState();
    }
  });
  // Reset the keyboard action map.
  ActionMap map = new ActionMapUIResource();
  map.put( "pressed", new AbstractAction() {
    @Override
    public void actionPerformed( ActionEvent e ) {
      TristateCheckBox.this.iterateState();
    }
  });
  map.put( "released", null );
  SwingUtilities.replaceUIActionMap( this, map );
}

代码示例来源:origin: net.sf.mmax2/mmax2

suppressCheck.addMouseListener(
new java.awt.event.MouseAdapter()
warnOnExtraAttributes.addMouseListener(
new java.awt.event.MouseAdapter()

代码示例来源:origin: org.netbeans.api/org-openide-explorer

Boolean3Inplace() {
  setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
  // Add a listener for when the mouse is pressed
  super.addMouseListener(new MouseAdapter() {
    @Override
    public void mousePressed(MouseEvent e) {
      grabFocus();
      model3way.nextState();
    }
  });
  // Reset the keyboard action map
  ActionMap map = new ActionMapUIResource();
  map.put("pressed", new AbstractAction() {
    public void actionPerformed(ActionEvent e) {
      grabFocus();
      model3way.nextState();
    }
  });
  map.put("released", null);
  SwingUtilities.replaceUIActionMap(this, map);
  // set the model to the adapted model
  model3way = new ButtonModel3Way(getModel());
  setModel(model3way);
  setState(null == v ? DONT_CARE : (v.booleanValue() ? SELECTED : NOT_SELECTED));
}

代码示例来源:origin: cytoscape.coreplugins/filters

chkNot.setName(Integer.toString(pGridY));
chkNot.setSelected(pFilter.getNegation());
chkNot.addMouseListener(
    new MouseAdapter() {
      public void mouseClicked(MouseEvent e) {

代码示例来源:origin: com.google.code.findbugs/findbugs

checkGlobal.addMouseListener(new MouseAdapter() {

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

public BuCheckBox3States(String text, Icon icon, int initial){
 super(text, icon);
 // Add a listener for when the mouse is pressed
 super.addMouseListener(new MouseAdapter() {
  public void mousePressed(MouseEvent e) {
   grabFocus();
   model.nextState();
  }
 });
 // Reset the keyboard action map
 ActionMap map = new ActionMapUIResource();
 map.put("pressed", new AbstractAction() {
  public void actionPerformed(ActionEvent e) {
   grabFocus();
   model.nextState();
  }
 });
 map.put("released", null);
 SwingUtilities.replaceUIActionMap(this, map);
 // set the model to the adapted model
 model = new BuCheckbox3StatesDecorator(getModel());
 setModel(model);
 setState(initial);
}
public BuCheckBox3States(String text, int initial) {

代码示例来源:origin: com.jidesoft/jide-oss

public LegacyTristateCheckBox(String text, Icon icon, State initial) {
  super(text, icon);
  // Add a listener for when the mouse is pressed
  super.addMouseListener(new MouseAdapter() {
    @Override
    public void mousePressed(MouseEvent e) {
      grabFocus();
      setState(getNextState(getState()));
    }
  });
  // Reset the keyboard action map
  ActionMap map = new ActionMapUIResource();
  map.put("pressed", new AbstractAction() {
    private static final long serialVersionUID = 7121802319351334948L;
    public void actionPerformed(ActionEvent e) {
      grabFocus();
      setState(getNextState(getState()));
    }
  });
  map.put("released", null);
  SwingUtilities.replaceUIActionMap(this, map);
  // set the model to the adapted model
  model = new TristateDecorator(getModel());
  setModel(model);
  setState(initial);
}

代码示例来源:origin: sc.fiji/TrakEM2_

this.c.addMouseListener(listener);
this.c.setIcon(INVISIBLE);
this.c.setSelectedIcon(VISIBLE);
this.c_locked.setSelectedIcon(LOCKED);
this.c_locked.setSelected(d.isLocked2());
this.c_locked.addMouseListener(listener);
this.c_locked.setBackground(Color.white);
Dimension maxdim10 = new Dimension(26, 10);
this.c_linked.setSelectedIcon(LINKED);
this.c_linked.setSelected(d.isLinked());
this.c_linked.addMouseListener(listener);
this.c_linked.setBackground(Color.white);
this.c_linked.setPreferredSize(maxdim10);

相关文章

JCheckBox类方法