Объектно-ориентированное программирование

panel1.add(label9);

replace2 = new JButton("OK");

panel.add(replace2);

contentPane.add(panel,BorderLayout.SOUTH);

contentPane.add(panel1,BorderLayout.CENTER);

}

catch (IOException e)

{

System.out.print("Can not read file66666"+e);

}

replace2.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent event2) >{

System.exit(0);

}

});

}

private JLabel label;

private JLabel label1;

private JLabel label2;

private JLabel label3;

private JLabel label4;

private JLabel label5;

private JLabel label6;

private JLabel label7;

private JLabel label9;

private JButton replace2;

private String S2;

private String hhh=new String("");

private int seconds_1;

private int minute_1;

private int hour_1;

private int day_1;

private int mouth_1;

private int year_1;

private int g;

private int r34=0;

private int r3=0;

private DataInputStream ids13;

private Device [] df;

private int [] m1;

private DataInputStream ids131;

private Device [] newStaff1=new Device[10];

static Device[] readData(BufferedReader in)

throws IOException

{

int n = Integer.parseInt(in.readLine());

Device [] e=new Device[n];

for(int i=0;i<n;i++)

{

e[i] = new Device();

e[i].readData(in);

}

return e;

}

}

class MyTimer1 extends JFrame

{

public MyTimer1()

{

setSize(650,350);

setTitle("His answer");

try

{

S2 =JOptionPane.showInputDialog("Введите логин искомого студента");

FileInputStream is12 = new

FileInputStream(new

File("C:\\Student\\"+S2+".txt"));

ids13 = new DataInputStream(is12);

String E=ids13.readUTF();

int f=Integer.parseInt(E);

df=new Device[f];

m1=new int [f];

FileInputStream is121 = new

FileInputStream(new

File("C:\\Student1\\"+S2+".txt"));

ids131 = new DataInputStream(is121);

for(int r123=0;r123<f;r123++)

{

String E1=ids131.readUTF();

int f1=Integer.parseInt(E1);

m1[r123]=f1;

}

BufferedReader in = new BufferedReader(new FileReader("device1.dat"));

newStaff1=readData(in);

in.close();

for(int g1=0;g1<f;g1++)

{

r3=m1[g1];

df[r34]=newStaff1[r3];

r34++;

}

label9= new JLabel("FFF");

for(int g1=0;g1<f;g1++)

{

String rrr=df[g1].getName();

hhh=hhh+"<br>"+rrr;

}

label9.setText("<html><br> Он правильно ответили на следующие темы(это - "+(f*10)+"%)<br>"+hhh+"</html>");

Container contentPane = getContentPane ();

JPanel panel = new JPanel();

JPanel panel1 = new JPanel();

panel.add(label9);

replace2 = new JButton("OK");

panel1.add(replace2);

contentPane.add(panel,BorderLayout.CENTER);

contentPane.add(panel1,BorderLayout.SOUTH);

}

catch (IOException e)

{

System.out.print("Can not read file66666"+e);

}

replace2.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent event2)

{

System.exit(0);

}

});

}

private JLabel label9;

private JButton replace2;

private String S2;

private String hhh=new String("");

private int r34=0;

private int r3=0;

private DataInputStream ids13;

private Device [] df;

private int [] m1;

private DataInputStream ids131;

private Device [] newStaff1=new Device[10];

static Device[] readData(BufferedReader in)

throws IOException

{

int n = Integer.parseInt(in.readLine());

Device [] e=new Device[n];

for(int i=0;i<n;i++)

{

e[i] = new Device();

e[i].readData(in);

}

return e;

}

}

class ButtonFrame11 extends JFrame

{

public ButtonFrame11()

{

Toolkit kit = Toolkit.getDefaultToolkit();

Dimension screenSize = kit.getScreenSize();

int screenHeight = screenSize.height;

int screenWidth = screenSize.width;

setSize(screenWidth/3,screenHeight/5);

setLocation(screenWidth/4,screenHeight/4);

Image img = kit.getImage("icon.gif");

setIconImage(img);

setTitle("CenteredFrame");

ButtonPanel11 panel = new ButtonPanel11();

add(panel);

}

}

class ButtonPanel11 extends JPanel

{

public ButtonPanel11()

{

JButton BeginButton = new JButton("Begin");

JButton ReButton = new JButton("Registration");

Password = new JPasswordField("",6);

login = new JTextField(15);

label1 = new JLabel("Please,input your name");

label2 = new JLabel("Please,input your password");

JPanel panel = new JPanel();

panel.setLayout(new GridLayout(2,2));

panel.add (label1);

panel.add (login);

panel.add (label2);

panel.add (Password);

add(panel,BorderLayout.CENTER);

JPanel panel1 = new JPanel();

panel1.add(BeginButton);

panel1.add (ReButton);

add(panel1,BorderLayout.SOUTH);

ColorAction11 BeginAction = new ColorAction11(2);

ColorAction11 ReAction = new ColorAction11(3);

BeginButton.addActionListener(BeginAction);

ReButton.addActionListener(ReAction);

}

private class ColorAction11 implements ActionListener

{

public ColorAction11(int c)

{

ccc=c;

t=0;

S1=new String("0");

S2=new String("1");

S3=new String("2");

S4=new String("3");

S5=new String("4");

S6=new String("5");

S7=new String("6");

S8=new String("7");

S9=new String("8");

S10=new String("9");

}

public void actionPerformed(ActionEvent event)

{

if(ccc==2)

{

S13 = login.getText();

pass = Password.getPassword();

S14=new String(pass,0,6);

try

{

FileInputStream is = new

FileInputStream(new

File("C:\\RGR\\"+S13+".txt"));

DataInputStream ids = new DataInputStream(is);

String S15=ids.readUTF();

if (S15.length() == S13.length())

{

if(S13.regionMatches(0, S15, 0, S15.length()))

{

String S16 = ids.readUTF();

if(S13.regionMatches(0, S11, 0, S11.length()))

{

t1=1;

}

if (S14.length() == S16.length())

{

if(S14.regionMatches(0, S16, 0, S16.length()))

{

if(S14.regionMatches(0, r, 0, r.length()))

{

t1=2;

}

FileOutputStream OS=new FileOutputStream (new File("C:\\USER\\NOW.txt"));

DataOutputStream ods = new DataOutputStream (OS);

ods.writeUTF(S13);

ods.close();

GregorianCalendar d = new GregorianCalendar();

int year=d.get(Calendar.YEAR);

int mouth=d.get(Calendar.MONTH);

int day=d.get(Calendar.DAY_OF_MONTH);

int hour=d.get(Calendar.HOUR);

int minute=d.get(Calendar.MINUTE);

Страница:  1  2  3  4  5  6  7 


Другие рефераты на тему «Программирование, компьютеры и кибернетика»:

Поиск рефератов

Последние рефераты раздела

Copyright © 2010-2024 - www.refsru.com - рефераты, курсовые и дипломные работы