printing through java

hOW CAN Print the contents in a textfield or textarea in java

Page 1 of 1

3 Replies - 1713 Views - Last Post: 03 March 2010 - 08:27 PM Rate Topic: -----

#1 Geetanjalid  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 31-December 08

printing through java

Posted 03 March 2010 - 08:16 PM

Can i print the contents of a textarea or textfield in java
Is This A Good Question/Topic? 0
  • +

Replies To: printing through java

#2 erik.price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 485
  • View blog
  • Posts: 2,690
  • Joined: 18-December 08

Re: printing through java

Posted 03 March 2010 - 08:18 PM

System.out.println(YourJTextArea.getText());


If you meant as in a printer, check this out
Was This Post Helpful? 0
  • +
  • -

#3 zim1985  Icon User is offline

  • Grand Inquisitor
  • member icon

Reputation: 74
  • View blog
  • Posts: 568
  • Joined: 19-February 10

Re: printing through java

Posted 03 March 2010 - 08:20 PM

View PostGeetanjalid, on 03 March 2010 - 06:16 PM, said:

Can i print the contents of a textarea or textfield in java

Sure you can. Use the .getText() method.
JTextField text1 = new JTextField("Words, words, words", 20);
System.out.println(text1.getText());


Works the same for the JTextArea. :)

This post has been edited by zim1985: 03 March 2010 - 08:20 PM

Was This Post Helpful? 0
  • +
  • -

#4 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: printing through java

Posted 03 March 2010 - 08:27 PM

If you want to keep the original format

http://www.dreaminco...=1&#entry375982

writtent in june 2008 will print any JComponent as it appears on screen
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1