lcdui

j2me - Does a List have any property to keep track of 'key' that identify the item

社会主义新天地 提交于 2019-12-10 10:56:34
问题 How do you usually deal with Lists and the fact that they don't have a property to clearly identity an specific item ? So far, the only solucion I could come up with is to put the key I use at the beginning, followed by a hyphen and the text that is shown on every item. This way when I retrieve the text from the selected item I can get the key for the item. This is how I do it, but surely there's gotta be a better solution and I'd really like that you could share your experience in this kind

J2ME: Convert transparent PNG image to grayscale

ε祈祈猫儿з 提交于 2019-12-08 06:17:20
问题 is there any possiblity in J2ME to convert an image (loaded from a png file with alpha) to a new transparent grayscale image? Until now I only got the rgb values, but not the alpha. Thanks. Edit: yes, it should be 32 bit grayscale. 回答1: I found the solution and here is the code: public Image getGrayScaleImage() { int[] rgbData = new int[getWidth() * getHeight()]; image.getRGB(rgbData, 0, getWidth(), 0, 0, getWidth(), getHeight()); for (int x = 0; x < getWidth() * getHeight(); x++) { rgbData[x

Disable TextField in J2ME

[亡魂溺海] 提交于 2019-12-08 04:26:06
问题 Is it possible to dynamically make TextField element disabled and enabled during the run time in Java ME? 回答1: according to API documentation, setConstraints(TextField.UNEDITABLE) could do something like that: Sets the input constraints of the TextField... Note if you need to preserve contents and modifier flags, parameter passed to above method might require some tweaking, like setConstraints((getConstraints() & TextField.CONSTRAINT_MASK) | TextField.UNEDITABLE) // "disable" - set UNEDITABLE

In J2ME, How I obtain reference of all controls of the form to record form's controls state changes?

五迷三道 提交于 2019-12-07 20:46:28
In my J2ME app, I want show an alert dialog box only when the user changes the state of any controls—that is, when the user uses any of the control of the form and then try to cancel the form without saving typed data. For example among all 5-6 controls of form if the user types in 1-2 textfields and tries to cancel the form without saving that typed data into database. An alert box should then display with the message "Save changes?" with Yes, No command. How to do this? This is my code which does not give the desired result: import javax.microedition.lcdui.*; import javax.microedition.midlet

J2ME: Convert transparent PNG image to grayscale

守給你的承諾、 提交于 2019-12-07 07:18:26
is there any possiblity in J2ME to convert an image (loaded from a png file with alpha) to a new transparent grayscale image? Until now I only got the rgb values, but not the alpha. Thanks. Edit: yes, it should be 32 bit grayscale. I found the solution and here is the code: public Image getGrayScaleImage() { int[] rgbData = new int[getWidth() * getHeight()]; image.getRGB(rgbData, 0, getWidth(), 0, 0, getWidth(), getHeight()); for (int x = 0; x < getWidth() * getHeight(); x++) { rgbData[x] = getGrayScale(rgbData[x]); } Image grayImage = Image.createRGBImage(rgbData, getWidth(), getHeight(),

Disable TextField in J2ME

主宰稳场 提交于 2019-12-06 21:38:34
Is it possible to dynamically make TextField element disabled and enabled during the run time in Java ME? according to API documentation, setConstraints(TextField.UNEDITABLE) could do something like that: Sets the input constraints of the TextField... Note if you need to preserve contents and modifier flags, parameter passed to above method might require some tweaking, like setConstraints((getConstraints() & TextField.CONSTRAINT_MASK) | TextField.UNEDITABLE) // "disable" - set UNEDITABLE above to disable, and to enable back, something like: setConstraints((getConstraints() & TextField

how to handle keypressed event in canvas for alphanumeric using j2me midp2.0?

余生颓废 提交于 2019-12-06 10:55:41
I am using canvas for drawing Strings in mobile screen based on the user input using key pressed event. Here my user wants to enter alphanumeric character like abc. For example user try to enter 'd' then it will display 3 instead of 'd'. So, do I get both String and numeric and able to draw in the mobile screen? Na if you're doing it in Canvas, you'll need to implement your own typing. I guess you'll have a 2D array of characters for each number. [['a', 'b', 'c'], ['d', 'e', 'f']... You'll also need to implement a timeout after which you move on to the next character. Not to mention detecting

j2me - Does a List have any property to keep track of 'key' that identify the item

霸气de小男生 提交于 2019-12-06 07:44:17
How do you usually deal with Lists and the fact that they don't have a property to clearly identity an specific item ? So far, the only solucion I could come up with is to put the key I use at the beginning, followed by a hyphen and the text that is shown on every item. This way when I retrieve the text from the selected item I can get the key for the item. This is how I do it, but surely there's gotta be a better solution and I'd really like that you could share your experience in this kind of scenarios. Thanks in advance. The picture ooks like you keep all the data managed in your

J2ME Soft Key Wrapper

懵懂的女人 提交于 2019-12-06 04:27:59
问题 Reading some articles, told me that soft keys varies between devices. Some says -6 or -21 for left soft key and -7 or -22 for right soft key. Given this situation, is there any good wrapper or function or best practice to handle it properly? If not possible for ALL devices, what is the best way to support most devices? with minor or no hack at all? 回答1: To give you a feel for the scope of the problem have a look at this table of keycodes. Omermuhammed's approach is a good one if you are able

Button Image Problem

元气小坏坏 提交于 2019-12-04 21:08:20
hallo. I want to ask something to you here. I know this may be easy for you, but this may be difficult for me. I learn new J2ME. I want to know the basics of the programing languages this. I have a case like this: class DrawImageCanvas extends Canvas { static Image image; static Image image2; static Image image3; static Image image4; static Image image5; static Image image6; static String string; int count; public void paint(Graphics g) { int width = getWidth(); int height = getHeight(); // Fill the background using black g.setColor(0xefffff); g.fillRect(0, 0, width, height); // Load an image