|
@@ -13,7 +13,7 @@ public class Gallery extends JPanel implements Observer
|
|
|
// Hook up this observer so that it will be notified when the model
|
|
|
// changes.
|
|
|
this.model = model;
|
|
|
- this.setLayout();
|
|
|
+ this.setLayout(new GridLayout(0, 3));
|
|
|
this.setBackground(Color.white);
|
|
|
this.items = new ArrayList();
|
|
|
reList();
|
|
@@ -37,7 +37,8 @@ public class Gallery extends JPanel implements Observer
|
|
|
this.items.clear();
|
|
|
for (PicData p: temp)
|
|
|
{
|
|
|
- this.items.add(p);
|
|
|
+ Item temp2 = new Item(p);
|
|
|
+ this.items.add(temp2);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -64,6 +65,7 @@ public class Gallery extends JPanel implements Observer
|
|
|
class Item extends JPanel
|
|
|
{
|
|
|
private PicData data;
|
|
|
+ private ImageIcon picture;
|
|
|
private JLabel pic;
|
|
|
private JLabel name;
|
|
|
private JLabel rating;
|
|
@@ -73,11 +75,12 @@ class Item extends JPanel
|
|
|
{
|
|
|
this.data = p;
|
|
|
this.setLayout(new GridLayout(0, 1));
|
|
|
- this.setPreferredSize(100, 150);
|
|
|
- this.pic = new JLabel(data.getPic());
|
|
|
+ this.setPreferredSize(new Dimension(100, 150));
|
|
|
+ this.picture = new ImageIcon(data.getPic());
|
|
|
+ this.pic = new JLabel(picture);
|
|
|
this.name = new JLabel(data.getName());
|
|
|
- this.rating = new JLabel(data.getRating().toString());
|
|
|
- this.dateSize = new JLabel(data.getDate().toString() + data.getSize().toString());
|
|
|
+ this.rating = new JLabel(Integer.toString(data.getRating()));
|
|
|
+ this.dateSize = new JLabel(Long.toString(data.getLastmod()) + Long.toString(data.getSize()));
|
|
|
this.add(pic);
|
|
|
this.add(name);
|
|
|
this.add(rating);
|