Solved

Writing/copying  System.out.println

Posted on 2002-05-02
7
150 Views
Last Modified: 2010-03-31
Hi All,

I have JBuilder5, personal edition, and I want to show and copy what I see in output of the applet now using  System.out.println("StringWhatEver");

I know how to use and can see it in:
   
public void paint(Graphics g) {
g.setColor(Color.blue);
g.drawString("StringWhatEver", 150, 10);
}

I want to show it inside a scroll box  in an applet so that the user  can higlight the outout  and copy the information.
A small example would be appreciated.

Delphi3





0
Comment
Question by:delphi3
  • 4
  • 3
7 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 50 total points
ID: 6986219
why not put a textarea on the applet and do something like:
TextArea myTextArea = new TextArea("StringWhatever", 5, 10, TextArea.SCROLLBARS_VERTICAL_ONLY);
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 6986228
and if you want to copy some selected text:

String strText = myTextArea.getSelectedText();
0
 
LVL 4

Author Comment

by:delphi3
ID: 6987656
bobbit31,

I have tried your answer and I have tried to extend it to include more than one text line.


I have used myTextArea.append to write the next line. What results is that the next line is not left justified and if copied shows the entire text as a single string. Is there a command to get it to be left justified in the second line, so that the next line and the one above it are on seperate lines?

Delphi3
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 4

Author Comment

by:delphi3
ID: 6987812
bobbit31,
 
Got it!!
 
This thing "\n" causes the next line to be left justified as in:
myTextArea.append("First String");
myTextArea.append("\nSecond String");

And now after a run, a higlight over the text in the applet text area and a control 'c',then pasting it into a .txt form shows that each line is now left justified.

Delphi3
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 6987831
the \n is a new line character.

but anyway, i take it it's working now? if so, glad to hear it!
0
 
LVL 4

Author Comment

by:delphi3
ID: 6987896
Yes it is working fine and I thank you very much for stopping by and helping out.

Delphi3
0
 
LVL 4

Author Comment

by:delphi3
ID: 6987899
Thanks again,


Delphi3
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now