This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Java Micro Edition and the fly likes is their any way to get the list in the middle of the screen whit out filling the screen or overwrit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "is their any way to get the list in the middle of the screen whit out filling the screen or overwrit" Watch "is their any way to get the list in the middle of the screen whit out filling the screen or overwrit" New topic
Author

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

Anton Sigurdsson
Greenhorn

Joined: Sep 29, 2011
Posts: 13
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

Joined: Jun 25, 2001
Posts: 16019
    
  20

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10268
    
    8

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


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: is their any way to get the list in the middle of the screen whit out filling the screen or overwrit