Example usage for javax.swing.text JTextComponent add

List of usage examples for javax.swing.text JTextComponent add

Introduction

In this page you can find the example usage for javax.swing.text JTextComponent add.

Prototype

public Component add(Component comp) 

Source Link

Document

Appends the specified component to the end of this container.

Usage

From source file:Main.java

public TextPrompt(String text, JTextComponent component) {
    this.component = component;
    document = component.getDocument();//from www  .  j a v a 2  s  .co m

    setText(text);
    setFont(component.getFont());
    setBorder(new EmptyBorder(component.getInsets()));

    component.addFocusListener(this);
    document.addDocumentListener(this);

    component.add(this);
}