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

📄 gptoolbar.java

📁 It is all about project scheduling. GanttProject is a tool for creating a project schedule by means
💻 JAVA
字号:
/* * Created on 29.09.2005 */package net.sourceforge.ganttproject;import java.util.ArrayList;import java.util.List;import javax.swing.AbstractButton;import javax.swing.Action;import javax.swing.Icon;import javax.swing.ImageIcon;import javax.swing.JLabel;import javax.swing.JToolBar;import net.sourceforge.ganttproject.gui.TestGanttRolloverButton;import net.sourceforge.ganttproject.language.GanttLanguage;public class GPToolBar extends JToolBar {    public static final Object SEPARATOR_OBJECT = new Object() {        private final String myString = GanttLanguage.getInstance().getText("separator");        public String toString() {            return myString;        }    };        private final GanttOptions options;    private List myButtons;        public GPToolBar(String title, int toolBarPosition, GanttOptions options) {        super(title, toolBarPosition);        setBorderPainted(true);        setRollover(true);        setFloatable(true);                this.options = options;    }        void populate(List/*<JButton>*/ buttons) {        removeAll();        myButtons = new ArrayList(buttons.size());        for (int i = 0; i < buttons.size(); i++) {            Object nextButton = buttons.get(i);            if (GPToolBar.SEPARATOR_OBJECT.equals(nextButton)) {                int size = Integer.parseInt(options.getIconSize());                // toolBar.addSeparator(new Dimension(size, size));                ImageIcon icon;                if (getOrientation() == JToolBar.HORIZONTAL) {                    icon =  new ImageIcon(getClass().getResource(                    "/icons/sepV_16.png"));                }                else {                    icon = new ImageIcon(getClass().getResource(                    "/icons/sepH_16.png"));                }                add(new JLabel(icon));            } else {                add((AbstractButton)nextButton);                if (nextButton instanceof TestGanttRolloverButton) {                    myButtons.add(nextButton);                }            }        }        invalidate();    }    void updateButtonsLook() {        for (int i=0; i<myButtons.size(); i++) {            TestGanttRolloverButton nextButton = (TestGanttRolloverButton) myButtons.get(i);            nextButton.setIconHidden(options.getButtonShow() == GanttOptions.TEXT);            nextButton.setTextHidden(options.getButtonShow() == GanttOptions.ICONS);        }        invalidate();    }    }

⌨️ 快捷键说明

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