rootexample.java

来自「java swing 开发代码」· Java 代码 · 共 20 行

JAVA
20
字号
// RootExample.java// An example of interacting directly with the JRootPane of a JFrame.//package	jswing.ch08;import java.awt.*;import javax.swing.*;public class RootExample {  public static void main(String[] args) {    JFrame f = new JFrame();    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);    JRootPane root = f.getRootPane();          // XXX Pay attention to these    Container content = root.getContentPane(); // XXX lines. They get more    content.add(new JButton("Hello"));         // XXX explanation in the book.    f.pack();    f.setVisible(true);  }}

⌨️ 快捷键说明

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