Just imported an image, but need a subPanel on the right with the dimensions (200,700) I've tried using the imported image as a panel but it just spans me with errors, any ideas?
package dodge;
import java.awt.*;
import javax.swing.*;
public class Dodge extends JFrame {
private ImageIcon image;
private JLabel label;
Dodge(){
JFrame frame = new JFrame();
frame.setResizable(false);
frame.pack();
setLayout(new FlowLayout());
JPanel image = new JPanel();
image = new ImageIcon(getClass().getResource("Road.jpg"));
label = new JLabel (image);
add(label);
}
public static void main(String[] args) {
//
JFrame frame = new JFrame();
frame.setResizable(false);
frame.pack();
Dodge gui = new Dodge();
gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
gui.setVisible(true);
gui.pack();
gui.setTitle("Dodge The Cars");
JPanel subPanel1= new JPanel();
subPanel1.setBackground(Color.DARK_GRAY);
subPanel1.setPreferredSize(new Dimension (250,700));
JLabel label = new JLabel ("Menu");
subPanel1.add(label);