Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement keyboard navigation for TabStrips #599

Open
juancnuno opened this issue Sep 17, 2024 · 2 comments
Open

Implement keyboard navigation for TabStrips #599

juancnuno opened this issue Sep 17, 2024 · 2 comments
Assignees
Labels
feature New feature or request

Comments

@juancnuno
Copy link

When a TabStrip is focused you should be able to navigate between the individual tabs with the keyboard

@juancnuno
Copy link
Author

juancnuno commented Sep 17, 2024

Here is a little Swing demonstration of the keyboard navigation JTabbedPanes have out of the box

import javax.swing.*;
import java.awt.*;

final class Test {
    private Test() {
    }

    public static void main(String[] args) {
        var tabbedPane = new JTabbedPane();
        tabbedPane.setPreferredSize(new Dimension(400, 200));

        tabbedPane.addTab("Tab 1", new JLabel("Tab 1"));
        tabbedPane.addTab("Tab 2", new JLabel("Tab 2"));

        var frame = new JFrame("Test");
        frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

        var contentPane = frame.getContentPane();

        contentPane.add(new JButton("North"), BorderLayout.NORTH);
        contentPane.add(tabbedPane, BorderLayout.CENTER);
        contentPane.add(new JButton("South"), BorderLayout.SOUTH);

        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }
}

@rock3r
Copy link
Collaborator

rock3r commented Sep 17, 2024

Thank you Juan. I tried keyboard navigation in the UI Sandbox internal action and I can't get the JBTabsImpl to switch tabs with either arrow keys, nor with the tab keys:

Screen.Recording.2024-09-17.at.13.04.19.mov

@rock3r rock3r added the feature New feature or request label Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants