extends JPanel
Hi all,
I'm using JPanel's in my code. But now i wanna make a class a JPanel like: public [class] extends JPanel.
But how can i use the JPanel in a another code? I tried this:
//In main-class with frame
new Times_of_War_Menu();
//And in the 'extends JPanel' class
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
publicclass Times_of_War_Ingameextends JPanel
{
public Times_of_War_Ingame()
{
this.setLayout(new BorderLayout());
//Background for status bar//
JPanel Status_Panel =new JPanel();
Status_Panel.setLayout(new FlowLayout(0, 0, 0));
Icon status_1 =new ImageIcon("C:\\Program Files\\xampp\\htdocs\\xampp\\Templates\\Java\\Times_of_War\\materials\\status_bar\\status_background.jpg");
JLabel status_label_1 =new JLabel(status_1);
Status_Panel.add(status_label_1);
this.add(Status_Panel, BorderLayout.PAGE_START);
//Bars ready//
//Content//
JPanel Content_Panel =new JPanel();
Content_Panel.setLayout(new FlowLayout(0, 0, 0));
Icon background =new ImageIcon("C:\\Program Files\\xampp\\htdocs\\xampp\\Templates\\Java\\Times_of_War\\materials\\backgrounds\\dirt.jpg");
JLabel background_label =new JLabel(background);
Content_Panel.add(background_label);
this.add(Content_Panel, BorderLayout.LINE_START);
//Content ready//
}
}
But i didn't work! Could anyone fix it for me?!
Thx,
Jasper

