Karvas
Karvas

Reputation: 39

How can i read a text file and diplay it in a netbeans JTextArea?

I'm working in a Netbeans GUI project. All I want to do is to read a text file from a path and display it in a JTextArea using Netbeans. How can I achieve this?

Is there any simple way to do this just using the file path?

Lets say i want this be done after a button click..

Upvotes: 1

Views: 1711

Answers (2)

mKorbel
mKorbel

Reputation: 109813

Upvotes: 3

Andrew Thompson
Andrew Thompson

Reputation: 168825

See JTextComponent.read(Reader,Object) for almost a 'one-line solution'.

Upvotes: 3

Related Questions