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

📄 sitemanager.java

📁 java swing 开发代码
💻 JAVA
字号:
// SiteManager.java// A sample Swing application that manages several internal frames.  This// is the main class for working with the SiteFrame and PageFrame classes.//package	jswing.ch02;import java.awt.*;import java.util.*;import javax.swing.*;public class SiteManager extends JFrame {  JLayeredPane desktop;  Vector popups = new Vector();  public SiteManager() {    super("Web Site Manager");    setSize(450, 250);    setDefaultCloseOperation(EXIT_ON_CLOSE);    Container contentPane = getContentPane();    JToolBar jtb = new JToolBar();    jtb.add(new CutAction(this));    jtb.add(new CopyAction(this));    jtb.add(new PasteAction(this));    contentPane.add(jtb, BorderLayout.NORTH);        // Add our LayeredPane object for the internal frames.    desktop = new JDesktopPane();    contentPane.add(desktop, BorderLayout.CENTER);    addSiteFrame("Sample");  }  public static void main(String args[]) {    SiteManager mgr = new SiteManager();    mgr.setVisible(true);  }  // Methods to create our internal frames  public void addSiteFrame(String name) {    SiteFrame sf = new SiteFrame(name, this);    popups.addElement(sf);    desktop.add(sf, new Integer(2));  // Keep sites on top for now    sf.setVisible(true);  }  public void addPageFrame(String name) {    PageFrame pf = new PageFrame(name, this);    desktop.add(pf, new Integer(1));    pf.setVisible(true);    pf.setIconifiable(true);    popups.addElement(pf);  }  public JInternalFrame getCurrentFrame() {    for (int i = 0; i < popups.size(); i++) {      JInternalFrame currentFrame = (JInternalFrame)popups.elementAt(i);      if (currentFrame.isSelected()) {        return currentFrame;      }    }    return null;  }}

⌨️ 快捷键说明

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