Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
public void mousePressed(MouseEvent e) {
JLabel selected = (JLabel) e.getSource();
JLabel label = new JLabel(slected.getImage().getScaledInstance(150, 150, Image.SCALE_DEFAULT));
frame.add(label, BorderLayout.Center);
}
final ImageIcon icon=new ImageIcon(imgList.get(0));
icon.setImage(icon.getImage().getScaledInstance(70, 70, Image.SCALE_DEFAULT));
final JLabel label1=new JLabel(icon);
// MouseListener für label1 und dem Icon
label1.addMouseListener(new MouseListener(){
public void mouseClicked(MouseEvent e) {
icon.setImage(icon.getImage().getScaledInstance(300, 300, Image.SCALE_DEFAULT));
panel2.add(label1);
cont.add(panel2,BorderLayout.CENTER);
}
frame.validate();
frame.update(f.getGraphics());
final ImageIcon icon=new ImageIcon(imgList.get(0));
icon.setImage(icon.getImage().getScaledInstance(70, 70, Image.SCALE_DEFAULT));
final JLabel label1=new JLabel(icon);
// MouseListener für label1 und dem Icon
label1.addMouseListener(new MouseListener(){
public void mouseClicked(MouseEvent e) {
// hier muss ich an das Original Photo kommen
panel2.add(label1);
cont.add(panel2,BorderLayout.CENTER);
}
FlickrPhoto photo=new FlickrPhoto();
public PhotoApp() throws Exception {
super("Aggregierte Fotos aus Flickr");
final Container cont=getContentPane();
final JPanel panel1=new JPanel();
final JPanel panel2=new JPanel();
//panel1.setLayout(new BorderLayout());
// Scrollbar
JScrollPane jscroll = new JScrollPane(panel1);
jscroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
List<URL> imgList = photo.fetchImage();
ImageIcon icon=new ImageIcon(imgList.get(0));
final ImageIcon icon_original=new ImageIcon(imgList.get(0));
icon.setImage(icon.getImage().getScaledInstance(70, 70, Image.SCALE_DEFAULT));
final JLabel label1=new JLabel(icon);
// MouseListener für label1 und dem Icon
label1.addMouseListener(new MouseListener(){
public void mouseClicked(MouseEvent e) {
JLabel label_original=new JLabel(icon_original);
panel2.add(label_original);
cont.add(panel2,BorderLayout.CENTER);
}
@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
}
}
);
ImageIcon icon1=new ImageIcon(imgList.get(1));
icon1.setImage(icon1.getImage().getScaledInstance(70, 70, Image.SCALE_DEFAULT));
JLabel label2=new JLabel(icon1);
ImageIcon icon2=new ImageIcon(imgList.get(2));
icon2.setImage(icon2.getImage().getScaledInstance(70, 70, Image.SCALE_DEFAULT));
JLabel label3=new JLabel(icon2);
ImageIcon icon3=new ImageIcon(imgList.get(3));
icon3.setImage(icon3.getImage().getScaledInstance(70, 70, Image.SCALE_DEFAULT));
JLabel label4=new JLabel(icon3);
ImageIcon icon4=new ImageIcon(imgList.get(4));
icon4.setImage(icon4.getImage().getScaledInstance(70, 70, Image.SCALE_DEFAULT));
JLabel label5=new JLabel(icon4);
ImageIcon icon5=new ImageIcon(imgList.get(5));
icon5.setImage(icon5.getImage().getScaledInstance(70, 70, Image.SCALE_DEFAULT));
JLabel label6=new JLabel(icon5);
ImageIcon icon6=new ImageIcon(imgList.get(6));
icon6.setImage(icon6.getImage().getScaledInstance(70, 70, Image.SCALE_DEFAULT));
JLabel label7=new JLabel(icon6);
ImageIcon icon7=new ImageIcon(imgList.get(7));
icon7.setImage(icon7.getImage().getScaledInstance(70, 70, Image.SCALE_DEFAULT));
JLabel label8=new JLabel(icon7);
ImageIcon icon8=new ImageIcon(imgList.get(8));
icon8.setImage(icon8.getImage().getScaledInstance(70, 70, Image.SCALE_DEFAULT));
JLabel label9=new JLabel(icon8);
ImageIcon icon9=new ImageIcon(imgList.get(9));
icon9.setImage(icon9.getImage().getScaledInstance(70, 70, Image.SCALE_DEFAULT));
JLabel label10=new JLabel(icon9);
panel1.add(label1);
panel1.add(label2);
panel1.add(label3);
panel1.add(label4);
panel1.add(label5);
panel1.add(label6);
panel1.add(label7);
panel1.add(label8);
panel1.add(label9);
panel1.add(label10);
cont.add(panel1,BorderLayout.SOUTH);
}
// }
public static void main(String args[]) {
PhotoApp app = null;
try {
app = new PhotoApp();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
app.setSize(600, 600);
app.validate();
app.update(app.getGraphics());
app.setVisible(true);
app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}