Back to index

lightning-sunbird  0.9+nobinonly
Package Functions | Private Member Functions
AboutBox Class Reference

List of all members.

Package Functions

 AboutBox (Menu aboutMenu, ActionListener[] actionListeners)

Private Member Functions

MenuItem cloneMenu (MenuItem oldItem)

Detailed Description

Definition at line 13 of file TrivialApplet.java.


Constructor & Destructor Documentation

AboutBox.AboutBox ( Menu  aboutMenu,
ActionListener[]  actionListeners 
) [inline, package]

Definition at line 14 of file TrivialApplet.java.

                                                                  {
              super("About Applet");
              
              addWindowListener(
                     new WindowAdapter() {
                            public void windowClosing(WindowEvent e) {
                                   dispose();
                            }
                     });
              
              Button okButton = new Button("OK");
              okButton.addActionListener(
                     new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                   dispose();
                            }
                     });
              
              // Annoying use of flow layout managers.
              Panel labelPanel = new Panel();
              Panel buttonPanel = new Panel();
              Panel fieldPanel = new Panel();

              labelPanel.add(new Label("This applet's about box..."));
              buttonPanel.add(okButton);

              fieldPanel.add(new TextField(20));
              fieldPanel.add(new TextField(20));

              add(labelPanel, "North");
              add(buttonPanel, "Center");
              add(fieldPanel, "South");
              
              // test menu bar stuff.
              MenuBar menuBar = new MenuBar();
              aboutMenu = (Menu) cloneMenu(aboutMenu);
              for (int i = 0; i < actionListeners.length; i++)
                     aboutMenu.getItem(i).addActionListener(actionListeners[i]);
              menuBar.add(aboutMenu);
              setMenuBar(menuBar);

              pack();
              show();
       }

Here is the call graph for this function:


Member Function Documentation

MenuItem AboutBox.cloneMenu ( MenuItem  oldItem) [inline, private]

Definition at line 59 of file TrivialApplet.java.

                                                    {
              if (oldItem instanceof Menu) {
                     Menu oldMenu = (Menu) oldItem;
                     Menu newMenu = new Menu(oldMenu.getLabel());
                     int count = oldMenu.getItemCount();
                     for (int i = 0; i < count; i++) {
                            newMenu.add(cloneMenu(oldMenu.getItem(i)));
                     }
                     return newMenu;
              } else {
                     MenuItem newItem = new MenuItem(oldItem.getLabel());
                     return newItem;
              }
       }

Here is the caller graph for this function:


The documentation for this class was generated from the following file: