Advertisement

08.12.2007 at 03:14PM PDT, ID: 22757759
[x]
Attachment Details

How to horizontally and vertically expand CustomItem?

Asked by UrosVidojevic in Java 2 Micro-Edition (J2ME)

Tags: customitem, j2me

Dear J2ME Experts,

I have written a subclass of CustomItem named MyCustomItem.
I want to add the object of this class to myForm (Form object) so that added MyCustomItem object is maximally horizontally and vertically expanded.
Of course, this MyCustomItem object would be the only item on this form.

This is the code sample that I used:

MyCustomItem myitem = new MyCustomItem();
myItem.setLayout(Item.LAYOUT_EXPAND | Item.LAYOUT_VEXPAND);
MyForm myform = new MyForm();
myform.append(myitem);

The problem is that getPrefContentWidth() and getPrefContentHeight() methods of MyCustomItem must be overrided, and it is obvious that J2ME LayoutManager uses this values to calculate dimensions of myitem, and ignores my requests for expanding.

Of course, now,  in the code-writting time I don't know user-screen dimensions so I can't return valid values from this methods.

I would really appreciate any help on this subject,
Thank you in advance,
Uros VidojevicStart Free Trial
[+][-]08.12.2007 at 05:01PM PDT, ID: 19680560

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.13.2007 at 12:04AM PDT, ID: 19681860

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.13.2007 at 02:21AM PDT, ID: 19682309

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Java 2 Micro-Edition (J2ME)
Tags: customitem, j2me
Sign Up Now!
Solution Provided By: jimmack
Participating Experts: 2
Solution Grade: A
 
 
[+][-]08.13.2007 at 04:03AM PDT, ID: 19682728

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.13.2007 at 04:56AM PDT, ID: 19683066

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628