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


Java JCheckBox.setBounds方法代码示例

本文整理汇总了Java中javax.swing.JCheckBox.setBounds方法的典型用法代码示例。如果您正苦于以下问题:Java JCheckBox.setBounds方法的具体用法?Java JCheckBox.setBounds怎么用?Java JCheckBox.setBounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JCheckBox的用法示例。


在下文中一共展示了JCheckBox.setBounds方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addEnableControl

import javax.swing.JCheckBox; //导入方法依赖的package包/类
/**
 * Add a control for enablement
 * 
 * @param text The label to be associated with the check box
 * @param listener The listener to be notified of updates to the new control
 */
private void addEnableControl(String text, ItemListener listener) {
	JCheckBox enableControl = new JCheckBox("Enable " + text);
	enableControl.setBounds(10, offset, 200, 20);
	enableControl.addItemListener(listener);
	add(enableControl);

	controlToValueName.put(enableControl, text);
	valueNameToControl.put(text, enableControl);
	offset += 25;
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:17,代码来源:WhiskasPanel.java

示例2: 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

示例3: initializeInputFields

import javax.swing.JCheckBox; //导入方法依赖的package包/类
/**
 * Initialize the text fields.
 */
private void initializeInputFields() {
	this.mBlueSphereMovementOptionsBox = new JCheckBox(EMoveType.BLUE_SPHERE.name(), true);
	this.mBlueSphereMovementOptionsBox.setHorizontalAlignment(SwingConstants.LEFT);
	this.mBlueSphereMovementOptionsBox.setBounds(0, 20, 150, 20);
	this.mMainPanel.add(this.mBlueSphereMovementOptionsBox);
	this.mInputElements.add(this.mBlueSphereMovementOptionsBox);

	this.mUseProtectionSpell = new JCheckBox("Use protection spell", true);
	this.mUseProtectionSpell.setHorizontalAlignment(SwingConstants.LEFT);
	this.mUseProtectionSpell.setBounds(0, 70, 150, 20);
	this.mMainPanel.add(this.mUseProtectionSpell);
	this.mInputElements.add(this.mUseProtectionSpell);

	this.mUseSpecialSkill = new JCheckBox("Use special skill", false);
	this.mUseSpecialSkill.setHorizontalAlignment(SwingConstants.LEFT);
	this.mUseSpecialSkill.setBounds(0, 90, 150, 20);
	this.mMainPanel.add(this.mUseSpecialSkill);
	this.mInputElements.add(this.mUseSpecialSkill);

	final int taskBoxInitialY = 140;
	final int taskBoxYPadding = 20;
	final EKivaTask[] tasks = EKivaTask.values();
	this.mTaskList = new LinkedList<>();
	for (int i = 0; i < tasks.length; i++) {
		final EKivaTask task = tasks[i];
		final JCheckBox taskBox = new JCheckBox(task.name(), true);
		taskBox.setHorizontalAlignment(SwingConstants.LEFT);
		taskBox.setBounds(0, taskBoxInitialY + (i * taskBoxYPadding), 180, 20);
		this.mMainPanel.add(taskBox);
		this.mInputElements.add(taskBox);
		this.mTaskList.add(taskBox);
	}

	this.mUsernameField = new JTextField();
	this.mUsernameField.setHorizontalAlignment(SwingConstants.LEFT);
	this.mUsernameField.setBounds((this.mMainPanel.getWidth() / 2) + 90, 0, 123, 20);
	this.mMainPanel.add(this.mUsernameField);
	this.mInputElements.add(this.mUsernameField);
	this.mUsernameField.setColumns(DEFAULT_FIELD_COLUMNS);

	this.mPasswordField = new JPasswordField();
	this.mPasswordField.setHorizontalAlignment(SwingConstants.LEFT);
	this.mPasswordField.setBounds((this.mMainPanel.getWidth() / 2) + 90, 30, 123, 20);
	this.mMainPanel.add(this.mPasswordField);
	this.mInputElements.add(this.mPasswordField);
	this.mPasswordField.setColumns(DEFAULT_FIELD_COLUMNS);

	this.mWorldChoiceBox = new JComboBox<>();
	for (final EWorld world : EWorld.values()) {
		this.mWorldChoiceBox.addItem(world);
		if (world == EWorld.ONE) {
			this.mWorldChoiceBox.setSelectedItem(world);
		}
	}
	this.mWorldChoiceBox.setBounds((this.mMainPanel.getWidth() / 2) + 90, 60, 123, 20);
	this.mMainPanel.add(this.mWorldChoiceBox);
	this.mInputElements.add(this.mWorldChoiceBox);

	this.mBrowserChoiceBox = new JComboBox<>();
	for (final EBrowser browser : EBrowser.values()) {
		this.mBrowserChoiceBox.addItem(browser);
		if (browser == EBrowser.CHROME) {
			this.mBrowserChoiceBox.setSelectedItem(browser);
		}
	}
	this.mBrowserChoiceBox.setBounds((this.mMainPanel.getWidth() / 2) + 90, 170, 123, 20);
	this.mMainPanel.add(this.mBrowserChoiceBox);
	this.mInputElements.add(this.mBrowserChoiceBox);
}
 
开发者ID:ZabuzaW,项目名称:KivaBot,代码行数:73,代码来源:MainFrameView.java

示例4: GuiPayloadField

import javax.swing.JCheckBox; //导入方法依赖的package包/类
private GuiPayloadField(FieldVO fieldVO, FieldVO superfieldVO) {

			this.isSubfield = (superfieldVO != null);
			this.superFieldVO = superfieldVO;
			this.fieldVO = fieldVO.getInstanceCopy();
			this.fieldVO.setFieldList(new ArrayList<FieldVO>());
			
			if (isSubfield)
				superFieldVO.getFieldList().add(this.fieldVO);
			else
				messageVO.getFieldList().add(this.fieldVO);
			
			ckBox = new JCheckBox();
			txtType = new JTextField();
			txtLength = new JTextField();
			txtValue = new JTextField();
			subfieldList = new ArrayList<GuiPayloadField>();
			
			lblFieldNum = new JLabel(fieldVO.getBitNum().toString());
			lblFieldName = new JLabel(fieldVO.getName());
			lblType = new JLabel(fieldVO.getType().toString());
			lblDynamic = new JLabel();
			lblDynamic.setIcon(new ImageIcon(PnlGuiPayload.class.getResource("/resource/search.png")));
			lblDynamic.setToolTipText(fieldVO.getDynaCondition());

			lineNum = numLines;
			numLines++;
			
			ckBox.setBounds(10, 10 + (lineNum * 25), 22, 22);
			lblFieldNum.setBounds(40, 10 + (lineNum * 25), 50, 22);
			lblFieldName.setBounds(80, 10 + (lineNum * 25), 100, 22);
			lblType.setBounds(470, 10 + (lineNum * 25), 100, 22);
			lblDynamic.setBounds(600, 10 + (lineNum * 25), 50, 22);
			
			if (fieldVO.getType() == TypeEnum.ALPHANUMERIC) {
				txtValue.setBounds(190, 10 + (lineNum * 25), 260, 22);
			}
			else if (fieldVO.getType() == TypeEnum.TLV) {
				txtType.setBounds(190, 10 + (lineNum * 25), 80, 22);
				txtLength.setBounds(280, 10 + (lineNum * 25), 80, 22);
				txtValue.setBounds(370, 10 + (lineNum * 25), 80, 22);
				
				pnlFields.add(txtType);
				pnlFields.add(txtLength);
			}
			
			if (!isSubfield)
				pnlFields.add(ckBox);
				
			pnlFields.add(lblFieldNum);
			pnlFields.add(lblFieldName);
			pnlFields.add(txtValue);
			pnlFields.add(lblType);

			txtType.addKeyListener(saveFieldPayloadAction);
			txtLength.addKeyListener(saveFieldPayloadAction);
			txtValue.addKeyListener(saveFieldPayloadAction);
			
			if (!fieldVO.getDynaCondition().equals("") && !fieldVO.getDynaCondition().equals("true"))
				pnlFields.add(lblDynamic);
			
			if (fieldVO.getDynaCondition().equals("true")) {
				ckBox.setSelected(true);
				ckBox.setEnabled(false);
				ckBoxClick(ckBox);
				
				setEnabled(true);
			}
			else {
				ckBox.addActionListener(new ActionListener() {
					@Override
					public void actionPerformed(ActionEvent e) {
						ckBoxClick((JCheckBox) e.getSource());
						saveFieldValue();
					}
				});
				
				setEnabled(false);
			}
		}
 
开发者ID:adelbs,项目名称:ISO8583,代码行数:81,代码来源:PayloadMessageConfig.java

示例5: createProxyPanel

import javax.swing.JCheckBox; //导入方法依赖的package包/类
JPanel createProxyPanel() {
	JPanel panel = new JPanel();
	panel.setLayout(null);

	usePAC = new JCheckBox("Use Proxy Autoconfig Script");
	usePAC.setBounds(10, 10, 200, 20);
	txtPAC = new JTextField(30);
	txtPAC.setBounds(10, 40, 340, 20);
	panel.add(usePAC);
	panel.add(txtPAC);

	useProxy = new JCheckBox("Use Proxy Server");
	useProxy.setBounds(10, 90, 200, 20);
	txtProxy = new JTextField(30);
	txtProxy.setBounds(10, 120, 340, 20);
	panel.add(useProxy);
	panel.add(txtProxy);

	JLabel lbl1 = new JLabel("User Name");
	lbl1.setBounds(10, 180, 100, 20);
	txtProxyUser = new JTextField(30);
	txtProxyUser.setBounds(110, 180, 100, 20);
	panel.add(lbl1);
	panel.add(txtProxyUser);

	JLabel lbl2 = new JLabel("Password");
	lbl2.setBounds(10, 210, 100, 20);
	txtProxyPass = new JPasswordField(30);
	txtProxyPass.setBounds(110, 210, 100, 20);
	panel.add(lbl2);
	panel.add(txtProxyPass);

	// Box box = Box.createVerticalBox();
	// box.setOpaque(false);
	// box.setBorder(new EmptyBorder(10, 0, 0, 10));
	//
	// JPanel p = new JPanel(new GridLayout(4, 1, 5, 5));
	// p.setOpaque(false);
	//
	// Box b = Box.createVerticalBox();
	// usePAC = new JCheckBox("Use Proxy Autoconfig Script");
	// txtPAC = new JTextField(30);
	// b.add(usePAC);
	// b.add(txtPAC);
	// p.add(b);
	//
	// JButton http = new JButton(getString("HTTP_PROXY"));
	// http.setName("HTTP_PROXY");
	// http.addActionListener(this);
	// p.add(http);
	//
	// JButton https = new JButton(getString("HTTPS_PROXY"));
	// https.setName("HTTPS_PROXY");
	// https.addActionListener(this);
	// p.add(https);
	//
	// JButton ftp = new JButton(getString("FTP_PROXY"));
	// ftp.setName("FTP_PROXY");
	// ftp.addActionListener(this);
	// p.add(ftp);
	//
	// box.add(p);
	// box.add(Box.createVerticalGlue());

	return panel;

}
 
开发者ID:kmarius,项目名称:xdman,代码行数:68,代码来源:ConfigDialog.java


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