Talk:Creating LCDUI Custom Components: CategoryBar
Hamishwillee - Subedited/Reviewed
Really nice article again. I've given it a minor subedit for wiki style and to improve readability (IMO). Wouldn't have been a problem if I'd left as was as most of the changes are for taste. Anyway, please check.
So general stuff, I like the abstract to be one line if possible - hence that change! I use "thumb" or "frame" for single images other than gallery.
Wasn't sure what categories to use - but decided that even though this has some useful code working with "Files/Data on Java ME", mostly this is not an article about files data and so doesn't belong there. It does belong in LCDUI and "Graphics on Java ME". I am considering whether we also need another category "Custom Components in Java ME" (Thoughts?)
In terms of "room for improvement", again I would suggest you talk to Stratos. Most of it made sense to me as a "non Java developer". I did think "However, when you want to access the new methods of the custom category bar, it has to be cast into itself." might be worth showing and also that " CustomCategoryBar.getNewInstance" implementation might be useful if this is something that again shows of the detail of how the inner class abstraction works.
In the draw function you do:
graphics.drawString(TAB_TITLES[_categoryBar.getSelectedIndex()], MARGIN, MARGIN, Graphics.TOP | Graphics.LEFT); _categoryBar.paint(graphics, getHeight() - CustomCategoryBar.HEIGHT);
I didn't understand this - firstly why doesn't the categorybar paint its own tab titles? Secondly, why is the bar drawn after (and presumably over) the text? Probably something a Java person would just understand.
06:56, 28 June 2013 (EEST)
Tomi - Thanks
You make very good points. I'll try to address them at some point.
About the draw function: The category bar does not care about what it is used for. It doesn't know or care what tab is shown. Paint the content of the tab is the responsibility of the canvas. Tab titles are drawn on the top and the bar itself on the bottom so they won't overlap.
I'm not sure how many wiki articles would fall under the "Custom Components" category. Might want to wait and see if there will be more.
12:16, 28 June 2013 (EEST)
Hamishwillee - ThanksThanks for explaining the category bar - makes sense. Might be worth making the point in the article - up to you.
07:57, 1 July 2013 (EEST)