Search in sources :

Example 1 with IconColor

use of se.trixon.almond.util.icons.IconColor in project java-jotasync by trixon.

the class TabHolder method init.

private void init() {
    setFocusTraversalKeysEnabled(false);
    mSpeedDialPanel = new SpeedDialPanel();
    IconColor iconColor = mAlmondOptions.getIconColor();
    add(mSpeedDialPanel, MaterialIcon._Action.HOME.get(AlmondUI.ICON_SIZE_NORMAL, iconColor));
    setIconAt(0, MaterialIcon._Action.HOME.get(AlmondUI.ICON_SIZE_NORMAL, iconColor));
    HistoryPanel historyPanel = new HistoryPanel();
    add(historyPanel, MaterialIcon._Action.HISTORY.get(AlmondUI.ICON_SIZE_NORMAL, iconColor));
    setIconAt(1, MaterialIcon._Action.HISTORY.get(AlmondUI.ICON_SIZE_NORMAL, iconColor));
    mJobMap.values().stream().forEach((tabItem) -> {
        tabItem.updateIcons(iconColor);
    });
    mManager.addConnectionListeners(this);
    mManager.getClient().addServerEventListener(this);
    mMenuMouseAdapter = new MouseAdapter() {

        @Override
        public void mousePressed(MouseEvent e) {
            if (e == null || e.getButton() == MouseEvent.BUTTON1) {
                Component component = ((TabListener) getSelectedComponent()).getMenuButton();
                JPopupMenu popupMenu = MainFrame.getPopupMenu();
                InputMap inputMap = popupMenu.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
                ActionMap actionMap = popupMenu.getActionMap();
                Action action = new AbstractAction("HideMenu") {

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        popupMenu.setVisible(false);
                    }
                };
                String key = "HideMenu";
                actionMap.put(key, action);
                KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
                inputMap.put(keyStroke, key);
                if (popupMenu.isVisible()) {
                    popupMenu.setVisible(false);
                } else {
                    popupMenu.show(component, component.getWidth() - popupMenu.getWidth(), component.getHeight());
                    int x = component.getLocationOnScreen().x + component.getWidth() - popupMenu.getWidth();
                    int y = component.getLocationOnScreen().y + component.getHeight();
                    popupMenu.setLocation(x, y);
                }
            }
        }
    };
    mSpeedDialPanel.getMenuButton().addMouseListener(mMenuMouseAdapter);
    // FIXME Why is this necessary?
    setTabLayoutPolicy(SCROLL_TAB_LAYOUT);
    setTabLayoutPolicy(WRAP_TAB_LAYOUT);
}
Also used : Action(javax.swing.Action) AbstractAction(javax.swing.AbstractAction) MouseEvent(java.awt.event.MouseEvent) ActionMap(javax.swing.ActionMap) ActionEvent(java.awt.event.ActionEvent) MouseAdapter(java.awt.event.MouseAdapter) JPopupMenu(javax.swing.JPopupMenu) IconColor(se.trixon.almond.util.icons.IconColor) KeyStroke(javax.swing.KeyStroke) InputMap(javax.swing.InputMap) JComponent(javax.swing.JComponent) Component(java.awt.Component) AbstractAction(javax.swing.AbstractAction)

Example 2 with IconColor

use of se.trixon.almond.util.icons.IconColor in project java-jotasync by trixon.

the class EditPanel method init.

private void init() {
    for (Component component : toolBar.getComponents()) {
        if (component instanceof AbstractButton) {
            AbstractButton button = (AbstractButton) component;
            button.setVisible(false);
        }
    }
    IconColor iconColor = mAlmondOptions.getIconColor();
    toggleButton.setIcon(MaterialIcon._Action.SCHEDULE.get(ICON_SIZE, iconColor));
    addButton.setIcon(MaterialIcon._Content.ADD.get(ICON_SIZE, iconColor));
    cloneButton.setIcon(MaterialIcon._Content.CONTENT_COPY.get(ICON_SIZE, iconColor));
    editButton.setIcon(MaterialIcon._Editor.MODE_EDIT.get(ICON_SIZE, iconColor));
    removeButton.setIcon(MaterialIcon._Content.REMOVE.get(ICON_SIZE, iconColor));
    removeAllButton.setIcon(MaterialIcon._Content.CLEAR.get(ICON_SIZE, iconColor));
    activateButton.setIcon(MaterialIcon._Navigation.ARROW_BACK.get(ICON_SIZE, iconColor));
    deactivateButton.setIcon(MaterialIcon._Navigation.ARROW_FORWARD.get(ICON_SIZE, iconColor));
    moveDownButton.setIcon(MaterialIcon._Navigation.ARROW_DOWNWARD.get(ICON_SIZE, iconColor));
    moveUpButton.setIcon(MaterialIcon._Navigation.ARROW_UPWARD.get(ICON_SIZE, iconColor));
    moveFirstButton.setIcon(MaterialIcon._Editor.VERTICAL_ALIGN_TOP.get(ICON_SIZE, iconColor));
    moveLastButton.setIcon(MaterialIcon._Editor.VERTICAL_ALIGN_BOTTOM.get(ICON_SIZE, iconColor));
// list.setModel(mModel);
}
Also used : AbstractButton(javax.swing.AbstractButton) Component(java.awt.Component) IconColor(se.trixon.almond.util.icons.IconColor)

Example 3 with IconColor

use of se.trixon.almond.util.icons.IconColor in project java-jotasync by trixon.

the class DualListPanel method init.

private void init() {
    IconColor iconColor = mAlmondOptions.getIconColor();
    removeAllButton.setIcon(MaterialIcon._Content.CLEAR.get(ICON_SIZE, iconColor));
    activateButton.setIcon(MaterialIcon._Navigation.ARROW_BACK.get(ICON_SIZE, iconColor));
    deactivateButton.setIcon(MaterialIcon._Navigation.ARROW_FORWARD.get(ICON_SIZE, iconColor));
}
Also used : IconColor(se.trixon.almond.util.icons.IconColor)

Aggregations

IconColor (se.trixon.almond.util.icons.IconColor)3 Component (java.awt.Component)2 ActionEvent (java.awt.event.ActionEvent)1 MouseAdapter (java.awt.event.MouseAdapter)1 MouseEvent (java.awt.event.MouseEvent)1 AbstractAction (javax.swing.AbstractAction)1 AbstractButton (javax.swing.AbstractButton)1 Action (javax.swing.Action)1 ActionMap (javax.swing.ActionMap)1 InputMap (javax.swing.InputMap)1 JComponent (javax.swing.JComponent)1 JPopupMenu (javax.swing.JPopupMenu)1 KeyStroke (javax.swing.KeyStroke)1