Icon change and lib folder problem
Hi.. I'm new to java, just made my first java desktop program several days ago.
I have two problems, hope you can help.
1. I've read about changing the java icon here
java-forums.org/new-java/21799-images-jar-file-via-eclipse.html
java-forums.org/new-java/21920-netbeans-6-5-java-icons-differences.html
java.sun.com/docs/books/tutorial/uiswing/components/icon.html
java.sun.com/javase/6/docs/api/javax/swing/ImageIcon.html#getImage%28%29
devx.com/tips/Tip/5697
I got the following errors with this trick java-forums.org/java-2d/18166-changing-java-icon-2.html
Code:
java.lang.IllegalArgumentException: input == null!
at javax.imageio.ImageIO.read(ImageIO.java:1362)
at binergabung.BinergabungView.<init>(BinergabungView.java:44)
at binergabung.BinergabungApp.startup(BinergabungApp.java:19)
at org.jdesktop.application.Application$1.run(Application.java:171)
with this trick I got the following errors java-forums.org/awt-swing/5373-how-change-window-icon.html
Code:
Uncaught error fetching image:
java.lang.NullPointerException
at sun.awt.image.URLImageSource.getConnection(URLImageSource.java:99)
at sun.awt.image.URLImageSource.getDecoder(URLImageSource.java:113)
at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:240)
at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:172)
at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136)
I'm using netbeans 6.7.1, I'm changing the frame properties at the constructor. Here's my code
Code:
/*
* BinergabungView.java
*/
package binergabung;
import java.awt.Color;
import org.jdesktop.application.Action;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JTextField;
import java.io.FileNotFoundException;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.File;
import java.awt.Toolkit;
import java.awt.Image;
import java.awt.Cursor;
/**
* The application's main frame.
*/
public class BinergabungView extends FrameView {
public BinergabungView(SingleFrameApplication app) {
super(app);
initComponents();
//Image icon = Toolkit.getDefaultToolkit().getImage("icon.gif");
Image icon = Toolkit.getDefaultToolkit().getImage(this.getFrame().getClass().getResource("/icon.gif"));
this.getFrame().setIconImage(icon);
this.getFrame().setResizable(false);
this.getFrame().setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
If I use this code
Code:
Image icon = Toolkit.getDefaultToolkit().getImage("icon.gif");
It's working with that code but I have to put the icon in the same folder as the jar, I want it to load the image from the jar not from outside of the jar..
2. I noticed that in order to make the jar application working I have to put the lib folder(contains appframework-1.0.3.jar and swing-worker-1.1.jar) with the same directory of the jar file. After doing some search I know that it's framework to make the jar file working. I want to intergrate it into the jar file, how to do it?
As I've stated above, I'm using netbeans 6.7.1.
I have one problem again, but I don't know if I can post it here or make new topic.
Hope you can help.. Thanks..