📄 rtlflowlayoutexample.java
字号:
package JFCBook.Chapter3.jdk12;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class RTLFlowLayoutExample {
public static void main(String[] args) {
JFrame f = new JFrame("Right-to-Left FlowLayout");
JPanel p = new JPanel();
Insets margin = new Insets(5, 14, 5, 14);
p.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 4));
p.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
for (int i = 1; i <= 6; i++) {
JButton b = new JButton("" + i);
b.setMargin(margin);
p.add(b);
}
f.getContentPane().add(p);
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
System.exit(0);
}
});
f.pack();
f.setVisible(true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -