简体   繁体   中英

right to left jframe

How to create right to left jframe ?!

this is java original 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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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