Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (791)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (864)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Newbie & Debugging Questions / Re: JFrames and JPanels on: 2012-01-14 02:39:00
Sorry that few lines of code where I added the Panels to the frame
2  Game Development / Newbie & Debugging Questions / JFrames and JPanels on: 2012-01-14 01:18:09
I have been pulling my hair for days with this now. I simply want to create a black background and then add a JPanel on top of that with a green bg. New to Java and Swing obvisiouly. Over all I want to draw a football field in the panel, that displays 30 yards at a time and the background will scroll up and down following the location of the football. I figured with a panel I could draw the entire field and the panel would clip the remainder of the field. Problem is I cant get the second panel to even show. This is what I have.

public static void main(String[] args) {

        drawPracticeField addField = new drawPracticeField();

        //Create frame

        JFrame backGroundWindow = new JFrame();
            backGroundWindow.setSize(760, 760);
            //Utilizing apsolute positioning
            //make Visible

            //JPanel Background color component

            JPanel backGroundPanel =  new JPanel();

            // add panel to container
            // addNewField JPanel
            backGroundWindow.add(addField).setLocation(50, 40);

public class drawPracticeField extends JPanel{

    public drawPracticeField() {

        JPanel newField = new JPanel();
        Dimension d = new Dimension();
        d.setSize(600, 600);
        Draw outside boarders
        Draw hash marks
        Draw 10 yard lines
        Add Line numbers Line of scrimage to 40 yard line


    protected void paintComponent(Graphics g) {

       Color greenField = new Color (45, 96, 32);



Thank you for any info you can give me.
Pages: [1]
hadezbladez (2894 views)
2018-11-16 13:46:03

hadezbladez (1046 views)
2018-11-16 13:41:33

hadezbladez (2846 views)
2018-11-16 13:35:35

hadezbladez (560 views)
2018-11-16 13:32:03

EgonOlsen (3839 views)
2018-06-10 19:43:48

EgonOlsen (4256 views)
2018-06-10 19:43:44

EgonOlsen (2552 views)
2018-06-10 19:43:20

DesertCoockie (3367 views)
2018-05-13 18:23:11

nelsongames (3480 views)
2018-04-24 18:15:36

nelsongames (4492 views)
2018-04-24 18:14:32
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!