Example usage for javax.swing JPasswordField cut

List of usage examples for javax.swing JPasswordField cut

Introduction

In this page you can find the example usage for javax.swing JPasswordField cut.

Prototype

public void cut() 

Source Link

Document

Invokes provideErrorFeedback on the current look and feel, which typically initiates an error beep.

Usage

From source file:Main.java

License:asdf

public static void main(String args[]) {
    JFrame f = new JFrame("JPasswordField Sample");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Box rowOne = Box.createHorizontalBox();
    rowOne.add(new JLabel("Username"));
    rowOne.add(new JTextField());
    Box rowTwo = Box.createHorizontalBox();
    rowTwo.add(new JLabel("Password"));
    JPasswordField jpassword = new JPasswordField();

    rowTwo.add(jpassword);/*www.j a v a 2 s .  com*/
    f.add(rowOne, BorderLayout.NORTH);
    f.add(rowTwo, BorderLayout.SOUTH);
    f.setSize(300, 200);
    f.setVisible(true);

    jpassword.setText("asdf");
    jpassword.selectAll();
    jpassword.cut();
    jpassword.copy();
    jpassword.paste();

}