当前位置: 首页>>代码示例>>Java>>正文


Java JCheckBox类代码示例

本文整理汇总了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);
}
 
开发者ID:addertheblack,项目名称:myster,代码行数:26,代码来源:MessageManager.java

示例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;
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:CodeTemplatesOperator.java

示例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);
}
 
开发者ID:equella,项目名称:Equella,代码行数:18,代码来源:FilteringTab.java

示例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);
}
 
开发者ID:cleitonferreira,项目名称:LivroJavaComoProgramar10Edicao,代码行数:21,代码来源:CheckBoxFrame.java

示例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);

}
 
开发者ID:Ativelox,项目名称:TwitchBot,代码行数:25,代码来源:MainView.java

示例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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:ScopeOptionsController.java

示例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);
}
 
开发者ID:xehoth,项目名称:VisualGraphviz,代码行数:16,代码来源:MainFrame.java

示例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);
}
 
开发者ID:CalebKussmaul,项目名称:GIFKR,代码行数:17,代码来源:PreviewStatusPanel.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:EditorPanelOperator.java

示例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());
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:18,代码来源:RToggleButtonTest.java

示例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);
}
 
开发者ID:roscisz,项目名称:KernelHive,代码行数:22,代码来源:ResourceMonitorPanel.java

示例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;
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:19,代码来源:XDMMainWindow.java

示例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();
                }
            }
        }
    });
}
 
开发者ID:hulang1024,项目名称:PTEAssistant,代码行数:20,代码来源:UserTableHeaderCellRenderer.java

示例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);
}
 
开发者ID:wesleyreis1808,项目名称:projetomcdonalds,代码行数:21,代码来源:ControlerAlteracaoLanche.java

示例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;
}
 
开发者ID:kristian,项目名称:JDigitalSimulator,代码行数:23,代码来源:Application.java


注:本文中的javax.swing.JCheckBox类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。