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

📄 actionbar.java

📁 Java的面向对象数据库系统的源代码
💻 JAVA
字号:
package org.ozoneDB.adminGui.feature;import org.ozoneDB.adminGui.res.Settings;import javax.swing.*;import java.awt.event.MouseListener;import java.awt.event.ActionListener;import java.awt.event.MouseEvent;import java.awt.*;/** * This is the action panel holding all subFeatures assiciated with a feature * $Id: ActionBar.java,v 1.1 2003/11/09 15:53:09 per_nyfelt Exp $ */public abstract class ActionBar extends JPanel {    public static final int WIDTH = 90;    protected static final Dimension DIMENSION = new Dimension(WIDTH, Settings.FEATURE_HEIGHT);    protected GridBagConstraints gbc = new GridBagConstraints();    public ActionBar() {        this.setPreferredSize(DIMENSION);        this.setLayout(new GridBagLayout());    }    protected class ActionButton extends JButton implements MouseListener {        JLabel icon;        JLabel label;        private final Dimension ICON_SIZE = new Dimension(40, 40);        public ActionButton(String text, String image, ActionListener listener) {            this.setLayout(new GridLayout(2, 1));            //this.setBackground(Color.white);            this.setToolTipText(text);            this.setBorder(BorderFactory.createEtchedBorder(Settings.COLOR_COBALT, Color.LIGHT_GRAY));            this.setBorderPainted(false);            this.setFocusPainted(false);            this.addActionListener(listener);            this.setMargin(new Insets(4, 2, 3, 2));            this.addMouseListener(this);            this.setVerticalAlignment(SwingConstants.CENTER);            this.setHorizontalAlignment(SwingConstants.CENTER);            icon = new JLabel(new ImageIcon(this.getClass().getResource(image)));            icon.setPreferredSize(ICON_SIZE);            label = new JLabel(text);            label.setVerticalTextPosition(SwingConstants.TOP);            label.setHorizontalAlignment(SwingConstants.CENTER);            this.add(icon);            this.add(label);        }        public ActionButton(String text, String image, ActionListener listener, String toolTip) {            this(text, image, listener);            this.setToolTipText(toolTip);        }        public void mouseEntered(MouseEvent me) {            this.setBorderPainted(true);        }        public void mouseExited(MouseEvent me) {            this.setBorderPainted(false);        }        public void mouseClicked(MouseEvent e) {        }        public void mousePressed(MouseEvent e) {        }        public void mouseReleased(MouseEvent e) {        }    }}

⌨️ 快捷键说明

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