?? toolbarpanel.java
字號:
/* CRMS, customer relationship management system Copyright (C) 2003 Service To Youth Council This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information contact the SYC ICT department on GPL@syc.net.au 98 Kermode Street North Adelaide South Australia SA 5006 +61 (0)8 8367 0755 *//* * ToolbarPanel.java * * Created on 27 March 2003, 23:09 */package crms.applet;import crms.applet.company.CompanySearchWindow;import javax.swing.*;import java.awt.*;import java.awt.event.*;/** * * @author dmurphy */public class ToolbarPanel extends javax.swing.JPanel { static final int ICON_WIDTH = 80; static final int ICON_HEIGHT = 80; JButton buttonHome = null; JButton buttonCalls = null; JButton buttonContacts = null; JButton buttonReminders = null; JButton buttonReports = null; JToolBar toolBarPanel = new JToolBar(); CRMSApplet parent = null; /** Creates a new instance of ToolbarPanel */ public ToolbarPanel(CRMSApplet parent) { this.parent = parent; init(); } void init() { setLayout(new BorderLayout()); toolBarPanel.setOrientation(JToolBar.HORIZONTAL); toolBarPanel.setLayout(new GridLayout(1,4)); // Set up the 'Home' button buttonHome = createButton("home.png","View the opening screen","My CRMS"); buttonHome.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ev) { CRMSPanel panel = new HomePanel(); PanelManager.getInstance().activatePanel(panel); } }); toolBarPanel.add(buttonHome); // Set up the 'Calls' button buttonCalls = createButton("call.gif","View Message information","Messages"); buttonCalls.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ev) { CRMSPanel panel = new CallViewPanel(); PanelManager.getInstance().activatePanel(panel); } }); toolBarPanel.add(buttonCalls); // Set up the 'Contacts' button buttonContacts = createButton("contact.gif","Show the company search screen","Companies"); buttonContacts.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ev) { //Button Clicked... //ContactsPanel panel = new ContactsPanel(); //PanelManager.getInstance().activatePanel(panel); CompanySearchWindow window = new CompanySearchWindow(null, "Search"); window.display(); } }); toolBarPanel.add(buttonContacts); // Set up the 'Reminders' button buttonReminders = createButton("reminder.gif","View Call information","Reminders"); buttonReminders.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ev) { //Button Clicked... ReminderViewPanel panel = new ReminderViewPanel(); PanelManager.getInstance().activatePanel(panel); } }); toolBarPanel.add(buttonReminders); // Set up the 'Reports' button buttonReports = createButton("report.gif","Report CRMS Data","Reports"); buttonReports.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ev) { //Button Clicked... ReportPanel panel = new ReportPanel(); PanelManager.getInstance().activatePanel(panel); } }); //toolBarPanel.add(buttonReports); add(toolBarPanel, BorderLayout.CENTER); } JButton createButton(String iconFile, String toolTip, String caption) { JButton button = new JButton(caption); ImageIcon icon = new ImageIcon(this.getClass().getResource("/images/" + iconFile)); if (icon == null) { throw new RuntimeException("Couldn't find " + caption + " icon at \"images\"" + iconFile); } icon.setImage(icon.getImage().getScaledInstance(32,32, Image.SCALE_SMOOTH)); button.setToolTipText(toolTip); button.setIcon(icon); button.setVerticalTextPosition(SwingConstants.CENTER); button.setHorizontalTextPosition(SwingConstants.RIGHT); button.setSize(new Dimension(ICON_WIDTH,ICON_HEIGHT)); return button; } }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -