📄 desktopanddialog.java
字号:
package examples.windows;
import javax.swing.*;
import java.awt.*;
/** An example class used to demonstrate the use of
* the JDesktopPane, JInternalFrame, and
* JOptionPane components
*/
public class DesktopAndDialog extends JFrame {
private static final boolean RESIZABLE = true;
private static final boolean CLOSABLE = true;
private static final boolean MAXIMIZABLE = true;
private static final boolean ICONIFIABLE = true;
private static final boolean MODAL = false;
/** Class constructor method
* @param titleText Window's title bar text
*/
public DesktopAndDialog( String titleText ) {
super( titleText );
addWindowListener( new WindowCloser() );
JInternalFrame ifrm = new JInternalFrame(
"Internal Frame",
RESIZABLE, CLOSABLE, MAXIMIZABLE, ICONIFIABLE );
ifrm.setPreferredSize( new Dimension( 375, 300 ) );
JDesktopPane dt = new JDesktopPane();
dt.setLayout( new FlowLayout() );
dt.add( ifrm );
getContentPane().add( dt, BorderLayout.CENTER );
setSize( 500, 400 );
setVisible( true );
JOptionPane.showMessageDialog(
ifrm, "This is a JOptionPane" );
}
/** The test method for the class
* @param args not used
*/
public static void main( String[] args ) {
new DesktopAndDialog(
"Example Desktop with Dialog" );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -