?
Solved

Writing/copying  System.out.println

Posted on 2002-05-02
7
Medium Priority
?
159 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 200 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
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…
This video teaches viewers about errors in exception handling.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

718 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