Cancel window closing operation in java app

August 30, 2010 by Mike · Comments Off
Filed under: Java, Programming 

Question: I have a Java swing crossplatform project. I have to ask the user if he really wants to quit from the desktop app before exit, so I have to handle the WindowClosing event. My problem is simple. When I even click on the NO button the window does close! I expected the DO_NOTHING_ON_CLOSE flag to prevent the form from closing. I didn’t thought the WindowClosing event will be fired even if the setDefaultCloseOperation was set to DO_NOTHING. Have you experienced it before and what have you done? Thank you in advance. I am attaching my code. Read more

Change data on PDF master page with iText

July 14, 2010 by Alex · Comments Off
Filed under: Adobe, Adobe Acrobat, Java 

Question: I am using Adobe LiveCycle ES2 to design multipaged and taylor made PDF documents containing interactive forms. We build JAVA web server applications to manipulate these online PDF documents with iText 5.0 API library. By using LiveCycle I created a static XFA form with one master page and some watermark and text fields on the footer. I want to change these on the fly.

I got a strange result. I added some text fields like TextWatermark, TextFieldDate and TextFieldName. The form I have created contains 10 pages so I expected Adobe Reader to present those fields on all the pages. The first page looks OK but my iText solution does not automatically update all other associated pages. What’s wrong?
Read more

Execute JAVA program from Windows 7 WPF application

January 20, 2010 by Alex · Comments Off
Filed under: C#, Java 

Question: I need to execute an external JAVA program from my Windows 7 WPF application during the installation and configuration phase. I use Visual Studio 2008 and CSharp. What to do?

Read more

Java error – Could not reserve enough space for object heap

December 20, 2009 by Alex · Comments Off
Filed under: Java, Web programming 

Question: I have a Linux web server with JRE and has got problems trying to run a Java APP from the shell. It seems that web server limits the memory I can allocate. Error messages:

Error occurred during initialization of VM
Could not reserve enough space for object heap

Shell code:

java -Xmx1950m -cp helloworld.jar

What’s wrong? Any ideas?
Read more