|
Re: Which is the best component to make 2D games?
|
Posted: Apr 11, 2006 4:34 AM
|
|
> 1. Which is the best component to make 2D games? Is it > Canvas? > Canvas sounds about right.
> 2. Is there any component in the swing library which I can > use instead of the CANVAS? Not that I can thing of but you may use canvas in conjunction with Swing components:
// within a JFrame or dialog
// set up your canvas as follows
// Canvas canv = new Canvas(someConfiguration)
// someConfiguration may be deduced via
// GraphicsEnvironment.getLocalGraphicsEnvironment()
// .getDefaultScreenDevice()
// .getBestConfiguration(template);
// add your canvas to your JDialog or JFrame
getContentPane().add(canv);
> 2. I have a problem, I have JFrame and a CANVAS is added > to the CENTER. When I click on Menu, menu items are drawn > under the canvas and I cannot see anything. I need a > solution please.
probably to do with paint issues (i.e. you may have to introduce a focusListener and make sure you paint your components depending on focus being gained and lost from your menuItems).
If I'm misleading or have misunderstood your Q's, my apologies...
Good luck
|
|