简体   繁体   中英

Problem opening in Swing Frames (from Menu Items) with JWS or created exe from Jar file

I have a Java Swing GUI for an application (I am using Neetbeans 6.9+XP+java 1.6), it has a few menus in Menu bar and several fields to fill. This application works well both in Netbeans IDE and with a Jar file of application.

Problem occurs only when I create Java Web Start application for my application or create an exe file from the jar file of my application.

Problem is with the Help menu, which has two menu items designed as Frames. One is "Help Content" contains some text as labels on this Frame. Second is "About" contains a png of the project and contains some texts as labels. Problem is when I click on any of the frames "Help Content" or "About" menu items it does not open the frame for first click and opens the frame on subsequent clicks on the top left corner, where I can only see the partial title of the frame with no frame window. When I resize it or maximize this frame then I don't see anything on this. (This problem occurs only when I create JWS application or exe from the jar fle).

Could anyone please help me in this?

Problem has been solved now, the problem was coming at the time of setting the image to the frame icon. I don't understand why the problem arose in the below piece of code

BufferedImage image = null;
            try {
                image = ImageIO.read(
                        aboutFrame.getClass().getResource("/org/ama/defect/prevention/tool/startup/splash/about.png"));
            } catch (IOException e) {
                e.printStackTrace();
            }

I removed this code from jMenuItemAboutActionPerformed and fetch the png image in the constructor and set the image in jMenuItemAboutActionPerformed and problem was solved.

Thanks again for your help. Rahul

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM