- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我写了一个扑克模拟器/赔率计算器。在 GUI 上,有一些 JComboBox
es,用户可以从中选择卡片。
现在,我有了这些卡片的图像,而且我还有 Base64 格式的图像。我尝试了 3 种不同的方式来展示它们。为了演示目的,我为每一个都写了一个小程序。
以下是我尝试过的3种方法:
1).将图像存储在 JAR 文件中:
非常简单。图像进入 JAR,Java 代码从那里读取它们。之后,它创建一个包含所有这些的 JComboBox
并显示它:
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.ImageIcon;
public class ImagesFromJAR
{
private JFrame mainframe;
public ImagesFromJAR ()
{
ImageIcon[] cardslist = new ImageIcon[52];
for (int i = 0; i < 52; ++i)
{
cardslist[i] = new ImageIcon (getClass (). getResource ((this.getImagePath (i))));
}
JComboBox cardsbox = new JComboBox (cardslist);
cardsbox.setSelectedIndex (0);
cardsbox.setEditable (false);
this.mainframe = new JFrame ();
this.mainframe.setDefaultCloseOperation (JFrame.DISPOSE_ON_CLOSE);
this.mainframe.setSize (150, 150);
this.mainframe.setLayout (null);
cardsbox.setBounds (20, 20, 55, 45);
this.mainframe.add (cardsbox);
this.mainframe.setVisible (true);
}
private String getImagePath (int index)
{
switch (index)
{
case 0: return "images/2c.gif";
case 1: return "images/3c.gif";
case 2: return "images/4c.gif";
case 3: return "images/5c.gif";
case 4: return "images/6c.gif";
case 5: return "images/7c.gif";
case 6: return "images/8c.gif";
case 7: return "images/9c.gif";
case 8: return "images/Tc.gif";
case 9: return "images/Jc.gif";
case 10: return "images/Qc.gif";
case 11: return "images/Kc.gif";
case 12: return "images/Ac.gif";
case 13: return "images/2d.gif";
case 14: return "images/3d.gif";
case 15: return "images/4d.gif";
......................................
default: return null;
}
}
public static void main (String[] args)
{
javax.swing.SwingUtilities.invokeLater (new Runnable ()
{
public void run ()
{
ImagesFromJAR t = new ImagesFromJAR ();
}
});
}
}
2).将图像以 Base64 格式存储在文本文件中:
我将每个图像转换为 Base64 格式,然后存储在一个文本文件中。 Java 代码读取该文件并通过解码文件中的行重新创建图像。之后,创建并显示一个JComboBox
:
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.ImageIcon;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.FileInputStream;
import java.io.IOException;
public class CodeFromFile
{
private JFrame mainframe;
public CodeFromFile ()
{
ImageIcon[] cardslist = new ImageIcon[52];
InputStreamReader in = null;
BufferedReader buff;
int index = -1;
try
{
in = new InputStreamReader (new FileInputStream ("card.encodings.txt"));
buff = new BufferedReader (in);
String line;
byte[] ba;
while ((line = buff.readLine ()) != null)
{
if (line.length () < 10)
{
continue;
}
index++;
ba = Base64.decode (line);
cardslist[index] = new ImageIcon (ba);
}
}
catch (IOException e)
{
e.printStackTrace ();
}
finally
{
if (in != null)
{
try
{
in.close ();
}
catch (IOException e2) {}
}
}
JComboBox cardsbox = new JComboBox (cardslist);
cardsbox.setSelectedIndex (0);
cardsbox.setEditable (false);
this.mainframe = new JFrame ();
this.mainframe.setDefaultCloseOperation (JFrame.DISPOSE_ON_CLOSE);
this.mainframe.setSize (150, 150);
this.mainframe.setLayout (null);
cardsbox.setBounds (20, 20, 55, 45);
this.mainframe.add (cardsbox);
this.mainframe.setVisible (true);
}
public static void main (String[] args)
{
javax.swing.SwingUtilities.invokeLater (new Runnable ()
{
public void run ()
{
CodeFromFile t = new CodeFromFile ();
}
});
}
}
card.encodings.txt
的内容是这样的:
2c:
R0lGODlhHgAmAMQAAAAAAP///+7u7t3d3czMzLu7u6qqqpmZmYiIiHd3d2ZmZlVVVURERDMzMyIiIhEREf///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABAALAAAAAAeACYAAAXKIAQBZGme6CmOQeu+cAwDrGzfLonvss7/LR/u8AA0CDu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AAAAAAP///+7u7szMzLu7u6qqqpmZmYiIiHd3d2ZmZlVVVURERDMzMyIiIhEREf///yH5BAEAAA8ALAAAAAAeACYAAATA8D1Aq734yhm6/2AIApxonh6FrqLKvp2LGg7ADKtsGpYjoDrR4nIAAlY1i8K4ahCZogSgobhUHYbWMYTIYAqhYCfprSTCWxC5MrycR+nP4YIwtCsEtGk+NQgWAXwMYHosVUU5cSIIdwqIJmIeXV6EhTAskZeWmieZnCmKJgwVS52hIQQWWaaGj4krAwAOCD+vKFIUDpWQpyEHQz5QL12umywMpbyaCAjCLzfOizgBjrYnbQu7yp+dJdwjG2XiGRIRADs=
.. 并且它适用于每张图片/卡片。
3).第三种方法是直接在源代码中将图像存储为 Base64 String
。像这样:
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.ImageIcon;
public class CodeFromSource
{
private JFrame mainframe;
public CodeFromSource ()
{
ImageIcon[] cardslist = new ImageIcon[52];
byte[] ba;
for (int i = 0; i < 52; ++i)
{
ba = Base64.decode (this.getImageCode (i));
cardslist[i] = new ImageIcon (ba);
}
JComboBox cardsbox = new JComboBox (cardslist);
cardsbox.setSelectedIndex (0);
cardsbox.setEditable (false);
this.mainframe = new JFrame ();
this.mainframe.setDefaultCloseOperation (JFrame.DISPOSE_ON_CLOSE);
this.mainframe.setSize (150, 150);
this.mainframe.setLayout (null);
cardsbox.setBounds (20, 20, 55, 45);
this.mainframe.add (cardsbox);
this.mainframe.setVisible (true);
}
private String getImageCode (int index)
{
switch (index)
{
case 0: return "R0lGODlhHgAmAMQAAAAAAP///+7u7t3d3czMzLu7u6qqqpmZmYiIiHd3d2ZmZlVVVURERDMzMyIiIhEREf///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABAALAAAAAAeACYAAAXKIAQBZGme6CmOQeu+cAwDrGzfLonvss7/LR/u8AA0CDuh7WB6CHBKGeOEgAJ2RdPCunNQuTIF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ieZnCmKJgMAeYkvVW9QKAIODD6mKwcIc4+QoSENA6wMsCcFgAFVOJ23H4MdBQAIqiKjFw3MIQm1XZWbIKw/HqNLticL3cYAtR+ZSQ4fZLzXnyMl7e4SZfMZEhEAOw==";
case 13: return "R0lGODlhHgAmAMQAAAAAAP////8AAP8REf8iIv8zM/9ERP9VVf9mZv93d/+IiP+Zmf+qqv+7u//MzP/d3f/u7v///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABEALAAAAAAeACYAAAW/YBQBZGme6CmOQeu+cAwDrGzfLonvss4HiJ9vtxAkeMMbhCAQNHZJm6EpIEBw0ZiC2gzesq8Gl7r4ApTMcfPZO9sOairBBm4t40662yZWK8w7W1wGWHs3U01WhTx3eYs8DAJejzwJV1CGP5iamnWcM5kxD4gGDps4BQwBDgQDl3o4C6YtkX+AmhACtrCaD468PwqElDtLD6c8BmzENwllSKExCbsJx8A2CWNzt9hqk22f0OFQNeMxNCIp6uskIiEAOw==";
.........
default: return null;
}
}
public static void main (String[] args)
{
javax.swing.SwingUtilities.invokeLater (new Runnable ()
{
public void run ()
{
CodeFromSource t = new CodeFromSource ();
}
});
}
}
(我不得不删除一些 switch case,因为 StackOverflow 有 30 K 个字符的限制)
这些方法中的每一个都会产生相同的结果,即:
PS:Base64 类只是一些实用类,用于编码/解码 Base64 信息(您可以在下面的链接中找到它)。
如果您想要这方面的所有资源(图像、源代码等),您可以从这里获取它们:Resources
既然我们已经搞清楚了……我想知道这 3 种方法中哪种更好。他们每个人的优点和缺点是什么?我应该使用哪一个?为什么 ?我也在谈论 JAR 文件损坏的可能性。
我唯一不关心的是性能。
最佳答案
更可取,因为不涉及转换,您的代码可以从类路径中读取它们。这使您的应用程序自包含。损坏不是问题,因为这会使整个应用程序无用 - 不仅是图像文件
将涉及转换的运行时惩罚(启动时间和内存),并且还会引入配置文件。
和 2 一样糟糕,但也不太灵活(如果不重新编译就不能更改图像)
关于Java 选择 : Store images in JAR or as Base64 sequence?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9359803/
是否有某种方法可以使用 JPA 或 Hibernate Crtiteria API 来表示这种 SQL?或者我应该将其作为 native 执行吗? SELECT A.X FROM (SELECT X,
在查询中, select id,name,feature,marks from (....) 我想删除其 id 在另一个 select 语句中存在的那些。 从 (...) 中选择 id 我是 sql
我想响应用户在 select 元素中选择一个项目。然而这个 jQuery: $('#platypusDropDown').select(function () { alert('You sel
这个问题在这里已经有了答案: SQL select only rows with max value on a column [duplicate] (27 个回答) 关闭8年前。 我正在学习 SQL
This question already has answers here: “Notice: Undefined variable”, “Notice: Undefined index”, and
我在 php 脚本中调用 SQL。有时“DE”中没有值,如果是这种情况我想从“EN”中获取值 应该是这样的,但不是这样的 IF (EXISTS (SELECT epf_application_deta
这可能是一个奇怪的问题,但不知道如何研究它。执行以下查询时: SELECT Foo.col1, Foo.col2, Foo.col3 FROM Foo INNER JOIN Bar ON
如何在使用 Camera.DestinationType.FILE_URI. 时在 phonegap camera API 中同时选择或拾取多个图像我能够一次只选择一张图像。我可以使用 this 在
这是一个纯粹的学术问题。这两个陈述实际上是否相同? IF EXISTS (SELECT TOP 1 1 FROM Table1) SELECT 1 ELSE SELECT 0 相对 IF EXIS
我使用 JSoup 来解析 HTML 响应。我有多个 Div 标签。我必须根据 ID 选择 Div 标签。 我的伪代码是这样的 Document divTag = Jsoup.connect(link
我正在处理一个具有多个选择框的表单。当用户从 selectbox1 中选择一个选项时,我需要 selectbox2 active 的另一个值。同样,当他选择 selectbox2 的另一个值时,我需要
Acme Inc. Christa Woods Charlotte Freeman Jeffrey Walton Ella Hubbard Se
我有一个login.html其中form定义如下: First Initial Plus Last Name : 我的do_authorize如下: "; pri
$.get( 'http://www.ufilme.ro/api/load/maron_online/470', function(data
我有一个下拉列表“磅”、“克”、“千克”和“盎司”。我想要这样一种情况,当我选择 gram 来执行一个函数时,当我在输入字段中输入一个值时,当我选择 pounds 时,我想要另一个函数来执行时我在输入
我有一个 GLSL 着色器,它从输入纹理的 channel 之一(例如 R)读取,然后写入输出纹理中的同一 channel 。该 channel 必须由用户选择。 我现在能想到的就是使用一个 int
我想根据下拉列表中的选定值生成输入文本框。 Options 2 3 4 5 就在这个选择框之后,一些输入字段应该按照选定的数字出现。 最佳答案 我建议您使用响应式(Reac
我是 SQL 新手,我想问一下如何根据首选项和分组选择条目。 +----------+----------+------+ | ENTRY_ID | ROUTE_ID | TYPE | +------
我有以下表结构: CREATE TABLE [dbo].[UTS_USERCLIENT_MAPPING_USER_LIST] ( [MAPPING_ID] [int] IDENTITY(1,1
我在移除不必要的床单时遇到了问题。我查看了不同的论坛并将不同的解决方案混合在一起。 此宏删除工作表(第一张工作表除外)。 Sub wrong() Dim sht As Object Applicati
我是一名优秀的程序员,十分优秀!