• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JTextArea

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there anyone who has good understanding of JTextArea
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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();
}

}
 
reply
    Bookmark Topic Watch Topic
  • New Topic