Guest User

Untitled

a guest
Jan 20th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1. public class CoursePanel extends JPanel {
  2.    
  3.    
  4.  
  5.     public CoursePanel() {
  6.         int num = Run.corecoursenum + Run.eleccoursenum;
  7.         JButton button[]=new JButton[num];
  8.         int j = num % 4;
  9.         int k = num / 4;
  10.         if(j == 0){
  11.             j++;
  12.         }
  13.     if(k == 0){
  14.         k++;
  15.         }
  16.        
  17.         setBackground(Color.white);
  18.    
  19.         int count = 0;
  20.         while(num < count){
  21.         String code =Run.getFacade().getAllCourses()[count].getCode();
  22.         String title = Run.getFacade().getAllCourses()[count].getTitle();
  23.         int credit = Run.getFacade().getAllCourses()[count].getCreditPoints();
  24.         String type = Run.getFacade().getAllCourses()[count].getClass().toString();
  25.         button[num] = new JButton (" Code"+ code + " Title:" + title + " Credit:" +credit + " Prereqs: none");
  26.         count ++;
  27.         }
  28.  
  29.  
  30.         setLayout(new GridLayout(j, k));
  31.          count = 0;
  32.         while(num < count){
  33.             add(button[count]);
  34.             count ++;
  35.         }
  36.     }
  37. }
Add Comment
Please, Sign In to add comment