📄 jinput.java
字号:
package net.aetherial.gis.our.auto.count.frame;
import javax.swing.*;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import net.aetherial.gis.surface.ItemValue;
import java.io.File;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2004</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class JInput extends JPanel{
public JInput() {
try {
jbInit();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
public static void main(String[] args) {
JInput jinput = new JInput();
}
private void jbInit() throws Exception {
jLabel1.setText("输入路径:");
this.setLayout(xYLayout1);
xYLayout1.setHeight(41);
jTextField1.setText(" ");
jButtonSelete.setToolTipText("选择输入路径");
jButtonSelete.setText("选择");
jButtonSelete.addActionListener(new JInput_jButtonSelete_actionAdapter(this));
this.add(jLabel1, new XYConstraints(6, 5, -1, 24));
this.add(jTextField1, new XYConstraints(66, 6, 237, -1));
this.add(jButtonSelete, new XYConstraints(311, 5, -1, -1));
}
JLabel jLabel1 = new JLabel();
XYLayout xYLayout1 = new XYLayout();
JTextField jTextField1 = new JTextField();
JButton jButtonSelete = new JButton();
public void jButtonSelete_actionPerformed(ActionEvent e) {
this.selectPath(this.jTextField1);
}
/**
* 设置输入目录
*/
public String getInput(){
String input = jTextField1.getText().trim();
if (input.equals("")) {
return "";
}else{
if ((input.endsWith("\\"))||(input.endsWith("/"))) {
return input;
}else{
return input +"\\";
}
}
}
private void selectPath(JTextField jText) {
JFileChooser fileDialog = new JFileChooser();
fileDialog.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
if (! (ItemValue.fileChoosePath.equals(""))) {
fileDialog.setCurrentDirectory(new File(ItemValue.fileChoosePath));
}
int result = fileDialog.showOpenDialog(this);
if (result == JFileChooser.APPROVE_OPTION) {
File f = fileDialog.getSelectedFile();
jText.setText(f.getAbsolutePath());
}
}
}
class JInput_jButtonSelete_actionAdapter
implements ActionListener {
private JInput adaptee;
JInput_jButtonSelete_actionAdapter(JInput adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButtonSelete_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -