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

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

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

JCheckBox.addMouseListener介绍

暂无

代码示例

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

  1. public TristateCheckBox(String text, Icon icon, Boolean initial) {
  2. super(text, icon);
  3. // Add a listener for when the mouse is pressed
  4. super.addMouseListener(new MouseAdapter() {
  5. @Override
  6. public void mousePressed(MouseEvent e) {
  7. grabFocus();
  8. decorator.nextState();
  9. }
  10. });
  11. // Reset the keyboard action map
  12. ActionMap map = new ActionMapUIResource();
  13. map.put("pressed", new AbstractAction() { //NOI18N
  14. public void actionPerformed(ActionEvent e) {
  15. grabFocus();
  16. decorator.nextState();
  17. }
  18. });
  19. map.put("released", null); //NOI18N
  20. SwingUtilities.replaceUIActionMap(this, map);
  21. // set the model to the adapted model
  22. decorator = new TristateDecorator(getModel());
  23. setModel(decorator);
  24. setState(initial);
  25. }

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

  1. /**
  2. * Sets the checkbox mouse listener.
  3. *
  4. * @param mouseAdapter the new checkbox mouse listener
  5. */
  6. public void setCheckboxMouseListener(MouseAdapter mouseAdapter) {
  7. checkBox.addMouseListener(mouseAdapter);
  8. }

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

  1. protected JComponent createComponentForModelValue(Object value) {
  2. final JCheckBox newElement = new JCheckBox("", (boolean) value);
  3. newElement.addMouseListener(new MouseAdapter() {
  4. @Override
  5. public void mouseReleased(MouseEvent e) {
  6. int row = BooleanListPanel.this.getMainList().getSelectedRow();
  7. if(row > -1) {
  8. for(EditableListPanelItemListener<Boolean> listener : BooleanListPanel.this.getItemListeners()) {
  9. listener.onItemChanged(new ListPanelItemEvent<>(ListPanelItemEvent.EVENT_TYPE_CHANGED,
  10. row,
  11. BooleanListPanel.this.getMainListModel().getData()));
  12. }
  13. }
  14. }
  15. });
  16. return newElement;
  17. }

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

  1. public MethodSignatureTypeSettingsForm(Project project) {
  2. this.project = project;
  3. this.tableView = new TableView<>();
  4. this.modelList = new ListTableModel<>(
  5. new CallToColumn(),
  6. new MethodColumn(),
  7. new IndexColumn(),
  8. new ProviderColumn()
  9. );
  10. this.attachItems();
  11. this.tableView.setModelAndUpdateColumns(this.modelList);
  12. this.tableView.getModel().addTableModelListener(e -> MethodSignatureTypeSettingsForm.this.changed = true);
  13. buttonHelp.addMouseListener(new MouseAdapter() {
  14. @Override
  15. public void mouseClicked(MouseEvent e) {
  16. super.mouseClicked(e);
  17. IdeHelper.openUrl(Symfony2ProjectComponent.HELP_URL + "extension/signature_type.html");
  18. }
  19. });
  20. enableCustomSignatureTypesCheckBox.setSelected(getSettings().objectSignatureTypeProvider);
  21. enableCustomSignatureTypesCheckBox.addMouseListener(new MouseAdapter() {
  22. @Override
  23. public void mouseClicked(MouseEvent e) {
  24. super.mouseClicked(e);
  25. MethodSignatureTypeSettingsForm.this.changed = true;
  26. }
  27. });
  28. }

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

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

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

  1. public PainelPluginItem() {
  2. initComponents();
  3. seletorPlugin.addMouseListener(new MouseAdapter() {
  4. @Override
  5. public void mouseClicked(MouseEvent e) {
  6. if(!eCompativelComSistema())
  7. {
  8. seletorPlugin.setSelected(false);
  9. QuestionDialog.getInstance().showMessage("O plugin não é compatível com seu sistema!", JOptionPane.ERROR_MESSAGE);
  10. }
  11. }
  12. });
  13. configurarCores();
  14. }

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

  1. public JCheckBox getCheckBox(String tooltip) {
  2. JCheckBox checkBox = new JCheckBox();
  3. checkBox.setFocusPainted(false);
  4. checkBox.setBackground(AppThemeColor.TRANSPARENT);
  5. // checkBox.setUI(new WindowsButtonUI());
  6. checkBox.addMouseListener(new TooltipMouseListener(tooltip));
  7. return checkBox;
  8. }

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

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

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

  1. public TristateCheckBox(String text, Icon icon,
  2. TristateState initial) {
  3. super(text, icon);
  4. //Set default single model
  5. setModel(new TristateButtonModel(initial));
  6. // override action behaviour
  7. super.addMouseListener(new MouseAdapter() {
  8. public void mousePressed(MouseEvent e) {
  9. TristateCheckBox.this.iterateState();
  10. }
  11. });
  12. ActionMap actions = new ActionMapUIResource();
  13. actions.put("pressed", new AbstractAction() {
  14. public void actionPerformed(ActionEvent e) {
  15. TristateCheckBox.this.iterateState();
  16. }
  17. });
  18. actions.put("released", null);
  19. SwingUtilities.replaceUIActionMap(this, actions);
  20. }

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

  1. TristateCheckBox(String text, Icon icon, TristateState initial, boolean original) {
  2. super(text, icon);
  3. //Set default single model
  4. setModel(new TristateButtonModel(initial, this, original));
  5. // override action behaviour
  6. super.addMouseListener(new MouseAdapter() {
  7. @Override
  8. public void mousePressed(MouseEvent e) {
  9. TristateCheckBox.this.iterateState();
  10. }
  11. });
  12. ActionMap actions = new ActionMapUIResource();
  13. actions.put("pressed", new AbstractAction() {
  14. private static final long serialVersionUID = 1L;
  15. @Override
  16. public void actionPerformed(ActionEvent e) {
  17. TristateCheckBox.this.iterateState();
  18. }
  19. });
  20. actions.put("released", null);
  21. SwingUtilities.replaceUIActionMap(this, actions);
  22. }

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

  1. public TristateCheckBox( final String text, final Icon icon, final TristateState initial )
  2. {
  3. super( text, icon );
  4. //Set default single model
  5. setModel( new TristateButtonModel( initial ) );
  6. // override action behaviour
  7. super.addMouseListener( new MouseAdapter()
  8. {
  9. @Override
  10. public void mousePressed( final MouseEvent e )
  11. {
  12. iterateState();
  13. }
  14. } );
  15. final ActionMap actions = new ActionMapUIResource();
  16. actions.put( "pressed", new AbstractAction()
  17. {
  18. public void actionPerformed( final ActionEvent e )
  19. {
  20. iterateState();
  21. }
  22. } );
  23. actions.put( "released", null );
  24. SwingUtilities.replaceUIActionMap( this, actions );
  25. }

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

  1. public TristateCheckBox( String text, Icon icon, TristateState initial ) {
  2. super( text, icon );
  3. setModel( new TristateButtonModel( initial ) );
  4. enableListener = new ChangeListener() {
  5. @Override
  6. public void stateChanged( ChangeEvent e ) {
  7. TristateCheckBox.this.setFocusable( TristateCheckBox.this.getModel().isEnabled() );
  8. }
  9. };
  10. // Add a listener for when the mouse is pressed.
  11. super.addMouseListener(new MouseAdapter() {
  12. @Override
  13. public void mousePressed( MouseEvent e ) {
  14. TristateCheckBox.this.iterateState();
  15. }
  16. });
  17. // Reset the keyboard action map.
  18. ActionMap map = new ActionMapUIResource();
  19. map.put( "pressed", new AbstractAction() {
  20. @Override
  21. public void actionPerformed( ActionEvent e ) {
  22. TristateCheckBox.this.iterateState();
  23. }
  24. });
  25. map.put( "released", null );
  26. SwingUtilities.replaceUIActionMap( this, map );
  27. }

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

  1. suppressCheck.addMouseListener(
  2. new java.awt.event.MouseAdapter()
  3. warnOnExtraAttributes.addMouseListener(
  4. new java.awt.event.MouseAdapter()

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

  1. Boolean3Inplace() {
  2. setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
  3. // Add a listener for when the mouse is pressed
  4. super.addMouseListener(new MouseAdapter() {
  5. @Override
  6. public void mousePressed(MouseEvent e) {
  7. grabFocus();
  8. model3way.nextState();
  9. }
  10. });
  11. // Reset the keyboard action map
  12. ActionMap map = new ActionMapUIResource();
  13. map.put("pressed", new AbstractAction() {
  14. public void actionPerformed(ActionEvent e) {
  15. grabFocus();
  16. model3way.nextState();
  17. }
  18. });
  19. map.put("released", null);
  20. SwingUtilities.replaceUIActionMap(this, map);
  21. // set the model to the adapted model
  22. model3way = new ButtonModel3Way(getModel());
  23. setModel(model3way);
  24. setState(null == v ? DONT_CARE : (v.booleanValue() ? SELECTED : NOT_SELECTED));
  25. }

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

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

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

  1. checkGlobal.addMouseListener(new MouseAdapter() {

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

  1. public BuCheckBox3States(String text, Icon icon, int initial){
  2. super(text, icon);
  3. // Add a listener for when the mouse is pressed
  4. super.addMouseListener(new MouseAdapter() {
  5. public void mousePressed(MouseEvent e) {
  6. grabFocus();
  7. model.nextState();
  8. }
  9. });
  10. // Reset the keyboard action map
  11. ActionMap map = new ActionMapUIResource();
  12. map.put("pressed", new AbstractAction() {
  13. public void actionPerformed(ActionEvent e) {
  14. grabFocus();
  15. model.nextState();
  16. }
  17. });
  18. map.put("released", null);
  19. SwingUtilities.replaceUIActionMap(this, map);
  20. // set the model to the adapted model
  21. model = new BuCheckbox3StatesDecorator(getModel());
  22. setModel(model);
  23. setState(initial);
  24. }
  25. public BuCheckBox3States(String text, int initial) {

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

  1. public LegacyTristateCheckBox(String text, Icon icon, State initial) {
  2. super(text, icon);
  3. // Add a listener for when the mouse is pressed
  4. super.addMouseListener(new MouseAdapter() {
  5. @Override
  6. public void mousePressed(MouseEvent e) {
  7. grabFocus();
  8. setState(getNextState(getState()));
  9. }
  10. });
  11. // Reset the keyboard action map
  12. ActionMap map = new ActionMapUIResource();
  13. map.put("pressed", new AbstractAction() {
  14. private static final long serialVersionUID = 7121802319351334948L;
  15. public void actionPerformed(ActionEvent e) {
  16. grabFocus();
  17. setState(getNextState(getState()));
  18. }
  19. });
  20. map.put("released", null);
  21. SwingUtilities.replaceUIActionMap(this, map);
  22. // set the model to the adapted model
  23. model = new TristateDecorator(getModel());
  24. setModel(model);
  25. setState(initial);
  26. }

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

  1. this.c.addMouseListener(listener);
  2. this.c.setIcon(INVISIBLE);
  3. this.c.setSelectedIcon(VISIBLE);
  4. this.c_locked.setSelectedIcon(LOCKED);
  5. this.c_locked.setSelected(d.isLocked2());
  6. this.c_locked.addMouseListener(listener);
  7. this.c_locked.setBackground(Color.white);
  8. Dimension maxdim10 = new Dimension(26, 10);
  9. this.c_linked.setSelectedIcon(LINKED);
  10. this.c_linked.setSelected(d.isLinked());
  11. this.c_linked.addMouseListener(listener);
  12. this.c_linked.setBackground(Color.white);
  13. this.c_linked.setPreferredSize(maxdim10);

相关文章

JCheckBox类方法