Scott Presley

Greenhorn
+ Follow
since Apr 15, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Scott Presley

I have an app that i run as an undecorated full screen jframe - i need all the screen real estate i can get. all works well until the app is minimized. When the application is brought back up, the windows task bar stay on top of the app. I'm overriding windowDeiconified() and windowActivated() on the main jframe, but i don't know what i should actually do to reclaim the real estate. any thoughts?
13 years ago
I have coded a simple multiple document viewing application. Up to this point, I've simply used a file chooser to open the files within my app.

I recently added lines to the registry to allow for an application protocol url, similar to the "mailto: ". So now, I can type in the run window of the windows start menu: "myapp:file1.txt" and windows will launch my app and the file path will be passed through as a command line argument. (background info: i use launch4j to create an exe which in turn calls my jars, launching my app...)

So the next step will be to create an association with a type of file, say *.txt, such that clicking on a txt file will launch my application.

My ultimate goal is to be able to click on a second document in windows somewhere while my app is running and the doc will load in the same instance of my app... does anyone know how this would be accomplished??? I'm assuming that the initial file click, launching the application, will pass the file name in as a command line arg, but once the app is running, how would i get another command line arg into the app??? Is this possible in java??

thanks in advance...

15 years ago
please don't ask how i got myself into this predicament...

i run the following command to start my applicaiton



there is a dll contained in the lib folder that one of my third-party classes relies on to write to the windows registry.

I'm stuck though... is part of a new feature i'm rolling out to my customers, but they have an existing exe wrapper that calls my java application and it does not include the this new jvm arg...

is there anyway to programmaticlly specify the java.library.path VM argument in the code? I tried


but it fails...
15 years ago
I need to launch a .bat file, "update.bat" from within a java application, let's call it calculator.java. I have been able to do this via ProcessBuilder. The thing is, I need to launch this "update.bat" then exit calculator.java without waiting for a return.

Through testing, it seems as though calculator.java doesn't fully exit until the "update.bat" is complete and returns. Here's the catch: "update.bat" launches a second java app that downloads and updates jars within the classpath of the original java app (calculator.java). It seems as though i'm running into some sort of deadlock issue.

I know that webstart would probably be a better solution, but in my current situation , webstart is not a option.

So here is the crux of my post: Can I launch an application (.bat, .exe) from within java and then have java exit without waiting for the spawned application to exit?

thanks in advance,
cotfessi
17 years ago
I have a requirement to view a PDF file within a given application I'm developing. I've tried several different open source and commercial pure java based PDF viewers and they really don't stack up to Acrobat.

I did find a few commercial products that bridge java and Microsoft COM, but they're crazy expensive and do a whole lot more than I need.

Does anyone have any experience embedding ActiveX controls into swing apps? I'm having trouble finding guides/tutorials on the web.

Any help would be greatly appreciated.

p.s. The actual dll I'm going after for adobe acrobat is: C:\Program Files\Adobe\Acrobat 7.0\ActiveX\AcroPDF.dll (assuming the default install directory)
17 years ago
I've been running webstart for a while in my test environment but we want to make the move to our production environment. I been having a problem with webstart not always recognizing that new jars are available.

Here is my process:
1. make changes to my application code
2. run ant to compile, jar, and sign my application and resource jars.
3. move the jars to the appropriate folder on the server, overwriting old jars
4. navigate to the web page that contains my launch button (link to my jnlp file)
5. first time launch button is clicked, application kicks off without updating jars.
6. close application and navigate back to the web page and click the launch button again.
7. webstart recognizes that updated jar are available and downloads the new jars before starting my application.

I did some poking around on the net and found a few resources, specifically this comment from the webstart FAQ at sun:

I don't want to rely on a server timestamp. How can I specify a versioned JAR and how can I get incremental updates of JARs?

Java Web Start supports versioned JARs and incremental updates. You can specify exact versions of the JAR files you want, instead of relying on timestamp information to determine if an update is available. Using version IDs also allows you to provide incremental updates from one version to another. See the JNLP Specification or the Developer's Guide for details.



I really haven't found anything in the developer's guide to detail how to version jar files. Does anyone know how to do this or at least know where i might find a resource that could explain this process?
17 years ago
I have my source tree in a CVS repository that uses SSH instead of the pserver. I'm creating an ant script to perform a nightly build. I want to checkout the source from CVS, compile it, build the jars, and depoly it to the server. I've completed writing the script, but when the CVS target is executed it asks for my password to login to the cvs server.

I've lookked through the ant forum here and tried to do some googling to find an answer but really didn't find much. Is it possible to automate a build that checks source out of CVS with SSH? If not is there another build tool that might work?

Thanks in advance,
Scott
18 years ago
I have a large html document contained within a JEditorPane using the HTMLEditorkit as the editorkit. A table of contents appears at the top of this large html document with links to specific areas of the text - this table of contents employs the use of anchor tags. Does anyone know how I would be able to navigate to one of these anchors? I'm already listening for events using a HyperlinkListener, but I can't find any documentation on how I use the HyperlinkListener with anchors.

Thanks,
Scott
19 years ago
I've got a requirement to build a component resembling a circular pizza. I need to be able to attach a mouse listener to each individual �slice� If the pizza was square, I could simply represent each �slice� as a JPanel, but since the slices aren�t square, a JPanel really doesn�t make sense. Does anyone know if I could extend JComponent to form an irregular (non-square) component?

One additional note... there are more requirements than just mouse listening, so simply tracking the mouse position isn't a viable solution...
19 years ago
thanks for the comments... i guess I am mixing up the two... I think I'm going to stick with the vector drawing and just undo the last 'line'
19 years ago
I'm a little stuck and thought I would see if anyone out there has any suggestions for this...

I have a simple panel that I'm allowing the user to draw a line while dragging the mouse inside the 'drawable' area. I'm using the mousePressed, mouseReleased, and MouseDragged methods to capture a series of points and drawing lines between those points during above mentoined mouseXX methods as well as in the paintComponents() method.

Each 'full draw stoke', (press+drag+release) is stored as a separate array of points. This gives me the ability to undo the last line drawn. This undo seems a little to drastic in the case that a lot of drawing took place before the mouse was released.

I'd like to make an eraser that would function as prety much the reverse of the draw, removing any previously drawn lines in the path of a drag of the 'eraser'.

initially I was simply drawing in the mouseXX methods, but on a repaint the lines would be lost. Now that I'm storing arrays of points, I can iterate through these arrays and redraw my lines in the paintComponent() method. This tatic makes an eraser all but impossible? I was initially thinking of simply drawing another line on top, in the same color as the background, but the uses for this drawing panel will vary such that there may be a gradient background or even an image as the background...

I may be approaching the whole thing wrong with recording the points the way that I am... does anyone have any suggestions?

Thanks in advance,
Scott
19 years ago
one more quick thing...

here is the test text I'm using:

<b>PREAMBLE</b><hr>We the People of the United States, in Order to form a more perfect Union, establish Justice, insure domestic Tranquility, provide for the common defense, promote the general Welfare, and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Constitution for the United States of America.
19 years ago
I have a unique situation in which I need to pop up a JWindow when the user brings the mouse over a specific area of my application. Inside this JWindow I need to display text with HTML formatting. I've employed the JEditorPane with an HtmlEditorKit. The text displays well, but I'm having serious problems sizing the window appropriately. Here is what I�ve tried so far:

1. Nothing. No explicit sizing logic, added the JEditorPane to the JWindow using BorderLayout.CENTER. This doesn�t work because there isn�t any word wrap in the JEditorPane, so the window is pretty much a single line of text across the screen. The text I�m using as a test is the preamble to the US Constitution, and with out sizing logic, the window�s pref size is: java.awt.Dimension[width=1774,height=44]!

2. I started to play with the javax.swing.text.View class. I created a subclass of JEditorPane and overrode the setText() method to include the following logic:



I�m hardcoding the value of 160 as the width and trying to determine the height based on that width. This seems to work for small pieces of text, but as the length of the text increases, the values returned aren�t reliable. In the case of the preamble, the last word, �America� is on its own line, but is not visible because the view is returning the wrong value.

Now in the code above, right after �//Comment #1�, I�m using the getMinimumSpan () method. I�ve noticed that in all of my tests that the getMinimumSpan() and getPreferredSpan() methods return the same value � a value that is too small. The getMaximumSpan returns some astronomically large number.

Has anyone had any experience with trying to size a JEditorPane with HTML?? If this was inside my main frame I could use layout managers and other components to size the JEditorPane correctly, but since this is a JWindow that only contains the JEditorPane, I�m sort of stuck!

Thanks in advance,

scott
19 years ago
Support for viewing PDF files within java is pretty lousy. You can try using Multivalent Browswer. You can embed the browser in a JPanel or something...
19 years ago
actually found the answer to my own question... Use GraphicsEnvironment!



yields the following output:

19 years ago