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


Java TextField.setEchoChar方法代碼示例

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


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

示例1: TFFrame

import java.awt.TextField; //導入方法依賴的package包/類
public TFFrame() {
	TextField tf = new TextField();
	add(tf);
	tf.addActionListener(new TFActionListener());
	tf.setEchoChar('*');
	pack();
	setVisible(true);
}
 
開發者ID:limengbo,項目名稱:youyoulearning,代碼行數:9,代碼來源:TFActionEvent.java

示例2: init

import java.awt.TextField; //導入方法依賴的package包/類
@Override
public void init() {
this.setVisible(true);
this.setSize(500, 500);
this.setBackground(Color.green);
this.setLayout(new FlowLayout());

l1 = new Label("User Name");
l2 = new Label("Password");
tf1 = new TextField(20);
tf2 = new TextField(20);
tf2.setEchoChar('*');
b = new Button("Login");
b.addActionListener(this);

Font font = new Font("arial", Font.BOLD, 25);
l1.setFont(font);
l2.setFont(font);
tf1.setFont(font);
tf2.setFont(font);
b.setFont(font);

this.add(l1);
this.add(tf1);
this.add(l2);
this.add(tf2);
this.add(b);

}
 
開發者ID:pratikdimble,項目名稱:Servlet_Applet_Communication,代碼行數:30,代碼來源:LoginApplet.java

示例3: handlePassword

import java.awt.TextField; //導入方法依賴的package包/類
protected synchronized void handlePassword(PasswordCallback c)
{
  Frame ownerFrame = new Frame();
  Dialog dialog = new Dialog(ownerFrame);
  dialog.setTitle(c.getPrompt());
  dialog.setLayout(new GridLayout(3, 1));
  Label label = new Label(c.getPrompt());
  TextField input = new TextField();
  if (!c.isEchoOn())
    {
      input.setEchoChar('*');
    }
  Panel buttons = new Panel();
  Button ok = new Button(messages.getString("callback.ok"));
  ok.setActionCommand(ACTION_OK);
  ok.addActionListener(this);
  Button cancel = new Button(messages.getString("callback.cancel"));
  cancel.setActionCommand(ACTION_CANCEL);
  cancel.addActionListener(this);
  dialog.add(label);
  dialog.add(input);
  buttons.setLayout(new FlowLayout(FlowLayout.RIGHT));
  buttons.add(ok);
  buttons.add(cancel);
  dialog.add(buttons);
  dialog.pack();
  dialog.show();
  try { wait(); }
  catch (InterruptedException ie) { }
  if (actionCommand.equals(ACTION_OK))
    {
      c.setPassword(input.getText().toCharArray());
    }
  dialog.dispose();
  ownerFrame.dispose();
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:37,代碼來源:AWTCallbackHandler.java

示例4: LoginRequester

import java.awt.TextField; //導入方法依賴的package包/類
public LoginRequester(Frame parent, String title, String user_label, String password_label, 
	String posText_, String negText) {
  
  super(parent, title, true);
  setLayout(new GridBagLayout());
  posText = posText_;
  
  add(new Label(user_label), Awt.constraints(false, GridBagConstraints.HORIZONTAL));
  u_text = new TextField(30);
  try{u_text.setText(System.getProperty("user.name",""));}
  catch(Exception e) {}
  add(u_text, Awt.constraints(true, GridBagConstraints.HORIZONTAL));
  
  add(new Label(password_label), Awt.constraints(false, GridBagConstraints.HORIZONTAL));
  p_text = new TextField(30);
  p_text.setEchoChar('*');
  add(p_text, Awt.constraints(true, GridBagConstraints.HORIZONTAL));
  
  Button pos = new Button(posText);
  add(pos, Awt.constraints(false, 10, 4, GridBagConstraints.HORIZONTAL));
  pos.addActionListener(this);
  
  Button neg = new Button(negText);
  add(neg, Awt.constraints(true, 10, 4, GridBagConstraints.HORIZONTAL));
  neg.addActionListener(this);
  
  pack();
}
 
開發者ID:tamirhassan,項目名稱:pdfxtk,代碼行數:29,代碼來源:LoginRequester.java

示例5: Login

import java.awt.TextField; //導入方法依賴的package包/類
Login()
{
    setSize(400,190);
    setTitle("Login");
    setVisible(true);
    setResizable(false);
    setLayout(null);
    setLocation(400,270);
    addWindowListener(new WindowAdapter() { 
                    @Override
                    public void windowClosing(WindowEvent we)
                    {
                        if(!fg)
                         dispose();
                   }
          });
    //add(fg);
    f=new Font("Georgia",Font.BOLD,14);
    setFont(f);
    tt1=new TextField();
    tt1.setBounds(110,40,150,30);
    
    tt2=new TextField();
    tt2.setBounds(110,80,150,30);
    tt2.setEchoChar('*');
    ll1=new Label("Username:");
    ll1.setBounds(25,40,80,20);
    
    ll2=new Label("Password:");
    ll2.setBounds(25,80,80,20);
    ll3=new Label("");
    ll3.setBounds(30,110,250,20);
    ll3.setForeground(Color.red);
    bb1=new Button("Login");
    bb1.setBounds(280,125,100,50);
    bb1.setForeground(Color.BLUE);
            
    cb=new Checkbox("Remember Me",false);
    cb.setBounds(40,130,150,20);
    cb.setEnabled(true);
    
    
    bb1.addActionListener(this);
    add(tt1);
    add(cb);
    add(tt2);
    add(ll3);
    add(ll2);
    add(ll1);
    add(bb1);
}
 
開發者ID:vedipen,項目名稱:food-delivery-database-management,代碼行數:52,代碼來源:Login.java

示例6: MainFrame

import java.awt.TextField; //導入方法依賴的package包/類
public MainFrame() {
	this.setTitle(FRAME_TITLE);
	this.setResizable(false);
	this.setLayout(null);
	Dimension windowSize = Toolkit.getDefaultToolkit().getScreenSize();
	this.setBounds((windowSize.width - WIDTH) / 2, (windowSize.height - HEIGHT) / 2, WIDTH, HEIGHT);

	Label problemIDLabel = new Label(PROBLEM_ID_LABEL);
	problemIDLabel.setBounds(20, 50, 95, 20);
	problemIDLabel.setFont(new Font(null, Font.PLAIN, 18));
	this.add(problemIDLabel);

	problemIDTextField = new TextField();
	problemIDTextField.setBounds(130, 50, 145, 20);
	this.add(problemIDTextField);

	Label bojIDLabel = new Label(BOJ_ID_LABEL);
	bojIDLabel.setBounds(20, 100, 95, 20);
	bojIDLabel.setFont(new Font(null, Font.PLAIN, 18));
	this.add(bojIDLabel);

	bojIDTextField = new TextField(User.BOJ_ID);
	bojIDTextField.setBounds(130, 100, 145, 20);
	this.add(bojIDTextField);

	Label bojPasswordLabel = new Label(BOJ_PW_LABEL);
	bojPasswordLabel.setBounds(20, 150, 95, 20);
	bojPasswordLabel.setFont(new Font(null, Font.PLAIN, 18));
	this.add(bojPasswordLabel);

	bojPasswordTextField = new TextField(User.BOJ_PASSWORD);
	bojPasswordTextField.setEchoChar('*');
	bojPasswordTextField.setBounds(130, 150, 145, 20);
	this.add(bojPasswordTextField);

	submitButton = new Button(SUBMIT_BUTTON);
	submitButton.setBounds(75, 200, 150, 40);
	submitButton.addActionListener(new SubmitButtonActionListener(this));
	this.add(submitButton);

	this.addWindowListener(new MainWindowListener());

	this.setVisible(true);
}
 
開發者ID:devetude,項目名稱:BOJ-PSJ,代碼行數:45,代碼來源:MainFrame.java


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