Solved

Writing/copying  System.out.println

Posted on 2002-05-02
7
154 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
hibernate example issues from command prompt 10 63
by zero exception 10 69
Android development question 2 76
Setup GlassFish 4 34
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…

740 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