All pastes #2104481 Raw Edit

Stuff

public text v1 · immutable
#2104481 ·published 2012-01-20 13:36 UTC
rendered paste body
import java.awt.*; 
import java.awt.event.*;
import javax.swing.*; 
import java.io.*; 
import java.util.*;

public class CatMain extends JFrame implements ActionListener
{
  String[] names = new String[310];
  String[] teachers = new String[62];
  public CatMain(String title)                           
  {

  JFrame frame = new JFrame("Creating a JList Component");
  JPanel panel = new JPanel();
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  JList list = new JList(getTeachers);
  frame.setUndecorated(true);
  frame.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
  panel.add(list);
  frame.add(panel);
  frame.setSize(400,400);
  frame.setVisible(true);  
  setLayout( new FlowLayout() ); 
  add( panel ); 
  }
  public void actionPerformed( ActionEvent evt)
  {
   
  }
  public static void main ( String[] args )
  {
    CatMain demo = new CatMain( "CatMain" ) ;

    demo.setSize( 800, 600 );     
    demo.setVisible( true );      
  }
  public void teachers() throws IOException
  {
    File file = new File("schedule.txt");
    
    Scanner scan = new Scanner(file);
    
    int i=0;
    int q=0;
    while (scan.hasNextLine())
    {
      //if(i%5=1)
      {
        names[i] = scan.nextLine();
      }
      i++;
    }
    for(int j=0; j < names.length;j+=5)
    {      
      teachers[q] = names[j]; 
      q++;
    }
    for(int k=0; k < teachers.length ; k++)
    {
      System.out.println(teachers[k]); 
    }
  }
  
    public String[] getTeachers()
    {
      return teachers;
    }
  
}