/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package windowtest; import javax.swing.*; import java.util.*; /** * * @author jcmt */ public class BookdataPanel extends JPanel { // private JLabel titleLabel, bookyr, bookcost, bookcount; private JLabel outputLabel = new JLabel("Data for a book"); private JLabel titleLabel = new JLabel("Title :"); private String titleString = new String(); private JLabel tLabel = new JLabel(titleString); public BookdataPanel(ArrayList b) { add(outputLabel); for (Bookdata bd: b) { getTitleString(bd.getTitle()); add(titleLabel); tLabel.setText(titleString); add(tLabel); } } public void getTitleString(String t) { titleString = t; } }