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

JideTabbedPane in right-to-left component orientation #20

Open
hakanai opened this issue Feb 21, 2017 · 0 comments
Open

JideTabbedPane in right-to-left component orientation #20

hakanai opened this issue Feb 21, 2017 · 0 comments

Comments

@hakanai
Copy link

hakanai commented Feb 21, 2017

An Arabic user noticed that the tab close buttons were on the left of the tabs, but thought they should be on the right.

I'm not sure whether the user is right or not, so I'm passing the question upwards. JIDE currently puts them on the left because it's the reverse of where they would be for a left-to-right layout. But sometimes in right-to-left UIs, things are not reversed. I wasn't able to quickly find any literature describing the correct behaviour for tab close buttons, so all I have to go on is this one user's comment.

Test program:

import java.awt.BorderLayout;
import java.awt.ComponentOrientation;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;

import com.jidesoft.swing.JideTabbedPane;

public class TestRtlTab implements Runnable {
    public static void main(String[] args) {
        System.setProperty("user.language", "ar");
        System.setProperty("user.country", "SA");

        SwingUtilities.invokeLater(new TestRtlTab());
    }

    @Override
    public void run() {
        showFrame("Left-to-Right", ComponentOrientation.LEFT_TO_RIGHT);
        showFrame("Right-to-Left", ComponentOrientation.RIGHT_TO_LEFT);
    }

    private void showFrame(String title, ComponentOrientation componentOrientation) {
        JideTabbedPane tabs = new JideTabbedPane();
        tabs.setShowCloseButtonOnTab(true);
        tabs.add("Tab 1", new JPanel());
        tabs.add("Tab 2", new JPanel());
        tabs.setComponentOrientation(componentOrientation);

        JPanel content = new JPanel();
        content.setLayout(new BorderLayout());
        content.add(tabs, BorderLayout.CENTER);
        content.setComponentOrientation(componentOrientation);

        JFrame frame = new JFrame(title);
        frame.setContentPane(content);
        frame.setComponentOrientation(componentOrientation);

        frame.pack();
        frame.setSize(500, 400);
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant