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.
//"changeColorBtn want int and BufferedImage to eat now!"
//If it fails,it just returns null
public BufferedImage changeColorBtn(int Clr,BufferedImage aIm){
BufferedImage aAImage = new BufferedImage(84,84,BufferedImage.TYPE_BYTE_BINARY);//Make a new Instance of BufferedImage...
try{//TRY all this stuff because maybe it explodes
MapColorsFilter filter = new MapColorsFilter(0xffffffff, Clr);//..Set the colors to replace...
filter.filter(aIm, aAImage);//...Filter it...
}
catch(Exception ex){
ex.printStackTrace();
aAImage=null;
}//return null in case it explodes!
finally{//This code will ALLWAYS run even if it Failed;
return aAImage;//and return our changed Image!
}
}
BufferedImage tempImage=new BufferedImage(84,84, BufferedImage.TYPE_BYTE_BINARY);
Icon icon = jButton1.getIcon();
icon.paintIcon(jButton1, tempImage.getGraphics(), 84, 84);
BufferedImage imgResult = changeColorBtn(0xff000000,tempImage);
ImageIcon iconRes = new ImageIcon(imgResult);
jButton1.setIcon(iconRes);