/* A basic extension of the java.awt.Frame class */ import java.awt.*; public class Frame5 extends Frame { Applet1 app; public Frame5() { // This code is automatically generated by Visual Cafe when you add // components to the visual environment. It instantiates and initializes // the components. To modify the code, only use code syntax that matches // what Visual Cafe can generate, or Visual Cafe may be unable to back // parse your Java file into its visual environment. //{{INIT_CONTROLS setLayout(null); setBackground(new java.awt.Color(208,211,181)); setFont(new Font("Serif", Font.PLAIN, 12)); setSize(221,399); setVisible(false); label1.setText("Invite Buddies"); add(label1); label1.setForeground(new java.awt.Color(91,0,18)); label1.setFont(new Font("Serif", Font.BOLD, 14)); label1.setBounds(48,12,166,41); list1.setBackground(new java.awt.Color(211,208,181)); list1.setForeground(new java.awt.Color(91,0,18)); list1.setFont(new Font("Serif", Font.BOLD, 10)); add(list1); list1.setBounds(36,60,144,180); label2.setText("Subject of Invitation"); add(label2); label2.setForeground(new java.awt.Color(91,0,18)); label2.setFont(new Font("Serif", Font.BOLD, 14)); label2.setBounds(36,288,165,36); add(textField1); textField1.setForeground(new java.awt.Color(91,0,18)); textField1.setFont(new Font("Serif", Font.BOLD, 10)); textField1.setBounds(36,324,175,24); button1.setLabel("Invite"); add(button1); button1.setBackground(new java.awt.Color(211,208,181)); button1.setForeground(new java.awt.Color(91,0,18)); button1.setFont(new Font("Serif", Font.BOLD, 10)); button1.setBounds(72,360,47,24); button2.setLabel("Close"); add(button2); button2.setBackground(new java.awt.Color(211,208,181)); button2.setForeground(new java.awt.Color(91,0,18)); button2.setFont(new Font("Serif", Font.BOLD, 10)); button2.setBounds(132,360,48,24); button3.setLabel("Add"); add(button3); button3.setBackground(new java.awt.Color(211,208,181)); button3.setForeground(new java.awt.Color(91,0,18)); button3.setFont(new Font("Serif", Font.BOLD, 10)); button3.setBounds(60,252,50,24); button4.setLabel("Remove"); add(button4); button4.setBackground(new java.awt.Color(211,208,181)); button4.setForeground(new java.awt.Color(91,0,18)); button4.setFont(new Font("Serif", Font.BOLD, 10)); button4.setBounds(120,252,48,24); //}} //{{INIT_MENUS //}} //{{REGISTER_LISTENERS SymWindow aSymWindow = new SymWindow(); this.addWindowListener(aSymWindow); SymAction lSymAction = new SymAction(); button2.addActionListener(lSymAction); button1.addActionListener(lSymAction); button3.addActionListener(lSymAction); //}} } public Frame5(String title,Applet1 ap) { this(); setTitle(title); app=ap; } /** * Shows or hides the component depending on the boolean flag b. * @param b if true, show the component; otherwise, hide the component. * @see java.awt.Component#isVisible */ public void setVisible(boolean b) { if(b) { setLocation(50, 50); } super.setVisible(b); } public void addNotify() { // Record the size of the window prior to calling parents addNotify. Dimension d = getSize(); super.addNotify(); if (fComponentsAdjusted) return; // Adjust components according to the insets Insets insets = getInsets(); setSize(insets.left + insets.right + d.width, insets.top + insets.bottom + d.height); Component components[] = getComponents(); for (int i = 0; i < components.length; i++) { Point p = components[i].getLocation(); p.translate(insets.left, insets.top); components[i].setLocation(p); } fComponentsAdjusted = true; } // Used for addNotify check. boolean fComponentsAdjusted = false; //{{DECLARE_CONTROLS java.awt.Label label1 = new java.awt.Label(); java.awt.List list1 = new java.awt.List(4); java.awt.Label label2 = new java.awt.Label(); java.awt.TextField textField1 = new java.awt.TextField(); java.awt.Button button1 = new java.awt.Button(); java.awt.Button button2 = new java.awt.Button(); java.awt.Button button3 = new java.awt.Button(); java.awt.Button button4 = new java.awt.Button(); //}} //{{DECLARE_MENUS //}} class SymWindow extends java.awt.event.WindowAdapter { public void windowClosing(java.awt.event.WindowEvent event) { Object object = event.getSource(); if (object == Frame5.this) Frame5_WindowClosing(event); } } void Frame5_WindowClosing(java.awt.event.WindowEvent event) { setVisible(false); // hide the Frame } class SymAction implements java.awt.event.ActionListener { public void actionPerformed(java.awt.event.ActionEvent event) { Object object = event.getSource(); if (object == button2) button2_ActionPerformed(event); else if (object == button1) button1_ActionPerformed(event); else if (object == button3) button3_ActionPerformed(event); } } void button2_ActionPerformed(java.awt.event.ActionEvent event) { // to do: code goes here. this.dispose(); } void button1_ActionPerformed(java.awt.event.ActionEvent event) { // to do: code goes here. String subject=textField1.getText(); if (subject.equals("")) subject="(None)"; String s=app.randid+"*"; for (int i=0;i