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

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

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

JButton.addMouseListener介绍

暂无

代码示例

代码示例来源:origin: checkstyle/checkstyle

/**
  anon inner in constructor.
*/
InputAnonInnerLength()
{
  mButton.addMouseListener( new MouseAdapter()
    {
      public void mouseClicked( MouseEvent aEv )
      {
        System.identityHashCode("click");
      }
    } );
}

代码示例来源:origin: checkstyle/checkstyle

/**
  anon inner in constructor.
*/
InputJavadocMethodScopeAnonInner()
{
  mButton.addMouseListener( new MouseAdapter()
    {
      public void mouseClicked( MouseEvent aEv )
      {
        System.identityHashCode("click");
      }
    } );
}

代码示例来源:origin: checkstyle/checkstyle

/**
    anon inner in method
  */
  public void addInputAnonInner()
  {
    mButton.addMouseListener( new MouseAdapter()
      {
        public void mouseClicked( MouseEvent aEv )
        {
          System.identityHashCode("click");
        }
      } );
  }
}

代码示例来源:origin: checkstyle/checkstyle

/**
    anon inner in method
  */
  public void addInputAnonInner()
  {
    mButton.addMouseListener( new MouseAdapter()
      {
        public void mouseClicked( MouseEvent aEv )
        {
          System.identityHashCode("click");
        }
      } );
  }
}

代码示例来源:origin: runelite/runelite

reset.addMouseListener(new MouseAdapter()

代码示例来源:origin: skylot/jadx

private SettingsGroup makeEditorGroup() {
  JButton fontBtn = new JButton(NLS.str("preferences.select_font"));
  fontBtn.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {

代码示例来源:origin: kiegroup/optaplanner

private JButton createExampleButton(final CommonApp commonApp) {
  String iconResource = commonApp.getIconResource();
  Icon icon = iconResource == null ? new EmptyIcon() : new ImageIcon(getClass().getResource(iconResource));
  JButton button = new JButton(new AbstractAction(commonApp.getName(), icon) {
    @Override
    public void actionPerformed(ActionEvent e) {
      commonApp.init(OptaPlannerExamplesApp.this, false);
    }
  });
  button.setHorizontalAlignment(JButton.LEFT);
  button.setHorizontalTextPosition(JButton.RIGHT);
  button.setVerticalTextPosition(JButton.CENTER);
  button.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseEntered(MouseEvent e) {
      descriptionTextArea.setText(commonApp.getDescription());
    }
    @Override
    public void mouseExited(MouseEvent e) {
      descriptionTextArea.setText("");
    }
  });
  return button;
}

代码示例来源:origin: wildfly/wildfly

leaveButton.setPreferredSize(new Dimension(150, 30));
buttons.add(leaveButton);
leaveButton.addMouseListener(new MouseAdapter() {
  public void mouseClicked(MouseEvent e) {
    stomp_client.send(USER_LEFT, USER, username);
sendButton.setPreferredSize(new Dimension(150, 30));
buttons.add(sendButton);
sendButton.addMouseListener(new MouseAdapter() {
  public void mouseClicked(MouseEvent e) {
    send(txtField.getText());
clearButton.addMouseListener(new MouseAdapter() {
  public void mouseClicked(MouseEvent e) {
    txtArea.setText("");

代码示例来源:origin: org.codehaus.groovy/groovy

popup.add(loadFileAction);
jbutton.setSize(30, 30);
jbutton.addMouseListener(new MouseAdapter() {
  public void mouseReleased(MouseEvent e) {

代码示例来源:origin: redwarp/9-Patch-Resizer

inputPanel.add(this.xhdpiButton, BorderLayout.CENTER);
this.xhdpiButton.addMouseListener(
  new MouseAdapter() {
   @Override

代码示例来源:origin: runelite/runelite

clearButton.addMouseListener(new MouseAdapter()

代码示例来源:origin: runelite/runelite

colorPickerBtn.addMouseListener(new MouseAdapter()

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

public SettingsForm(@NotNull final Project project) {
  this.project = project;
  buttonHelp.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      super.mouseClicked(e);
      IdeHelper.openUrl(Symfony2ProjectComponent.HELP_URL);
    }
  });
}

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

private void setupOverflowButton() {
  overflowButton = new JButton(ImageUtilities.loadImageIcon(getOrientation() == HORIZONTAL ? toolbarArrowVertical : toolbarArrowHorizontal, false));
  overflowButton.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      if(popup.isShowing()) {
        popup.setVisible(false);
      } else {
        displayOverflow();
      }
    }
    @Override
    public void mouseEntered(MouseEvent e) {
      if(displayOverflowOnHover) {
        displayOverflow();
      }
    }
  });
}

代码示例来源:origin: ron190/jsql-injection

/**
 * Tab header with a custom icon.
 */
public TabHeader(Icon imageIcon) {
  super(new FlowLayout(FlowLayout.LEFT, 0, 0));
  this.setOpaque(false);
  // Set the text of tab
  this.getTabTitleLabel().setIcon(imageIcon);
  this.add(this.getTabTitleLabel());
  JButton tabCloseButton = new ButtonClose();
  tabCloseButton.addMouseListener(this);
  this.add(tabCloseButton);
}

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

public JComponent createComponent() {
  pathToTranslationRootTextField.getButton().addMouseListener(createPathButtonMouseListener(pathToTranslationRootTextField.getTextField(), FileChooserDescriptorFactory.createSingleFolderDescriptor()));
  pathToTranslationRootTextFieldReset.addMouseListener(createResetPathButtonMouseListener(pathToTranslationRootTextField.getTextField(), Settings.DEFAULT_TRANSLATION_PATH));
  directoryToApp.getButton().addMouseListener(createPathButtonMouseListener(directoryToApp.getTextField(), FileChooserDescriptorFactory.createSingleFolderDescriptor()));
  directoryToAppReset.addMouseListener(createResetPathButtonMouseListener(directoryToApp.getTextField(), Settings.DEFAULT_APP_DIRECTORY));
  directoryToWeb.getButton().addMouseListener(createPathButtonMouseListener(directoryToWeb.getTextField(), FileChooserDescriptorFactory.createSingleFolderDescriptor()));
  directoryToWebReset.addMouseListener(createResetPathButtonMouseListener(directoryToWeb.getTextField(), Settings.DEFAULT_WEB_DIRECTORY));
  enableSchedulerCheckBox.setEnabled(WebDeploymentUtil.isEnabled(project));
  buttonReindex.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      IndexUtil.forceReindex();
      super.mouseClicked(e);
    }
  });
  return panel1;
}

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

public RoutingSettingsForm(@NotNull Project project) {
  this.project = project;
  this.tableView = new TableView<>();
  this.modelList = new ListTableModel<>(
    new UiPathColumnInfo.PathColumn(),
    new UiPathColumnInfo.TypeColumn(project)
  );
  this.initList();
  this.modelList.addTableModelListener(e -> RoutingSettingsForm.this.changed = true);
  this.tableView.setModelAndUpdateColumns(this.modelList);
  buttonReset.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      super.mouseClicked(e);
      resetList();
      // add default path
      for (String defaultContainerPath : Settings.DEFAULT_ROUTES) {
        RoutingSettingsForm.this.modelList.addRow(new RoutingFile(defaultContainerPath));
      }
    }
  });
}

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

public ContainerSettingsForm(@NotNull Project project) {
  this.project = project;
  this.tableView = new TableView<>();
  this.modelList = new ListTableModel<>(
    new UiPathColumnInfo.PathColumn(),
    new UiPathColumnInfo.TypeColumn(project)
  );
  this.fillContainerList();
  this.modelList.addTableModelListener(e ->
    ContainerSettingsForm.this.changed = true
  );
  this.tableView.setModelAndUpdateColumns(this.modelList);
  buttonReset.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      super.mouseClicked(e);
      resetContainerList();
      // add default path
      for (String defaultContainerPath : Settings.DEFAULT_CONTAINER_PATHS) {
        ContainerSettingsForm.this.modelList.addRow(new ContainerFile(defaultContainerPath));
      }
    }
  });
}

代码示例来源: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: Haehnchen/idea-php-symfony2-plugin

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

相关文章

JButton类方法