Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (476)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
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: Noobest question ever. on: 2005-05-23 18:33:48
I took a java course, but the most advanced topic it covered was threads, so it wasn't a lot of use, but I have learned a lot from this forum, and some tutorials on the net. The one that has helped me most was probably this space invaders one.. http://www.planetalia.com/cursos/index.jsp
it doesn't go into a lot of detail, but after months and months of messing with the code, using techniques from other tutorials, and reading posts on this board, I've almost finished my first main project, and learnt a hell of a lot more than my course could ever teach me.
2  Game Development / Newbie & Debugging Questions / Re: Jar and JFrame problems on: 2005-02-14 17:18:00
Ok, I had to modify this post. The main problem was my filenames. I was mis-spelling my image names. The only *real* problem is with my scrolling background code. I can sort that out easily enough.

Stupid me  :-/

Thanks
3  Game Development / Newbie & Debugging Questions / Re: Jar and JFrame problems on: 2005-02-13 13:37:40
The actual JFrame closes fine, but for the split second it appears, its blank. Could it be a problem with the resources in the Jar file?

public class FrontEnd extends Canvas implements Stage, KeyListener {
......
public static void main(String[] args) {
           FrontEnd front = new FrontEnd();
           front.game();      
     }

     public FrontEnd() {
           // Initialise New Window
           spriteCache = new SpriteCache();
           soundCache = new SoundCache();

           JFrame ventana = new JFrame("RA Invaders");
           JPanel panel = (JPanel) ventana.getContentPane();
           setBounds(0, 0, Stage.WIDTH, Stage.HEIGHT);
           panel.setPreferredSize(new Dimension(Stage.WIDTH, Stage.HEIGHT));
           panel.setLayout(null);
           panel.add(this);
           ventana.setBounds(0, 0, Stage.WIDTH, Stage.HEIGHT);
           ventana.setVisible(true);
           ventana.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
           ventana.setResizable(false);
           createBufferStrategy(2);
           strategy = getBufferStrategy();
           requestFocus();

           addKeyListener(this);
           setIgnoreRepaint(true);
           BufferedImage cursor = spriteCache.createCompatible(10, 10,
                       Transparency.BITMASK);
           Toolkit t = Toolkit.getDefaultToolkit();
           Cursor c = t.createCustomCursor(cursor, new Point(5, 5), "null");
           setCursor(c);
           
     }
..........
public void game() {
           // INITIALISE GAME //
           initGame();
           initLevel();
           
                 while (isVisible()) {
           t++;
           long startTime = System.currentTimeMillis();
           checkForEndOfLevel();
           updateWorld();
           checkCollisions();
           paintWorld();
           usedTime = System.currentTimeMillis() - startTime;
           do {
                 Thread.yield();
           } while (System.currentTimeMillis() - startTime < 17);
     }
     }
......

That's basically the main part of the code that deals with the JFrame, if you need anything else, I'll post/email it.
Any ideas?
4  Game Development / Newbie & Debugging Questions / Jar and JFrame problems on: 2005-02-13 13:01:49
Hi, and sorry for this topic.

My program runs fine as an application in Eclipse. But when I try to run the Jar file, the JFrame opens, then closes again, straight away. It doesn't do this on an earlier version of the game, nor when run in Eclipse, and i cannot see any changes that would cause this to happen. I'm stumped.  Huh There's no code that would cause it to close, apart from setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)

Any help at all would be appreciated. I know its a pretty vague topic, so if anyone would help, I'll email the Jar's, or whatever you need.

Thanks
5  Game Development / Newbie & Debugging Questions / Re: Bit of help with JFrame window listener on: 2005-01-29 19:01:39
Hmm, it didn't start out as an applet, but thanks, that's all I needed.
6  Game Development / Newbie & Debugging Questions / Re: Bit of help with JFrame window listener on: 2005-01-29 18:12:39
Oh, haha. I just figured it out.  Grin
Closing the original window kills the applet and JFrame. Very sloppy, but it'll do for now.
7  Game Development / Newbie & Debugging Questions / Bit of help with JFrame window listener on: 2005-01-29 17:59:27
Hey guys.
I'm new to the boards, and relatively new to Java compared to most  Tongue

I wrote a game, in a JFrame, as an application. Now, to change it to an applet, it works fine, running it in a browser. (Haven't tried hosting it yet). The only problem is closing the window.
Here is the code for my windowListener part:


     JFrame ventana = new JFrame("RA Invaders");
     JPanel panel = (JPanel) ventana.getContentPane();
     setBounds(0, 0, Stage.WIDTH, Stage.HEIGHT);
     panel.setPreferredSize(new Dimension(Stage.WIDTH, Stage.HEIGHT));
     panel.setLayout(null);
     panel.add(this);
     ventana.setBounds(0, 0, Stage.WIDTH, Stage.HEIGHT);
     ventana.setVisible(true);
     ventana.addWindowListener(new WindowAdapter() {
           public void windowClosing(WindowEvent e) {
                 System.exit(0);
                 
           }
     });
     ventana.setResizable(false);
     createBufferStrategy(2);
     strategy = getBufferStrategy();
     requestFocus();


So, I have to put somewhere the dispose() and setVisible(false) somewhere. Or do I have to add a windowListener to the class that extends JApplet? The code above is in another class called FrontEnd, which just has its main/init() method called from a class that extends JApplet. When I ran it, I ended up having the small applet window pop up, then the JFrame window pop up. Realistically, I want the JFrame in the original webpage, but I just want the window to close for now  Wink

Any help at all would be appreciated.
Jay
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (22 views)
2014-07-24 01:59:36

Riven (20 views)
2014-07-23 21:16:32

Riven (17 views)
2014-07-23 21:07:15

Riven (20 views)
2014-07-23 20:56:16

ctomni231 (48 views)
2014-07-18 06:55:21

Zero Volt (44 views)
2014-07-17 23:47:54

danieldean (35 views)
2014-07-17 23:41:23

MustardPeter (38 views)
2014-07-16 23:30:00

Cero (53 views)
2014-07-16 00:42:17

Riven (52 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org 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‑gaming.org
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!