Command issue in J2ME - java-me

Currently I am working on J2ME App and I am facing command issue in j2me.
When I am adding any command on form its coming under options, not coming directly on screen.
Command selCommand = new Command("Select");
This select command is not coming directly on screen, options is coming on screen then click on option command then Select command is coming.
I want Select command on screen instead of option.

High Level GUI coding in JavaME doesn't let you decide how a Command should be displayed.
The same code may display a Command directly on the screen on some devices, but under Options on other devices. So don't have any control of that.
Your best chance is to look into priorities. By setting a high priority on your Command, you may be lucky that it displays directly on the screen instead of under Options. It is not something you should count on though, since it's not required by the specification, but I suspect at least many devices would do that.

J2ME doesn't let you allow to add commands on Screen it will come in menu but we can set priority to command so that they can be visible in left or right side.
even if you want to add command on Screen you have to use buttons.
Container containerbtn;
Button btnsel = new Button("Select");
containerbtn.addComponent(btnsel );
this.addComponent(containerbtn);

Related

How to prevent an X Window from receiving user input?

I would like to create some windows on a linux desktop for simple layout purposes. I need to avoid user input going to these windows (and I suppose avoiding the windows from gaining focus should suffice for that to happen).
I think that I can do this with the xprop command, by setting the WM_HINTS property, but I haven't found specific documentation on how to do it.
By the way, for an mplayer window, I can do this by using the option -input nodefault-bindings:conf=/dev/null. I simply need a general solution which I can enforce at a low level on any application's window.
Thanks!
A window indicates whether it wants to receive keyboard input by setting the KeyPress and KeyRelease bits in its event mask. If you do not want your window to receive keyboard input, simply do not set those event in CreateWindow()'s event mask. See http://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#requests:ChangeWindowAttributes for more information.
Additionally, you should also set the input focus hints for your window to "NoFocus", as described in section 4.1.7 of ICCCM: http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.7
If you want to fiddle with other applications' windows, you should be able to change their attributes and hints, although this may result in undesirable behavior and/or side effects.

Show only 2 commands in the menu bar in Lwuit or Native J2ME

I added 2 commands to my form in lwuit.
form.addCommand(test);
form.setBackCommand(exitCommand);
I changed the command behavior to COMMAND_BEHAVIOR_NATIVE, so i can show the status, and my commands appear at the bottom too, but they appear exit at the right ..and test Command in the middle.
I want to show only 2 commands layout in the menu bar, Exit on the right and options list that contains test on the left.
How can i do that?
First get the back Command and remove it. After this, add the exit Command like a standard Commandwith addCommand. Try this, if this doesn´t work we can try something else.
I don't know about LWUIT since I've never used it, but with native JavaME you sadly have no control of this. It is the individual device that decides where to place the commands.
You can move them around by changing the priority parameter, and you may be able to achieve an acceptable result that way, but only on some devices. The same code will give a different result on other devices.

Lwuit on nokia. Setting a command to the game fire key

This may seem trivial, but i'm working on a project to be deployed exclusively on nokia phones, and all i want is to create a command and set it to the "GAME_FIRE" center key. For some reason, when adding lwuit commands, LWUIT skips the game fire key, and instead creates a defaut menu command that then shows the added commands. Please help.
As far as I understand, LWUIT never uses the center key to commands. It wont event let you have two menus,it will always use one soft key for the main (the first) command, and all the other commands will be on a menu in the other soft button
Use
Display.getInstance().setThirdSoftButton(true);
This will set the label on the fire key as well.

Is there a way to specify the window offset for an app spawned in X?

I am writing a bash script that calls some apps that run in their own window. However, they appear at a standard position on the screen. I want to be able to specify the screen co-ordinates where they appear.
Is there a setting that can be passed in command line to make this happen? I am presently using openbox and if this is a window manager feature that openbox cannot provide, could anyone recommend another lightweight window manager (fluxbox?) to which I can specify window offsets?
Is there an X setting that can do this for me?
Many X clients support a -geometry argument (sometimes --geometry) which allows you to specify size and/or position of the initial window.
devilspie could be of help you can specify different window properties on compliant window managers.
Some examples are also available.

How to change focus in X-Windows?

I am working on old Motif-based application for Linux. I want to be able to programmatically change the active window of our application. I can redirect the input by using XSetInputFocus() function and the keyboard input start to go there, but XReconfigureWMWindow() and XRaiseWindow() functions just don't work.
I've read that Window Managers try to stop this behaviour, so tried to disable configure redirection, but this doesn't work either. Any ideas how to make one of my own windows on top of the window stack?
There is a tiny program called wmctrl available (at least in Debian/Ubuntu it is in standard distribution) which is able to perform many operations on windows and desktops, and handles plenty of window managers. I'd suggest testing whether it works in your environment, and if so, peeking at its sources.
You may find the answer to this is dependent on the Window Manager the user is using, or even what settings they've given to the Window Manager. I like to set my Window Managers to do "focus follows mouse", which means you can't send the focus to a window that I haven't put my mouse on, unless you also warp the mouse there (is that function called XWarpMouse?).

Resources