Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (623)
Games in Android Showcase (176)
games submitted by our members
Games in WIP (676)
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  
  ImageIcon vs BufferedImage  (Read 2810 times)
0 Members and 1 Guest are viewing this topic.
Offline Achri

Junior Newbie

« Posted 2013-06-06 23:21:08 »

I am still struggling with the best way of using images in Java Game design.

Do you use ImageIcon or BufferedImage? Or Both?  Don't mix AWT and SWING is the golden rule I have found. ImageIcon is in the SWING library and BufferedImage is in AWT.
When every resource, whether it be new/old/magazine/book/article uses one or the other, it's very hard to figure out what is the "proper" course of action.

I have many resources and have performed a lot of searches:
Killer Game Programming in Java by Andrew Davison, which is outdated but still useful
thenewboston's tuts:
realtutsGML's tuts:
the java docs ofc
lots of other articles

Offline Troncoso

JGO Coder

Medals: 20

« Reply #1 - Posted 2013-06-06 23:55:12 »

Use BufferedImage.

Or, if you are serious about Java Game Development, use some sort of gaming library that uses OpenGL for rendering images(LWJGL, JMonkey, Sick2D, LibGDX to name a few).
Offline Jimmt
« League of Dukes »

JGO Kernel

Medals: 163
Projects: 5
Exp: 3 years

« Reply #2 - Posted 2013-06-07 00:05:28 »

Not mixing Swing and AWT usually refers to GUI components. If you want to do any graphics at all, you're going to have to use AWT for painting. But for user interface (button, window, menu, etc) use Swing or JavaFX.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline gimbal

JGO Knight

Medals: 26

« Reply #3 - Posted 2013-06-07 12:08:29 »

Even if I use an ImageIcon in a Swing app, I tend to construct it from a BufferedImage anyway just to have consistent "ImageIO-proof" images anywhere in my application.

But if I create a Swing application it tends to be a tool for game development purposes and it will likely do image manipulation things anyway.
Offline Achri

Junior Newbie

« Reply #4 - Posted 2013-06-08 01:15:16 »

Thanks for the replies. I learned Libgdx, but was trying to do some design a little closer to the native Java libraries.
Offline Jimmt
« League of Dukes »

JGO Kernel

Medals: 163
Projects: 5
Exp: 3 years

« Reply #5 - Posted 2013-06-08 01:38:55 »

Why? TableLayout is so much better Grin
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

BurntPizza (14 views)
2015-10-07 02:11:23

KaiHH (13 views)
2015-10-06 20:22:20

KaiHH (11 views)
2015-10-06 19:41:59

BurntPizza (23 views)
2015-10-06 19:04:48

basil_ (44 views)
2015-09-30 17:04:40

shadowstryker (22 views)
2015-09-29 15:55:06

TheSpaceHedgehog (28 views)
2015-09-29 01:58:48

GamerC4 (54 views)
2015-09-24 21:10:38

GamerC4 (71 views)
2015-09-24 21:09:48

htuy (28 views)
2015-09-24 04:57:24
Math: Inequality properties
by Roquen
2015-10-01 13:30:46

Math: Inequality properties
by Roquen
2015-09-30 16:06:05

HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36 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!