Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (763)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (852)
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]
EgonOlsen (525 views)
2018-06-10 19:43:48

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

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

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

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

nelsongames (983 views)
2018-04-24 18:14:32

ivj94 (1547 views)
2018-03-24 14:47:39

ivj94 (559 views)
2018-03-24 14:46:31

ivj94 (1329 views)
2018-03-24 14:43:53

Solater (562 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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!