Review for Forestle by Tiger19
Rated 3 out of 5 stars
MJP
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JPanel;
public class MeinJPanel extends JPanel{
private int panelHoehe;
private int panelBreite;
private Image aktBild;
public MeinJPanel(int hoehe, int breite, Image bild){
this.setPanelHoehe(hoehe);
this.setPanelBreite(breite);
this.setAktBild(bild);
setBackground(Color.black);
}
public Dimension getPreferredSize(){
return new Dimension(this.panelBreite, this.panelHoehe);
}
public void paintComponent(Graphics g){
super.paintComponent(g);
if(aktBild != null){
g.drawImage(this.getAktBild(),0,0, this.getPanelBreite(), this.getPanelHoehe(), this);
}
else{
g.drawString("Kein Bild da!", this.getPanelBreite(), this.getPanelHoehe());
}
}
public int getPanelHoehe() {
return panelHoehe;
}
public void setPanelHoehe(int panelHoehe) {
this.panelHoehe = panelHoehe;
}
public int getPanelBreite() {
return panelBreite;
}
public void setPanelBreite(int panelBreite) {
this.panelBreite = panelBreite;
}
public Image getAktBild() {
return aktBild;
}
public void setAktBild(Image aktBild) {
this.aktBild = aktBild;
}
}
To create your own collections, you must have a Mozilla Add-ons account.