⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serverfeaturebar.java

📁 Java的面向对象数据库系统的源代码
💻 JAVA
字号:
package org.ozoneDB.adminGui.feature.server;import org.ozoneDB.adminGui.main.AdminGui;import org.ozoneDB.adminGui.feature.ActionBar;import org.ozoneDB.adminGui.feature.InfoPanel;import org.ozoneDB.adminGui.res.Images;import javax.swing.*;import java.awt.*;import java.awt.event.ActionListener;import java.awt.event.ActionEvent;/** * $Id: ServerFeatureBar.java,v 1.2 2003/03/24 08:36:55 per_nyfelt Exp $ */public class ServerFeatureBar extends ActionBar {    private InfoPanel serverInfoPanel;    public ServerFeatureBar(ServerInfoPanel userInfoPanel) {        this.serverInfoPanel = userInfoPanel;        addComponents();    }    protected void addComponents() {        this.removeAll();        //gbc.gridx = GridBagConstraints.REMAINDER;        gbc.insets = new Insets(1, 5, 1, 5);        gbc.fill = GridBagConstraints.HORIZONTAL;        gbc.gridy = 0;        // Add label        //gbc.anchor = GridBagConstraints.SOUTHWEST;        //gbc.weighty = .3;        add(new ActionButton("shutdown", Images.SERVER_SHUTDOWN, new ShutdownListener()), gbc);        gbc.gridy++;        add(new ActionButton("transactions", Images.SERVER_TRANSACTIONS, new TransactionLister()), gbc);        gbc.gridy++;        add(new ActionButton("garbage collector", Images.SERVER_GARBAGE_COLLECTOR, new GarbageCollectorListener(), "start Ozone garbage collector"), gbc);    }    private class ShutdownListener implements ActionListener {        public void actionPerformed(ActionEvent event) {            System.out.println("shuttting down server");            try {                AdminGui.instance().getDb().admin().shutdown();                AdminGui.instance().showDisconnected();            } catch (Exception e) {                serverInfoPanel.setDisplay(new JTextArea("Unable to shut down: " + e.getMessage()));            }        }    }    private class TransactionLister implements ActionListener {        public void actionPerformed(ActionEvent event) {            System.out.println("list all transactions");            int transactionCount = 0;            try {                transactionCount = AdminGui.instance().getDb().admin().numberOfTxs();            } catch (Exception e) {                System.out.println("Unable to retrieve transaction count: " + e.getMessage());            }            JTextArea display = new JTextArea();            display.append("Number of transactions: " + transactionCount);            serverInfoPanel.setDisplay(display);        }    }    private class GarbageCollectorListener implements ActionListener {        public void actionPerformed(ActionEvent event) {            System.out.println("Strating garbage collection");            try {                AdminGui.instance().getDb().admin().startGarbageCollection();            } catch (Exception e) {                e.printStackTrace();            }        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -