📄 infodialog.java
字号:
package JavaDatabaseBible.part2;
import java.awt.*;
import java.util.Hashtable;
import java.util.Vector;
import javax.swing.*;
import javax.swing.JTree;
import javax.swing.border.*;
import javax.swing.tree.*;
public class InfoDialog extends JDialog{
protected DatabaseUtilities dbUtils = null;
protected JPanel dbInfoPanel = new JPanel();
protected JPanel featuresPanel = new JPanel();
protected JPanel transactionsPanel = new JPanel();
protected JPanel topPanel = new JPanel(new BorderLayout());
protected JPanel centerPanel = new JPanel(new BorderLayout());
protected JPanel bottomPanel = new JPanel(new BorderLayout());
public InfoDialog(DatabaseUtilities dbUtils){
this.dbUtils=dbUtils;
setTitle("Database Info");
getContentPane().setLayout(new BorderLayout());
String[] dbInfo = dbUtils.databaseInfo();
dbInfoPanel.setLayout(new GridLayout(dbInfo.length,1,2,2));
for(int i=0;i<dbInfo.length;i++){
dbInfoPanel.add(new JLabel(dbInfo[i]));
}
dbInfoPanel.setBorder(new CompoundBorder(new BevelBorder(BevelBorder.LOWERED),new EmptyBorder(2,2,2,2)));
topPanel.add(new JLabel(" Database and Driver:"),BorderLayout.NORTH);
topPanel.add(dbInfoPanel,BorderLayout.CENTER);
getContentPane().add(topPanel,BorderLayout.NORTH);
String[] features = dbUtils.featuresSupported();
featuresPanel.setLayout(new GridLayout(features.length,1,2,2));
for(int i=0;i<features.length;i++){
featuresPanel.add(new JLabel(features[i]));
}
featuresPanel.setBorder(new CompoundBorder(new BevelBorder(BevelBorder.LOWERED),new EmptyBorder(2,2,2,2)));
centerPanel.add(new JLabel(" Supported Features:"),BorderLayout.NORTH);
centerPanel.add(featuresPanel,BorderLayout.CENTER);
getContentPane().add(centerPanel,BorderLayout.CENTER);
String[] t = dbUtils.isolationLevelsSupported();
transactionsPanel.setLayout(new GridLayout(t.length,1,2,2));
for(int i=0;i<t.length;i++){
transactionsPanel.add(new JLabel(t[i]));
}
transactionsPanel.setBorder(new CompoundBorder(new BevelBorder(BevelBorder.LOWERED),new EmptyBorder(2,2,2,2)));
bottomPanel.add(new JLabel(" Supported Transactions:"),BorderLayout.NORTH);
bottomPanel.add(transactionsPanel,BorderLayout.CENTER);
getContentPane().add(bottomPanel,BorderLayout.SOUTH);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -