⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rtlborderlayoutexample.java

📁 一个用java开发界面的程序集(jfc核心编程)
💻 JAVA
字号:
package JFCBook.Chapter3.jdk12;

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

public class RTLBorderLayoutExample {
	static boolean isLTR = false;

	public static void main(String[] args) {
		JFrame f = new JFrame("Border1");
		final Container cp = f.getContentPane();
		cp.add(new JButton("Before First Line"), BorderLayout.BEFORE_FIRST_LINE);
		cp.add(new JButton("After Last Line"), BorderLayout.AFTER_LAST_LINE);
		cp.add(new JButton("<html>After<BR>Line<BR>Ends"), BorderLayout.AFTER_LINE_ENDS);
		cp.add(new JButton("<html>Before<BR>Line<BR>Begins"), BorderLayout.BEFORE_LINE_BEGINS);

		JButton centerButton = new JButton("C");
		cp.add(centerButton, BorderLayout.CENTER);

		f.pack();
		f.addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent evt) {
				System.exit(0);
			}
		});

		centerButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent evt) {
				isLTR = !isLTR;
				ComponentOrientation co = isLTR? ComponentOrientation.RIGHT_TO_LEFT :
												ComponentOrientation.LEFT_TO_RIGHT;
				cp.setComponentOrientation(co);
				cp.invalidate();
				cp.validate();
			}
		});

		f.setVisible(true);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -