J2ME Canvas grid

I'm using that two classes to generate a table:
http://isengard.metal.pl/TableCanvas.java
and
http://isengard.metal.pl/ScrollableTable.java
(the first one uses the second)
The table is fullscreen but I'd like it to get only 90% of screen heigth and on the top of screen I'd like to put an information about f.e. internet connection etc. The problem is because I've found this Java code illegible and don't know how to move the table to the bottom for a approximately 15 px so that on the top I'd get more place for text. Could you please give me any ideas what should I change?
thank you

Hi, I finally managed to get it to run on my machine (the line vec.copyInto(array); in the TableCanvas constructor threw an exception for me, apparently it doesn't like 2D arrays, so I'm suprised it works for you). But anyway, with the changes I mentioned before it works perfectly fine.
The TableCanvas paint method:
protected void paint(Graphics g) {
          g.setColor(0xffffff);
          g.fillRect(0, 0, getWidth(), getHeight());
          g.translate(10, 25);
          g.setFont(Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_PLAIN, Font.SIZE_SMALL));
          table.paint(g);
          g.translate(-10, -25);
          g.drawString("test", 60, 0, Graphics.TOP|Graphics.LEFT);
     }The ScrollableTable paint method:
public void paint(Graphics g) {
        int cX = g.getClipX();
        int cY = g.getClipY();
        int cW = g.getClipWidth();
        int cH = g.getClipHeight();
        g.setClip(0, 0, viewportWidth, viewportHeight +10);
        g.translate(-viewportX, -viewportY);
        g.setColor(bgColor);
        g.fillRect(0, 0, width, height);
        int currentX = 0;
        int currentY = 0;
        for (int i = 0; i < rows; i++) {
            currentX = 0;
            g.setColor(borderColor);
            g.fillRect(0, currentY, width, borderWidth);
            currentY += borderWidth;
            for (int j = 0; j < cols; j++) {
                if (i == 0) {
                    g.setColor(borderColor);
                    g.fillRect(currentX, 0, borderWidth, height);
                if (j == currentCol && i == currentRow) {
                    g.setColor(bgFocusedColor);
                    g.fillRect(borderWidth + currentX, currentY, colWidths[j], rowHeights);
g.setColor(foreColor);
currentX += borderWidth;
g.setColor(foreColor);
for (int k = 0; k < dataRows[i][j].length; k++) {
g.drawString(dataRows[i][j][k], padding + currentX, padding + currentY + k * (font.getHeight() + interline), Graphics.TOP | Graphics.LEFT);
currentX += colWidths[j];
if (i == 0) {
g.setColor(borderColor);
g.fillRect(currentX, 0, borderWidth, height);
currentY += rowHeights[i];
g.setColor(borderColor);
g.fillRect(0, currentY, width, borderWidth);
g.translate(viewportX, viewportY);
g.setColor(this.foreColor);
g.setClip(cX, cY, cW, cH);
}I have added in g.setColor(foreColor); because otherwise the title would be drawn using the border colour.  And as I said for me it worked fine.  So I'm not sure why it is not working for you.  Try copying the above code exactly into your code and see if there is any difference, if it still does not work then you could send me your files and I'll have a look on my machine if I can get it to work.
p.s. what emulator and IDE are you using?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • J2ME game gui? J2ME Canvas? J2ME polish? Which is better?

    I am currently trying to build a J2ME brochure like project which is required to have rich presentation.
    JAVA is not a problem for me as I've used it for quite a long time. But since I am very new in J2ME, I am confused which technology to use, should I use j2me game gui, j2me canvas or j2me polish?
    Using j2me game gui looks good. J2me canvas looks a bit tedious to me because for a brochure like project, it will mean I will probably end up using a lot of canvas which make the application quite big. Regarding to J2ME polish, there is not many materials or examples about it. it seems that J2ME polish hasn't been used a lot and I don't know whether it's good or not.
    Anybody knows something about those three? Please give me a hand.
    Thanks.

    J2ME Polish have licensing costs associated with it:
    http://www.j2mepolish.org/licenses.html
    As for Canvas VS GameCanvas:
    GameCanvas is MIDP 2.0 and up, so depending which devices your app supports you might want to stick with Canvas. GameCanvas eases graphics flushing, but double buffering can be implemented on Canvas like so:
    Image offscreen = isDoubleBuffered () ? null :
               Image.createImage (getWidth (), getHeight ());See http://www.developer.com/java/j2me/article.php/10934_1561591_8
    section: Avoiding Flickering

  • J2ME - Canvas - repaint

    Hi,
    I have a stupid question. As far as I know the Canvas class of J2ME doesn't have getGraphics() method. That means, that I can't get the graphic representation of the Canvas object and so I can't make changes calling the properly methods of the Graphics class.
    However, the repaint() method is the only way, to do this?
    Say, I want to draw a string to the screen when the user hits a button.
    How can I do this?
    Thanks in advance,
    holex

    Hi!! I�ve a little problem, when i used repaint() method, the canvas don�t clear.
    int k=0;
    protected void pointerPressed( int x, int y){
    if (((x>0) && (x<5)) && ((y>0)&& (y<5))){
    k=1;
    repaint();
    protected void paint(Graphics g) {
    if (k==0) {
    g.drawRect(0,0,5,5);
    if (k==1) {
    g.drawRect(1,10,10,10);
    For example, when k=0 the canvas draw a rectangle, and when k=1 the canvas draw another rectangle, but i want to erase first rectangle and it�s not occur when i used repaint() method. Please, what i need to do ?

  • J2ME Canvas and Form Objects

    I am currently in the process of converting an existing MIDP application which uses the standard high-level UI to implement menus and form objects.
    I am converting this to use the low-level UI with canvases to make the application look far more professional. There seem to be no decent tutorials realting to using the canvas to with relation to menus or user input.
    Is it possible to add the standard TextField and ChoiceGroup types into a canvas? If not, how are these implemented in existing MIDP applications that clearly use a canvas.
    Thanks for any help that you might be able to give,
    Dave

    umm abit of athread revivial but it seems that using j2me polish is more hard work than using standard j2me. This is because you need to know abit of xml and css to take full advantage of j2me polish.
    still is that the only way to create a form in a canvas?

  • Timer in j2me canvas

    Hi,
    I want to implement timer in my mobile game,that will start from 5and go to 0
    timer will show hours:min:sec:milisec
    on screeen .
    plz tell me if anybody know

    Hi,
    You can start a separate Thread that keeps updating the time drawn on the Canvas. You are working with which version of MIDP ?
    -Priyanka

  • How to draw  blinking coursor on J2ME canvas.?

    Hi..esperts
    I have draw a TextField on canvas. i want to draw a blinking cursor on TextField also.
    cursor will change position as characters are drawn in TextField .
    how i can do that.
    please suggest me.
    Thanks and Regards

    Don't cross post. Once is enough.
    I'm locking this thread. All responses on
    [http://forums.sun.com/thread.jspa?threadID=5345819]
    db

  • (Java ME/J2me) Canvas Vertical Scroll Problem

    Hi i have spent a couple of days creating a small canvas bassed application i hours on a glitch trying to figure out why the myscreen.translate() will not let me scoll down verticly more than two pages can anyone see the problem ?
    import javax.microedition.lcdui.*;
    public class MobileLifeList extends Canvas {
    private Font Myfont = Font.getDefaultFont();
    private int LEFTSOFTKEYCODE =  -6;
    private int RIGHTSOFTKEYCODE = -7;
    private String[] ListItems;
    private Image[] ListImages;
    private int SelectedIndex = 0;
    MobileLife midlet;
    private int Amount = 0;
    public int mywidth;
    public int myheight;
    private int PageMode;
    public int ooscounter;
    private int MyPerPage;
    public int Page = 1;
    MobileLifeList(MobileLife mymidlet,String[] items,Image[] images){
    this.midlet     = mymidlet;
    this.ListItems  = items;
    this.ListImages = images;
    protected void paint(Graphics myscreen){
    int mywidth = myscreen.getClipWidth();
    int myheight = myscreen.getClipHeight();
    myscreen.setColor(0xffffff); //WHT
    myscreen.fillRect(0,0,mywidth,myheight);
    MyPerPage = myheight/Myfont.getHeight() - 1 * Page;
    if(ooscounter>=MyPerPage){
    myscreen.translate(0,-myheight * Page);
    for(int i=0; i<=ListItems.length - 1; i++){
    if(i!=ListItems.length){
    if(SelectedIndex==i){
    myscreen.setColor(0x000000); //BLK
    } else {
    myscreen.setColor(0xFFFFFF); //BLK
    myscreen.fillRect(0,(Myfont.getHeight() + 1) * i,mywidth,Myfont.getHeight());
    if(SelectedIndex==i){
    myscreen.setColor(0xFFFFFF); //BLK
    } else {
    myscreen.setColor(0x000000); //BLK
    myscreen.drawString(ListItems,0,(Myfont.getHeight() + 1) * i, Graphics.TOP|Graphics.LEFT);
    protected void keyPressed(int keyCode) {
    String TheMobileAgent = System.getProperty("microedition.platform");
    if(TheMobileAgent.indexOf("Vodafone")>=0 || TheMobileAgent.indexOf("Panasonic/X60")>=0 || TheMobileAgent.indexOf("Sharp")>=0 || TheMobileAgent.indexOf("Panasonic/X60")>=0){
    LEFTSOFTKEYCODE = 21;
    RIGHTSOFTKEYCODE = 22;
    if(TheMobileAgent.indexOf("Motorola")>=0 || TheMobileAgent.indexOf("GX15")>=0 || TheMobileAgent.indexOf("GX25")>=0){
    LEFTSOFTKEYCODE = -21;
    RIGHTSOFTKEYCODE = -22;
    if(TheMobileAgent.indexOf("Siemens")>=0){
    LEFTSOFTKEYCODE = -1;
    RIGHTSOFTKEYCODE = -4;
    if(TheMobileAgent.indexOf("Sagem")>=0){
    LEFTSOFTKEYCODE = -7;
    RIGHTSOFTKEYCODE = -6;
    if(TheMobileAgent.indexOf("Qtek")>=0 || TheMobileAgent.indexOf("T-Mobile/MDA")>=0|| TheMobileAgent.indexOf("Verizon/XV8600")>=0 || TheMobileAgent.indexOf("Samsung/Blackjack")>=0) {
    LEFTSOFTKEYCODE = 57345;
    RIGHTSOFTKEYCODE = 57346;
    if(TheMobileAgent.indexOf("Sony-Ericsson/W910i")>=0 || TheMobileAgent.indexOf("Nokia/2630") >=0|| TheMobileAgent.indexOf("Nokia/3110_classic") >=0 || TheMobileAgent.indexOf("Nokia/3110c") >=0 || TheMobileAgent.indexOf("Nokia/3500_classic") >=0){
    LEFTSOFTKEYCODE = -3;
    RIGHTSOFTKEYCODE = -4;
    if(TheMobileAgent.indexOf("Sony-Ericsson/M")>=0|| TheMobileAgent.indexOf("Sony-Ericsson/P")>=0){     
    LEFTSOFTKEYCODE = -7;
    RIGHTSOFTKEYCODE = -6;
    if(TheMobileAgent.indexOf("Samsung/B2700")>=0){          
    LEFTSOFTKEYCODE = -5;
    RIGHTSOFTKEYCODE = -7;
    if(TheMobileAgent.indexOf("Sony-Ericsson/T303")>=0){
    LEFTSOFTKEYCODE = -6;
    RIGHTSOFTKEYCODE = -10;
    if(keyCode==LEFTSOFTKEYCODE){
    System.out.println("LEFT softkey Pressed");
    MobileLifeCanvas mListCanvas = new MobileLifeCanvas(midlet);
    Display.getDisplay(midlet).setCurrent(mListCanvas);
    if(keyCode==RIGHTSOFTKEYCODE){
    System.out.println("Right softkey Pressed");
    int act = getGameAction(keyCode);
    int PerPage = myheight/Myfont.getHeight() - 1;
    if(act==Canvas.UP){
    if(SelectedIndex > 0){
    SelectedIndex--;
    ooscounter--;
    if(act==Canvas.DOWN){
    if(SelectedIndex != ListItems.length - 1){
    SelectedIndex++;
    ooscounter++;
    System.out.println("Index:" + SelectedIndex);
    repaint();
    Thankyou,
    Rob                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    ...how can i access myscreen varible outside of my paint function?Why don't you call the variable myGraphics? myscreen is a confusing name for a variable that refers to Graphics object because there's quite a different class Screen in MIDP API.
    As for accessing Graphics from outside of paint, I am not sure if that's a good idea. If memory serves, it can change in different invocations of paint (check the Canvas class javadocs for details if you're interested).
    To have a reliable reference to Graphics, I would rather use GameCanvas (it's a subclss of Canvas with some additional features).

  • A question about j2me Canvas?

    I want to draw a n-point ploygon, and fill some color in this ploygon, please help me, I cannot get a way to solve this problem?

    Hi , I hava download jmicropolygon_midp2-1.0.jar.
    and use
    private int[] xpoint = { 10, 100, 100, 50, 50, 30, 30, 10,10 };
    private int[] ypoint = { 10, 10, 70, 70, 40, 40, 100, 100,10 };
    g.setColor(255, 255, 255);
         g.fillRect(0, 0, getWidth(), getHeight());
         g.setColor(255,0,0);
         PolygonGraphics.drawPolygon(g,xpoint,ypoint);
    but it doesn't work.
    can you tell me how to use it?
    Thanks!!

  • Which one is better to use..Canvas or J2ME Polish

    Hello Frnds,
    I want to add background images n want to use High level GUI, So is the polish be a good option for it , or should I go for simple j2me canvas n write my own low level... GUI like construct .....or should go for Synclast 3rd party API. library......

    I've J2ME Polish on a few projects, and it can be really nice. But sometimes you just need more, you need pure Canvas flexibility. And for that (and for 90% of my projects) I use synclast. It's a canvas based container toolkit, it allows you to do a LOT with a canvas, and you can also extend it very easily to create your own widgets for the UI.
    http://synclast.com/ui_api.jsp
    don't download the release build, it's REALLY old, download the source and compile your own jar for a much more up-to-date library.

  • Manipulation of LongRaw objects.

    Hi all!
    I have an application in which I am using OLE Container item
    to embed employees photographs into the Oracle table. The field
    is defined as a LONG RAW. I wanted to fetch the photograph of
    the employee based on the employee number entered by the user.
    One way is to make a base table form and use execute_query built
    in. This works. But I require a control block and need to get
    the Long Raw field into a variable and then assign it to the
    forms bind variable. How to go about it??
    Pl. treat this as URGENT..
    Thanks..
    Srini
    null

    Hi Matt,
    So I have implemented a function that computes a new RenderTransformOrigin (RTO) for each object in a group. The new RTOs are computed around the center of the group of objects. Then transforms are applied in a loop and the objects will rotate as a group
    around the common center. It's great!
    However, if the object is scaled, then when the new RTO is applied, the object shifts. I have not been able to discover the mathematical relationship so I have not been able to compensate for this. Consider the following XAML:
    <Grid Background="White">
    <Canvas Width="772" Height="772" Background="#330000FF" RenderTransformOrigin="0.5,0.5">
    <Rectangle Width="200" Height="200" Fill="Red" Canvas.Left="286" Canvas.Top="286" />
    <Canvas.RenderTransform>
    <CompositeTransform TranslateX="0" TranslateY="0" ScaleX="0.439999997615814" ScaleY="0.439999997615814" />
    </Canvas.RenderTransform>
    </Canvas>
    </Grid>
    If ScaleX and ScaleY are 1.0, then you can change the RTO to anything (0.5, 0.25 for example) and the canvas will remain where it is, ready for further transformations. However, if the scale values are not 1.0, then the object will shift whenever the new
    RTO values are applied.
    Can you shed some light on what is happening here?
    Thank you,
    Thaine Norris

  • Suggestions - Vertical Ruler or the ability to set horizontail guides for various view ports.

    The suggestion link seems to be broken so I am posting here in hopes someone will see it. Edge Reflow would benefit greatly from the addition of a vertical ruler. Unless this is a view aready that I am somehow missing. Also it would be cool to be able to set a horizontal guides in the canvas grid (DOM). This would help in allowing the user set a guide for multiple viewing areas.
    And the pie in the sky, Santa Claus Christmas list of all request would be the ability to "blend" break points. It would be cool to set a 2000px view and a bookend break-point at 1024px, work both compositions to the desired look and have a "blend tool" that scales all the elements to the desired look form 2000px to 1024px.

    Hi Bobby, thanks for the suggestions!

  • Dividing integers never returns double, no round function?

    can someone explain why this is happening
    int myInt1;
    double myDouble;
    myInt1 = 160
    myDouble = myInt / 100;
    myDouble == 1.0 ????
    Also... I need to be able to use the round to int function but I can not seem to find it? Im doing the following...
    import java.lang.Math;
    tempInt = Math.round(myDouble);
    but im getting a messaging saying round not found???
    would the fact im doing this in a extension of a J2ME canvas make a difference?
    Please Help!
    Daniel

    myInt/100 is an int expression, so the result is 1. The result is then cast to double for the assignment. For double arithmetic, at least one of the terms has to be double. Either cast myInt to double, or use 100.0 as the divisor.
    For whatever reason (probably to save space), Math.round was not included in the CLDC 1.1 spec. Just do it the old fashioned way: (int) (someDouble + 0.5)

  • How to add canvas to the background of a form in j2me

    I am new to j2me. I am developing a mobile application in j2me. Is there a way of adding a canvas object to the background of a form? I tried searching in net with few people suggesting to use "jmepolish". I have no idea what jmepolish is..Is there a way to do this with normal j2me classes?

    Short answer: You can't. There are two types of Displayables (javax.microedition.lcdui.Displayable): Screen items and the Canvas item.
    You have no control of the appearance of Screen items: Alert, Form, List, TextBox. The implementation(phone maker) decided the appearance of those items. You can only alter the appearance of Canvas and GameCanvas.
    If you want to change the appearance of a Form you should check out something like LWUIT or J2ME Polish.

  • Grid in Canvas window?

    Is it possible in the canvas window to put up a grid to align text more effectively?
    It is hard to align text just by eye. I know in avid you can put up a grid as a guide to align text, can you do the same in FCP? Also when using the Basic Motion controls, is it possible to nudge items or text using keystrokes as opposed to using just image and wireframe, where you grab text and move it manually?
    Thanks
    Patch

    free plugin:
    http://www.digital-heaven.co.uk/fcplugins/dh_grid.php
    there is also a guides plugin

  • Can icons be moved manually (rather than connected to the grid) on the Magic Canvas / TouchSmart​?

    Can icons be moved manually (rather than connected to the grid) on the Magic Canvas / TouchSmart?

    I want to be able to arrange the icons myself on the MC.
    Unfortunately, I don't think this is possible. These are the only settings available for the Magic Canvas related to desktop icons:
    Strangely enough, none of my desktop icons show up when this is enabled though

Maybe you are looking for

  • How do I register my address with BT?

    Hello! I recently moved to a newly built flat, part of new development. The address is register with royal mail and water. The landlord did receive a letter from BT but the last two letters of the postcode was incorrect. I was informed by the landlor

  • Subsequent Lookup Operators causes OWB to generate undeployable mappings

    Hi, I am using OWB 11gR2 . I am trying to create a fact loading mapping based on datavault. That gives me error during deployment. Validating and Generate doesn't give me an error. So in trying to load the fact i tie various datavault tables together

  • Interactive Image - Text Gets Cut Off

    Please see image - When second line (unbolded text) is not as lengthy as first line (bolded text) it cuts off. Is this a glitch or can I fix this somehow?

  • Why is UTL_DBWS is doing a POST when calling a webservice??

    Hi everyone, I was testing the UTL_DBWS package with a 10.2.0.2.0 database to get a call to a webservice on an Oracle AS. My PL/SQL code is like this: declare l_service sys.UTL_DBWS.service; l_call sys.UTL_DBWS.call; l_result ANYDATA; l_wsdl_url VARC

  • Problem after importing mail to Mail 2.1.3

    Hi, Imported mail from another G4 and all email within the Sent Items folder is displaying as from and date received instead of to and date sent. Anybody any ideas on how I can fix this? It's driving me potty!