当前位置: 首页>>代码示例>>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;未经允许,请勿转载。