carox kaur

Ranch Hand
+ Follow
since Mar 19, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by carox kaur

Registration of ItemCommandListener is applicable on Items (MessageItem) and not to the form. Form class do not have method "setItemCommandListener()".
Below is the complete code which is no working. I have no idea why on clicking the MessageItem, Alert is not been shown.
15 years ago
I am using de.enough.polish.ui.MessageItem class in my application. I want to trap the event on selection of this item. In my application, I have many instances of MessageItems (like a list) appended to the form and I want to show an Alert (along with the text of the MessageItem) when user selects a MessageItem. What I am doing is:

The above code is just the overview of what I am doing. I am trying to capture the event by using javax.microedition.lcdui.ItemCommandListener but the event is not been trapped. By using CommandListener, although I am able to show the Alert but I am not able to get the reference of the MessageItem which is selected by the user.
Can anyone help me in event handling on MessageItem. I will be really thankful.

15 years ago

create a folder ( res) in your main project .
put all images in this folder.

add this folder in resource ..


I have created the folder res. Now how should I add this to resource?

What I have done till now is:
Created a directory structure
Main Project->resources->base, ScreenSize.128+x160+,ScreenSize.176+x220+,ScreenSize.240+x320+,ScreenSize.320+x240+
Now I have put the images in all these folders. base is the common folder and other are the screen size specific folders as mentioned in the documentation.

In build.xml I have done the following entry:

I am able to see the images in the mobile but the screensize specific images are not been used.
In java files, I have coded the same way as told by you. My program is able to access the images only from the base folder and not from the screen size specific folders. In all devices whatever be the screensize, the images are been picked only from the base folder. Do I need to code anything in build.xml?
15 years ago
Hi all, I am also a newbie in j2me. I am making a mobile mail application. I want to give the clients a facility to send/recieve mails from mobile. I am also facing a similar situation: attachments with mail. Can I get hint as to how can we give the facility of attachments...I have made the screen of composing the mails...
15 years ago
I am using j2me polish and making a mail application. When I use the de.enough.polish.ui.TextField class and instantiate it with a predefined string "abcd", a width of the box alters with the no. of characters of the string. E.g. if I enter "abcdef" the width of the textfield is of 6 characters, if I enter "abcdefegg" the width of the textfield is of 9 characters...I want the width of the textfiled should be constant and should not be mutable. Following is the code which I have written:

15 years ago
I am making a mobile application using j2me polish for these mobiles:
Generic/jtwi,Generic/Midp2Cldc11,Nokia/Series40E3,Nokia/Series60E2,Nokia/Series60E3,Sony-Ericsson/JavaPlatform7,Sony-Ericsson/JavaPlatform8

To work with images I could not find any Image class under the polish framework which is independent of android, doja and blacberry....
de.enough.polish.android.lcdui
de.enough.polish.blackberry.ui
de.enough.polish.doja.ui
The other way is:
There is a class javax.microedition.lcdui.Image , whose object is passed in the constructor of the de.enough.polish.ui.ImageItem.
Can I work with this class( javax.microedition.lcdui.Image ) to get the application work on every phone listed above?
15 years ago
I am new to J2me. I am facing problem with showing images in the List....
The directory structure/hierarchy of my project for such resources is:


<Main Project>-> resources-> base, customization1, customization2 folders.
Under Base, customization1, customization2 folders, each folder has Images, sounds folder.
In Base folder->Under images folder there are many folders each for screen size..I have put the image 'png' files in each of the folders including the image folder.
In customization1, customization2 folders->I have put the images in these folders including the image folder under these.

I think I have given some idea of the directory structure...if not, I ll make them more clear..
I want that images should appear after each items of the list....

The code is :


The error is that images are not appearing in each item of the list....
If something is not clear, kindly post.
15 years ago

If it were me, I would make a Map<Word, Count>, rather than Map<Count, Word>. Then, when I wanted to show a Sorted View, I would take the Entry Set, and add it to a TreeSet<Map.Entry<Word,Count>>. I would make the TreeSet with a Comparator<Map.Entry<Word, Count>> which took the Map.Entry's Value (count) and ordered them according to that.


Thanks for the logic. So you mean you would have done:

But then how the comparator can be speciified? In the construtor the set is passed.

15 years ago
I have to make a program: read a file from the hard disk and count the number of words in the file. The programmer must then print the words along with the number of times the word has occured in the file in order of their occurence.
I have counted the number of times the word has occured in the file but I am not able to print them in ascending order of their occurence. For e.g. if words are:
'student' occured 2 times
'child' occured 1 time
'parent' occured 1 time, then the output should be

child: 1
parent :1
student :2

I think map can be the best way to store this. I tried using TreeMap so that it can store the key ( number of occurence) in ascending order. But it does not store duplicate keys!!!


I mean my output is coming as:

child: 1
student :2

the entry :
parent :1
is missing as the key "1" is duplicate.
How can I maintain duplicate keys in map so that I can use them in ascending order?
15 years ago
Among the features of java, it is said that java is robust and secure. The reasons are not clear to me, why it is said so.
Robustness means that which is strong, powerful and not effected by others. But how is java strong and powerful, In what sense?
Secure means safe and protected. Is this means that the bytecode generated by the java compiler is safe and protected from outside attacks , if we change anything in the bytecode then it wont run?

How far I am correct?
15 years ago
Thanks Jeff but I am sorry to say my question is still unanswered. I am not getting the right answer, don't know why. Have I asked any wrong question or broken any of ranch rule?

When an object is exported to the registry, the clients get a reference to the object stub, not to the object itself (since the object itself lives on the machine


Ya I know this. But how? when we bind the real remote object to the registry then the client should also get the real object instead of the stub to the remote object.


The remote object is obj. We are binding the remote object and not the stub to the registry, so the client should also get the remote object upon lookup. How does the client get the stub to the remote object, upon lookup? At what point of time stub (object) of the remote object is made- while binding the remote object to the registry or when the client does lookup?


Also,

When we are explicitly binding the remote object (dunno whether remote object is bound or stub object) to the rmi registry so that all the clients in the network can access this object then why there is need to explicitly export the remote object.



15 years ago
I have read some of the older posts here to clear my doubts...
https://coderanch.com/t/430129/Distributed-Java/java/Small-UnicastRemoteObject
https://coderanch.com/t/422569/Distributed-Java/java/UnicastRemoteObject-class-Remote-Interface
In the Sun API also its written that:

Used for exporting a remote object with JRMP and obtaining a stub that communicates to the remote object.



My question is:
1.

When we bind the object of this class in the rmi registry on server side, we do:

This binds the remote object "stub" or simply the remote object with the name "stub_object" in the rmi registry ?

2. On client side when we do:

Here the client gets the stub to the remote object according to the spec. But...
The remote object is obj. We are binding the remote object and not the stub to the registry, so the client should also get the remote object upon lookup. How does the client get the stub to the remote object, upon lookup? At what point of time stub (object) of the remote object is made- while binding the remote object to the registry or when the client does lookup?
I think I am missing something here...

3. When we are explicitly binding the remote object (dunno whether remote object is bound or stub object) to the rmi registry so that all the clients in the network can access this object then why there is need to explicitly export the remote object.
15 years ago
I have not understood.
I have one more doubt regarding this.
When we bind the object of this class in the rmi registry on server side, we do:

This binds the remote object "stub" or simply the remote object with the name "stub_object" in the rmi registry ?
On client side when we do:

Here the client gets the stub to the remote object according to the spec.
The remote object is obj. We are binding the remote object and not the stub to the registry, so the client should also get the remote object upon lookup. Why it is said that the client gets the stub to the remote object, upon lookup?

By extending this class, the object will be automatically exported for RMI access


Are talking about the 'obj' object to be automatically exported for RMI access? But we are doing that explicitly using the registry.
15 years ago
Thanks. So the client calls the method on the reference of the interface. And on the server side the method which is actually invoked is of the class which implements this interface.
What is exporting logic and why do we extend our server side class with UnicastRemoteObject? What is the purpose of extending?
15 years ago