Example usage for javax.swing.text DefaultEditorKit beepAction

List of usage examples for javax.swing.text DefaultEditorKit beepAction

Introduction

In this page you can find the example usage for javax.swing.text DefaultEditorKit beepAction.

Prototype

String beepAction

To view the source code for javax.swing.text DefaultEditorKit beepAction.

Click Source Link

Document

Name of the action to create a beep.

Usage

From source file:MainClass.java

MainClass(String title) {
    super(title);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel jp = new JPanel();

    JLabel jl = new JLabel("Name:");
    jp.add(jl);//from   ww  w  .  ja  va 2s .co  m

    JTextField jt = new JTextField(20);
    jp.add(jt);

    KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_B, Event.CTRL_MASK);

    jt.getInputMap().put(ks, DefaultEditorKit.beepAction);

    getContentPane().add(jp);

    pack();
    setVisible(true);
}