易截截图软件、单文件、免安装、纯绿色、仅160KB

JAVA目录选择框的解决办法

FileDialog只能选择文件而不能选择文件夹。JFileChooser又太大,不太好看,鼓捣了好一会终于解决了。
记录一下关键部分代码,以备查用。
final JButton choose=new JButton("选择存储文件目录");
final JTextField dir=new JTextField();

final JFileChooser chooser=new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);


choose.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
int returnValue=chooser.showOpenDialog(SearchFrame.this);
if (returnValue==JFileChooser.APPROVE_OPTION) {
File file=chooser.getSelectedFile();
dir.setText(file.getAbsolutePath());
path=file.getAbsolutePath();
}else {
JOptionPane.showMessageDialog(null, "请手动输入目录");
return;
}

}


相关文档:

Java NIO API详解

 
Java NIO API详解
在JDK
1.4以前,Java的IO操作集中在java.io这个包中,是基于流的阻塞(blocking)API。对于大多数应用来说,这样的API使用很方
便,然而,一些对性能要求较高的应用,尤其是服务端应用,往往需要一个更为有效的方式来处理IO。从JDK 1.4起,NIO
API作为一个基于缓冲区,并能提供非阻塞(non-blo ......

java使用rocksaw和vserv tcpip实现基于ICMP的Ping功能

一:准备 www.savarese.org download
 1.  rocksaw-1.0.0-src.tar.gz
 2.  vserv-tcpip-0.9.2-src.tar.gz
二:编译源文件得到jar包 使用Ant
 1.  build vserv-tcpip-0.9.2-src
      在vserv-tcpip-0.9.2目录下面建一个tests目录,然后在cmd窗口下进入 ......

Java读写cookie

转自:http://www.blogjava.net/action/archive/2007/04/10/109574.html
         http://www.javaeye.com/topic/232662
1.设置Cookie
1Cookie cookie = new Cookie("key", "value");
2cookie.setMaxAge(60); //设置60秒生存期,如果设置为负值 ......

20个非常有用的Java程序片段

1. 字符串有整型的相互转换
  Java代码
  String a = String.valueOf(2);   //integer to numeric string
  int i = Integer.parseInt(a); //numeric string to an int
  2. 向文件末尾添加内容
  Java代码
  BufferedWriter out = null;
  try {
  out = new BufferedWriter(new FileWr ......

IBM Java 面试题

1.what is oracle.
2.what is major differenece oracle8i and oracle9i.
4.tell me some thing ur self.
5.please tell me about oops.
6.what is single inheritance.
7.what is multiple inheritance.
8.can java support multiple inheritance.
9.what is interface.
10.what is differenec between abstract c ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号