All:

After banging my head against the wall, I have more information to describe my problem (JRE problem that is!!).

Here is a snippet of the code:

   // MyJEditorPane does the following:
   setEditorKit(new MyHTMLEditorKit());
   // Note: MyHTMLEditorKit() just extends HTMLEditorKit() to override async doc loading

   setEditable(false);
   File f=new File(mergedFileName);
   String completePath = f.getAbsolutePath();
   completePath = "file:////" + completePath;
   URL url = "" URL(completePath);
   setPage(url);


   // Main code is here

   MyJEditorPane mjep = new MyJEditorPane(fileName);  // Extends JeditorPane

   JWindow jw = new JWindow();
   JScrollPane jspHP = new JScrollPane( mjep,
                                        JScrollPane.VERTICAL_SCROLLBAR_NEVER,
                                        JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
   jw.setSize(ps.paperWidth, ps.paperHeight);   // w * h
   jw.getContentPane().add(jspHP, BorderLayout.CENTER);

   // Point #1 check bounds

   jw.setVisible(true);

   // Point #2 check bounds

   Thread.sleep(500);  // sleep for a half second because images are loaded async

   // Point #3 check bounds


Ok, Here is the output from getting the bounds from the various points. i.e.  mjep.getBounds(null)

The following shows the differences in being triggered from either a Command Prompt and a Windows Service.


            Command Prompt    From Windows Service
Point #1
Width             0                   0
height            0                   0

Point #2
Width            609                 609
height          1353                1353

Point #3
Width            609                 609
height           789                1353



For whatever reason, the HTMLEditorKit makes my JEditorPane large and then after rendering it, it is shrunk to the right size. But this does not happen when it is launched from a Windows service.

So, I tried to validate(), invalidate(), doLayout(), repaint(), etc... to mjep component.  But nothing helps.

I tried to validate(), invalidate(), doLayout(), repaint(), pack(),  etc... to jw component.  But nothing helps, although pack() does some wild stuff.

Just now, I happened to try (after the setVisible) both repaint() and show() against jw (JWindow) and voila, it works perfectly.  Ahhhhhhhhhhh

So for whatever reason, you need to kick the JRE hard to get the HTMLEditorKit and / or JEditorPane to complete the rendering process when being launched from a Windows Service.

Any gurus out there want to try explaining these little subtle differences.

So, I am posting this for other people's future reference.

later
Roger...




At 03:18 PM 7/7/2003, you wrote:
All:

Technologies: Windows 2000, JDK v1.4.1_03

I have an application that gets a message from a MQSeries queue, merges the data with a HTML template and then prints the merged-document (no user interaction).

When I run the application from Eclipse or the Command Prompt, everything is fine.

My client wants to use MQSeries triggering - meaning when a message arrives in the queue, the application will be started.  This requires a "Trigger Monitor" to be running.

If I start the Trigger Monitor from the Command Prompt, when a message arrives, my program is started and everything is fine.

Now to the problem:
===============
If I start the Trigger Monitor as a Windows Service, when a message arrives, my program is started and the merged-document (HTML) is printed but 1 blank page (sometimes 2) also get printed.  I have no idea why this is happening.

It is almost as if the JRE is sending a clear / page eject after my print job.  I thought maybe I needed to explicitly close my print job but DocPrintJob does not support the close method.

I know it is not a problem with the MQSeries Trigger Monitor (it just starts program as a separate process) and I don't think the Windows Service Management cares about it either.

Therefore, the only things left are my program and the JRE.  Since my program works fine when launched from any other way that leaves the JRE.

Anybody got any ideas?

Thanks
Roger...
---
You are currently subscribed to jdjlist as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
http://www.sys-con.com/fusetalk

Reply via email to