本文整理了Java中javax.swing.JCheckBox.addActionListener()
方法的一些代码示例,展示了JCheckBox.addActionListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JCheckBox.addActionListener()
方法的具体详情如下:
包路径:javax.swing.JCheckBox
类名称:JCheckBox
方法名:addActionListener
暂无
代码示例来源:origin: libgdx/libgdx
JPanel panel = new JPanel();
panel.add(new JLabel("Global"), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
panel.add(isGlobalCheckBox = new JCheckBox(), new GridBagConstraints(1, 0, 1, 1, 0, 0,
GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
contentPanel.add(panel,new GridBagConstraints(0, 1, 1, 1, 0, 0,
GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
JPanel spacer = new JPanel();
spacer.setPreferredSize(new Dimension());
contentPanel.add(spacer, new GridBagConstraints(6, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
isGlobalCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed (ActionEvent e) {
代码示例来源:origin: kiegroup/optaplanner
public CheapTimePanel() {
setLayout(new BorderLayout());
groupByMachineCheckBox = new JCheckBox("Group by assigned machine", false);
groupByMachineCheckBox.setHorizontalAlignment(SwingConstants.RIGHT);
groupByMachineCheckBox.addActionListener(e -> {
updatePanel(getSolution());
validate();
});
}
代码示例来源:origin: skylot/jadx
public SearchBar(RSyntaxTextArea textArea) {
rTextArea = textArea;
JLabel findLabel = new JLabel(NLS.str("search.find") + ":");
add(findLabel);
prevButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
add(nextButton);
markAllCB = new JCheckBox(NLS.str("search.mark_all"));
markAllCB.addActionListener(new ForwardListener());
add(markAllCB);
regexCB = new JCheckBox(NLS.str("search.regex"));
regexCB.addActionListener(new ForwardListener());
add(regexCB);
matchCaseCB = new JCheckBox(NLS.str("search.match_case"));
matchCaseCB.addActionListener(new ForwardListener());
add(matchCaseCB);
wholeWordCB = new JCheckBox(NLS.str("search.whole_word"));
wholeWordCB.addActionListener(new ForwardListener());
add(wholeWordCB);
代码示例来源:origin: 4thline/cling
statusIconButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
toggleLogPanel();
statusIconPanel.add(statusIconButton);
fullscreenCheckbox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
toggleFullscreen();
statusIconPanel.add(fullscreenCheckbox);
代码示例来源:origin: Killerardvark/CryodexSource
public PlayerPanel(Player player) {
this.player = player;
playerNameLabel = new JLabel(player.getName());
checkbox = new JCheckBox();
checkbox.setSelected(player.isActive());
checkbox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
updateActivePlayerCount();
}
});
}
代码示例来源:origin: org.fudaa.framework.ebli/ebli-3d
public void buildPanel() {
if (pn_ != null) {
return;
}
pn_ = new BuPanel();
pn_.setLayout(new BuHorizontalLayout(3));
chbEnable_ = new BuCheckBox();
cbMode_ = new BuComboBox(new String[] { "Modulate", "Decal", "Blend", "Replace" });
btFileChooser_ = new BuButton();
setBtDefaultTltip();
chbEnable_.addActionListener(this);
btFileChooser_.addActionListener(this);
setNoneIcone();
cbMode_.addItemListener(this);
pn_.add(chbEnable_);
pn_.add(btFileChooser_);
pn_.add(cbMode_);
updateSrc();
}
代码示例来源:origin: com.samskivert/samskivert
@Override protected void populateEditor (JPanel editor)
{
editor.add(_valbox = new JCheckBox(), GroupLayout.FIXED);
_valbox.setSelected(getValue());
_valbox.addActionListener(this);
}
代码示例来源:origin: winder/Universal-G-Code-Sender
public ProcessorConfigCheckbox(ProcessorConfig pc, String helpMessage) {
this.pc = pc;
if (helpMessage == null)
throw new RuntimeException("Help message was not provided.");
JButton help = new JButton("?");
help.addActionListener((ActionEvent e) -> {
GUIHelpers.displayHelpDialog(helpMessage);
});
add(help, "w 25");
box = new JCheckBox(Localization.getString(pc.name));
box.setSelected(pc.enabled);
box.addActionListener((ActionEvent e) -> {
pc.enabled = box.isSelected();
});
if (!pc.optional) {
box.setEnabled(false);
}
JButton edit = new JButton("edit");
edit.addActionListener(evt -> editArgs());
setLayout(new MigLayout("insets 0 50 0 0", "[][grow]20[]25"));
add(box, "growx");
if (pc.args != null) {
add(edit, "w 45");
}
}
代码示例来源:origin: libgdx/libgdx
JPanel panel = new JPanel();
panel.add(new JLabel("Global"), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
panel.add(isGlobalCheckBox = new JCheckBox(), new GridBagConstraints(1, 0, 1, 1, 0, 0,
GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
contentPanel.add(panel,new GridBagConstraints(0, 1, 1, 1, 0, 0,
GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
JPanel spacer = new JPanel();
spacer.setPreferredSize(new Dimension());
contentPanel.add(spacer, new GridBagConstraints(6, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
isGlobalCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed (ActionEvent e) {
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd
/*package*/ NewQtFormPanelGUI(Project project, SourceGroup[] folders, Component bottomPanel, FormType[] formTypes) {
super(project, folders);
this.formTypes = formTypes;
initComponents();
if (bottomPanel != null) {
bottomPanelContainer.add(bottomPanel, java.awt.BorderLayout.CENTER);
}
initValues(null, null, null);
/* handled by parent class */
tfFormName.getDocument().addDocumentListener(this);
tfFolder.getDocument().addDocumentListener(this);
/* handled by this class */
cbCreateClass.addActionListener(this);
cbLocation.addActionListener(this);
browseButton.addActionListener(this);
}
代码示例来源:origin: Audiveris/audiveris
TopicPane (Topic topic)
{
this.topic = topic;
PanelBuilder builder = new PanelBuilder(layout3, this);
CellConstraints cst = new CellConstraints();
JCheckBox box = new JCheckBox();
box.addActionListener(this);
box.setSelected(topic.isSet());
final int r = 1;
builder.add(box, cst.xy(1, r));
builder.add(new JLabel(topic.name()), cst.xy(3, r));
builder.add(new JLabel(topic.getDescription()), cst.xy(5, r));
}
代码示例来源:origin: libgdx/libgdx
private void initializeComponents(RegularEmitter emitter){
continuousCheckbox = new JCheckBox("Continuous");
continuousCheckbox.setSelected(emitter.isContinuous());
continuousCheckbox.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent event) {
RegularEmitter emitter = (RegularEmitter) editor.getEmitter().emitter;
emitter.setContinuous(continuousCheckbox.isSelected());
}
});
continuousCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
int i =0;
addContent(i++, 0, continuousCheckbox, GridBagConstraints.WEST, GridBagConstraints.NONE);
addContent(i++, 0, countPanel = new CountPanel(editor, "Count", "Min number of particles at all times, max number of particles allowed.", emitter.minParticleCount, emitter.maxParticleCount));
addContent(i++, 0, delayPanel = new RangedNumericPanel(editor, emitter.getDelay(), "Delay", "Time from beginning of effect to emission start, in milliseconds.", false));
addContent(i++, 0, durationPanel = new RangedNumericPanel(editor, emitter.getDuration(), "Duration", "Time particles will be emitted, in milliseconds."));
addContent(i++, 0, emissionPanel = new ScaledNumericPanel(editor, emitter.getEmission(), "Duration", "Emission","Number of particles emitted per second."));
addContent(i++, 0, lifePanel = new ScaledNumericPanel(editor, emitter.getLife(), "Duration", "Life", "Time particles will live, in milliseconds."));
addContent(i++, 0, lifeOffsetPanel = new ScaledNumericPanel(editor, emitter.getLifeOffset(), "Duration", "Life Offset","Particle starting life consumed, in milliseconds.", false));
}
代码示例来源:origin: libgdx/libgdx
contentPanel.add(new JLabel("XYZ:"), new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
new Insets(6, 0, 0, 0), 0, 0));
drawXYZCheckBox = new JCheckBox();
contentPanel.add(drawXYZCheckBox, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));
contentPanel.add(new JLabel("XZ Plane:"), new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
new Insets(6, 0, 0, 0), 0, 0));
drawXZPlaneBox = new JCheckBox();
contentPanel.add(drawXZPlaneBox, new GridBagConstraints(1, 2, 1, 1, 1, 0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));
drawXYZCheckBox.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent event) {
DrawPanel.this.editor.getRenderer().setDrawXYZ(drawXYZCheckBox.isSelected());
drawXYZCheckBox.setSelected(editor.getRenderer().IsDrawXYZ());
drawXZPlaneBox.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent event) {
DrawPanel.this.editor.getRenderer().setDrawXZPlane(drawXZPlaneBox.isSelected());
drawXZPlaneBox.setSelected(editor.getRenderer().IsDrawXZPlane());
drawXYPlaneBox.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent event) {
DrawPanel.this.editor.getRenderer().setDrawXYPlane(drawXYPlaneBox.isSelected());
代码示例来源:origin: Exslims/MercuryTrade
@Override
public void onViewInit() {
this.setLayout(new BorderLayout());
this.setBackground(AppThemeColor.FRAME);
JButton hideButton = componentsFactory.getIconButton("app/close.png", 12, AppThemeColor.FRAME, "Dismiss");
hideButton.addActionListener((action) -> {
stashTabDescriptor.setUndefined(true);
MercuryStoreUI.dismissTabInfoPanelSubject.onNext(this);
});
JPanel tabInfoPanel = componentsFactory.getJPanel(new FlowLayout(FlowLayout.CENTER));
JLabel tabLabel = componentsFactory.getTextLabel(stashTabDescriptor.getTitle());
tabLabel.setBorder(null);
tabLabel.setFont(componentsFactory.getFont(FontStyle.BOLD, 15f));
tabInfoPanel.add(tabLabel);
JCheckBox isItQuad = componentsFactory.getCheckBox("Is it Quad?");
isItQuad.setSelected(stashTabDescriptor.isQuad());
isItQuad.setPreferredSize(new Dimension(16, 16));
isItQuad.addActionListener(action -> {
stashTabDescriptor.setQuad(isItQuad.isSelected());
});
tabInfoPanel.add(isItQuad);
tabInfoPanel.add(hideButton);
this.add(tabInfoPanel, BorderLayout.PAGE_END);
this.setBorder(BorderFactory.createLineBorder(AppThemeColor.BORDER, 1));
}
代码示例来源:origin: libgdx/libgdx
private void initializeComponents(RegularEmitter emitter){
continuousCheckbox = new JCheckBox("Continuous");
continuousCheckbox.setSelected(emitter.isContinuous());
continuousCheckbox.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent event) {
RegularEmitter emitter = (RegularEmitter) editor.getEmitter().emitter;
emitter.setContinuous(continuousCheckbox.isSelected());
}
});
continuousCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
int i =0;
addContent(i++, 0, continuousCheckbox, GridBagConstraints.WEST, GridBagConstraints.NONE);
addContent(i++, 0, countPanel = new CountPanel(editor, "Count", "Min number of particles at all times, max number of particles allowed.", emitter.minParticleCount, emitter.maxParticleCount));
addContent(i++, 0, delayPanel = new RangedNumericPanel(editor, emitter.getDelay(), "Delay", "Time from beginning of effect to emission start, in milliseconds.", false));
addContent(i++, 0, durationPanel = new RangedNumericPanel(editor, emitter.getDuration(), "Duration", "Time particles will be emitted, in milliseconds."));
addContent(i++, 0, emissionPanel = new ScaledNumericPanel(editor, emitter.getEmission(), "Duration", "Emission","Number of particles emitted per second."));
addContent(i++, 0, lifePanel = new ScaledNumericPanel(editor, emitter.getLife(), "Duration", "Life", "Time particles will live, in milliseconds."));
addContent(i++, 0, lifeOffsetPanel = new ScaledNumericPanel(editor, emitter.getLifeOffset(), "Duration", "Life Offset","Particle starting life consumed, in milliseconds.", false));
}
代码示例来源:origin: libgdx/libgdx
contentPanel.add(new JLabel("XYZ:"), new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
new Insets(6, 0, 0, 0), 0, 0));
drawXYZCheckBox = new JCheckBox();
contentPanel.add(drawXYZCheckBox, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));
contentPanel.add(new JLabel("XZ Plane:"), new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
new Insets(6, 0, 0, 0), 0, 0));
drawXZPlaneBox = new JCheckBox();
contentPanel.add(drawXZPlaneBox, new GridBagConstraints(1, 2, 1, 1, 1, 0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));
drawXYZCheckBox.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent event) {
DrawPanel.this.editor.getRenderer().setDrawXYZ(drawXYZCheckBox.isSelected());
drawXYZCheckBox.setSelected(editor.getRenderer().IsDrawXYZ());
drawXZPlaneBox.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent event) {
DrawPanel.this.editor.getRenderer().setDrawXZPlane(drawXZPlaneBox.isSelected());
drawXZPlaneBox.setSelected(editor.getRenderer().IsDrawXZPlane());
drawXYPlaneBox.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent event) {
DrawPanel.this.editor.getRenderer().setDrawXYPlane(drawXYPlaneBox.isSelected());
代码示例来源:origin: libgdx/libgdx
private void initializeComponents(DynamicsModifier.Angular aValue, String charTitle) {
JPanel contentPanel = getContentPanel();
JPanel panel = new JPanel();
panel.add(new JLabel("Global"), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
panel.add(isGlobalCheckBox = new JCheckBox(), new GridBagConstraints(1, 0, 1, 1, 0, 0,
GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
contentPanel.add(panel,new GridBagConstraints(0, 1, 1, 1, 0, 0,
GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
JPanel spacer = new JPanel();
spacer.setPreferredSize(new Dimension());
contentPanel.add(spacer, new GridBagConstraints(6, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
thetaPanel.setIsAlwayShown(true);
isGlobalCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed (ActionEvent e) {
代码示例来源:origin: libgdx/libgdx
private void initializeComponents(DynamicsModifier.Angular aValue, String charTitle) {
JPanel contentPanel = getContentPanel();
JPanel panel = new JPanel();
panel.add(new JLabel("Global"), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
panel.add(isGlobalCheckBox = new JCheckBox(), new GridBagConstraints(1, 0, 1, 1, 0, 0,
GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
contentPanel.add(panel,new GridBagConstraints(0, 1, 1, 1, 0, 0,
GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
JPanel spacer = new JPanel();
spacer.setPreferredSize(new Dimension());
contentPanel.add(spacer, new GridBagConstraints(6, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
thetaPanel.setIsAlwayShown(true);
isGlobalCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed (ActionEvent e) {
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private JPanel createSearchPanel(final FilteredJList classes) {
JPanel search = new JPanel();
search.setLayout(new BorderLayout());
search.add(new JLabel("Choose a Demo to start: Find: "),
BorderLayout.WEST);
final javax.swing.JTextField jtf = new javax.swing.JTextField();
final JCheckBox showSettingCheck = new JCheckBox("Show Setting");
showSettingCheck.setSelected(true);
showSettingCheck.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
showSetting = showSettingCheck.isSelected();
search.add(jtf, BorderLayout.CENTER);
search.add(showSettingCheck, BorderLayout.EAST);
return search;
代码示例来源:origin: runelite/runelite
private JPanel buildCheckboxPanel(SkillDataBonus bonus)
{
JPanel uiOption = new JPanel(new BorderLayout());
JLabel uiLabel = new JLabel(bonus.getName());
JCheckBox uiCheckbox = new JCheckBox();
uiLabel.setForeground(Color.WHITE);
uiLabel.setFont(FontManager.getRunescapeSmallFont());
uiOption.setBorder(BorderFactory.createEmptyBorder(3, 7, 3, 0));
uiOption.setBackground(ColorScheme.DARKER_GRAY_COLOR);
// Adjust XP bonus depending on check-state of the boxes.
uiCheckbox.addActionListener(event -> adjustCheckboxes(uiCheckbox, bonus));
uiCheckbox.setBackground(ColorScheme.MEDIUM_GRAY_COLOR);
uiOption.add(uiLabel, BorderLayout.WEST);
uiOption.add(uiCheckbox, BorderLayout.EAST);
bonusCheckBoxes.add(uiCheckbox);
return uiOption;
}
内容来源于网络,如有侵权,请联系作者删除!