wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes JTextArea Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTextArea " Watch "JTextArea " New topic
Author

JTextArea

Piyush Walia
Greenhorn

Joined: Apr 16, 2004
Posts: 8
I am creating a simple JTextArea but i want that when ever it is displayed for
Editing it should look like this:

-------------------------------------------------------------

TEXT SHOULD BE ALLOW EDITING
ONLY BETWEEN THE DOTTED LINES.


-------------------------------------------------------------
Piyush Walia
Greenhorn

Joined: Apr 16, 2004
Posts: 8
Is there anyone who has good understanding of JTextArea
Kriti Garg
Ranch Hand

Joined: Sep 13, 2004
Posts: 50
Hi,

is there any specific reason to use texArea alone for this,

i mean u can concatenate two JLables one above and one below textArea

Kriti
Kriti Garg
Ranch Hand

Joined: Sep 13, 2004
Posts: 50
Like This....

......Code.........


package abc;

import javax.swing.*;
import java.awt.*;


public class TextTry extends JFrame{
JTextArea textArea=new JTextArea();
JLabel label=new JLabel();
JLabel label1=new JLabel();
public TextTry() {

label.setText("...................................");
textArea.setText("Text Editing Only allowed here");
label1.setText("...................................");

Box box=Box.createVerticalBox();
box.add(label);
box.add(Box.createVerticalStrut(15));
box.add(textArea);
box.add(Box.createVerticalStrut(15));
box.add(label1);


this.getContentPane().setBackground(Color.WHITE);
this.getContentPane().add(box);
this.setSize(new Dimension(250,250));
this.setVisible(true);

}
public static void main(String args[]){
TextTry textTry=new TextTry();
}

}
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: JTextArea
 
Similar Threads
Problem using a String containing large number of characters.
JTextArea size increase as size of font increase
i need to position my Caret
captured text
Icon in JTextArea