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

📄 wizard.java

📁 WAP ide 代码
💻 JAVA
字号:
package wapide;import java.awt.*;import javax.swing.*;import java.awt.event.*;import javax.swing.border.*;/** * A wizard dialog for creating new project files of type wml, si, sl, text, and wmls * Copyright:    Copyright (c) 2003 * @author Mark Busman * @version 1.0 * * For License and contact information see WAPIDE.java */public class Wizard extends JDialog {  BorderLayout borderLayout1 = new BorderLayout();  JPanel ButtonPanel = new JPanel();  JButton CancelButton = new JButton();  FlowLayout flowLayout1 = new FlowLayout();  JButton OkButton = new JButton();  ImageIcon wmldocImage;  ImageIcon wmlsdocImage;  ImageIcon pushdocImage;  ImageIcon pulldocImage;  ImageIcon textdocImage;  JPanel ContentsPanel = new JPanel();  JLabel pushdocLabel = new JLabel();  JLabel wmlsdocLabel = new JLabel();  JLabel wmlsdocIconLabel = new JLabel();  JTabbedPane ChoicesTabPane1 = new JTabbedPane();  JLabel wmldocIconLabel = new JLabel();  JLabel wmldocLabel = new JLabel();  JPanel WAPFilesTab = new JPanel();  JLabel pulldocIconLabel = new JLabel();  GridBagLayout gridBagLayout1 = new GridBagLayout();  JLabel pulldocLabel = new JLabel();  JLabel pushdocIconLabel = new JLabel();  BorderLayout borderLayout2 = new BorderLayout();  TitledBorder titledBorder1;  JPanel OthersTab = new JPanel();  JLabel textdocIconLabel = new JLabel();  GridBagLayout gridBagLayout2 = new GridBagLayout();  JLabel textdocLabel = new JLabel();  // User Variables  private int Selected = -1;  public Wizard() {    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }    pack();    setSize(320, 300);    setResizable(false);  }  public static void main(String[] args) {    Wizard wizard1 = new Wizard();    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();    Dimension frameSize = wizard1.getSize();    if (frameSize.height > screenSize.height) {      frameSize.height = screenSize.height;    }    if (frameSize.width > screenSize.width) {      frameSize.width = screenSize.width;    }    wizard1.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);    wizard1.show();  }  private void jbInit() throws Exception {    wmldocImage = new ImageIcon(wapide.IDEFrame.class.getResource("wmldoc.gif"));    wmlsdocImage = new ImageIcon(wapide.IDEFrame.class.getResource("scriptdoc.gif"));    pushdocImage = new ImageIcon(wapide.IDEFrame.class.getResource("pushdoc.gif"));    pulldocImage = new ImageIcon(wapide.IDEFrame.class.getResource("pulldoc.gif"));    textdocImage = new ImageIcon(wapide.IDEFrame.class.getResource("textdoc.gif"));    titledBorder1 = new TitledBorder("");    this.setModal(true);    this.setTitle("Choose a Project...");    this.getContentPane().setLayout(borderLayout1);    CancelButton.setToolTipText("Close this window without making any changes");    CancelButton.setText("Cancel");    CancelButton.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        CancelButton_actionPerformed(e);      }    });    ButtonPanel.setLayout(flowLayout1);    flowLayout1.setAlignment(FlowLayout.RIGHT);    OkButton.setMaximumSize(new Dimension(81, 23));    OkButton.setMinimumSize(new Dimension(81, 23));    OkButton.setPreferredSize(new Dimension(81, 23));    OkButton.setToolTipText("Accept choices made");    OkButton.setText("Ok");    OkButton.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        OkButton_actionPerformed(e);      }    });    pushdocLabel.setForeground(Color.black);    pushdocLabel.setOpaque(true);    pushdocLabel.setText("Push Message");    pushdocLabel.addMouseListener(new java.awt.event.MouseAdapter() {      public void mouseClicked(MouseEvent e) {        IconClicked(e);      }    });    wmlsdocLabel.setEnabled(false);    wmlsdocLabel.setForeground(Color.black);    wmlsdocLabel.setOpaque(true);    wmlsdocLabel.setText("WML Script Document");    wmlsdocLabel.addMouseListener(new java.awt.event.MouseAdapter() {      public void mouseClicked(MouseEvent e) {        IconClicked(e);      }    });    wmlsdocIconLabel.setEnabled(false);    wmlsdocIconLabel.setIcon(wmlsdocImage);    wmlsdocIconLabel.addMouseListener(new java.awt.event.MouseAdapter() {      public void mouseClicked(MouseEvent e) {        IconClicked(e);      }    });    wmldocIconLabel.setIcon(wmldocImage);    wmldocIconLabel.addMouseListener(new java.awt.event.MouseAdapter() {      public void mouseClicked(MouseEvent e) {        IconClicked(e);      }    });    wmldocLabel.setForeground(Color.black);    wmldocLabel.setOpaque(true);    wmldocLabel.setText("WML Document");    wmldocLabel.addMouseListener(new java.awt.event.MouseAdapter() {      public void mouseClicked(MouseEvent e) {        IconClicked(e);      }    });    WAPFilesTab.setLayout(gridBagLayout1);    pulldocIconLabel.setIcon(pulldocImage);    pulldocIconLabel.addMouseListener(new java.awt.event.MouseAdapter() {      public void mouseClicked(MouseEvent e) {        IconClicked(e);      }    });    pulldocLabel.setForeground(Color.black);    pulldocLabel.setOpaque(true);    pulldocLabel.setText("Pull Message");    pulldocLabel.addMouseListener(new java.awt.event.MouseAdapter() {      public void mouseClicked(MouseEvent e) {        IconClicked(e);      }    });    pushdocIconLabel.setIcon(pushdocImage);    pushdocIconLabel.addMouseListener(new java.awt.event.MouseAdapter() {      public void mouseClicked(MouseEvent e) {        IconClicked(e);      }    });    ContentsPanel.setLayout(borderLayout2);    OthersTab.setLayout(gridBagLayout2);    textdocIconLabel.setIcon(textdocImage);    textdocIconLabel.addMouseListener(new java.awt.event.MouseAdapter() {      public void mouseClicked(MouseEvent e) {        IconClicked(e);      }    });    textdocIconLabel.setName("text");    textdocLabel.setForeground(Color.black);    textdocLabel.setOpaque(true);    textdocLabel.setText("Text Document");    textdocLabel.addMouseListener(new java.awt.event.MouseAdapter() {      public void mouseClicked(MouseEvent e) {        IconClicked(e);      }    });    textdocLabel.setName("text");    this.getContentPane().add(ButtonPanel, BorderLayout.SOUTH);    ButtonPanel.add(OkButton, null);    ButtonPanel.add(CancelButton, null);    this.getContentPane().add(ContentsPanel, BorderLayout.CENTER);    ContentsPanel.add(ChoicesTabPane1, BorderLayout.CENTER);    ChoicesTabPane1.add(WAPFilesTab, "WAP Files");    WAPFilesTab.add(wmlsdocIconLabel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 2, 0));    WAPFilesTab.add(wmlsdocLabel, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0));    WAPFilesTab.add(wmldocIconLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0            ,GridBagConstraints.SOUTH, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 0, 0));    WAPFilesTab.add(wmldocLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 2, 0));    WAPFilesTab.add(pushdocIconLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 0, 0));    WAPFilesTab.add(pushdocLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0            ,GridBagConstraints.SOUTH, GridBagConstraints.NONE, new Insets(5, 0, 6, 10), 0, 0));    WAPFilesTab.add(pulldocIconLabel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0));    WAPFilesTab.add(pulldocLabel, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0));    ChoicesTabPane1.add(OthersTab, "Others");    OthersTab.add(textdocIconLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));    OthersTab.add(textdocLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));    wmldocIconLabel.setName("wml");    wmldocLabel.setName("wml");    wmlsdocIconLabel.setName("wmls");    wmlsdocLabel.setName("wmls");    pushdocIconLabel.setName("push");    pushdocLabel.setName("push");    pulldocIconLabel.setName("pull");    pulldocLabel.setName("pull");  }  void IconClicked(MouseEvent e) {    JLabel l = (JLabel) e.getSource();    if (l.isEnabled()) {      if (l.getName().equals("wml")) {        wmldocLabel.setBackground(Color.black);        wmldocLabel.setForeground(Color.white);        wmlsdocLabel.setBackground(this.getBackground());        pushdocLabel.setBackground(this.getBackground());        pulldocLabel.setBackground(this.getBackground());        textdocLabel.setBackground(this.getBackground());        wmlsdocLabel.setForeground(Color.black);        pushdocLabel.setForeground(Color.black);        pulldocLabel.setForeground(Color.black);        textdocLabel.setForeground(Color.black);        Selected = 1;      }      if (l.getName().equals("wmls")) {        wmlsdocLabel.setBackground(Color.black);        wmlsdocLabel.setForeground(Color.white);        wmldocLabel.setBackground(this.getBackground());        pushdocLabel.setBackground(this.getBackground());        pulldocLabel.setBackground(this.getBackground());        textdocLabel.setBackground(this.getBackground());        wmldocLabel.setForeground(Color.black);        pushdocLabel.setForeground(Color.black);        pulldocLabel.setForeground(Color.black);        textdocLabel.setForeground(Color.black);        Selected = 4;      }      if (l.getName().equals("push")) {        pushdocLabel.setBackground(Color.black);        pushdocLabel.setForeground(Color.white);        wmldocLabel.setBackground(this.getBackground());        wmlsdocLabel.setBackground(this.getBackground());        pulldocLabel.setBackground(this.getBackground());        textdocLabel.setBackground(this.getBackground());        wmldocLabel.setForeground(Color.black);        wmlsdocLabel.setForeground(Color.black);        pulldocLabel.setForeground(Color.black);        textdocLabel.setForeground(Color.black);        Selected = 2;      }      if (l.getName().equals("pull")) {        pulldocLabel.setBackground(Color.black);        pulldocLabel.setForeground(Color.white);        wmldocLabel.setBackground(this.getBackground());        pushdocLabel.setBackground(this.getBackground());        wmlsdocLabel.setBackground(this.getBackground());        textdocLabel.setBackground(this.getBackground());        wmldocLabel.setForeground(Color.black);        pushdocLabel.setForeground(Color.black);        wmlsdocLabel.setForeground(Color.black);        textdocLabel.setForeground(Color.black);        Selected = 3;      }      if (l.getName().equals("text")) {        textdocLabel.setBackground(Color.black);        textdocLabel.setForeground(Color.white);        wmldocLabel.setBackground(this.getBackground());        pushdocLabel.setBackground(this.getBackground());        pulldocLabel.setBackground(this.getBackground());        wmlsdocLabel.setBackground(this.getBackground());        wmldocLabel.setForeground(Color.black);        pushdocLabel.setForeground(Color.black);        pulldocLabel.setForeground(Color.black);        wmlsdocLabel.setForeground(Color.black);        Selected = 5;      }      if (e.getClickCount() == 2)        OkButton.doClick();    }  }  void OkButton_actionPerformed(ActionEvent e) {    setVisible(false);  }  void CancelButton_actionPerformed(ActionEvent e) {      setVisible(false);      Selected = -1;  }  /**Overridden so we can exit when window is closed*/  protected void processWindowEvent(WindowEvent e) {    super.processWindowEvent(e);    if (e.getID() == WindowEvent.WINDOW_CLOSING) {      setVisible(false);    }  }  public int getData() {    return Selected;  }}

⌨️ 快捷键说明

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