Java Code Examples for javax.swing.JCheckBox#setAlignmentX()

The following examples show how to use javax.swing.JCheckBox#setAlignmentX() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PageableTable.java    From jdal with Apache License 2.0 5 votes vote down vote up
/**
 * @param cd
 */
public VisibilityItem(ColumnDescriptor cd) {
	this.cd = cd;
	BoxLayout layout = new BoxLayout(this, BoxLayout.LINE_AXIS);
	setLayout(layout);
	this.setAlignmentX(0f);
	check = new JCheckBox(cd.getDisplayName(), cd.isVisible());
	check.setAlignmentX(0f);
	add(check);
	check.addChangeListener(this);
	refresh();
}
 
Example 2
Source File: NetAdmin.java    From nullpomino with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * Init login screen
 */
private void initLoginUI() {
	// Main panel
	JPanel mpLoginOwner = new JPanel(new BorderLayout());
	this.getContentPane().add(mpLoginOwner, SCREENCARD_NAMES[SCREENCARD_LOGIN]);
	JPanel mpLogin = new JPanel();
	mpLogin.setLayout(new BoxLayout(mpLogin, BoxLayout.Y_AXIS));
	mpLoginOwner.add(mpLogin, BorderLayout.NORTH);

	// * Login Message label
	labelLoginMessage = new JLabel(getUIText("Login_Message_Default"));
	labelLoginMessage.setAlignmentX(0f);
	mpLogin.add(labelLoginMessage);

	// * Server panel
	JPanel spServer = new JPanel(new BorderLayout());
	spServer.setAlignmentX(0f);
	mpLogin.add(spServer);

	// ** Server label
	JLabel lServer = new JLabel(getUIText("Login_Server"));
	spServer.add(lServer, BorderLayout.WEST);

	// ** Server textbox
	txtfldServer = new JTextField(30);
	txtfldServer.setText(propConfig.getProperty("login.server", ""));
	txtfldServer.setComponentPopupMenu(new TextComponentPopupMenu(txtfldServer));
	spServer.add(txtfldServer, BorderLayout.EAST);

	// * Username panel
	JPanel spUsername = new JPanel(new BorderLayout());
	spUsername.setAlignmentX(0f);
	mpLogin.add(spUsername);

	// ** Username label
	JLabel lUsername = new JLabel(getUIText("Login_Username"));
	spUsername.add(lUsername, BorderLayout.WEST);

	// ** Username textbox
	txtfldUsername = new JTextField(30);
	txtfldUsername.setText(propConfig.getProperty("login.username", ""));
	txtfldUsername.setComponentPopupMenu(new TextComponentPopupMenu(txtfldUsername));
	spUsername.add(txtfldUsername, BorderLayout.EAST);

	// * Password panel
	JPanel spPassword = new JPanel(new BorderLayout());
	spPassword.setAlignmentX(0f);
	mpLogin.add(spPassword);

	// ** Password label
	JLabel lPassword = new JLabel(getUIText("Login_Password"));
	spPassword.add(lPassword, BorderLayout.WEST);

	// ** Password textbox
	passfldPassword = new JPasswordField(30);
	String strPassword = propConfig.getProperty("login.password", "");
	if(strPassword.length() > 0) {
		passfldPassword.setText(NetUtil.decompressString(strPassword));
	}
	passfldPassword.setComponentPopupMenu(new TextComponentPopupMenu(passfldPassword));
	spPassword.add(passfldPassword, BorderLayout.EAST);

	// * Remember Username checkbox
	chkboxRememberUsername = new JCheckBox(getUIText("Login_RememberUsername"));
	chkboxRememberUsername.setSelected(propConfig.getProperty("login.rememberUsername", false));
	chkboxRememberUsername.setAlignmentX(0f);
	mpLogin.add(chkboxRememberUsername);

	// * Remember Password checkbox
	chkboxRememberPassword = new JCheckBox(getUIText("Login_RememberPassword"));
	chkboxRememberPassword.setSelected(propConfig.getProperty("login.rememberPassword", false));
	chkboxRememberPassword.setAlignmentX(0f);
	mpLogin.add(chkboxRememberPassword);

	// * Buttons panel
	JPanel spButtons = new JPanel();
	spButtons.setLayout(new BoxLayout(spButtons, BoxLayout.X_AXIS));
	spButtons.setAlignmentX(0f);
	mpLogin.add(spButtons);

	// ** Login button
	btnLogin = new JButton(getUIText("Login_Login"));
	btnLogin.setMnemonic('L');
	btnLogin.setMaximumSize(new Dimension(Short.MAX_VALUE, btnLogin.getMaximumSize().height));
	btnLogin.setActionCommand("Login_Login");
	btnLogin.addActionListener(this);
	spButtons.add(btnLogin);

	// ** Quit button
	JButton btnQuit = new JButton(getUIText("Login_Quit"));
	btnQuit.setMnemonic('Q');
	btnQuit.setMaximumSize(new Dimension(Short.MAX_VALUE, btnQuit.getMaximumSize().height));
	btnQuit.setActionCommand("Login_Quit");
	btnQuit.addActionListener(this);
	spButtons.add(btnQuit);
}
 
Example 3
Source File: AISelectFrame.java    From nullpomino with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * GUIAInitialization
 */
protected void initUI() {
	this.getContentPane().setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS));

	// AIList
	JPanel panelAIList = new JPanel();
	panelAIList.setLayout(new BorderLayout());
	panelAIList.setAlignmentX(LEFT_ALIGNMENT);
	this.add(panelAIList);

	String[] strList = new String[aiPathList.length];
	for(int i = 0; i < strList.length; i++) {
		strList[i] = aiNameList[i] + " (" + aiPathList[i] + ")";
	}
	listboxAI = new JList(strList);

	JScrollPane scpaneAI = new JScrollPane(listboxAI);
	scpaneAI.setPreferredSize(new Dimension(400, 250));
	panelAIList.add(scpaneAI, BorderLayout.CENTER);

	JButton btnNoUse = new JButton(NullpoMinoSwing.getUIText("AISelect_NoUse"));
	btnNoUse.setMnemonic('N');
	btnNoUse.addActionListener(this);
	btnNoUse.setActionCommand("AISelect_NoUse");
	btnNoUse.setMaximumSize(new Dimension(Short.MAX_VALUE, 30));
	panelAIList.add(btnNoUse, BorderLayout.SOUTH);

	// AIText box of the movement interval
	JPanel panelTxtfldAIMoveDelay = new JPanel();
	panelTxtfldAIMoveDelay.setLayout(new BorderLayout());
	panelTxtfldAIMoveDelay.setAlignmentX(LEFT_ALIGNMENT);
	this.add(panelTxtfldAIMoveDelay);

	panelTxtfldAIMoveDelay.add(new JLabel(NullpoMinoSwing.getUIText("AISelect_LabelAIMoveDelay")), BorderLayout.WEST);

	txtfldAIMoveDelay = new JTextField(20);
	panelTxtfldAIMoveDelay.add(txtfldAIMoveDelay, BorderLayout.EAST);

	// AIText box of the movement interval
	JPanel panelTxtfldAIThinkDelay = new JPanel();
	panelTxtfldAIThinkDelay.setLayout(new BorderLayout());
	panelTxtfldAIThinkDelay.setAlignmentX(LEFT_ALIGNMENT);
	this.add(panelTxtfldAIThinkDelay);

	panelTxtfldAIThinkDelay.add(new JLabel(NullpoMinoSwing.getUIText("AISelect_LabelAIThinkDelay")), BorderLayout.WEST);

	txtfldAIThinkDelay = new JTextField(20);
	panelTxtfldAIThinkDelay.add(txtfldAIThinkDelay, BorderLayout.EAST);

	// AIThread use check Box
	chkboxAIUseThread = new JCheckBox(NullpoMinoSwing.getUIText("AISelect_CheckboxAIUseThread"));
	chkboxAIUseThread.setAlignmentX(LEFT_ALIGNMENT);
	chkboxAIUseThread.setMnemonic('T');
	this.add(chkboxAIUseThread);

	chkBoxAIShowHint = new JCheckBox(NullpoMinoSwing.getUIText("AISelect_CheckboxAIShowHint"));
	chkBoxAIShowHint.setAlignmentX(LEFT_ALIGNMENT);
	chkBoxAIShowHint.setMnemonic('H');
	this.add(chkBoxAIShowHint);

	chkBoxAIPrethink = new JCheckBox(NullpoMinoSwing.getUIText("AISelect_CheckboxAIPrethink"));
	chkBoxAIPrethink.setAlignmentX(LEFT_ALIGNMENT);
	chkBoxAIPrethink.setMnemonic('P');
	this.add(chkBoxAIPrethink);

	chkBoxAIShowState = new JCheckBox(NullpoMinoSwing.getUIText("AISelect_CheckboxAIShowState"));
	chkBoxAIShowState.setAlignmentX(LEFT_ALIGNMENT);
	chkBoxAIShowState.setMnemonic('S');
	this.add(chkBoxAIShowState);

	//  buttonKind
	JPanel panelButtons = new JPanel();
	panelButtons.setLayout(new BoxLayout(panelButtons, BoxLayout.X_AXIS));
	panelButtons.setAlignmentX(LEFT_ALIGNMENT);
	this.add(panelButtons);

	JButton btnOK = new JButton(NullpoMinoSwing.getUIText("AISelect_OK"));
	btnOK.setMnemonic('O');
	btnOK.addActionListener(this);
	btnOK.setActionCommand("AISelect_OK");
	btnOK.setAlignmentX(LEFT_ALIGNMENT);
	btnOK.setMaximumSize(new Dimension(Short.MAX_VALUE, 30));
	panelButtons.add(btnOK);
	this.getRootPane().setDefaultButton(btnOK);

	JButton btnCancel = new JButton(NullpoMinoSwing.getUIText("AISelect_Cancel"));
	btnCancel.setMnemonic('C');
	btnCancel.addActionListener(this);
	btnCancel.setActionCommand("AISelect_Cancel");
	btnCancel.setAlignmentX(LEFT_ALIGNMENT);
	btnCancel.setMaximumSize(new Dimension(Short.MAX_VALUE, 30));
	panelButtons.add(btnCancel);
}
 
Example 4
Source File: ConfigWindow.java    From rscplus with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Adds a preconfigured JCheckbox to the specified container, setting its alignment constraint to
 * left and adding an empty padding border.
 *
 * @param text The text of the checkbox
 * @param container The container to add the checkbox to.
 * @return The newly created JCheckBox.
 */
private JCheckBox addCheckbox(String text, Container container) {
  JCheckBox checkbox = new JCheckBox(text);
  checkbox.setAlignmentX(Component.LEFT_ALIGNMENT);
  checkbox.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 5));
  container.add(checkbox);
  return checkbox;
}