有没有关于:JAVA应用程序内嵌图像资源的方法的文章 你可以将需要的图像资源和编译后的.class文件一起打包装入.jar文件发布。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 打包成jar做个meta-inf目录添加一个manifest.mf文件就OK 1、把他字节话try { PrintWriter out1 = new PrintWriter(new BufferedWriter(new FileWriter("d:\\lcl\\lcl.txt"))); for (int t = 0; t < leecl; t++){ String lll = ".gif"; if (t > 11) lll = ".png"; RandomAccessFile ri=new RandomAccessFile("d:\\lcl\\l"+String.valueOf(t)+lll,"r"); out1.println("{"); byte [] map=new byte[(int)ri.length()]; ri.read(map,0,(int)ri.length()); //PrintWriter out1 = new PrintWriter(new BufferedWriter(new FileWriter("d:\\lcl\\t"+String.valueOf(t)+".txt"))); String str =""; for (int i=0;i<map.length;i++) { out1.print(map[i]+", "); System.out.print(map[i]+", "); if ((i%10)==0){ System.out.println(); out1.println(); } } ri.close(); out1.println("},"); } out1.close(); } catch (Exception ex) { System.out.println(ex); } 2、把字节化放到一个CLASS中public class Color_lcl implements Serializable { private int iconNam = 15; public Icon[] img = new ImageIcon[iconNam]; //Serializable接口中声明的方法 private void writeObject(java.io.ObjectOutputStream out) throws IOException { out.defaultWriteObject(); } //Serializable接口中声明的方法 private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); } public Color_lcl() { for (int i = 0; i < iconNam; i++){ Image imgTmp=Toolkit.getDefaultToolkit().createImage(bImg[i]); img[i] = new ImageIcon(imgTmp); } } private byte[][] bImg ={ {71,73, 70, 56, 57, 97, 32, 0, 32, 0, -111,2, 0, 50, 50, 50, -1, -1, -1, -1, -1,-1, 0, 0, 0, 33, -7, 4, 1, 0, 0,2, 0, 44, 0, 0, 0, 0, 32, 0, 32,0, 64, 2, 106, -116, -113, -87, -101, -30, 15,13, -128, -76, 58, 99, 31, 2, -68, -49, -116,101, 89, 39, 10, 97, -119, 90, -89, -102, 124,-24, 90, -71, -90, -12, 6, -23, 77, -63, 120,93, -54, -69, 30, 57, -8, 74, 64, -51, 98,-104, -77, -119, 104, -62, 84, 17, 68, 91, 42,119, -73, 39, 53, 121, -83, 78, -77, 82, 46,111, -119, -4, 66, 3, 97, 40, 113, -125, -77,30, -99, -37, 10, -125, 124, 62, -109, -93, 98,-43, -89, 89, -81, -63, -29, 63, 58, -53, -53,7, -8, 39, -56, -14, 102, 120, 24, 80, 0,0, 59, },//////////////////////////////////////////////////////////////////////////////0{71,73, 70, 56, 57, 97, 32, 0, 32, 0, -111,2, 0, 0, 0, 0, -1, -1, -1, -1, -1,-1, 0, 0, 0, 33, -7, 4, 1, 0, 0,2, 0, 44, 0, 0, 0, 0, 32, 0, 32,0, 64, 2, 101, -116, -113, -87, -101, -30, 15,-93, -100, -50, 72, -122, -63, 13, -76, -5, 103,125, -30, -74, 97, -118, 22, -123, -112, -71, -96,43, 55, -58, 21, 44, -113, 106, -3, -35, 51,-117, -72, 32, -3, -29, 29, 124, -77, -110, 48,64, 20, -24, 28, -128, -90, -13, 9, 109, -110,112, -94, 37, 117, 122, -19, 88, -77, 63, -82,22, -24, 125, 25, -123, -109, -27, 113, -120, 13,30, -109, -26, 51, 50, -67, 91, -61, -107, 110,54, -104, 126, -74, -121, -53, -9, -3, -42, -5,-57, -27, 54, 88, 0, 0, 59, },/////////////////////////////////////////////////////////////1 构造器的小问题,在线等 关个关于数据备份和还原的问题 Overriding与Overloading 一道垃圾回收的题,高手请进! java中中文查询数据库时出现乱码的问题 关于流的解惑~~~~希望个位大虾们能过来看下~~` 求助。哥们儿比较穷,没分了 调查一下有没有人对永远免杀的远程操控感兴趣 --关于经典HelloWorld程序调试--一个最基本的RMI问题---高手请进! 两个问题,请指教,谢谢! sql server的驱动包那里有下载? 对SCJP考试比较了解的请进
try {
PrintWriter out1 = new PrintWriter(new BufferedWriter(new FileWriter("d:\\lcl\\lcl.txt")));
for (int t = 0; t < leecl; t++){
String lll = ".gif";
if (t > 11) lll = ".png";
RandomAccessFile ri=new RandomAccessFile("d:\\lcl\\l"+String.valueOf(t)+lll,"r");
out1.println("{");
byte [] map=new byte[(int)ri.length()];
ri.read(map,0,(int)ri.length());
//PrintWriter out1 = new PrintWriter(new BufferedWriter(new FileWriter("d:\\lcl\\t"+String.valueOf(t)+".txt")));
String str ="";
for (int i=0;i<map.length;i++)
{
out1.print(map[i]+", ");
System.out.print(map[i]+", ");
if ((i%10)==0){
System.out.println();
out1.println();
}
}
ri.close();
out1.println("},");
} out1.close(); }
catch (Exception ex) {
System.out.println(ex);
}
public class Color_lcl implements Serializable { private int iconNam = 15; public Icon[] img = new ImageIcon[iconNam]; //Serializable接口中声明的方法
private void writeObject(java.io.ObjectOutputStream out)
throws IOException {
out.defaultWriteObject();
} //Serializable接口中声明的方法
private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException {
in.defaultReadObject();
} public Color_lcl() {
for (int i = 0; i < iconNam; i++){
Image imgTmp=Toolkit.getDefaultToolkit().createImage(bImg[i]);
img[i] = new ImageIcon(imgTmp);
}
} private byte[][] bImg ={
{
71,
73, 70, 56, 57, 97, 32, 0, 32, 0, -111,
2, 0, 50, 50, 50, -1, -1, -1, -1, -1,
-1, 0, 0, 0, 33, -7, 4, 1, 0, 0,
2, 0, 44, 0, 0, 0, 0, 32, 0, 32,
0, 64, 2, 106, -116, -113, -87, -101, -30, 15,
13, -128, -76, 58, 99, 31, 2, -68, -49, -116,
101, 89, 39, 10, 97, -119, 90, -89, -102, 124,
-24, 90, -71, -90, -12, 6, -23, 77, -63, 120,
93, -54, -69, 30, 57, -8, 74, 64, -51, 98,
-104, -77, -119, 104, -62, 84, 17, 68, 91, 42,
119, -73, 39, 53, 121, -83, 78, -77, 82, 46,
111, -119, -4, 66, 3, 97, 40, 113, -125, -77,
30, -99, -37, 10, -125, 124, 62, -109, -93, 98,
-43, -89, 89, -81, -63, -29, 63, 58, -53, -53,
7, -8, 39, -56, -14, 102, 120, 24, 80, 0,
0, 59, },//////////////////////////////////////////////////////////////////////////////0
{
71,
73, 70, 56, 57, 97, 32, 0, 32, 0, -111,
2, 0, 0, 0, 0, -1, -1, -1, -1, -1,
-1, 0, 0, 0, 33, -7, 4, 1, 0, 0,
2, 0, 44, 0, 0, 0, 0, 32, 0, 32,
0, 64, 2, 101, -116, -113, -87, -101, -30, 15,
-93, -100, -50, 72, -122, -63, 13, -76, -5, 103,
125, -30, -74, 97, -118, 22, -123, -112, -71, -96,
43, 55, -58, 21, 44, -113, 106, -3, -35, 51,
-117, -72, 32, -3, -29, 29, 124, -77, -110, 48,
64, 20, -24, 28, -128, -90, -13, 9, 109, -110,
112, -94, 37, 117, 122, -19, 88, -77, 63, -82,
22, -24, 125, 25, -123, -109, -27, 113, -120, 13,
30, -109, -26, 51, 50, -67, 91, -61, -107, 110,
54, -104, 126, -74, -121, -53, -9, -3, -42, -5,
-57, -27, 54, 88, 0, 0, 59, },/////////////////////////////////////////////////////////////1