如题。。
解决方案 »
- jsp的${obj.id}写法失效?
- SSH整合看看错误指点一下哪些包不支持
- 关于javabean的疑问
- 请问如何在JSP中使用SQL的统计函数
- 无奈!!超级大难题
- 那位兄弟有<<How Tomcat Works>>这本书呀,或者知道那里可以下载呀
- 数据库问题???
- JBOSS下载有两个压缩包,一个有TOMCAT,另一个没有,应该安装哪一个呢?
- 请教Tomcat4.0中有时修改后的JSP文件不能显示出修改内容?同行请近。
- jsp页面的美化,如何实现??急急急。功能自己可以搞定
- 问个问题,有关tomcat conf 文件夹下面的context.xml文件
- 关于 Microsoft SQL Server JDBC Driver 2.0的配置问题
String url="jdbc:odbc:db1";
Class.forName(driverName).newInstance();
Connection conn=DriverManager.getConnection(url,"","");
....
conn.close();
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;public class SystemOS extends JFrame implements ActionListener {
JPanel pnlMain;
JTextField txtfile;
JButton btnSelect;
JFileChooser fc = new JFileChooser();
JCheckBox cb = null;
String filepath = ""; public SystemOS() {
pnlMain = new JPanel();
this.getContentPane().add(pnlMain);
txtfile = new JTextField(12);
btnSelect = new JButton("选择保存文件路径");
this.setSize(300, 400);
int i = 0;
for (; i < 4; i++) {
JCheckBox cb= new JCheckBox();
cb.setText("132");
} btnSelect.addActionListener(this);
pnlMain.add(cb, "Center");
pnlMain.add(txtfile, "Center");
pnlMain.add(btnSelect, "Center"); this.setResizable(false);
this.setVisible(true);
pnlMain.setLayout(new BorderLayout());
} public void actionPerformed(ActionEvent e) {
if (e.getSource() == btnSelect) {
/*
* 这是尤为重要的。因为JFileChooser默认的是选择文件,而需要选目录。 故要将DIRECTORIES_ONLY装入模型
* 另外,若选择文件,则无需此句
*/
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int intRetVal = fc.showOpenDialog(this);
if (intRetVal == JFileChooser.APPROVE_OPTION) {
txtfile.setText(fc.getSelectedFile().getPath());
filepath = txtfile.getText();
}
}
} public static void main(String[] args) {
JFrame f = new SystemOS(); }
}