Latest messages

79 topics, 214 messages
Kuix general board » button on a picture..

dfdffd

Kuix general board » button on a picture..

Uhmmm realmente que quieres hacer???? poner una imagen en un boton o al contrario!!!???

Ummm what you really wanna do!!!?? put an imagen on a button or vice versa?????

Saludos desde Colombia!!

Greetz From Colombia!!!

Kuix general board » button on a picture..

as I can put a button on an image?...i try with include but dont work¡¡

please help

Kuix general board » What About Jquery!!!???

Hi everybody, Im a newbie in j2me, but really kuix is interesting!!!!!

I'm a desktop and web apps developer but I wanted to take one more step!!!! THE J2ME PROGRAMMING!!!, hahah I got a question about KUIX, there's any way to use jquery code inside of it????

I would like to help to improve this feature, I've been searching on the web, I couldn't find something similar to this feature in J2ME

(SORRY I'M NOT AN ENGLISH NATIVE SPEAKER, SO, THERE'S WORDS THAT I THINK ARE WRONG!!)

GREETZ FROM COLOMBIA, AND I HOPE SOME ACTIVE PROGRAMMERS LIKE ME, HELP ME !!! 

Kuix general board » Newbie to the world of Mobile development

Hello Everyone,

e-Greetings,

I'm a web developer. But I'm eager to start mobile application development.

In fact, I've been asked to write a client-server mobile application, where PHP

serves some content for the client application, which is hosted on user's cellphone.

The Client application is responsible to display a list of menus to the user. Once the

user clicks on an item, a SMS message will be send to a specific number. Some

magic happens here, and finally PHP recieves the SMS. Depending on the SMS's content,

a result is generated and will be send back to the cellphone using SMS.


Now I find kalmeo. Without any Java experience, I'm trying to start using it.

Since it can handle HTML and CSS, some of it sounds familiar to me.

But I have a few questions:

 

How can I send SMS messages? Is this possible using kalmeo?

How kalemo handles different screen resoulutions?

Is kalmeo a good solution to implement the above scenario?

 

Please let me know.

Thank you very much in advance.

Kuix general board » 52 – Error in HTTP operation

 

Hi,

I’m programming a application which connect to PHP server by using httpConnection.

I used DataProvider to create objects corresponding with tables in database.

However, when I connect to server, it’s has a error message “52 – Error in HTTP operation”. I checked and found error with command: http.openInputStream();

When I tried to connect from a basic MIDLET, everything was working fine.

I’ve just learned about KUIX. I’m looking forward to your help.

Thank you so much!

 

Kuix general board » KUIX midlet does not start on Nokia phones

Right click on your  project and select Properties. In the dialog window, select Application Descriptor and click on Tab MIDlets. and click on Add and write name of class and location +ok  +clean and build your project.

Kuix general board » Image From Url

If you have an ID of picture, you can setImage for this by way:

1. Download Image from URL.

2. Get widget instance of Picture by ID

3. Set Image for widget.

 

Thanks!

Kuix general board » Load xml from server

is it possible to load the xml from a server. rather than local.i see the method load screan can take an input stream so could an xml file be placed on a server then loadedthru input stream.

Kuix general board » Fixed TextField Size

Got it!

 

1) Create new  TextField and repalce by one below

2)_ I have only

         i ) overwriten -----    public Metrics getPreferredSize(int preferredWidth)

         ii  changed --------  protected String getDisplayedText()

         iii added utili method --------- private int getMaxSizeWidth() {

3) to specify min size for text

          i) on the xmal   <textfield style="min-size:200  0; ......." />

          ii) or on the css textfield {  min-size: 160 0;  }

4) To specify maxsize

                   i) use ither only the min size above as min and max .

                   ii )or use only the xml maxsize an as min and max. <textfield style="..."  maxsize="10"/>

              iii) or use both to specify min and max <textfield style="min-size:80  0; ......."  maxsize="20"/>

         Please note tha above specifies min as 10 (8*10) chars and max as 20 chars.

 

Enjoy,

 

 

 

/*
 * This file is part of org.kalmeo.kuix.
 *
 * org.kalmeo.kuix is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * org.kalmeo.kuix is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with org.kalmeo.kuix.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Creation date : 21 nov. 2007
 * Copyright (c) Kalmeo 2007-2008. All rights reserved.
 * http://www.kalmeo.org
 */
package org.kalmeo.kuix.widget;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.TextBox;

import org.kalmeo.kuix.core.Kuix;
import org.kalmeo.kuix.core.KuixConstants;
import org.kalmeo.kuix.util.Alignment;
import org.kalmeo.kuix.util.Color;
import org.kalmeo.kuix.util.Insets;
import org.kalmeo.kuix.util.Metrics;
import org.kalmeo.util.BooleanUtil;
import org.kalmeo.util.StringTokenizer;
import org.kalmeo.util.worker.Worker;
import org.kalmeo.util.worker.WorkerTask;

/**
 * This class represents a textfield. <br>
 * <br>
 * <strong>For further informations, visit the <a
 * href="http://www.kalmeo.org/files/kuix/widgetdoc/index.html"
 * target="new">Kuix widgets reference page</a></strong>.
 *
 * @author bbeaulant
 */
public class TextField extends Text implements CommandListener {

    // Allowed constraints
    public static final String ANY = "any";
    public static final String EMAILADDR = "emailaddr";
    public static final String NUMERIC = "numeric";
    public static final String PHONENUMBER = "phonenumber";
    public static final String DECIMAL = "decimal";
    public static final String URL = "url";
    public static final String PASSWORD = "password";
    public static final String SENSITIVE = "sensitive";
    public static final String NON_PREDICTIVE = "non_predictive";
    public static final String INITIAL_CAPS_WORD = "initial_caps_word";
    public static final String INITIAL_CAPS_SENTENCE = "initial_caps_sentence";
    // TextBox command
    private final Command validateCommand;
    private final Command cancelCommand;
    // The associated textBox
    private TextBox textBox;
    // TextBox's title
    private String title = null;
    // TextBox's maxSize
    private int maxSize = 1000;
    // TextBox's constraints
    private int constraints = javax.microedition.lcdui.TextField.ANY;
    // Define if the edit dialog is opened when a key is hit
    private boolean editOnAllKeys = true;
    // Tooltip
    private long tooltipTimer;
    private WorkerTask tooltipTask;
    private Text tooltipText;
    private boolean tooltipVisible;
    // The change method
    private String onChange;
    // Internal
    private String displayedText = null;

    /**
     * Construct a {@link TextField}
     */
    public TextField() {
        super(KuixConstants.TEXT_FIELD_WIDGET_TAG);

        // Create command to be sure that labels have the correct value
        validateCommand = new Command(Kuix.getMessage(KuixConstants.VALIDATE_I18N_KEY), Command.OK, 1);
        cancelCommand = new Command(Kuix.getMessage(KuixConstants.CANCEL_I18N_KEY), Command.BACK, 0);
    }

    /* (non-Javadoc)
     * @see org.kalmeo.kuix.widget.Text#setAttribute(java.lang.String, java.lang.String)
     */
    public boolean setAttribute(String name, String value) {
        if (KuixConstants.TITLE_ATTRIBUTE.equals(name)) {
            setTitle(value);
            return true;
        }
        if (KuixConstants.MAX_SIZE_ATTRIBUTE.equals(name)) {
            setMaxSize(Integer.parseInt(value));
            return true;
        }
        if (KuixConstants.CONSTRAINTS_ATTRIBUTE.equals(name)) {
            constraints = javax.microedition.lcdui.TextField.ANY;
            StringTokenizer st = new StringTokenizer(value, ", ");
            while (st.hasMoreTokens()) {
                String constraint = st.nextToken();
                if (EMAILADDR.equals(constraint)) {
                    constraints |= javax.microedition.lcdui.TextField.EMAILADDR;
                } else if (NUMERIC.equals(constraint)) {
                    constraints |= javax.microedition.lcdui.TextField.NUMERIC;
                } else if (PHONENUMBER.equals(constraint)) {
                    constraints |= javax.microedition.lcdui.TextField.PHONENUMBER;
                } else if (URL.equals(constraint)) {
                    constraints |= javax.microedition.lcdui.TextField.URL;
                } else if (DECIMAL.equals(constraint)) {
                    constraints |= javax.microedition.lcdui.TextField.DECIMAL;
                } else if (PASSWORD.equals(constraint)) {
                    constraints |= javax.microedition.lcdui.TextField.PASSWORD;
                } else if (SENSITIVE.equals(constraint)) {
                    constraints |= javax.microedition.lcdui.TextField.SENSITIVE;
                } else if (NON_PREDICTIVE.equals(constraint)) {
                    constraints |= javax.microedition.lcdui.TextField.NON_PREDICTIVE;
                } else if (INITIAL_CAPS_WORD.equals(constraint)) {
                    constraints |= javax.microedition.lcdui.TextField.INITIAL_CAPS_WORD;
                } else if (INITIAL_CAPS_SENTENCE.equals(constraint)) {
                    constraints |= javax.microedition.lcdui.TextField.INITIAL_CAPS_SENTENCE;
                }
            }
            return true;
        }
        if (KuixConstants.EDIT_ON_ALL_KEYS_ATTRIBUTE.equals(name)) {
            setEditOnAllKeys(BooleanUtil.parseBoolean(value));
            return true;
        }
        if (KuixConstants.TOOLTIP_ATTRIBUTE.equals(name)) {
            setTooltip(value);
            return true;
        }
        if (KuixConstants.ON_CHANGE_ATTRIBUTE.equals(name)) {
            setOnChange(value);
            return true;
        }
        return super.setAttribute(name, value);
    }

    /**
     * @return the title
     */
    public String getTitle() {
        return title;
    }

    /**
     * @param title the title to set
     */
    public void setTitle(String title) {
        this.title = title;
    }

    /**
     * @return the maxSize
     */
    public int getMaxSize() {
        return maxSize;
    }

    /**
     * @param maxSize the maxSize to set
     */
    public void setMaxSize(int maxSize) {
        this.maxSize = Math.max(1, maxSize);
        if (text != null && text.length() > maxSize) {
            setText(text);
        }
    }

    /**
     * @return the constraints
     */
    public int getConstraints() {
        return constraints;
    }

    /**
     * @param constraints the constraints to set
     */
    public void setConstraints(int constraints) {
        this.constraints = constraints;
    }

    /**
     * @return the editOnAllKeys
     */
    public boolean isEditOnAllKeys() {
        return editOnAllKeys;
    }

    /**
     * @param editOnAllKeys the editOnAllKeys to set
     */
    public void setEditOnAllKeys(boolean editOnAllKeys) {
        this.editOnAllKeys = editOnAllKeys;
    }

    /**
     * @return th tooltip
     */
    public String getTooltip() {
        if (tooltipText != null) {
            return tooltipText.getText();
        }
        return null;
    }

    /**
     * Define the {@link TextField} tooltip text.
     *
     * @param text
     */
    public void setTooltip(String text) {
        if (tooltipText == null) {
            tooltipText = new Text();
            tooltipText.parent = this;
            tooltipText.setStyleClass(KuixConstants.TEXT_FIELD_TOOLTIP_STYLE_CLASS);
        }
        tooltipText.setText(text);
    }

    /**
     * @return the onChange
     */
    public String getOnChange() {
        return onChange;
    }

    /**
     * @param onChange the onChange to set
     */
    public void setOnChange(String onChange) {
        this.onChange = onChange;
    }

    /* (non-Javadoc)
     * @see org.kalmeo.kuix.widget.FocusableWidget#isFocusable()
     */
    public boolean isFocusable() {
        return enabled && focusable;
    }

    /* (non-Javadoc)
     * @see org.kalmeo.kuix.widget.AbstractTextWidget#setText(java.lang.String)
     */
    public TextWidget setText(String text) {
        displayedText = null;
        return super.setText(text != null ? text.substring(0, Math.min(text.length(), maxSize)) : null);
    }

    /* (non-Javadoc)
     * @see org.kalmeo.kuix.widget.AbstractTextWidget#getDisplayedText()
     */
    protected String getDisplayedText() {

        int maxSizeWidth = getMaxSizeWidth();
        if ((constraints & javax.microedition.lcdui.TextField.PASSWORD) == javax.microedition.lcdui.TextField.PASSWORD) {
            if (displayedText == null && text != null) {
                StringBuffer buffer = new StringBuffer();
                for (int i = 0; i < text.length(); ++i) {
                    buffer.append('*');
                }
                displayedText = buffer.toString();
            }
//            return displayedText;
            return (displayedText == null) ? "" : displayedText.length() > maxSizeWidth ? displayedText.substring(0, maxSizeWidth - 1)
                    : displayedText;
        }
        // return super.getDisplayedText();

        return (text == null) ? "" : text.length() > maxSizeWidth ? text.substring(0, maxSizeWidth - 1)
                : text;
    }

    private int getMaxSizeWidth() {
        Metrics minSize = getMinSize();
        // get max(text minSize.width, maxSizeWidth (if mazSize is set. (note default is 1000)))
        // maxsize is in number of chars, while width is nuber is chars* 8
        //that is why I convert to check
        return (maxSize >= 1000) ? minSize.width
                : (maxSize * 8 < minSize.width) ? minSize.width
                : maxSize * 8;
    }

    /* (non-Javadoc)
     * @see org.kalmeo.kuix.widget.Widget#getPreferredSize(int)
     */
    public Metrics getPreferredSize(int preferredWidth) {
        Metrics metrics = getCachedMetrics();

        if (needToComputePreferredSize(preferredWidth)) {
            //calculate boundry size
            Insets insets = getInsets();
            metrics.width = insets.left + insets.right;
            metrics.height = insets.top + insets.bottom;


            Font font = getFont();
            if (font != null) {
                // get max(text minSize.width, maxSizeWidth)
                int maxSizeWidth = getMaxSizeWidth();
                //specified minsize
                Metrics minSize = getMinSize();
                // if  text fond width is smaller than minSize.width make sise minSize.width; else limit to maxSizeWidth
                metrics.width += font.stringWidth(getText() + "") < minSize.width ? minSize.width : maxSizeWidth;

                metrics.height += font.getHeight();
            }
        }
//        System.out.println(" E- metrics.width" + metrics.width);
//        System.out.println(" E-metrics.height" + metrics.height);
//        System.out.println(" mazSize" + maxSize);
//
//        System.out.println(" \n \n");

        return metrics;
    }


    /* (non-Javadoc)
     * @see org.kalmeo.kuix.widget.Widget#doLayout()
     */
    protected void doLayout() {
        super.doLayout();
        if (tooltipText != null) {
            Metrics preferredSize = tooltipText.getPreferredSize(getWidth());
            int x = Alignment.CENTER.alignX(getWidth(), preferredSize.width);
            int y = Alignment.CENTER.alignY(getHeight(), preferredSize.height);
            tooltipText.setBounds(x, y, preferredSize.width, preferredSize.height);
        }
    }

    /* (non-Javadoc)
     * @see org.kalmeo.kuix.widget.Text#paint(javax.microedition.lcdui.Graphics)
     */
    public void paint(Graphics g) {
        super.paint(g);
        paintBorder(g);
    }

    /* (non-Javadoc)
     * @see org.kalmeo.kuix.widget.Text#paintChildrenImpl(javax.microedition.lcdui.Graphics)
     */
    protected void paintChildrenImpl(Graphics g) {
        super.paintChildrenImpl(g);
        if (isFocused()) {
            Color color = getColor();
            if (color != null) {
                g.setColor(color.getRGB());
            } else {
                g.setColor(0x000000);
            }
            g.setStrokeStyle(Graphics.SOLID);
            g.drawLine(textX, textY, textX, textY + insetHeight - 1);
        }
        if (tooltipText != null && tooltipVisible) {
            tooltipText.paintImpl(g);
        }
    }

    /* (non-Javadoc)
     * @see javax.microedition.lcdui.CommandListener#commandAction(javax.microedition.lcdui.Command, javax.microedition.lcdui.Displayable)
     */
    public void commandAction(Command command, Displayable displayable) {
        if (command == validateCommand) {
            String textBoxString = textBox.getString();
            hideTooltip();
            boolean changed = textBoxString != null && !textBoxString.equals(getText());
            setText(textBoxString);
            if (changed && onChange != null) {
                Worker.instance.pushTask(new WorkerTask() {

                    public boolean run() {
                        Kuix.callActionMethod(Kuix.parseMethod(onChange, TextField.this));
                        return true;
                    }
                });
            }
        }
        Display.getDisplay(Kuix.getCanvas().getInitializer().getMIDlet()).setCurrent(Kuix.getCanvas());
    }

    /* (non-Javadoc)
     * @see org.kalmeo.kuix.widget.AbstractFocusableWidget#processPointerEvent(byte, int, int)
     */
    public boolean processPointerEvent(byte type, int x, int y) {
        if (isEnabled() && type == KuixConstants.POINTER_RELEASED_EVENT_TYPE) {
            processActionEvent();
        }
        return super.processPointerEvent(type, x, y);
    }

    /* (non-Javadoc)
     * @see org.kalmeo.kuix.widget.Widget#processKeyEvent(byte, int)
     */
    public boolean processKeyEvent(byte type, int kuixKeyCode) {
        if (isEnabled() && type == KuixConstants.KEY_PRESSED_EVENT_TYPE
                && (kuixKeyCode == KuixConstants.KUIX_KEY_FIRE
                || (editOnAllKeys
                && (kuixKeyCode == KuixConstants.KUIX_KEY_1
                || kuixKeyCode == KuixConstants.KUIX_KEY_2
                || kuixKeyCode == KuixConstants.KUIX_KEY_3
                || kuixKeyCode == KuixConstants.KUIX_KEY_4
                || kuixKeyCode == KuixConstants.KUIX_KEY_5
                || kuixKeyCode == KuixConstants.KUIX_KEY_6
                || kuixKeyCode == KuixConstants.KUIX_KEY_7
                || kuixKeyCode == KuixConstants.KUIX_KEY_8
                || kuixKeyCode == KuixConstants.KUIX_KEY_9
                || kuixKeyCode == KuixConstants.KUIX_KEY_STAR
                || kuixKeyCode == KuixConstants.KUIX_KEY_POUND
                || kuixKeyCode == KuixConstants.KUIX_KEY_PENCIL)))) {
            return processActionEvent();
        }
        return super.processKeyEvent(type, kuixKeyCode);
    }

    /* (non-Javadoc)
     * @see org.kalmeo.kuix.widget.Widget#processActionEvent()
     */
    public boolean processActionEvent() {

        // Setup TextBox properties
        textBox = new TextBox(title == null ? "" : title, text == null ? "" : text, maxSize, constraints);
        textBox.addCommand(validateCommand);
        textBox.addCommand(cancelCommand);
        textBox.setCommandListener(this);

        // Show TextBox
        Display.getDisplay(Kuix.getCanvas().getInitializer().getMIDlet()).setCurrent(textBox);

        return true;
    }

    /**
     * Hide the TextField tooltip
     */
    private void hideTooltip() {
        if (tooltipTask != null) {
            tooltipTimer = 0;
            tooltipTask = null;
            tooltipVisible = false;
        }
    }

    /* (non-Javadoc)
     * @see org.kalmeo.kuix.widget.Widget#onFocus(org.kalmeo.kuix.widget.Widget)
     */
    protected void onFocus(Widget focusedWidget) {
        super.onFocus(focusedWidget);
        if (focusedWidget == this && tooltipText != null) {
            if (tooltipTimer != 0) {
                tooltipTimer = System.currentTimeMillis();
            } else {
                tooltipTimer = System.currentTimeMillis();
                tooltipTask = new WorkerTask() {

                    /* (non-Javadoc)
                     * @see com.kalmeo.util.worker.WorkerTask#execute()
                     */
                    public boolean run() {
                        if (tooltipTimer == 0) {
                            return true;
                        }
                        if (System.currentTimeMillis() - tooltipTimer > 2000) {
                            tooltipVisible = true;
                            invalidateAppearance();
                            return true;
                        }
                        return false;
                    }
                };
                Worker.instance.pushTask(tooltipTask);
            }
        }
    }

    /* (non-Javadoc)
     * @see org.kalmeo.kuix.widget.Widget#onLostFocus(org.kalmeo.kuix.widget.Widget)
     */
    protected void onLostFocus(Widget focusedWidget) {
        super.onLostFocus(focusedWidget);
        hideTooltip();
    }
}

 

 

 

Kuix general board » Image From Url

Kuix picture does not support a remote image(from internet),watch the source yourself,that's really not difficult.For Kuix does not have any socket or connection functionality.Add it yourself if you want.That's easy.

Kuix general board » Fixed TextField Size

shappy please paste code or tell us what you changed.

Kuix general board » How can i set the text of button dynamically?

<button>@{textFromJava}</button>

nii amon

Kuix general board » IS THIS PROJECT DEAD?

Kuix is open source and the source is available for download. Development can continue if there's still interest. In Africa J2ME is still very large in terms of phone platforms and so I am thinking of continuing with it in terms of what I will need in my projects.

Kuix general board » Button with java

I think that the right way to do this in Kuix is to use the CSS properties of the button object. Snippets of documentation:

border-color - No Define the border color. The value is an array of 4 colors values (like color property). Syntax : <top> <right> <bottom> <left>. If all the values are the same, you can specify only one value.

bg-image - No Define the background images. The value is a liste of image files path separated by a '|'.

bg-color - No

Define the background color. The value is a color like color property.

nii amon