jcombobox的问题 我有个文件a.txt内容为:(格式是 拼音+汉字)hz-汉族hz-回族zz-藏族......现在用jcombobox来读取文本文件a.txt怎么实现,请给出代码,谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 BufferedReader in = null;List<String> list;try{ in = new BufferedReader(new FileReader("C:\\a.txt")); String strLine = ""; list = new ArrayList<String>(); while ((strLine = in.readLine()) != null) { list.add(strLine); }} catch (FileNotFoundException ffe){ ffe.printStackTrace();} catch (IOException ioe){ ioe.printStackTrace();} finally{ if (in != null) { try { in.close(); } catch (IOException e1) { e1.printStackTrace(); } }}if(list != null) combobox = new JComboBox(list.toArray()); java如何调用服务器的shell脚本,并判断是否执行成功 JDK是否可以和Visual Studio共存? struts2出现java.lang.OutOfMemoryError: PermGen space! 求助 doc 等 office 文档如何转换为swf 求解析CSV的正则表达式 java中swing得一些方法 请教关于ClassLoader的getResource方法的使用 关于applet 请问,在jdk1-2-2中,import所需的东西在什么地方,我怎么找不到阿 哪位高手用几句话说说接口是什么?小弟感激不尽! 如何通过socket实现双方通信 有个问题,大家拿分
List<String> list;
try
{
in = new BufferedReader(new FileReader("C:\\a.txt"));
String strLine = "";
list = new ArrayList<String>();
while ((strLine = in.readLine()) != null)
{
list.add(strLine);
}
} catch (FileNotFoundException ffe)
{
ffe.printStackTrace();
} catch (IOException ioe)
{
ioe.printStackTrace();
} finally
{
if (in != null)
{
try
{
in.close();
} catch (IOException e1)
{
e1.printStackTrace();
}
}
}if(list != null)
combobox = new JComboBox(list.toArray());