networking authentication program 1.0
Submitted By:
manoveg
Rating:
(Not rated) (
Rate It)
package server;
import java.awt.*;
import java.util.*;
import java.sql.*;
import java.io.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class Subscreen
{
public static void main(String args[])
{
SFrontEnd31 frame1=new SFrontEnd31();
frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame1.show();
}
}
class SFrontEnd31 extends JFrame implements ActionListener
{
public static final int WIDTH=300;
public static final int HEIGHT=300;
String acommand="";
public SFrontEnd31()
{
setTitle("Server");
setSize(WIDTH,HEIGHT);
Container contentPane=getContentPane();
JButton b1= new JButton("Add new user");
JButton b2= new JButton("Delete a user");
JButton b3= new JButton("LOGOUT");
Box hbox1=Box.createHorizontalBox();
hbox1.add(b1);
hbox1.add(Box.createHorizontalStrut(10));
hbox1.add(b2);
Box hbox2=Box.createHorizontalBox();
hbox2.add(b3);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
Box vbox=Box.createVerticalBox();
vbox.add(hbox1);
vbox.add(Box.createGlue());
vbox.add(hbox2);
contentPane.add(vbox,BorderLayout.CENTER);
}
public void actionPerformed(ActionEvent ae)
{
acommand=ae.getActionCommand();
if(acommand.equals("Add new user"))
{
SFrontEnd s1 = new SFrontEnd();
s1.setVisible(true);
this.setVisible(false);
}
else
if(acommand.equals("Delete a user"))
{
SFrontEnd1 s3 = new SFrontEnd1();
s3.setVisible(true);
this.setVisible(false);
}
else
if(acommand.equals("LOGOUT"))
{
SFrontEnd3 s4 = new SFrontEnd3();
s4.setVisible(true);
this.dispose();
}
}
}
/*
class DialogBox1 extends Dialog implements ActionListener
{
String msg="";
DialogBox1(Frame parent , String title, String msg1)
{
super(parent, title , true);
msg=msg1;
setLayout(new FlowLayout(FlowLayout.LEFT));
setSize(300,300);
Button Ok = new Button("OK");
add(Ok);
Ok.addActionListener(this);
}
public void actionPerformed(ActionEvent ae1)
{
dispose();
}
public void paint(Graphics g)
{
g.drawString(msg,10,170);
}
}
*/