📄 featurebutton.java
字号:
// You can redistribute this software and/or modify it under the terms of// the Ozone Library License version 1 published by ozone-db.org.//// The original code and portions created by SMB are// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.//// $Id: FeatureButton.java,v 1.2 2003/03/24 08:36:55 per_nyfelt Exp $package org.ozoneDB.adminGui.feature;import org.ozoneDB.adminGui.res.Settings;import org.ozoneDB.adminGui.main.AdminGui;import javax.swing.*;import java.awt.event.MouseListener;import java.awt.event.ActionListener;import java.awt.event.ActionEvent;import java.awt.event.MouseEvent;import java.awt.*;/** * @author Per Nyfelt */public class FeatureButton extends JButton implements MouseListener, ActionListener { private static final Dimension BUTTON_SIZE = new Dimension(65, 70); private Feature feature; private Component strut; private String name; public FeatureButton(Feature feature, Component strut) { super(); this.feature = feature; this.strut = strut; this.name = feature.getName(); this.setText(name); this.setIcon(feature.getImage()); this.addActionListener(this); setButtonColors(); setButtonSize(); setButtonAlignment(); this.setBorderPainted(false); this.setFocusPainted(false); this.addMouseListener(this); this.setBorder(BorderFactory.createEtchedBorder(Settings.COLOR_COBALT, Color.LIGHT_GRAY)); } public void setVisible(boolean visible) { super.setVisible(visible); this.strut.setVisible(visible); } public String getName() { return this.name; } private void setButtonColors() { this.setForeground(Color.BLACK); this.setBackground(Color.WHITE); } private void setButtonSize() { this.setPreferredSize(BUTTON_SIZE); this.setMaximumSize(BUTTON_SIZE); this.setMinimumSize(BUTTON_SIZE); } private void setButtonAlignment() { this.setVerticalTextPosition(SwingConstants.BOTTOM); this.setHorizontalTextPosition(SwingConstants.CENTER); this.setAlignmentX(JButton.CENTER_ALIGNMENT); } public Feature getFeature() { return feature; } public void actionPerformed(ActionEvent e) { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); AdminGui.instance().setFeature(feature); setCursor(Cursor.getDefaultCursor()); } public void mouseClicked(MouseEvent me) { } public void mouseEntered(MouseEvent me) { setBorderPainted(true); } public void mouseExited(MouseEvent me) { setBorderPainted(false); } public void mousePressed(MouseEvent me) { } public void mouseReleased(MouseEvent me) { }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -