import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.io.*; import ffio.*; public class ffbroster extends JApplet { ffio io = new ffio(); public int grabtotal(int teamnumber, int playernum, int position) throws IOException { int totalweeks=io.gettotalweeks(teamnumber); // totalweeks++; System.out.println("Totalweeks is " + totalweeks); String[] data = new String[totalweeks+1]; Integer[] dataint = new Integer[totalweeks+1]; int total=0; for(int i=0; i < totalweeks; i++) { System.out.println("I equals " + i + " in the scary for loop."); data[i] = io.getplayerdata(teamnumber, playernum, position, i); System.out.println("the data for " + i + " is " + data[i]); } for(int i=1; i < totalweeks; i++) { total = total+Integer.parseInt(data[i]); } // for(int i=0; i <= totalweeks; i++) { // total=total+Integer.intValue(dataint[i]); //} return total; } public String[] PlayerName(String position, int team) throws IOException { int i = team; if(position == "RB") { String[] returnvalue = io.getplayernamesonline(i, 1); //String [] returnvalue = { "RB 1", "RB 2", "RB 3" }; return returnvalue; } if(position == "RCV") { String[] returnvalue = io.getplayernamesonline(i, 2); //String[] returnvalue = { "RCV 1", "RCV 2", "RCV 3"}; return returnvalue; } if(position == "QB") { String[] returnvalue = io.getplayernamesonline(i, 3); //String[] returnvalue = { "QB 1", "QB 2"}; return returnvalue; } if(position == "TE") { String[] returnvalue = io.getplayernamesonline(i, 4); //String[] returnvalue = { "TE 1", "TE 2"}; return returnvalue; } if(position == "K") { String[] returnvalue = io.getplayernamesonline(i, 5); //String[] returnvalue = { "K 1", "K 2"}; return returnvalue; } if(position == "D") { String[] returnvalue = io.getplayernamesonline(i, 6); //String[] returnvalue = { "D 1", "D 2"}; return returnvalue; } System.out.println("Something went wrong."); String[] returnvalue = { "oh", "well"}; return returnvalue; } public String playerdata(String position, int number, int datatype) throws IOException { int team=1; if(position == "RB") { int pos=1; if(number == 1) { String returnvalue = io.getplayerdata(team, number, pos, datatype); return returnvalue; } if(number == 2) { String returnvalue = io.getplayerdata(team, number, pos, datatype); return returnvalue; } if(number == 3) { String returnvalue = io.getplayerdata(team, number, pos, datatype); return returnvalue; } } if(position == "RCV") { int pos=2; if(number == 1) { String returnvalue = io.getplayerdata(team, number, pos, datatype); return returnvalue; } if(number == 2) { String returnvalue = io.getplayerdata(team, number, pos, datatype); return returnvalue; } if(number == 3) { String returnvalue = io.getplayerdata(team, number, pos, datatype); return returnvalue; } } if(position == "QB") { int pos=3; if(number == 1) { String returnvalue = io.getplayerdata(team, number, pos, datatype); return returnvalue; } if(number == 2) { String returnvalue = io.getplayerdata(team, number, pos, datatype); return returnvalue; } } if(position == "TE") { int pos=4; if(number == 1) { String returnvalue = io.getplayerdata(team, number, pos, datatype); return returnvalue; } if(number == 2) { String returnvalue = io.getplayerdata(team, number, pos, datatype); return returnvalue; } } if(position == "K") { int pos=5; if(number == 1) { String returnvalue = io.getplayerdata(team, number, pos, datatype); return returnvalue; } if(number == 2) { String returnvalue = io.getplayerdata(team, number, pos, datatype); return returnvalue; } } if(position == "D") { int pos=6; if(number == 1) { String returnvalue = io.getplayerdata(team, number, pos, datatype); return returnvalue; } if(number == 2) { String returnvalue = io.getplayerdata(team, number, pos, datatype); return returnvalue; } } String returnvalue = "0"; return returnvalue; } public String[][] allplayerdata(String position) throws IOException { String[][] returnvalue1 = new String[3][6]; String[][] returnvalue2 = new String[2][6]; String[][] returnvalue3 = new String[1][1]; int used = 0; int positionint = 0; for(int i=0; i < 6; i++) { if(position == "RB") { positionint = 1; System.out.println("I equals " + i); returnvalue1[0][i] = playerdata("RB", 1, i); returnvalue1[1][i] = playerdata("RB", 2, i); returnvalue1[2][i] = playerdata("RB", 3, i); used = 1; } else if(position == "RCV") { positionint = 2; returnvalue1[0][i] = playerdata("RCV", 1, i); returnvalue1[1][i] = playerdata("RCV", 2, i); returnvalue1[2][i] = playerdata("RCV", 3, i); used = 1; } else if(position == "TE") { positionint = 3; returnvalue2[0][i] = playerdata("TE", 1, i); returnvalue2[1][i] = playerdata("TE", 2, i); used = 2; } else if(position == "QB") { positionint = 4; returnvalue2[0][i] = playerdata("QB", 1, i); returnvalue2[1][i] = playerdata("QB", 2, i); used = 2; } else if(position == "K") { positionint = 5; returnvalue2[0][i] = playerdata("K", 1, i); returnvalue2[1][i] = playerdata("K", 2, i); used = 2; } else if(position == "D") { positionint = 6; returnvalue2[0][i] = playerdata("D", 1, i); returnvalue2[1][i] = playerdata("D", 2, i); used = 2; } else { returnvalue3[0][0] = "Didn't"; used = 3; } } if(used == 1) { System.out.println("Shifting data"); String[][] newreturnvalue = new String[3][5]; for(int i=0; i < 4; i++) { newreturnvalue[0][i]=returnvalue1[0][i+1]; newreturnvalue[1][i]=returnvalue1[1][i+1]; newreturnvalue[2][i]=returnvalue1[2][i+1]; } System.out.println("Data is " + newreturnvalue + " going to grab total."); int total1=grabtotal(1, positionint, 1); int total2=grabtotal(1, positionint, 2); int total3=grabtotal(1, positionint, 3); // System.out.println("Total for " + player + " player is " + total); newreturnvalue[0][4]=Integer.toString(total1); newreturnvalue[1][4]=Integer.toString(total2); newreturnvalue[2][4]=Integer.toString(total3); return newreturnvalue; } if(used == 2) { System.out.println("Shifting data"); String[][] newreturnvalue = new String[2][5]; for(int i=0; i < 5; i++) { newreturnvalue[0][i]=returnvalue2[0][i+1]; newreturnvalue[1][i]=returnvalue2[1][i+1]; } int total1=grabtotal(1, positionint, 1); int total2=grabtotal(1, positionint, 2); newreturnvalue[0][4]=Integer.toString(total1); newreturnvalue[1][4]=Integer.toString(total2); return newreturnvalue; } if(used == 3) { return returnvalue3; } return null; } public void init() { try { String[] RBnames = PlayerName("RB", 1); String[] RCVnames = PlayerName("RCV", 1); String[] QBnames = PlayerName("QB", 1); String[] TEnames = PlayerName("TE", 1); String[] Knames = PlayerName("K", 1); String[] Dnames = PlayerName("D", 1); String[][] RBdata = allplayerdata("RB"); String[][] RCVdata = allplayerdata("RCV"); String[][] QBdata = allplayerdata("QB"); String[][] TEdata = allplayerdata("TE"); String[][] Kdata = allplayerdata("K"); String[][] Ddata = allplayerdata("D"); JFrame roster = new JFrame("Roster"); ButtonGroup RBgroup1 = new ButtonGroup(); final JRadioButton RB11 = new JRadioButton(RBnames[0], false); final JRadioButton RB12 = new JRadioButton(RBnames[1], false); final JRadioButton RB13 = new JRadioButton(RBnames[2], false); ButtonGroup RCVgroup1 = new ButtonGroup(); final JRadioButton RCV11 = new JRadioButton(RCVnames[0], false); final JRadioButton RCV12 = new JRadioButton(RCVnames[1], false); final JRadioButton RCV13 = new JRadioButton(RCVnames[2], false); ButtonGroup RBgroup2 = new ButtonGroup(); final JRadioButton RB21 = new JRadioButton(RBnames[0], false); final JRadioButton RB22 = new JRadioButton(RBnames[1], false); final JRadioButton RB23 = new JRadioButton(RBnames[2], false); ButtonGroup RCVgroup2 = new ButtonGroup(); final JRadioButton RCV21 = new JRadioButton(RCVnames[0], false); final JRadioButton RCV22 = new JRadioButton(RCVnames[1], false); final JRadioButton RCV23 = new JRadioButton(RCVnames[2], false); ButtonGroup QBgroup = new ButtonGroup(); final JRadioButton QB1 = new JRadioButton(QBnames[0], false); final JRadioButton QB2 = new JRadioButton(QBnames[1], false); ButtonGroup TEgroup = new ButtonGroup(); final JRadioButton TE1 = new JRadioButton(TEnames[0], false); final JRadioButton TE2 = new JRadioButton(TEnames[1], false); ButtonGroup Kgroup = new ButtonGroup(); final JRadioButton K1 = new JRadioButton(Knames[0], false); final JRadioButton K2 = new JRadioButton(Knames[1], false); ButtonGroup Dgroup = new ButtonGroup(); final JRadioButton D1 = new JRadioButton(Dnames[0], false); final JRadioButton D2 = new JRadioButton(Dnames[1], false); // final JLabel LRB11 = new JLabel("1"); JLabel[] LRB11 = new JLabel[5]; JLabel[] LRB12 = new JLabel[5]; JLabel[] LRB13 = new JLabel[5]; JLabel[] LRB21 = new JLabel[5]; JLabel[] LRB22 = new JLabel[5]; JLabel[] LRB23 = new JLabel[5]; JLabel[] LRCV11 = new JLabel[5]; JLabel[] LRCV12 = new JLabel[5]; JLabel[] LRCV13 = new JLabel[5]; JLabel[] LRCV21 = new JLabel[5]; JLabel[] LRCV22 = new JLabel[5]; JLabel[] LRCV23 = new JLabel[5]; JLabel[] LQB1 = new JLabel[5]; JLabel[] LQB2 = new JLabel[5]; JLabel[] LTE1 = new JLabel[5]; JLabel[] LTE2 = new JLabel[5]; JLabel[] LD1 = new JLabel[5]; JLabel[] LD2 = new JLabel[5]; JLabel[] LK1 = new JLabel[5]; JLabel[] LK2 = new JLabel[5]; // LRB1[0] = RBdata[0][0]; // JLabel LRB1[2] = new JLabel(RBdata[0][2]); // JLabel LRB1[3] = new JLabel(RBdata[0][3]); // JLabel LRB1[4] = new JLabel(RBdata[0][4]); // JLabel LRB2[0] = new JLabel(RBdata[1][0]); // JLabel LRB2[1] = new JLabel(RBdata[1][1]); // JLabel LRB2[2] = new JLabel(RBdata[1][2]); // JLabel LRB2[3] = new JLabel(RBdata[1][3]); // JLabel LRB2[4] = new JLabel(RBdata[1][4]); // JLabel LRB3[0] = new JLabel(RBdata[2][0]); // final JLabel LRB3[1] = new JLabel(RBdata[2][1]); // final JLabel LRB3[2] = new JLabel(RBdata[2][2]); // final JLabel LRB3[3] = new JLabel(RBdata[2][3]); // final JLabel LRB3[4] = new JLabel(RBdata[2][4]); // final JLabel LRCV1[0] = new JLabel(RCVdata[0][0]); // final JLabel LRCV1[1] = new JLabel(RCVdata[0][1]); // final JLabel LRCV1[2] = new JLabel(RCVdata[0][2]); // final JLabel LRCV1[3] = new JLabel(RCVdata[0][3]); // final JLabel LRCV1[4] = new JLabel(RCVdata[0][4]); // final JLabel LRCV2[0] = new JLabel(RCVdata[1][0]); // final JLabel LRCV2[1] = new JLabel(RCVdata[1][1]); // final JLabel LRCV2[2] = new JLabel(RCVdata[1][2]); // final JLabel LRCV2[3] = new JLabel(RCVdata[1][3]); // final JLabel LRCV2[4] = new JLabel(RCVdata[1][4]); // final JLabel LRCV3[0] = new JLabel(RCVdata[2][0]); // final JLabel LRCV3[1] = new JLabel(RCVdata[2][1]); // final JLabel LRCV3[2] = new JLabel(RCVdata[2][2]); // final JLabel LRCV3[3] = new JLabel(RCVdata[2][3]); // final JLabel LRCV3[4] = new JLabel(RCVdata[2][4]); // final JLabel TE1[0] = new JLabel(TEdata[0][0]); // final JLabel TE1[1] = new JLabel(TEdata[0][1]); // final JLabel TE1[2] = new JLabel(TEdata[0][2]); // final JLabel TE1[3] = new JLabel(TEdata[0][3]); // final JLabel TE1[4] = new JLabel(TEdata[0][4]); // final JLabel TE2[0] = new JLabel(TEdata[1][0]); // final JLabel TE2[1]= new JLabel(TEdata[1][1]); // final JLabel TE2[2] = new JLabel(TEdata[1][2]); // final JLabel TE2[3] = new JLabel(TEdata[1][3]); // final JLabel TE2[4] = new JLabel(TEdata[1][4]); // final JLabel QB1[0] = new JLabel(TEdata[0][0]); // final JLabel QB1[1] = new JLabel(TEdata[0][1]); // final JLabel QB1[2] = new JLabel(TEdata[0][2]); // final JLabel QB1[3] = new JLabel(TEdata[0][3]); // final JLabel QB1[4] = new JLabel(TEdata[0][4]); // final JLabel QB2[0] = new JLabel(TEdata[1][0]); // final JLabel QB2[1] = new JLabel(TEdata[1][1]); // final JLabel QB2[2] = new JLabel(TEdata[1][2]); // final JLabel QB2[3] = new JLabel(TEdata[1][3]); // final JLabel QB2[4] = new JLabel(TEdata[1][4]); // final JLabel K1[0] = new JLabel(Kdata[0][0]); // final JLabel K1[1] = new JLabel(Kdata[0][1]); // final JLabel K1[2] = new JLabel(Kdata[0][2]); // final JLabel K1[3] = new JLabel(Kdata[0][3]); // final JLabel K1[4] = new JLabel(Kdata[0][4]); // final JLabel K2[0] = new JLabel(Kdata[1][0]); // final JLabel K2[1] = new JLabel(Kdata[1][1]); // final JLabel K2[2] = new JLabel(Kdata[1][2]); // final JLabel K2[3] = new JLabel(Kdata[1][3]); // final JLabel K2[4] = new JLabel(Kdata[1][4]); // final JLabel D1[0] = new JLabel(Ddata[0][0]); // final JLabel D1[1] = new JLabel(Ddata[0][1]); // final JLabel D1[2] = new JLabel(Ddata[0][2]); // final JLabel D1[3] = new JLabel(Ddata[0][3]); // final JLabel D1[4] = new JLabel(Ddata[0][4]); // final JLabel D2[0] = new JLabel(Ddata[1][0]); // final JLabel D2[1] = new JLabel(Ddata[1][1]); // final JLabel D2[2] = new JLabel(Ddata[1][2]); // final JLabel D2[3] = new JLabel(Ddata[1][3]); // final JLabel D2[4] = new JLabel(Ddata[1][4]); final JLabel RB = new JLabel("Running Back"); final JLabel RCV = new JLabel("Wide Reciever"); final JLabel R2B = new JLabel("Second Running Back"); final JLabel R2CV = new JLabel("Second Wide Reciever"); final JLabel TE = new JLabel("Tight End"); final JLabel QB = new JLabel("Quarterback"); final JLabel K = new JLabel("Kicker"); final JLabel D = new JLabel("Defense"); final JLabel Position = new JLabel(" Position "); final JLabel Players = new JLabel(" Players Names "); final JLabel Week1 = new JLabel(" Week 1 "); final JLabel Week2 = new JLabel(" Week 2 "); final JLabel Week3 = new JLabel(" Week 3 "); final JLabel Week4 = new JLabel(" Week 4 "); final JLabel Total = new JLabel(" Total "); RBgroup1.add(RB11); RBgroup1.add(RB12); RBgroup1.add(RB13); RCVgroup1.add(RCV11); RCVgroup1.add(RCV12); RCVgroup1.add(RCV13); RBgroup2.add(RB21); RBgroup2.add(RB22); RBgroup2.add(RB23); RCVgroup2.add(RCV21); RCVgroup2.add(RCV22); RCVgroup2.add(RCV23); QBgroup.add(QB1); QBgroup.add(QB2); TEgroup.add(TE1); TEgroup.add(TE2); Kgroup.add(K1); Kgroup.add(K2); Dgroup.add(D1); Dgroup.add(D2); Container cp = getContentPane(); GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); cp.setLayout(gridbag); c.gridx=0; c.gridy=0; gridbag.setConstraints(Position, c); cp.add(Position); c.gridx=1; c.gridy=0; gridbag.setConstraints(Players, c); cp.add(Players); c.gridx=2; c.gridy=0; gridbag.setConstraints(Week1, c); cp.add(Week1); c.gridx=3; c.gridy=0; gridbag.setConstraints(Week2, c); cp.add(Week2); c.gridx=4; c.gridy=0; gridbag.setConstraints(Week3, c); cp.add(Week3); c.gridx=5; c.gridy=0; gridbag.setConstraints(Week4, c); cp.add(Week4); c.gridx=6; c.gridy=0; gridbag.setConstraints(Total, c); cp.add(Total); c.gridx=0; c.gridy=1; c.gridwidth=2; gridbag.setConstraints(RB, c); cp.add(RB); c.gridx=1; c.gridy=2; c.gridwidth=1; gridbag.setConstraints(RB11, c); cp.add(RB11); int z=0; for(int x=2; x < 7; x++) { LRB11[z] = new JLabel(RBdata[0][z]); c.gridx=x; c.gridy=2; gridbag.setConstraints(LRB11[z], c); cp.add(LRB11[z]); z++; } c.gridx=1; c.gridy=3; gridbag.setConstraints(RB12, c); cp.add(RB12); z=0; for(int x=2; x < 7; x++) { LRB12[z] = new JLabel(RBdata[1][z]); c.gridx=x; c.gridy=3; gridbag.setConstraints(LRB12[z], c); cp.add(LRB12[z]); z++; } c.gridx=1; c.gridy=4; gridbag.setConstraints(RB13, c); cp.add(RB13); z=0; for(int x=2; x < 7; x++) { LRB13[z] = new JLabel(RBdata[2][z]); c.gridx=x; c.gridy=4; gridbag.setConstraints(LRB13[z], c); cp.add(LRB13[z]); z++; } c.gridx=0; c.gridy=5; c.gridwidth=2; gridbag.setConstraints(R2B, c); cp.add(R2B); c.gridx=1; c.gridy=6; c.gridwidth=1; gridbag.setConstraints(RB21, c); cp.add(RB21); z=0; for(int x=2; x < 7; x++) { LRB21[z] = new JLabel(RBdata[0][z]); c.gridx=x; c.gridy=6; gridbag.setConstraints(LRB21[z], c); cp.add(LRB21[z]); z++; } c.gridx=1; c.gridy=7; gridbag.setConstraints(RB22, c); cp.add(RB22); z=0; for(int x=2; x < 7; x++) { LRB22[z] = new JLabel(RBdata[1][z]); c.gridx=x; c.gridy=7; gridbag.setConstraints(LRB22[z], c); cp.add(LRB22[z]); z++; } c.gridx=1; c.gridy=8; gridbag.setConstraints(RB23, c); cp.add(RB23); z=0; for(int x=2; x < 7; x++) { LRB23[z] = new JLabel(RBdata[2][z]); c.gridx=x; c.gridy=8; gridbag.setConstraints(LRB23[z], c); cp.add(LRB23[z]); z++; } c.gridx=0; c.gridy=9; c.gridwidth=2; gridbag.setConstraints(RCV, c); cp.add(RCV); c.gridx=1; c.gridy=10; c.gridwidth=1; gridbag.setConstraints(RCV11, c); cp.add(RCV11); z=0; for(int x=2; x < 7; x++) { LRCV11[z] = new JLabel(RCVdata[0][z]); c.gridx=x; c.gridy=10; gridbag.setConstraints(LRCV11[z], c); cp.add(LRCV11[z]); z++; } c.gridx=1; c.gridy=11; gridbag.setConstraints(RCV12, c); cp.add(RCV12); z=0; for(int x=2; x < 7; x++) { LRCV12[z] = new JLabel(RCVdata[1][z]); c.gridx=x; c.gridy=11; gridbag.setConstraints(LRCV12[z], c); cp.add(LRCV12[z]); z++; } c.gridx=1; c.gridy=12; gridbag.setConstraints(RCV13, c); cp.add(RCV13); z=0; for(int x=2; x < 7; x++) { LRCV13[z] = new JLabel(RCVdata[2][z]); c.gridx=x; c.gridy=12; gridbag.setConstraints(LRCV13[z], c); cp.add(LRCV13[z]); z++; } c.gridx=0; c.gridy=13; c.gridwidth=2; gridbag.setConstraints(R2CV, c); cp.add(R2CV); c.gridx=1; c.gridy=14; c.gridwidth=1; gridbag.setConstraints(RCV21, c); cp.add(RCV21); z=0; for(int x=2; x < 7; x++) { LRCV21[z] = new JLabel(RCVdata[0][z]); c.gridx=x; c.gridy=14; gridbag.setConstraints(LRCV21[z], c); cp.add(LRCV21[z]); z++; } c.gridx=1; c.gridy=15; gridbag.setConstraints(RCV22, c); cp.add(RCV22); z=0; for(int x=2; x < 7; x++) { LRCV22[z] = new JLabel(RCVdata[1][z]); c.gridx=x; c.gridy=15; gridbag.setConstraints(LRCV22[z], c); cp.add(LRCV22[z]); z++; } c.gridx=1; c.gridy=16; gridbag.setConstraints(RCV23, c); cp.add(RCV23); z=0; for(int x=2; x < 7; x++) { LRCV23[z] = new JLabel(RCVdata[2][z]); c.gridx=x; c.gridy=16; gridbag.setConstraints(LRCV23[z], c); cp.add(LRCV23[z]); z++; } c.gridx=0; c.gridy=17; c.gridwidth=2; gridbag.setConstraints(QB, c); cp.add(QB); c.gridx=1; c.gridy=18; c.gridwidth=1; gridbag.setConstraints(QB1, c); cp.add(QB1); z=0; for(int x=2; x < 7; x++) { LQB1[z] = new JLabel(QBdata[0][z]); c.gridx=x; c.gridy=18; gridbag.setConstraints(LQB1[z], c); cp.add(LQB1[z]); z++; } c.gridx=1; c.gridy=19; gridbag.setConstraints(QB2, c); cp.add(QB2); z=0; for(int x=2; x < 7; x++) { LQB2[z] = new JLabel(QBdata[1][z]); c.gridx=x; c.gridy=19; gridbag.setConstraints(LQB2[z], c); cp.add(LQB2[z]); z++; } c.gridx=0; c.gridy=20; c.gridwidth=2; gridbag.setConstraints(TE, c); cp.add(TE); c.gridx=1; c.gridy=21; c.gridwidth=1; gridbag.setConstraints(TE1, c); cp.add(TE1); z=0; for(int x=2; x < 7; x++) { LTE1[z] = new JLabel(TEdata[0][z]); c.gridx=x; c.gridy=21; gridbag.setConstraints(LTE1[z], c); cp.add(LTE1[z]); z++; } c.gridx=1; c.gridy=22; gridbag.setConstraints(TE2, c); cp.add(TE2); z=0; for(int x=2; x < 7; x++) { LTE2[z] = new JLabel(TEdata[1][z]); c.gridx=x; c.gridy=22; gridbag.setConstraints(LTE2[z], c); cp.add(LTE2[z]); z++; } c.gridx=0; c.gridy=23; c.gridwidth=2; gridbag.setConstraints(K, c); cp.add(K); c.gridx=1; c.gridy=24; c.gridwidth=1; gridbag.setConstraints(K1, c); cp.add(K1); z=0; for(int x=2; x < 7; x++) { LK1[z] = new JLabel(Kdata[0][z]); c.gridx=x; c.gridy=24; gridbag.setConstraints(LK1[z], c); cp.add(LK1[z]); z++; } c.gridx=1; c.gridy=25; gridbag.setConstraints(K2, c); cp.add(K2); z=0; for(int x=2; x < 7; x++) { LK2[z] = new JLabel(Kdata[1][z]); c.gridx=x; c.gridy=25; gridbag.setConstraints(LK2[z], c); cp.add(LK2[z]); z++; } c.gridx=0; c.gridy=26; c.gridwidth=2; gridbag.setConstraints(D, c); cp.add(D); c.gridx=1; c.gridy=27; c.gridwidth=1; gridbag.setConstraints(D1, c); cp.add(D1); z=0; for(int x=2; x < 7; x++) { LD1[z] = new JLabel(Ddata[0][z]); c.gridx=x; c.gridy=27; gridbag.setConstraints(LD1[z], c); cp.add(LD1[z]); z++; } c.gridx=1; c.gridy=28; gridbag.setConstraints(D2, c); cp.add(D2); z=0; for(int x=2; x < 7; x++) { LD2[z] = new JLabel(Ddata[1][z]); c.gridx=x; c.gridy=28; gridbag.setConstraints(LD2[z], c); cp.add(LD2[z]); z++; } } catch(IOException e) { System.out.println(e.getMessage()); } } // public void init() { // postinit(); // } public static void main(String[] args) { } }