|
@@ -4,6 +4,11 @@ import javax.swing.*;
|
|
|
import javax.swing.event.*;
|
|
|
import java.awt.event.*;
|
|
|
import java.io.Serializable;
|
|
|
+import javax.swing.ImageIcon;
|
|
|
+import java.awt.image.*;
|
|
|
+import javax.imageio.ImageIO;
|
|
|
+import java.io.File;
|
|
|
+import java.io.*;
|
|
|
|
|
|
public class Gallery extends JPanel implements Observer, Serializable
|
|
|
{
|
|
@@ -30,11 +35,11 @@ public class Gallery extends JPanel implements Observer, Serializable
|
|
|
{
|
|
|
Item.emptyStarImg = ImageIO.read(new File("src/main/resources/emptyStar.png"));
|
|
|
} catch(IOException e) {}
|
|
|
- Item.fullStarImg = Item.fullStarImg.getScaledInstance(50, 50, java.awt.Image.SCALE_SMOOTH);
|
|
|
- Item.emptyStarImg = Item.emptyStarImg.getScaledInstance(50, 50, java.awt.Image.SCALE_SMOOTH);
|
|
|
+ Item.fullStarImg = Item.fullStarImg.getScaledInstance(25, 25, java.awt.Image.SCALE_SMOOTH);
|
|
|
+ Item.emptyStarImg = Item.emptyStarImg.getScaledInstance(25, 25, java.awt.Image.SCALE_SMOOTH);
|
|
|
Item.fullStarIcon = new ImageIcon(Item.fullStarImg);
|
|
|
Item.emptyStarIcon = new ImageIcon(Item.emptyStarImg);
|
|
|
-
|
|
|
+
|
|
|
model.addObserver(this);
|
|
|
}
|
|
|
|
|
@@ -310,8 +315,10 @@ class Item extends JPanel implements Serializable
|
|
|
this.picture = new ImageIcon(data.getPic());
|
|
|
this.pic = new JLabel(picture, JLabel.CENTER);
|
|
|
this.pic.addMouseListener(clicklistener);
|
|
|
+ this.pic.setAlignmentX(LEFT_ALIGNMENT);
|
|
|
this.pic.setPreferredSize(new Dimension(200, 200));
|
|
|
- this.name = new JLabel(data.getName(), JLabel.CENTER);
|
|
|
+ this.name = new JLabel(data.getName(), JLabel.LEFT);
|
|
|
+ this.name.setAlignmentX(LEFT_ALIGNMENT);
|
|
|
this.name.setPreferredSize(new Dimension(200, 25));
|
|
|
this.rating = new JPanel();
|
|
|
this.rating.setLayout(new BoxLayout(this.rating, BoxLayout.X_AXIS));
|
|
@@ -321,7 +328,9 @@ class Item extends JPanel implements Serializable
|
|
|
this.rating.add(star4);
|
|
|
this.rating.add(star5);
|
|
|
this.rating.setPreferredSize(new Dimension(200, 50));
|
|
|
- this.dateSize = new JLabel(Long.toString(data.getLastmod()) + Long.toString(data.getSize()), JLabel.CENTER);
|
|
|
+ this.rating.setAlignmentX(LEFT_ALIGNMENT);
|
|
|
+ this.dateSize = new JLabel(Long.toString(data.getLastmod()) + Long.toString(data.getSize()), JLabel.LEFT);
|
|
|
+ this.dateSize.setAlignmentX(LEFT_ALIGNMENT);
|
|
|
this.dateSize.setPreferredSize(new Dimension(200, 25));
|
|
|
this.add(pic);
|
|
|
this.add(name);
|
|
@@ -329,4 +338,4 @@ class Item extends JPanel implements Serializable
|
|
|
this.add(dateSize);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|