Search code examples
javaswingorientationjframearabic

set JFrame Orientation from right to left!


To align my JFrame from righ-to-left, I use:

setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

but this works only if I use the following style (decoration) of the JFrame:

public class RightToLeft {
  public static void main(String []args){
    javax.swing.SwingUtilities.invokeLater(new Runnable(){
      public void run() {
        try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); }
        catch (Exception e) { e.printStackTrace(); }
        JFrame.setDefaultLookAndFeelDecorated(true);
        JFrame frame = new JFrame("العنوان بالعربي");
        frame.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
        frame.setSize(300,300);
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        frame.setVisible(true);
      }
    });
  }
}

enter image description here

but I want it to work without this decoration. How to solve this issue?

EDIT:

@mre I want a JFrame like this one:

enter image description here

EDIT2:

I really really need this issue to be fixed, so I offer 500+ to who will give a JFrame like this (with WindowsLookAndFeel):

enter image description here


Solution

  • @Eng.Fouad

    just joke and this one ???...

    Substance L&F

    code:

    import java.awt.ComponentOrientation;
    import javax.swing.JFrame;
    import javax.swing.UIManager;
    import org.pushingpixels.substance.api.skin.SubstanceOfficeSilver2007LookAndFeel;
    
    public class RightToLeft {
    
        public static void main(String[] args) {
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
    
                @Override
                public void run() {
                    try {
                        //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
                        UIManager.setLookAndFeel(new SubstanceOfficeSilver2007LookAndFeel());
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    JFrame.setDefaultLookAndFeelDecorated(true);
                    JFrame frame = new JFrame("العنوان بالعربي");
                    frame.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
                    frame.setSize(300, 300);
                    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                    frame.setVisible(true);
                }
            });
        }
    
        private RightToLeft() {
        }
    }