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

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

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

JCheckBox.addActionListener介绍

暂无

代码示例

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

  1. JPanel panel = new JPanel();
  2. panel.add(new JLabel("Global"), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
  3. new Insets(0, 0, 0, 0), 0, 0));
  4. panel.add(isGlobalCheckBox = new JCheckBox(), new GridBagConstraints(1, 0, 1, 1, 0, 0,
  5. GridBagConstraints.WEST, GridBagConstraints.NONE,
  6. new Insets(0, 0, 0, 0), 0, 0));
  7. contentPanel.add(panel,new GridBagConstraints(0, 1, 1, 1, 0, 0,
  8. GridBagConstraints.WEST, GridBagConstraints.NONE,
  9. new Insets(0, 0, 0, 0), 0, 0));
  10. JPanel spacer = new JPanel();
  11. spacer.setPreferredSize(new Dimension());
  12. contentPanel.add(spacer, new GridBagConstraints(6, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
  13. isGlobalCheckBox.addActionListener(new ActionListener() {
  14. @Override
  15. public void actionPerformed (ActionEvent e) {

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

  1. public CheapTimePanel() {
  2. setLayout(new BorderLayout());
  3. groupByMachineCheckBox = new JCheckBox("Group by assigned machine", false);
  4. groupByMachineCheckBox.setHorizontalAlignment(SwingConstants.RIGHT);
  5. groupByMachineCheckBox.addActionListener(e -> {
  6. updatePanel(getSolution());
  7. validate();
  8. });
  9. }

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

  1. public SearchBar(RSyntaxTextArea textArea) {
  2. rTextArea = textArea;
  3. JLabel findLabel = new JLabel(NLS.str("search.find") + ":");
  4. add(findLabel);
  5. prevButton.addActionListener(new ActionListener() {
  6. @Override
  7. public void actionPerformed(ActionEvent e) {
  8. add(nextButton);
  9. markAllCB = new JCheckBox(NLS.str("search.mark_all"));
  10. markAllCB.addActionListener(new ForwardListener());
  11. add(markAllCB);
  12. regexCB = new JCheckBox(NLS.str("search.regex"));
  13. regexCB.addActionListener(new ForwardListener());
  14. add(regexCB);
  15. matchCaseCB = new JCheckBox(NLS.str("search.match_case"));
  16. matchCaseCB.addActionListener(new ForwardListener());
  17. add(matchCaseCB);
  18. wholeWordCB = new JCheckBox(NLS.str("search.whole_word"));
  19. wholeWordCB.addActionListener(new ForwardListener());
  20. add(wholeWordCB);

代码示例来源:origin: 4thline/cling

  1. statusIconButton.addActionListener(new ActionListener() {
  2. public void actionPerformed(ActionEvent actionEvent) {
  3. toggleLogPanel();
  4. statusIconPanel.add(statusIconButton);
  5. fullscreenCheckbox.addActionListener(new ActionListener() {
  6. public void actionPerformed(ActionEvent actionEvent) {
  7. toggleFullscreen();
  8. statusIconPanel.add(fullscreenCheckbox);

代码示例来源:origin: Killerardvark/CryodexSource

  1. public PlayerPanel(Player player) {
  2. this.player = player;
  3. playerNameLabel = new JLabel(player.getName());
  4. checkbox = new JCheckBox();
  5. checkbox.setSelected(player.isActive());
  6. checkbox.addActionListener(new ActionListener() {
  7. @Override
  8. public void actionPerformed(ActionEvent e) {
  9. updateActivePlayerCount();
  10. }
  11. });
  12. }

代码示例来源:origin: org.fudaa.framework.ebli/ebli-3d

  1. public void buildPanel() {
  2. if (pn_ != null) {
  3. return;
  4. }
  5. pn_ = new BuPanel();
  6. pn_.setLayout(new BuHorizontalLayout(3));
  7. chbEnable_ = new BuCheckBox();
  8. cbMode_ = new BuComboBox(new String[] { "Modulate", "Decal", "Blend", "Replace" });
  9. btFileChooser_ = new BuButton();
  10. setBtDefaultTltip();
  11. chbEnable_.addActionListener(this);
  12. btFileChooser_.addActionListener(this);
  13. setNoneIcone();
  14. cbMode_.addItemListener(this);
  15. pn_.add(chbEnable_);
  16. pn_.add(btFileChooser_);
  17. pn_.add(cbMode_);
  18. updateSrc();
  19. }

代码示例来源:origin: com.samskivert/samskivert

  1. @Override protected void populateEditor (JPanel editor)
  2. {
  3. editor.add(_valbox = new JCheckBox(), GroupLayout.FIXED);
  4. _valbox.setSelected(getValue());
  5. _valbox.addActionListener(this);
  6. }

代码示例来源:origin: winder/Universal-G-Code-Sender

  1. public ProcessorConfigCheckbox(ProcessorConfig pc, String helpMessage) {
  2. this.pc = pc;
  3. if (helpMessage == null)
  4. throw new RuntimeException("Help message was not provided.");
  5. JButton help = new JButton("?");
  6. help.addActionListener((ActionEvent e) -> {
  7. GUIHelpers.displayHelpDialog(helpMessage);
  8. });
  9. add(help, "w 25");
  10. box = new JCheckBox(Localization.getString(pc.name));
  11. box.setSelected(pc.enabled);
  12. box.addActionListener((ActionEvent e) -> {
  13. pc.enabled = box.isSelected();
  14. });
  15. if (!pc.optional) {
  16. box.setEnabled(false);
  17. }
  18. JButton edit = new JButton("edit");
  19. edit.addActionListener(evt -> editArgs());
  20. setLayout(new MigLayout("insets 0 50 0 0", "[][grow]20[]25"));
  21. add(box, "growx");
  22. if (pc.args != null) {
  23. add(edit, "w 45");
  24. }
  25. }

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

  1. JPanel panel = new JPanel();
  2. panel.add(new JLabel("Global"), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
  3. new Insets(0, 0, 0, 0), 0, 0));
  4. panel.add(isGlobalCheckBox = new JCheckBox(), new GridBagConstraints(1, 0, 1, 1, 0, 0,
  5. GridBagConstraints.WEST, GridBagConstraints.NONE,
  6. new Insets(0, 0, 0, 0), 0, 0));
  7. contentPanel.add(panel,new GridBagConstraints(0, 1, 1, 1, 0, 0,
  8. GridBagConstraints.WEST, GridBagConstraints.NONE,
  9. new Insets(0, 0, 0, 0), 0, 0));
  10. JPanel spacer = new JPanel();
  11. spacer.setPreferredSize(new Dimension());
  12. contentPanel.add(spacer, new GridBagConstraints(6, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
  13. isGlobalCheckBox.addActionListener(new ActionListener() {
  14. @Override
  15. public void actionPerformed (ActionEvent e) {

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd

  1. /*package*/ NewQtFormPanelGUI(Project project, SourceGroup[] folders, Component bottomPanel, FormType[] formTypes) {
  2. super(project, folders);
  3. this.formTypes = formTypes;
  4. initComponents();
  5. if (bottomPanel != null) {
  6. bottomPanelContainer.add(bottomPanel, java.awt.BorderLayout.CENTER);
  7. }
  8. initValues(null, null, null);
  9. /* handled by parent class */
  10. tfFormName.getDocument().addDocumentListener(this);
  11. tfFolder.getDocument().addDocumentListener(this);
  12. /* handled by this class */
  13. cbCreateClass.addActionListener(this);
  14. cbLocation.addActionListener(this);
  15. browseButton.addActionListener(this);
  16. }

代码示例来源:origin: Audiveris/audiveris

  1. TopicPane (Topic topic)
  2. {
  3. this.topic = topic;
  4. PanelBuilder builder = new PanelBuilder(layout3, this);
  5. CellConstraints cst = new CellConstraints();
  6. JCheckBox box = new JCheckBox();
  7. box.addActionListener(this);
  8. box.setSelected(topic.isSet());
  9. final int r = 1;
  10. builder.add(box, cst.xy(1, r));
  11. builder.add(new JLabel(topic.name()), cst.xy(3, r));
  12. builder.add(new JLabel(topic.getDescription()), cst.xy(5, r));
  13. }

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

  1. private void initializeComponents(RegularEmitter emitter){
  2. continuousCheckbox = new JCheckBox("Continuous");
  3. continuousCheckbox.setSelected(emitter.isContinuous());
  4. continuousCheckbox.addActionListener(new ActionListener() {
  5. public void actionPerformed (ActionEvent event) {
  6. RegularEmitter emitter = (RegularEmitter) editor.getEmitter().emitter;
  7. emitter.setContinuous(continuousCheckbox.isSelected());
  8. }
  9. });
  10. continuousCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
  11. int i =0;
  12. addContent(i++, 0, continuousCheckbox, GridBagConstraints.WEST, GridBagConstraints.NONE);
  13. addContent(i++, 0, countPanel = new CountPanel(editor, "Count", "Min number of particles at all times, max number of particles allowed.", emitter.minParticleCount, emitter.maxParticleCount));
  14. addContent(i++, 0, delayPanel = new RangedNumericPanel(editor, emitter.getDelay(), "Delay", "Time from beginning of effect to emission start, in milliseconds.", false));
  15. addContent(i++, 0, durationPanel = new RangedNumericPanel(editor, emitter.getDuration(), "Duration", "Time particles will be emitted, in milliseconds."));
  16. addContent(i++, 0, emissionPanel = new ScaledNumericPanel(editor, emitter.getEmission(), "Duration", "Emission","Number of particles emitted per second."));
  17. addContent(i++, 0, lifePanel = new ScaledNumericPanel(editor, emitter.getLife(), "Duration", "Life", "Time particles will live, in milliseconds."));
  18. addContent(i++, 0, lifeOffsetPanel = new ScaledNumericPanel(editor, emitter.getLifeOffset(), "Duration", "Life Offset","Particle starting life consumed, in milliseconds.", false));
  19. }

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

  1. contentPanel.add(new JLabel("XYZ:"), new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
  2. new Insets(6, 0, 0, 0), 0, 0));
  3. drawXYZCheckBox = new JCheckBox();
  4. contentPanel.add(drawXYZCheckBox, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST,
  5. GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));
  6. contentPanel.add(new JLabel("XZ Plane:"), new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
  7. new Insets(6, 0, 0, 0), 0, 0));
  8. drawXZPlaneBox = new JCheckBox();
  9. contentPanel.add(drawXZPlaneBox, new GridBagConstraints(1, 2, 1, 1, 1, 0, GridBagConstraints.WEST,
  10. GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));
  11. drawXYZCheckBox.addActionListener(new ActionListener() {
  12. public void actionPerformed (ActionEvent event) {
  13. DrawPanel.this.editor.getRenderer().setDrawXYZ(drawXYZCheckBox.isSelected());
  14. drawXYZCheckBox.setSelected(editor.getRenderer().IsDrawXYZ());
  15. drawXZPlaneBox.addActionListener(new ActionListener() {
  16. public void actionPerformed (ActionEvent event) {
  17. DrawPanel.this.editor.getRenderer().setDrawXZPlane(drawXZPlaneBox.isSelected());
  18. drawXZPlaneBox.setSelected(editor.getRenderer().IsDrawXZPlane());
  19. drawXYPlaneBox.addActionListener(new ActionListener() {
  20. public void actionPerformed (ActionEvent event) {
  21. DrawPanel.this.editor.getRenderer().setDrawXYPlane(drawXYPlaneBox.isSelected());

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

  1. @Override
  2. public void onViewInit() {
  3. this.setLayout(new BorderLayout());
  4. this.setBackground(AppThemeColor.FRAME);
  5. JButton hideButton = componentsFactory.getIconButton("app/close.png", 12, AppThemeColor.FRAME, "Dismiss");
  6. hideButton.addActionListener((action) -> {
  7. stashTabDescriptor.setUndefined(true);
  8. MercuryStoreUI.dismissTabInfoPanelSubject.onNext(this);
  9. });
  10. JPanel tabInfoPanel = componentsFactory.getJPanel(new FlowLayout(FlowLayout.CENTER));
  11. JLabel tabLabel = componentsFactory.getTextLabel(stashTabDescriptor.getTitle());
  12. tabLabel.setBorder(null);
  13. tabLabel.setFont(componentsFactory.getFont(FontStyle.BOLD, 15f));
  14. tabInfoPanel.add(tabLabel);
  15. JCheckBox isItQuad = componentsFactory.getCheckBox("Is it Quad?");
  16. isItQuad.setSelected(stashTabDescriptor.isQuad());
  17. isItQuad.setPreferredSize(new Dimension(16, 16));
  18. isItQuad.addActionListener(action -> {
  19. stashTabDescriptor.setQuad(isItQuad.isSelected());
  20. });
  21. tabInfoPanel.add(isItQuad);
  22. tabInfoPanel.add(hideButton);
  23. this.add(tabInfoPanel, BorderLayout.PAGE_END);
  24. this.setBorder(BorderFactory.createLineBorder(AppThemeColor.BORDER, 1));
  25. }

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

  1. private void initializeComponents(RegularEmitter emitter){
  2. continuousCheckbox = new JCheckBox("Continuous");
  3. continuousCheckbox.setSelected(emitter.isContinuous());
  4. continuousCheckbox.addActionListener(new ActionListener() {
  5. public void actionPerformed (ActionEvent event) {
  6. RegularEmitter emitter = (RegularEmitter) editor.getEmitter().emitter;
  7. emitter.setContinuous(continuousCheckbox.isSelected());
  8. }
  9. });
  10. continuousCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
  11. int i =0;
  12. addContent(i++, 0, continuousCheckbox, GridBagConstraints.WEST, GridBagConstraints.NONE);
  13. addContent(i++, 0, countPanel = new CountPanel(editor, "Count", "Min number of particles at all times, max number of particles allowed.", emitter.minParticleCount, emitter.maxParticleCount));
  14. addContent(i++, 0, delayPanel = new RangedNumericPanel(editor, emitter.getDelay(), "Delay", "Time from beginning of effect to emission start, in milliseconds.", false));
  15. addContent(i++, 0, durationPanel = new RangedNumericPanel(editor, emitter.getDuration(), "Duration", "Time particles will be emitted, in milliseconds."));
  16. addContent(i++, 0, emissionPanel = new ScaledNumericPanel(editor, emitter.getEmission(), "Duration", "Emission","Number of particles emitted per second."));
  17. addContent(i++, 0, lifePanel = new ScaledNumericPanel(editor, emitter.getLife(), "Duration", "Life", "Time particles will live, in milliseconds."));
  18. addContent(i++, 0, lifeOffsetPanel = new ScaledNumericPanel(editor, emitter.getLifeOffset(), "Duration", "Life Offset","Particle starting life consumed, in milliseconds.", false));
  19. }

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

  1. contentPanel.add(new JLabel("XYZ:"), new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
  2. new Insets(6, 0, 0, 0), 0, 0));
  3. drawXYZCheckBox = new JCheckBox();
  4. contentPanel.add(drawXYZCheckBox, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST,
  5. GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));
  6. contentPanel.add(new JLabel("XZ Plane:"), new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
  7. new Insets(6, 0, 0, 0), 0, 0));
  8. drawXZPlaneBox = new JCheckBox();
  9. contentPanel.add(drawXZPlaneBox, new GridBagConstraints(1, 2, 1, 1, 1, 0, GridBagConstraints.WEST,
  10. GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));
  11. drawXYZCheckBox.addActionListener(new ActionListener() {
  12. public void actionPerformed (ActionEvent event) {
  13. DrawPanel.this.editor.getRenderer().setDrawXYZ(drawXYZCheckBox.isSelected());
  14. drawXYZCheckBox.setSelected(editor.getRenderer().IsDrawXYZ());
  15. drawXZPlaneBox.addActionListener(new ActionListener() {
  16. public void actionPerformed (ActionEvent event) {
  17. DrawPanel.this.editor.getRenderer().setDrawXZPlane(drawXZPlaneBox.isSelected());
  18. drawXZPlaneBox.setSelected(editor.getRenderer().IsDrawXZPlane());
  19. drawXYPlaneBox.addActionListener(new ActionListener() {
  20. public void actionPerformed (ActionEvent event) {
  21. DrawPanel.this.editor.getRenderer().setDrawXYPlane(drawXYPlaneBox.isSelected());

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

  1. private void initializeComponents(DynamicsModifier.Angular aValue, String charTitle) {
  2. JPanel contentPanel = getContentPanel();
  3. JPanel panel = new JPanel();
  4. panel.add(new JLabel("Global"), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
  5. new Insets(0, 0, 0, 0), 0, 0));
  6. panel.add(isGlobalCheckBox = new JCheckBox(), new GridBagConstraints(1, 0, 1, 1, 0, 0,
  7. GridBagConstraints.WEST, GridBagConstraints.NONE,
  8. new Insets(0, 0, 0, 0), 0, 0));
  9. contentPanel.add(panel,new GridBagConstraints(0, 1, 1, 1, 0, 0,
  10. GridBagConstraints.WEST, GridBagConstraints.NONE,
  11. new Insets(0, 0, 0, 0), 0, 0));
  12. JPanel spacer = new JPanel();
  13. spacer.setPreferredSize(new Dimension());
  14. contentPanel.add(spacer, new GridBagConstraints(6, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
  15. thetaPanel.setIsAlwayShown(true);
  16. isGlobalCheckBox.addActionListener(new ActionListener() {
  17. @Override
  18. public void actionPerformed (ActionEvent e) {

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

  1. private void initializeComponents(DynamicsModifier.Angular aValue, String charTitle) {
  2. JPanel contentPanel = getContentPanel();
  3. JPanel panel = new JPanel();
  4. panel.add(new JLabel("Global"), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
  5. new Insets(0, 0, 0, 0), 0, 0));
  6. panel.add(isGlobalCheckBox = new JCheckBox(), new GridBagConstraints(1, 0, 1, 1, 0, 0,
  7. GridBagConstraints.WEST, GridBagConstraints.NONE,
  8. new Insets(0, 0, 0, 0), 0, 0));
  9. contentPanel.add(panel,new GridBagConstraints(0, 1, 1, 1, 0, 0,
  10. GridBagConstraints.WEST, GridBagConstraints.NONE,
  11. new Insets(0, 0, 0, 0), 0, 0));
  12. JPanel spacer = new JPanel();
  13. spacer.setPreferredSize(new Dimension());
  14. contentPanel.add(spacer, new GridBagConstraints(6, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
  15. thetaPanel.setIsAlwayShown(true);
  16. isGlobalCheckBox.addActionListener(new ActionListener() {
  17. @Override
  18. public void actionPerformed (ActionEvent e) {

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

  1. private JPanel createSearchPanel(final FilteredJList classes) {
  2. JPanel search = new JPanel();
  3. search.setLayout(new BorderLayout());
  4. search.add(new JLabel("Choose a Demo to start: Find: "),
  5. BorderLayout.WEST);
  6. final javax.swing.JTextField jtf = new javax.swing.JTextField();
  7. final JCheckBox showSettingCheck = new JCheckBox("Show Setting");
  8. showSettingCheck.setSelected(true);
  9. showSettingCheck.addActionListener(new ActionListener() {
  10. public void actionPerformed(ActionEvent e) {
  11. showSetting = showSettingCheck.isSelected();
  12. search.add(jtf, BorderLayout.CENTER);
  13. search.add(showSettingCheck, BorderLayout.EAST);
  14. return search;

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

  1. private JPanel buildCheckboxPanel(SkillDataBonus bonus)
  2. {
  3. JPanel uiOption = new JPanel(new BorderLayout());
  4. JLabel uiLabel = new JLabel(bonus.getName());
  5. JCheckBox uiCheckbox = new JCheckBox();
  6. uiLabel.setForeground(Color.WHITE);
  7. uiLabel.setFont(FontManager.getRunescapeSmallFont());
  8. uiOption.setBorder(BorderFactory.createEmptyBorder(3, 7, 3, 0));
  9. uiOption.setBackground(ColorScheme.DARKER_GRAY_COLOR);
  10. // Adjust XP bonus depending on check-state of the boxes.
  11. uiCheckbox.addActionListener(event -> adjustCheckboxes(uiCheckbox, bonus));
  12. uiCheckbox.setBackground(ColorScheme.MEDIUM_GRAY_COLOR);
  13. uiOption.add(uiLabel, BorderLayout.WEST);
  14. uiOption.add(uiCheckbox, BorderLayout.EAST);
  15. bonusCheckBoxes.add(uiCheckbox);
  16. return uiOption;
  17. }

相关文章

JCheckBox类方法