Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: OutPut.

  1. #1
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Question OutPut.

    is it possible that i can print a simple program in an active window like "notepad"?

    like the robot sample in java tutorials

    brief example:

    here's the code


    public static void main(String[] args)
     
    {
            System.out.println("Hello Mates!);
    }

    can i display it in notepad? or ohter window?

    how am i going to do that?

    is it possible?



    tnx !!!!


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: OutPut.

    Have you taken a look at http://www.javaprogrammingforums.com...bot-class.html yet?

    The Robot class acts on whatever the active window is. I believe java might be able to let you change the active window, but i'm not sure how.

  3. #3
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: OutPut.

    yes i did. but im not so sure and i dont have any idea if i can display this simple program
    in that same way...
    without using robot class..


  4. #4
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: OutPut.

    In pure Java, no. The reason is Java or any other program doesn't have the handle to the other program's process/threads (which is good because that would be a severe security breach if it did). However, In languages that compile down to machine code, you can manipulate the hardware and spoof keystrokes/mouse movement etc. that will be passed to the program by your OS. Native Java can't do this, but the Robot class allows Java to spoof keystrokes and mouse movement by linking some native code for use by your Java program.

    The same is true with Java graphics. AWT is a java interface to native components, as well as other graphics libraries that allow for graphics card acceleration. SWING may be written in Java, but it still needs to access AWT methods to draw to the screen.

Similar Threads

  1. how to output using JLabel?
    By qaromi in forum AWT / Java Swing
    Replies: 1
    Last Post: August 30th, 2009, 02:09 PM
  2. Replies: 3
    Last Post: August 19th, 2009, 11:30 AM
  3. Redirect error and output stream using java program
    By leenabora in forum File I/O & Other I/O Streams
    Replies: 5
    Last Post: June 16th, 2009, 04:12 AM
  4. Display output from a file using regular expression
    By jazz2k8 in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: May 29th, 2008, 09:33 AM
  5. [SOLVED] Java program error in displaying Output
    By crazydeo in forum AWT / Java Swing
    Replies: 9
    Last Post: May 14th, 2008, 10:42 AM