从右到左设置JFrame Orientation! [英] set JFrame Orientation from right to left!

查看:219
本文介绍了从右到左设置JFrame Orientation!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要将我的JFrame从左到右对齐,我使用:

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

setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

但这仅适用于我使用JFrame的以下样式(装饰):

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);
      }
    });
  }
}

但我想让它在没有这种装饰的情况下工作。如何解决这个问题?

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

编辑:

@mre我想要一个像这样的JFrame:

@mre I want a JFrame like this one:

EDIT2:

我真的需要修复这个问题,所以我提供了500多个会给这样的JFrame(使用WindowsLookAndFeel):

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

推荐答案

@ Eng.Fouad

@Eng.Fouad

只是玩笑而这一个??? ...

just joke and this one ???...

代码:

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() {
    }
}

这篇关于从右到左设置JFrame Orientation!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆