Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (404)
games submitted by our members
Games in WIP (289)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Drawing game in a Frame  (Read 981 times)
0 Members and 1 Guest are viewing this topic.
Offline MBrenaman

Junior Member




Javanaut


« Posted 2004-09-06 19:16:24 »

Hi, I've got a problem that I'm really not sure how to remedy.

I'm converting my fullscreen arcade game over to windowed version, actively rendered in a AWT Frame.

The problem is that the origin of the frame is under the top bar of the windows created, so everything drawn at the top and left-most edges of the graphics context isnt shown.

Is there a way around this?

-Mathew Brenaman
Offline MBrenaman

Junior Member




Javanaut


« Reply #1 - Posted 2004-09-06 20:37:02 »

Sorry nevermind I got it. I'm new to using AWT/Swing. I decided to go with a JFrame instead. I just made a Canvas, added to the JFrame's content pane, drew to it, and it was placed below the title bar.

-Mathew Brenaman
Offline CaptainJester

JGO Knight


Medals: 10
Projects: 2


Make it work; make it better.


« Reply #2 - Posted 2004-09-07 18:24:55 »

You should use JPanel instead of Canvas.  Since Canvas is awt and JFrame is swing.  Swing and awt do not play well together and you may experience problems that you cannot track down the cause for.

Games published by our own members! Check 'em out!
Play the free demo of Revenge of the Titans!
Offline MBrenaman

Junior Member




Javanaut


« Reply #3 - Posted 2004-09-08 12:40:16 »

Well, if I use a JPanel then I can't get to the BufferStrategy stuff right. I need it for active rendering. Thats what it seems like from the API and of course the errors I get from compilation. I could just switch my JFrame to a Frame. The only reason I used a JFrame was for the EXIT_ON_CLOSE. I could easily just add a my own WindowListener to the Frame for that effect  Smiley.

-Mathew Brenaman
Offline DannyFromTower

Senior Newbie




Java games rock!


« Reply #4 - Posted 2004-09-09 00:39:12 »

JFrame inherits Window.getBufferedStrategy()
JPanel inherits JComponent.setDoubleBuffered()

What are you trying to achieve with the buffer strategy?
Offline MBrenaman

Junior Member




Javanaut


« Reply #5 - Posted 2004-09-09 09:01:37 »

Just double buffering for 2d sprites and animation. Will the JComponent.setDoubleBuffered() work just the same? I'll try it out  Cheesy

-Mathew Brenaman
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (45 views)
2013-05-17 21:29:12

alaslipknot (54 views)
2013-05-16 21:24:48

gouessej (83 views)
2013-05-16 00:53:38

gouessej (82 views)
2013-05-16 00:17:58

theagentd (91 views)
2013-05-15 15:01:13

theagentd (84 views)
2013-05-15 15:00:54

StreetDoggy (128 views)
2013-05-14 15:56:26

kutucuk (150 views)
2013-05-12 17:10:36

kutucuk (150 views)
2013-05-12 15:36:09

UnluckyDevil (160 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.076 seconds with 20 queries.