CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 21

Thread: PrintEvent help

  1. #1
    Join Date
    Sep 2011
    Posts
    197

    PrintEvent help

    Once again I have come to a halt I am in the proccess of tracking down the answer, but if someone here could save me some time that would be splendid.

    PrintEvent's (for the record I have already imported the PrintEvent class) syntax is like this..

    Code:
     new PrintEvent(method(args));
    I have encased mine in the 'try' statment.

    My only question is how do I tell java WHERE to PrintEvent(); also, what syntax do I use to do so.


    Just in case you need it here's mine:

    Code:
     
      PrintEvent pe = null;
      paraM = newObj(paraM);
    
       try {
         bw.write(paraM);
        pe = new PrintEvent(newObj(paraM));
    } catch (IOException ioe) {
    			}
    Last edited by kolt007; September 15th, 2011 at 11:49 PM.

  2. #2
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: PrintEvent help

    What are you trying to create a PrintEvent object for?
    Do you get errors? Please copy and paste here the full text of the error message.
    Norm

  3. #3
    Join Date
    Feb 2008
    Posts
    966

    Re: PrintEvent help

    Where did you get the PrintEvent class from.

  4. #4
    Join Date
    Sep 2011
    Posts
    197

    Re: PrintEvent help

    Code:
     public String newObj(String paraM) {
     BufferedWriter bw = null;
    
      try {
         bw = new BufferedWriter(new FileWriter("Objects"+(paraM)));
         bw.write(paraM);
          objectS(paraM);
         return paraM;
    } catch (IOException ioe) {
    			}
               return null;
                       }
    public void NewObjects(String paraM) {
    //global
      BufferedWriter bw = null;
      PrintEvent pe = null;
    
      paraM = newObj(paraM);
    
       try {
         bw.write(paraM);
        pe = new PrintEvent(newObj(paraM));
    } catch (IOException ioe) {
    			}
    
    
       makeGlobalObject(2536, 4717, 2213, -1, 10);
    }

    No error's just when I go though it it doesn't print the event anywhere.

  5. #5
    Join Date
    Sep 2011
    Posts
    197

    Re: PrintEvent help

    Quote Originally Posted by ProgramThis View Post
    Where did you get the PrintEvent class from.
    From: http://download.oracle.com/javase/6/docs/api/index.html

  6. #6
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: PrintEvent help

    it doesn't print the event anywhere.
    Where are you trying to print the contents of the PrintEvent object?

    Add this statement at the end of the NewObjects method to print it:
    System.out.println("pe=" + pe); // print contents of PrintEvent object
    Norm

  7. #7
    Join Date
    Sep 2011
    Posts
    197

    Re: PrintEvent help

    Is there anyway Ican make system.out.println() or system.out.format() etc.. print in the NewObejcts() method?

  8. #8
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: PrintEvent help

    Yes, You can use/call the System.out.println() method in any method.
    Norm

  9. #9
    Join Date
    Sep 2011
    Posts
    197

    Re: PrintEvent help

    Code:
     call(system.out.println(paraM));
    Say's 'package system does not exist

    What is the syntax for call?

  10. #10
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: PrintEvent help

    Check your spelling. Java is case sensitive.
    Norm

  11. #11
    Join Date
    Sep 2011
    Posts
    197

    Re: PrintEvent help

    Code:
           public String newObj(String paraM) {
     BufferedWriter bw = null;
    
      try {
         bw = new BufferedWriter(new FileWriter("Objects//"+(paraM)));
         bw.write(paraM);
          objectS(paraM);
         return paraM;
         System.out.println(paraM);
    } catch (IOException ioe) {
    			}
               return null;
                        }
    public void NewObjects(String paraM) {
    //global
      BufferedWriter bw = null;
      PrintEvent pe = null;
    
    
    
    
    call(System.out.println(newObj(paraM)));
    
     makeGlobalObject(2536, 4717, 2213, -1, 10);
    }
    Say's
    Code:
     client.java:5618: 'void' type not allowed here
    call(System.out.println((paraM)));
                           ^
    1 error
    Finished!
    Press any key to continue . . .


    I've tried
    Code:
     call(System.out.println(paraM));
    aswell say's void not allowed? It's werid because, my newObj class isn't void??

  12. #12
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: PrintEvent help

    Try this:
    System.out.println("paraM=" + paraM);
    Norm

  13. #13
    Join Date
    Sep 2011
    Posts
    197

    Re: PrintEvent help

    Code:
     call(System.out.println(paraM));
    gets

    Code:
     client.java:5617: 'void' type not allowed here
    call(System.out.println(paraM));
                           ^
    1 error
    Finished!
    Press any key to continue . . .
    I tried

    Code:
      call(newObj(paraM));
    and, got:

    Code:
     client.java:5617: cannot find symbol
    symbol  : method call(java.lang.String)
    location: class client
    call(newObj(paraM));
    ^
    1 error
    Finished!
    Press any key to continue . . .

  14. #14
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: PrintEvent help

    Where is the call(String) method defined? The compiler can not find its definition in the client class.
    Norm

  15. #15
    Join Date
    Sep 2011
    Posts
    197

    Re: PrintEvent help

    is it a class in API or is it an interface?

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured