File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is their any way to get the list in the middle of the screen whit out filling the screen or overwrit

 
Anton Sigurdsson
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi.

i got this code this is the draw stuff. its works great bat when i wont to use the list. like new game and load and exit, the are command i mad. it fills the screen. and the list is up in the upper left corner. and its overwrites the display filling the screen whit the list.

what i wont the list to do is to by in the middle of the screen on top of the draw stuff.

Image backGround= Image.createImage("/MenuImage.png");
g.drawImage(backGround, 0, 0, Graphics.TOP | Graphics.LEFT);

i do no this menu overwrites canvas
display.setCurrent(canvas);
display.setCurrent(menu);

is their any way to get the list in the middle of the screen whit out filling the screen or overwrite the nice background using the drawImage in canvas?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17621
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Anton!

Screen layout can be tricky, especially if you're trying to create a general-use program where people can be using devices whose screens are many different sizes and shapes.

For basic control layout, usually there's a layout manager that you can instruct on how to align components (left/right/center, top/middle/bottom).

If you're doing custom controls inside a Canvas, you'll have to do the work yourself. The center point is, of course w/2, h/2, where w and h are width and height of the Canvas object that you want to center the graphics in. And the top/left corner of the control would then be w/2 - bw/2, h/2 - bh/2, where "bw" and "bh" are the box width and box height of the control itself.
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frankly speaking the UI and controls offered by basic MIDP is very basic, to put it in a nice way.
For more control over component placements, layouts and a richer user experience, I would recommend using something like LWUIT
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic