Search in sources :

Example 6 with JTabFrame

use of com.github.weisj.darklaf.components.tabframe.JTabFrame in project darklaf by weisJ.

the class DarkPanelPopupUI method installListeners.

protected void installListeners() {
    popupComponent.addPropertyChangeListener(this);
    installFocusListener();
    JTabFrame frame = popupComponent.getTabFrame();
    if (frame != null) {
        frame.addPropertyChangeListener(this);
    }
}
Also used : JTabFrame(com.github.weisj.darklaf.components.tabframe.JTabFrame)

Example 7 with JTabFrame

use of com.github.weisj.darklaf.components.tabframe.JTabFrame in project darklaf by weisJ.

the class DarkPanelPopupUI method installFocusListener.

protected void installFocusListener() {
    JTabFrame tabFrame = popupComponent.getTabFrame();
    Alignment a = popupComponent.getAlignment();
    if (tabFrame == null || a == null)
        return;
    JComponent container = tabFrame.getContentPane().getContainer(a);
    FocusParentHelper.setFocusParent(popupComponent, container, c -> {
        if (!popupComponent.isOpen())
            return;
        setHeaderBackground(DarkUIUtil.hasFocus(popupComponent));
    });
}
Also used : Alignment(com.github.weisj.darklaf.util.Alignment) JTabFrame(com.github.weisj.darklaf.components.tabframe.JTabFrame)

Example 8 with JTabFrame

use of com.github.weisj.darklaf.components.tabframe.JTabFrame in project darklaf by weisJ.

the class TabFrameDemo method createComponent.

@Override
public JComponent createComponent() {
    Icon folderIcon = DemoResources.FOLDER_ICON;
    JTabFrame tabFrame = new JTabFrame();
    for (Alignment o : Alignment.values()) {
        if (o != Alignment.CENTER) {
            for (int i = 0; i < 2; i++) {
                JPanel pcc = new JPanel();
                pcc.setOpaque(true);
                pcc.add(new JLabel(o.toString() + "_" + i + " Popup"));
                tabFrame.addTab(pcc, o + "_" + i, folderIcon, o);
            }
        }
    }
    TabbedPopup tabbedPopup = new TabbedPopup("Tabbed Popup:");
    tabFrame.setTabAt(tabbedPopup, "NORTH (Tabbed Pane Tab)", null, Alignment.NORTH, 0);
    for (int i = 0; i < 5; i++) {
        JPanel panel = new JPanel();
        JLabel label = new JLabel("Tab Number " + i);
        panel.add(label);
        tabbedPopup.getTabbedPane().addTab("Tab " + i, panel);
    }
    for (int i = 0; i < 3; i++) {
        String text = "Custom Button " + i;
        tabbedPopup.addButton(AllIcons.Menu.Help.get(), text).addActionListener(e -> JOptionPane.showMessageDialog(tabFrame, text));
        tabFrame.getPopupAt(Alignment.EAST, 0).addButton(AllIcons.Menu.Help.get(), "Custom Button").addActionListener(e -> JOptionPane.showMessageDialog(tabFrame, text));
    }
    /*
         * Activate for a custom tab. tabFrame.setUserTabComponentAt(new JLabel("NORTH (custom tab)") {{
         * setBorder(new EmptyBorder(0, 5, 0, 5)); setOpaque(false); setForeground(Color.RED); setFont(new
         * Font(Font.SERIF, Font.ITALIC, 12)); }}, Alignment.NORTH, 1);
         */
    tabFrame.setAcceleratorAt(1, Alignment.NORTH_WEST, 0);
    tabFrame.setTabEnabled(Alignment.NORTH_EAST, 0, false);
    JPanel contentPane = new JPanel(new BorderLayout());
    contentPane.add(tabFrame, BorderLayout.CENTER);
    tabFrame.setContent(createTextArea());
    return tabFrame;
}
Also used : Alignment(com.github.weisj.darklaf.util.Alignment) JTabFrame(com.github.weisj.darklaf.components.tabframe.JTabFrame) TabbedPopup(com.github.weisj.darklaf.components.tabframe.TabbedPopup)

Aggregations

JTabFrame (com.github.weisj.darklaf.components.tabframe.JTabFrame)8 Alignment (com.github.weisj.darklaf.util.Alignment)6 TabFrameUI (com.github.weisj.darklaf.components.tabframe.TabFrameUI)3 TabFrameTab (com.github.weisj.darklaf.components.tabframe.TabFrameTab)1 TabbedPopup (com.github.weisj.darklaf.components.tabframe.TabbedPopup)1 UnsupportedFlavorException (java.awt.datatransfer.UnsupportedFlavorException)1