📄 logtable.java
字号:
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import javax.swing.event.*;
import javax.swing.border.LineBorder;
import java.sql.*;
public class LogTable extends JPanel
{
Component f;
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
JPanel logSystempane = new JPanel();
JPanel logClientpane = new JPanel();
JPanel logAccountpane = new JPanel();
JDBCAdapter adoSrvlog1 = new JDBCAdapter("srvlog");
JDBCAdapter adoSrvlog2 = new JDBCAdapter("srvlog");
JDBCAdapter adoAccounts= new JDBCAdapter("accounts");
JTable tableSystem = new JTable(adoSrvlog2);
JTable tableClient = new JTable(adoSrvlog1);
JTable tableAccount= new JTable(adoAccounts);
private JButton btQuery = new JButton("日志查询");
private JButton btDelete = new JButton("删除记录");
private JButton btFlash = new JButton("刷新表格");
private JButton btExit = new JButton(" 关 闭 ");
private ActionListener listener=new ActionResponse();
Font buttonfont=new Font("Serif",Font.BOLD,15);
public void Select(int type)
{
tabbedPane.setSelectedIndex(type);
}
public LogTable(Component ComponentF)
{
f=ComponentF;
try{
tabbedPane.setBounds(0,0,780,400);
tabbedPane.addTab("客户日志",null,logClientpane,"Client Log");
tabbedPane.addTab("系统日志",null,logSystempane,"System Log");
tabbedPane.addTab("ATM卡信息",null,logAccountpane,"Atm Card Information");
btQuery.setBounds(100,410,100,40);
btDelete.setBounds(250,410,100,40);
btFlash.setBounds(400,410,100,40);
btExit.setBounds(550,410,100,40);
btQuery.setFont(buttonfont);
btDelete.setFont(buttonfont);
btFlash.setFont(buttonfont);
btExit.setFont(buttonfont);
this.add(btQuery);
this.add(btDelete);
this.add(btFlash);
this.add(btExit);
this.add(tabbedPane);
btFlash.addActionListener(listener);
//ClientLog
adoSrvlog1.executeQuery("select * from CliEvent");
logClientpane.setLayout(null);
JScrollPane tbScrollclient = new JScrollPane(tableClient);
tbScrollclient.setBounds(0,0,775,400);
//tbScrollclient.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
logClientpane.add(tbScrollclient);
adoSrvlog1.close();
//SystemLog
adoSrvlog2.executeQuery("select * from SysEvent");
logSystempane.setLayout(null);
JScrollPane tbScrollsystem=new JScrollPane(tableSystem);
//tbScrollsystem.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
tbScrollsystem.setBounds(0,0,775,360);
logSystempane.add(tbScrollsystem);
adoSrvlog2.close();
//Accounts
adoAccounts.executeQuery("select CardID,Name,Sum,Licence,CreateDate,OutDate,LostFlag,State from Accounts");
logAccountpane.setLayout(null);
JScrollPane tbScrollaccount=new JScrollPane(tableAccount);
//tbScrollaccount.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
tbScrollaccount.setBounds(0,0,775,360);
logAccountpane.add(tbScrollaccount);
adoAccounts.close();
}
catch(SQLException e)
{}
}
class ActionResponse implements ActionListener
{
public void actionPerformed (ActionEvent e)
{ adoAccounts.Refresh("select CardID,Name,Sum,Licence,CreateDate,OutDate,LostFlag,State from Accounts");
}
}
//Form1.add(tabbedPane);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -