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 static void main(String[] args) {
JFrame frame = new JFrame();
ImageIcon icon1;
ImageIcon icon2;
try {
icon1 = new ImageIcon(ImageIO.read(new File("C:/image1.gif")));
icon2 = new ImageIcon(ImageIO.read(new File("C:/image1.gif")).getScaledInstance(width_toScale,height_toScale,Image.SCALE_FAST));
JButton button1 = new JButton("test1",icon1);
JButton button2 = new JButton("test2",icon2);
frame.getContentPane().setLayout(new GridLayout(2,1));
frame.getContentPane().add(button1);
frame.getContentPane().add(button2);
frame.setSize(500,500);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
} catch (IOException ex) {
ex.printStackTrace();
}
}
JFileChooser chooser = new JFileChooser();
FileSystemView view = chooser.getFileSystemView();
ImageIcon ic = (ImageIcon)view.getSystemIcon(new File(path));
iconLabel = new JLabel(ic);
iconLabel.setBounds(10,10,60,30);
this.add(iconLabel);
FileSystemView view = FileSystemView.getFileSystemView();
ImageIcon ic = (ImageIcon)view.getSystemIcon(new File(path));
ImageIcon ic2 = new ImageIcon(ic.getImage().getScaledInstance(width,height,Image.SCALE_FAST));