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

📄 sheettest.java

📁 oraily的Swing hacks code
💻 JAVA
字号:
import javax.swing.*;import java.awt.*;import java.awt.event.*;import java.beans.*;public class SheetTest extends Object     implements PropertyChangeListener {    JOptionPane optionPane;    AniSheetableJFrame frame;    public static void main (String[] args) {        new SheetTest();    }    public SheetTest () {        frame = new AniSheetableJFrame ("Animated sheet test");        // put an image in the frame's content pane        ImageIcon icon = new ImageIcon ("keagy-lunch.png");        JLabel label = new JLabel (icon);        frame.getContentPane().add(label);        // build JOptionPane dialog and hold onto it        optionPane = new JOptionPane ("Do you want to save?",                                      JOptionPane.QUESTION_MESSAGE,                                      JOptionPane.YES_NO_OPTION);        frame.pack();        frame.setVisible(true);        optionPane.addPropertyChangeListener (this);        // pause for effect, then show the sheet        try {Thread.sleep(1000);}        catch (InterruptedException ie) {}        JDialog dialog =             optionPane.createDialog (frame, "irrelevant");        frame.showJDialogAsSheet (dialog);    }    public void propertyChange (PropertyChangeEvent pce) {        if (pce.getPropertyName().equals (JOptionPane.VALUE_PROPERTY)) {            System.out.println ("Selected option " +                                 pce.getNewValue());            frame.hideSheet();        }    }}

⌨️ 快捷键说明

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