
-----------------------------------
eNc
Sun Nov 20, 2005 4:04 pm

Class List GUI
-----------------------------------
Ok so in the following code I am trying to change all the JButtons labels. This is how it works. The JButton labels are corresponding to a class list. The class list can be sorted, randomized and searched. I would like to have the class list randomized and displayed when the "Ownage" button is pressed. I have tried to do so in the following code, but I only can get the default class list to appear in the GUI. Please help me to see what I am doing wrong.


import java.io.*;
import java.util.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

//start class student
class student
{
	//declaring instance fields
	String firstName;	
	String lastName;
	int age;
	
	//student constructor
	public student(String l, String f, int a)
	{
		lastName = l;
		firstName = f;
		age = a;
	}//end student constructor
	
	//Part A - creates createList() method
	//creates class list and store into array studentArray
	//source from studentList.txt
	public static student[] createList()
	{
		String first, last = null;
		int age = 0;
		
		student [] studentArray = new student[33];
		
      try
      {
      	FileReader fr = new FileReader("C:\\java\\programs\\chanto\\studentList.txt");
      	BufferedReader br = new BufferedReader(fr);    
      	String line; 
      	for(int i = 0; i