I was thinking to set an image as background instead of a solid color. Is that possible?
Here are the codes of my MainApp.java
package com.gabriel.guiApp;
import java.awt.Color;
import javax.swing.JFrame;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.*;
import com.gabriel.guiImpl.Car;
public class MainApp extends JFrame{
/**
*
*/
private static final long serialVersionUID = 1L;
public static void main(String[] args) {
MainApp mainApp=new MainApp();
mainApp.setTitle("Draw");
mainApp.setBounds(10,10, 1200, 400);
Draw draw= new Draw();
draw.setBounds(0,0, 80,80);
draw.setBackground(Color.red);
draw.setForeground(Color.yellow);
draw.init();
mainApp.add(draw);
ClassPathResource r= new ClassPathResource("ApplicationContext.xml");
BeanFactory factory=new XmlBeanFactory((org.springframework.core.io.Resource) r);
Car car=(Car) factory.getBean("car");
draw.setCar(car);
mainApp.setVisible(true);
}
}
Please insert your solution to my code. Thank you!