开发者

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

开发者 https://www.devze.com 2023-03-17 22:54 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消