Jonathan Moore

Ranch Hand
+ Follow
since Nov 02, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Jonathan Moore

I added an empty shortcut tag and that seemed to do the trick.

Cheers
Jon
16 years ago
I did see the shortcut element but couldn't find any decent documentation on it. I don't have it in my current jnlp, but if I have my shortcut creation preference set to "Always allow" it creates the shortcut silently. I don't know who will have Java already installed and what their settings are so I can't seem to guarantee prevention of the shortcut creation.

Thanks
Jon
16 years ago
Hi,

We have an application that we are deploying to multiple sites around the world. Currently the app is installed manually on a file share in each site and users have a desktop link to it - a far from ideal solution. We want to swicth to using web start but the issue we have is that users do not have administrator rights to their PCs and many only have old versions of Java installed. We cannot therefore rely on Java Web Start to download the correct Java version.

We have come up with a solution where each site run a one off installation that installs the correct version of java on a central file share together with a startup script which will run javaws from that install, pointing to the correct jnlp file. Users will have a shortcut on their desktop to the script. This is actually similar to what happens at the moment except the shortcut runs the Java app directly off the share. What we want to prevent is web start installing its own shortcut as this will potentially cause problems. Is there a way of disabling shortcut creation, either as a command line param for javaws or in the jnlp file?

Alternatively is there a different solution to our problem which would enable us to use web start in a more conventional manner? I know the obvious answer is to upgrade all users to the correct version of Java, but we are talking about ~50 sites worldwide with associated language problems, and we need a solution that will work fairly seemlessly.

Any advice gratefully received.

Thanks
Jon
16 years ago
Hi,

Another Jacob question. I've found that if you already have Word open when generating a document using Jacob you get problems when trying to close Word. Specifically calling

ActiveXComponent wordApp = new ActiveXComponent("Word.Application");

will open a new instance of Word. When you attempt to close this you get the error message

"This file is in use by another application or user.
(C:\Documents and Settings\...\Normal.dot)"

When you click "OK" it opens a "Save As" dialog for you to ave the Normal.dot template.

It seems that the first Word instance has a lock on the template, and the 2nd is trying to update it (not sure why) but this will cause confusion and problems for my users (especially as Word will be run with visibility off).

So my question is, is there a way to prevent this? Currently I have checked the task list to see if Word is running and give the user a message to close it but that seems a bit heavy handed. Is there a way of connecting to the existing Word instance rather than creating a new one? Alternatively is there a way of resetting the template location (to say a temp directory) to prevent the lock clash.

Thanks for any help.

Jon
Hi all,

I am working on a project to generate Word documents from Java code and am using the Jacob bridge. I'm able to do most things I require but am having real trouble with applying a formatting style to a a section of text.

I generally work out the calls to make by creating a macro and converting the code it produces into Jacob calls. Setting the style to "Heading 1" will produce the macro code:

Selection.Style = ActiveDocument.Styles("Heading 1")

I have converted this as follows:



but this produces the following exception:

com.jacob.com.ComFailException: Can't map name to dispid: Heading 1

Any ideas what's going wrong?

Thanks for any assistance.

Jon
That's great - thanks for your help Craig.

Jon
17 years ago
I'm trying to create a JTable that acts like a set of JTextFields, with the top row and left column rendered as JLabels. The code below works fine, but I'd like to be able to tab between cells and the cell to immediately go into edit mode (so it's invisible to the user that this is actually a table). Additionally I'd like it to skip uneditable cells, so tabbing on a far right cell doesn't move to the label on the next row, but to the next editable cell. I've spent quite a while trying to figure this one out but with no luck, so does anyone have any pointers?

If you run the code below you will see that clicking in an editable cell automatically puts it into edit mode (with cursor and changed text position) but tabbing doesn't give any visual indications, though if you start typing it starts editing.

Thanks for any help, and here;s the code:

17 years ago
Hi,

I'm implementing drag and drop into my application and am trying to display a ghosted image of the dragged component during the drag. There is an example of this in the Swing Hacks book - it involves creating a glass pane and painting the component on it with the opacity set to 0.5. Not a problem.

However the example given only shows the movement of the source component and doesn't actually implement drag and drop. You need to add a MouseMotionListener to the source component to do the animation, but I've found that once you've called setTransferHandler on a Component you can't then add a MouseMotionListener (or you can but the events don't get called). Has anyone attempted this before, and is it possible to set the transfer handler AND a MouseMotionListener on the same component?

Thanks for any help,
Jon
18 years ago
I don't know much about Linux, but should you be escaping the space? If a windows filename has spaces you usually put quotes around it. Also if you use the exec(String[]) method you shouldn't need to escape or quote it - you should just be able to use:
18 years ago
Hi Alan,

I didn't take deadlocks into consideration. I had a business layer on the server side, so for instance I had a book() method that called lock, read, update and unlock in the finally block. This means that a client can't hold a lock open, and even if the client dies immediately after making the call, the server will finish it's method call and will only fail when trying to return. Similarly I ignored the possibility of orphaned locks. Of course I mentioned all this in my choices document.

Cheers
Jon
18 years ago
I don't think you can do what you're trying to do. Each Timer has a background thread and I believe once the last scheduled task has completed the Timer finishes and is eligible for garbage collection. I think this is the same as calling start() on a thread, waiting for it to finish then trying to call start() again. Once your task has completed you would need to create a new Timer to reschedule.

Cheers
Jon
18 years ago
I think the timeline for using Java 1.4 is very close - I can't find the exact date but I submitted my project last month and had a date in my mind of the end of March as a deadline for using 1.4.2. It's probably safest to compile and test using Java 5 - you can easily download it from the Java homepage and the time's well spent if it saves an automatic failure.

Cheers
Jon
Hmm, sorry I didn't read it properly - I was assuming inventory was the ArrayList.

You won't be able to call get() on your inventory item because you haven't defined a get() method. You can either define a get() method and your code snippet should work, or you could change your inventory class so that the removeItem() method returns the item you have removed. Wither way will obtain a reference to the item you are about to remove so that you can call getName() on it.

Another tip - you should capitalise class names, so call your class Inventory rather than inventory.

Cheers
Jon
18 years ago
Be carefull abut adding extra things like progress bars - they're not part of the requirements so you won't get extra marks for them, but you may be marked down if you introduce any bugs.

Jon
It took about 5 weeks to mark
18 years ago