简体   繁体   English

从右到左jframe

[英]right to left jframe

How to create right to left jframe ?! 如何创建从右到左的jframe?

this is java original jframe 这是java原始的jframe 在此处输入图片说明

and this is the result when use : 这是使用时的结果:

JFrame.setDefaultLookAndFeelDecorated(true);

在此处输入图片说明

but i need some thing like this 但我需要这样的东西

在此处输入图片说明

The only way I know how to do it is to use an undecorated frame with the Metal LAF: 我知道怎么做的唯一方法是对Metal LAF使用未经装饰的框架:

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

public class SSCCE5
{
    private static void createAndShowGUI()
    {
        JFrame frame = new JFrame("SSCCE5");

        frame.setUndecorated(true);
        frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
        frame.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLocationByPlatform( true );
        frame.setSize(200, 200);
        frame.setVisible( true );
    }

    public static void main(String[] args)
    {
        EventQueue.invokeLater(new Runnable()
        {
            public void run()
            {
                createAndShowGUI();
            }
        });
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM