本文整理汇总了Java中javax.swing.JCheckBox类的典型用法代码示例。如果您正苦于以下问题:Java JCheckBox类的具体用法?Java JCheckBox怎么用?Java JCheckBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JCheckBox类属于javax.swing包,在下文中一共展示了JCheckBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MessagePreferencesPanel
import javax.swing.JCheckBox; //导入依赖的package包/类
public MessagePreferencesPanel() {
setLayout(null);
refuseMessages = new JCheckBox("Refuse Messages");
refuseMessages.setSize(150, 25);
refuseMessages.setLocation(10, 25);
refuseMessages.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
updateEnabled();
}
});
add(refuseMessages);
denyMessageLabel = new JLabel("Refusal Message:");
denyMessageLabel.setSize(150, 25);
denyMessageLabel.setLocation(20, 50);
add(denyMessageLabel);
denyMessageText = new JTextField(REFUSAL_MESSAGE_DEFAULT);
denyMessageText.setSize(400, 25);
denyMessageText.setLocation(25, 75);
add(denyMessageText);
setSize(STD_XSIZE, STD_YSIZE);
}
示例2: setContext
import javax.swing.JCheckBox; //导入依赖的package包/类
public CodeTemplatesOperator setContext(Set<String> set) {
JTabbedPaneOperator tabbedPane = getTabbedPane();
tabbedPane.selectPage("Contexts");
ContainerOperator<JEditorPane> selectedComponent = new ContainerOperator<>((Container)tabbedPane.getSelectedComponent());
JListOperator list = new JListOperator(selectedComponent);
for (int i = 0; i < list.getModel().getSize(); i++) {
JCheckBox checkBox = (JCheckBox) list.getRenderedComponent(i);
String contextName = checkBox.getText();
list.scrollToItem(i);
if(!checkBox.isSelected() && set.contains(contextName)) {
list.selectItem(i);
} else if(checkBox.isSelected() && !set.contains(contextName)) {
list.selectItem(i);
}
}
return this;
}
示例3: setup
import javax.swing.JCheckBox; //导入依赖的package包/类
@Override
public void setup(ChangeDetector changeDetector)
{
showResults = new JCheckBox(getString("filteringtab.display"), true); //$NON-NLS-1$
filter = new SearchSetFilter(cache, clientService);
final int[] rows = {TableLayout.PREFERRED, TableLayout.FILL,};
final int[] cols = {TableLayout.FILL,};
setLayout(new TableLayout(rows, cols));
add(showResults, new Rectangle(0, 0, 1, 1));
add(filter, new Rectangle(0, 1, 1, 1));
changeDetector.watch(showResults);
changeDetector.watch(filter);
}
示例4: CheckBoxFrame
import javax.swing.JCheckBox; //导入依赖的package包/类
public CheckBoxFrame()
{
super("JCheckBox Test");
setLayout(new FlowLayout());
// set up JTextField and set its font
textField = new JTextField("Watch the font style change", 20);
textField.setFont(new Font("Serif", Font.PLAIN, 14));
add(textField); // add textField to JFrame
boldJCheckBox = new JCheckBox("Bold");
italicJCheckBox = new JCheckBox("Italic");
add(boldJCheckBox); // add bold checkbox to JFrame
add(italicJCheckBox); // add italic checkbox to JFrame
// register listeners for JCheckBoxes
CheckBoxHandler handler = new CheckBoxHandler();
boldJCheckBox.addItemListener(handler);
italicJCheckBox.addItemListener(handler);
}
示例5: manageButtons
import javax.swing.JCheckBox; //导入依赖的package包/类
private void manageButtons() {
this.joinChannel = new JButton("Join Channel");
this.joinChannel.setPreferredSize(
new Dimension(this.chatAreaDescription.getPreferredSize().width, this.joinChannel.getPreferredSize().height));
this.joinChannel.setBorder(BorderFactory.createBevelBorder(1));
this.leaveChannel = new JButton("Leave Channel");
this.leaveChannel.setPreferredSize(
new Dimension(this.chatAreaDescription.getPreferredSize().width, this.joinChannel.getPreferredSize().height));
this.leaveChannel.setBorder(BorderFactory.createBevelBorder(1));
this.actAsBot = new JCheckBox("React to !");
this.actAsBot.setSelected(true);
this.trollPaul = new JCheckBox("Copy Swaul");
this.trollPaul.setSelected(false);
this.trollMatti = new JCheckBox("Copy GeniusMatti");
this.trollMatti.setSelected(false);
this.logToFile = new JCheckBox("Log To File");
this.logToFile.setSelected(true);
}
示例6: init
import javax.swing.JCheckBox; //导入依赖的package包/类
private void init() {
btnTestFileNamePattern = new JButton();
chkFileNameRegex = new JCheckBox();
chkFileNameRegex.setToolTipText(UiUtils.getText(
"BasicSearchForm.chkFileNameRegex.tooltip")); //NOI18N
if (!replacing) {
chkArchives = new JCheckBox();
chkGenerated = new JCheckBox();
}
chkUseIgnoreList = new JCheckBox();
btnEditIgnoreList = new JButton();
checkBoxListener = new CheckBoxListener();
component.setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0));
setMnemonics();
initIgnoreListControlComponents();
initScopeOptionsRow(replacing);
initInteraction();
}
示例7: addCheckBox
import javax.swing.JCheckBox; //导入依赖的package包/类
private void addCheckBox() {
/* isDirected */
directed = new JCheckBox("isDirected");
directed.setBounds(635, 17, 125, 20);
directed.setFont(checkBoxFont);
directed.setMargin(DEFAULT_INSETS);
/* hasWight */
weight = new JCheckBox("hasWeight");
weight.setBounds(530, 17, 100, 20);
weight.setFont(checkBoxFont);
weight.setMargin(DEFAULT_INSETS);
}
示例8: initializeComponents
import javax.swing.JCheckBox; //导入依赖的package包/类
private void initializeComponents() {
qualitySlider = new JSlider(10, 100, 50) {
private static final long serialVersionUID = -3633632766184431178L;
@Override
public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width/2, new JLabel(" ").getPreferredSize().height);
}
};
qualitySlider.addChangeListener(ce -> r.refresh());
qualitySlider.setOpaque(false);
statusLabel = new JLabel();
skipFrames = new JCheckBox("Skip frames", false);
skipFrames.setOpaque(false);
}
示例9: getOpenedPanel
import javax.swing.JCheckBox; //导入依赖的package包/类
protected JPanel getOpenedPanel(EditorOperator editorOperator) {
for (int i = 0; i < 10; i++) {
this.panel = findPanel((Container) editorOperator.getSource());
if(panel!=null) break;
new EventTool().waitNoEvent(200);
}
if(panel==null) return null;
for (Component c : panel.getComponents()) {
if (c instanceof JCheckBox) {
checkBoxesInPanel.add((JCheckBox)c);
} else if(c instanceof JButton) {
buttons.add((JButton)c);
}
}
return panel;
}
示例10: selectCheckBoxNotSelected
import javax.swing.JCheckBox; //导入依赖的package包/类
public void selectCheckBoxNotSelected() throws InterruptedException {
final LoggingRecorder lr = new LoggingRecorder();
siw(new Runnable() {
@Override public void run() {
List<Component> comps = ComponentUtils.findComponents(JCheckBox.class, frame);
JCheckBox checkBox = (JCheckBox) comps.get(3);
RToggleButton rButton = new RToggleButton(checkBox, null, null, lr);
checkBox.setSelected(false);
rButton.mouseEntered(null);
checkBox.setSelected(true);
rButton.mouseClicked(null);
}
});
Call call = lr.getCall();
AssertJUnit.assertEquals("select", call.getFunction());
AssertJUnit.assertEquals("true", call.getState());
}
示例11: ResourceMonitorPanel
import javax.swing.JCheckBox; //导入依赖的package包/类
/**
*
*/
public ResourceMonitorPanel() {
setLayout(new BorderLayout(0, 0));
picturePanel = new JPanel();
picturePanel.setLayout(new BoxLayout(picturePanel, BoxLayout.PAGE_AXIS));
JScrollPane scroll = new JScrollPane(picturePanel);
add(scroll);
final JPanel buttonPanel = new JPanel();
add(buttonPanel, BorderLayout.SOUTH);
btnRefresh = new JButton("Refresh");
buttonPanel.add(btnRefresh);
autoRefreshCheckbox = new JCheckBox("Auto-refresh", true);
buttonPanel.add(autoRefreshCheckbox);
}
示例12: getDupAction
import javax.swing.JCheckBox; //导入依赖的package包/类
int getDupAction(String url) {
JTextField txt = new JTextField(url, 30);
String lbl = StringResource.getString("DUP_TXT");
JComboBox choice = new JComboBox(new String[] { StringResource.getString("DUP_OP1"),
StringResource.getString("DUP_OP2"), StringResource.getString("DUP_OP3") });
JCheckBox chk = new JCheckBox(StringResource.getString("DUP_CHK"));
int ret = JOptionPane.showOptionDialog(null, new Object[] { txt, lbl, choice, chk },
StringResource.getString("DUP_TITLE"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null,
null, null);
if (ret == JOptionPane.OK_OPTION) {
int index = choice.getSelectedIndex();
if (chk.isSelected()) {
config.duplicateLinkAction = index;
}
return index;
}
return -1;
}
示例13: UserTableHeaderCellRenderer
import javax.swing.JCheckBox; //导入依赖的package包/类
public UserTableHeaderCellRenderer(JTable table) {
this.tableModel = (UserTableModel) table.getModel();
this.tableHeader = table.getTableHeader();
selectBox = new JCheckBox(tableModel.getColumnName(0));
selectBox.setSelected(false);
tableHeader.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() > 0) {
int selectColumn = tableHeader.columnAtPoint(e.getPoint());
if (selectColumn == 0) {
boolean value = !selectBox.isSelected();
selectBox.setSelected(value);
tableModel.selectAll(value);
tableHeader.repaint();
}
}
}
});
}
示例14: ControlerAlteracaoLanche
import javax.swing.JCheckBox; //导入依赖的package包/类
public ControlerAlteracaoLanche(AlteracaoLanche alteracaoLanche, Lanche lanche, Vendas tela) {
this.alteracaoLanche = alteracaoLanche;
this.lanche = lanche;
this.telaVenda = tela;
this.alteracaoLanche.getBtn_Cancelar().addActionListener(this);
this.alteracaoLanche.getBtn_Finalizar().addActionListener(this);
for (JCheckBox botao : this.alteracaoLanche.getBotoes()) {
botao.addActionListener(this);
}
getDados();
iniciaCheckBox();
marcarCheck();
this.alteracaoLanche.setVisible(true);
this.alteracaoLanche.toFront();
this.alteracaoLanche.setLocationRelativeTo(this.telaVenda);
this.alteracaoLanche.setVisible(true);
}
示例15: createTitlePanel
import javax.swing.JCheckBox; //导入依赖的package包/类
private JPanel createTitlePanel() {
JPanel title = new JPanel(new BorderLayout());
title.add(Guitilities.createGradientTitle(getTranslation("components.title")), BorderLayout.NORTH);
JPanel interact = new JPanel();
interact.setBackground(UIManager.getColor(Guitilities.SUB_PANEL_BACKGROUND));
interact.setLayout(new BoxLayout(interact, BoxLayout.X_AXIS));
interact.setBorder(new CompoundBorder(Guitilities.CHISEL_BORDER, new EmptyBorder(12, 8, 12, 8)));
final JCheckBox checkImages = new JCheckBox(getTranslation("group.images"), true);
checkImages.setBackground(UIManager.getColor(Guitilities.SUB_PANEL_BACKGROUND));
checkImages.addActionListener(new ActionListener() {
@Override public void actionPerformed(ActionEvent event) {
for(ComponentButton button:componentButtons)
button.setIconVisible(checkImages.isSelected());
for(CollapsiblePanel panel:collapsiblePanels)
panel.setExpanded(false);
}
});
interact.add(checkImages);
title.add(interact, BorderLayout.CENTER);
return title;
}