📄 driver.java
字号:
package com.softfz.jn0708.config;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import javax.swing.Box;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
import com.softfz.jn0708.util.Tools;
/**
* 数据库驱动 面板
*/
public class Driver extends JPanel{
private static final long serialVersionUID = 1L;
private JPanel topPanel=new JPanel();
private JPanel centerPanel=new JPanel();
private JPanel bottomPanel=new JPanel();
private JTextField driverText=new JTextField("oracle.jdbc.driver.OracleDriver");
private JTextField urlText=new JTextField("jdbc:oracle:thin:@127.0.0.1:1521:name");
private JTextField userNameText=new JTextField("qq");
private JPasswordField userPwdText=new JPasswordField("qq");
ConfigPanel configpanel;
/**
* 构造
* @param configpanel 配置面板
*/
public Driver(ConfigPanel configpanel){
this.configpanel=configpanel;
topPanel.add(new JLabel("库驱动类:"));
driverText.setText((String) Tools.properties.getProperty("Driver"));
driverText.setPreferredSize(new Dimension(450,25));
topPanel.add(driverText);
centerPanel.add(new JLabel("库连接串:"));
urlText.setText((String) Tools.properties.getProperty("URL"));
urlText.setPreferredSize(new Dimension(450,25));
centerPanel.add(urlText);
bottomPanel.add(new JLabel("库用户名:"));
userNameText.setText((String) Tools.properties.getProperty("UName"));
userNameText.setPreferredSize(new Dimension(167,25));
bottomPanel.add(userNameText);
bottomPanel.add(Box.createHorizontalStrut(52));
bottomPanel.add(new JLabel("库密码:"));
userPwdText.setPreferredSize(new Dimension(167,25));
userPwdText.setText((String) Tools.properties.getProperty("UPwd"));
bottomPanel.add(userPwdText);
this.setBorder(new TitledBorder("数据库相关设置"));
this.setLayout(new GridLayout(3,1));
this.add(topPanel);
this.add(centerPanel);
this.add(bottomPanel);
topPanel.setBackground(new Color(241,250,255));
centerPanel.setBackground(new Color(241,250,255));
bottomPanel.setBackground(new Color(241,250,255));
this.setPreferredSize(new Dimension(570,200));
this.setBackground(new Color(241,250,255));
}
/**
* 获取数据库驱动文本域
* @return
*/
public JTextField getDriverText() {
return driverText;
}
/**
* 获取数据库url文本域
* @return
*/
public JTextField getUrlText() {
return urlText;
}
/**
* 获取数据库用户名文本域
* @return
*/
public JTextField getUserNameText() {
return userNameText;
}
/**
* 获取数据库用户密码文本域
* @return
*/
public JPasswordField getUserPwdText() {
return userPwdText;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -