當前位置: 首頁>>代碼示例>>Java>>正文


Java JTextField.setActionCommand方法代碼示例

本文整理匯總了Java中javax.swing.JTextField.setActionCommand方法的典型用法代碼示例。如果您正苦於以下問題:Java JTextField.setActionCommand方法的具體用法?Java JTextField.setActionCommand怎麽用?Java JTextField.setActionCommand使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JTextField的用法示例。


在下文中一共展示了JTextField.setActionCommand方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ChatPanel

import javax.swing.JTextField; //導入方法依賴的package包/類
/**
 * The constructor that will add the items to this panel.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 */
public ChatPanel(FreeColClient freeColClient) {
    super(freeColClient, new BorderLayout(10, 10));

    JLabel label = Utility.localizedLabel("chatPanel.message");

    field = new JTextField("", 40);
    field.setActionCommand(String.valueOf(CHAT));
    field.addActionListener(this);

    add(label);
    add(field);

    //setFocusable(false);
    label.setFocusable(false);
    field.setFocusable(true);

    setSize(getPreferredSize());
}
 
開發者ID:FreeCol,項目名稱:freecol,代碼行數:24,代碼來源:ChatPanel.java

示例2: createToolBar

import javax.swing.JTextField; //導入方法依賴的package包/類
private void createToolBar() {
    searchBar = new JToolBar();
    searchBar.setFloatable(false);
    searchBar.setLayout(new BoxLayout(searchBar, BoxLayout.X_AXIS));
    searchBar.setBorder(BorderFactory.createEtchedBorder());

    JLabel searchLabel = new JLabel(Utils.getIconByResourceName("/ui/resources/search"));

    searchField = new JTextField();
    searchField.setActionCommand("SearchField");
    searchField.addActionListener(this);

    searchBar.add(searchLabel);
    searchBar.add(new javax.swing.Box.Filler(new java.awt.Dimension(5, 0),
            new java.awt.Dimension(5, 0),
            new java.awt.Dimension(5, 32767)));
    searchBar.add(searchField);

}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:20,代碼來源:TreeSearch.java

示例3: PasswordManagerRegistration

import javax.swing.JTextField; //導入方法依賴的package包/類
public PasswordManagerRegistration(PasswordManagerGUI gui) {
       this.gui = gui;
	regpanel = new JPanel();
	regpanel.setLayout(new BorderLayout(0, 0));
	JPanel panel_1 = new JPanel();
	regpanel.add(panel_1, BorderLayout.NORTH);

	JLabel lblRegistration = new JLabel(Labels.REG_REGISTRATION);
	lblRegistration.setFont(new Font("Tahoma", Font.PLAIN, 38));
	panel_1.add(lblRegistration);

	JPanel panel_2 = new JPanel();
	regpanel.add(panel_2, BorderLayout.CENTER);
	panel_2.setLayout(null);

	JLabel lblUsername = new JLabel(Labels.REG_USERNAME);
	lblUsername.setBounds(74, 92, 132, 16);
	panel_2.add(lblUsername);
	
	JLabel lblPassword = new JLabel(Labels.REG_PASSWORD);
	lblPassword.setBounds(74, 149, 173, 16);
	panel_2.add(lblPassword);
	
	JLabel lblPasswordAgain = new JLabel(Labels.REG_RE_PASSWORD);
	lblPasswordAgain.setBounds(74, 204, 173, 16);
	panel_2.add(lblPasswordAgain);
	
	txtUsername = new JTextField();
	txtUsername.setBounds(252, 89, 380, 22);
	panel_2.add(txtUsername);
	txtUsername.setColumns(10);
	
	txtPass1 = new JPasswordField();
	txtPass1.setBounds(252, 146, 380, 22);
	panel_2.add(txtPass1);
	
	txtPass2 = new JPasswordField();
	txtPass2.setBounds(252, 201, 380, 22);
	txtPass1.addActionListener(gui.getController());
	txtPass1.setActionCommand(Labels.REG_PASS1FIELD);
	txtPass2.addActionListener(gui.getController());
       txtPass2.setActionCommand(Labels.REG_PASS2FIELD);
	txtUsername.addActionListener(gui.getController());
       txtUsername.setActionCommand(Labels.REG_USERFIELD);
	panel_2.add(txtPass2);
	
	JButton btnRegistration = new JButton(Labels.REG_REGBUTTON);
	btnRegistration.addActionListener(gui.getController());

	btnRegistration.setBounds(278, 288, 151, 25);
	panel_2.add(btnRegistration);

}
 
開發者ID:zoltanvi,項目名稱:password-manager,代碼行數:54,代碼來源:PasswordManagerRegistration.java


注:本文中的javax.swing.JTextField.setActionCommand方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。