Focus remains in Button when showing Form

Hi all,
I have a Form into which there are Container, GridLayout, Label's, TextField's, and Button's.
Here is the code :
package hello;
import com.sun.lwuit.*;
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.ActionListener;
import com.sun.lwuit.layouts.GridLayout;
import com.sun.lwuit.plaf.UIManager;
import com.sun.lwuit.util.Resources;
import javax.microedition.midlet.MIDlet;
import java.util.Hashtable;
import javax.microedition.rms.*;
public class HelloMIDlet extends MIDlet implements ActionListener {
private Form form;
private Command ajoutCommand,exitCommand;
private Container panel;
private GridLayout layout;
private Label cin,nom,prenom,adresse;
private TextField cinField,nomField,prenomField,adresseField;
private Button btnAjout, btnExit;
private Hashtable tTheme;
private RecordStore base;
private String dataDB;
public HelloMIDlet() {
public void startApp() {
Display.init(this);
try
Resources r = Resources.open("/resources.res");
tTheme = r.getTheme("Theme");
UIManager.getInstance().setThemeProps(tTheme);
catch (java.io.IOException e)
System.err.println("error reading resource file !");
try {
base = RecordStore.openRecordStore("LWUITBase", true);
catch (RecordStoreException ex) {
ex.printStackTrace();
form = new Form("test");
panel = new Container();
layout = new GridLayout(4,2);
panel.setLayout(layout);
ajoutCommand = new Command("Ajouter",1);
exitCommand = new Command("Exit", 2);
//form.addCommand(ajoutCommand);
//form.addCommand(exitCommand);
cin = new Label("CIN :");
cinField = new TextField();
//cinField.setConstraint(TextArea.NUMERIC);
nom = new Label("Nom :");
nomField = new TextField();
prenom = new Label("Prénom :");
prenomField = new TextField();
adresse = new Label("Adresse :");
adresseField = new TextField();
btnAjout = new Button(ajoutCommand);
btnAjout.addActionListener(this);
btnExit = new Button(exitCommand);
btnExit.addActionListener(this);
panel.addComponent(cin);
panel.addComponent(cinField);
panel.addComponent(nom);
panel.addComponent(nomField);
panel.addComponent(prenom);
panel.addComponent(prenomField);
panel.addComponent(adresse);
panel.addComponent(adresseField);
panel.addComponent(btnExit);
panel.addComponent(btnAjout);
cinField.setFocus(true);
form.addComponent(panel);
form.show();
public void pauseApp() {
public void destroyApp(boolean unconditional) {
notifyDestroyed();
public void actionPerformed(ActionEvent evt) {
if (evt.getCommand() == exitCommand)
destroyApp(false);
else
if (evt.getCommand() == ajoutCommand)
insert();
public synchronized void insert()
String record = cinField.getText() + ";" + nomField.getText() + ";" + prenomField.getText() + ";" + adresseField.getText();
byte[] bytes = record.getBytes();
try {
base.addRecord(bytes, 0, bytes.length);
cinField.setText("");
nomField.setText("");
prenomField.setText("");
adresseField.setText("");
catch (RecordStoreException ex) {
ex.printStackTrace();
RecordEnumeration enumRec = null;
try {
enumRec = base.enumerateRecords(null, null, false);
} catch (RecordStoreNotOpenException ex) {
ex.printStackTrace();
while(enumRec.hasNextElement())
try {
dataDB = new String(enumRec.nextRecord());
} catch (RecordStoreException ex) {
ex.printStackTrace();
Dialog.show("Confirm","data = "+dataDB,"Ok","Cancel");
So when running the application then the cursor is on the Exit button but not on the "cinField" field as I coded.
So how to make the cursor in the "cinField" field after showing the Form ?
Another problem : when I set a NUMERIC constraint to the "cinField" field then when I try to enter a value in it then I cannot type numbers , and I must click the T9 command ! So how to make the application ready to accept numbers in that situation ?
Thank you very much indeed

use button.requestFocus();

Similar Messages

  • Button.requestFocus(); does not give the focus to a button...

    I have a Frame with a message (textPane) and a button, for accept the message. I want the button to be focused when I open the frame, so this will allow the user to just press one key for accepting the message without use the mouse.
    How can I acomplish this???!!!
    Thanks on advance.

    I still cannot give the focus to the button when I open the JDialog.
    My code is this:
    public class VError extends JDialog
    GridBagLayout gridBagLayout1 = new GridBagLayout();
    JTextPane jTextPane1 = new JTextPane();
    JPanel jPanel1 = new JPanel();
    JButton jButton1 = new JButton();
    GridBagLayout gridBagLayout2 = new GridBagLayout();
    String message;
    ResourceBundle mes = ResourceBundle.getBundle("com.saincotrafico.optimus.client.resources.RError",Locale.getDefault());
    MutableAttributeSet mas;
    public VError(String message)
    this.setSize(250,150);
    this.setResizable(false);
    this.getContentPane().setBackground(UIManager.getColor("Panel.background"));
    this.setTitle(mes.getString("title"));
    this.message = message;
    try
    jbInit();
    catch(Exception e) {
    e.printStackTrace();
    private void jbInit() throws Exception
    mas=new SimpleAttributeSet();
    StyleConstants.setAlignment(mas,StyleConstants.ALIGN_CENTER);
    jTextPane1.setParagraphAttributes(mas,true);
    jTextPane1.setEditable(false);
    jTextPane1.setSelectedTextColor(Color.black);
    jTextPane1.setText("\n"+message);
    jTextPane1.setBackground(this.getBackground());
    jTextPane1.setEditable(false);
    this.getContentPane().setLayout(gridBagLayout1);
    jButton1.setSelected(true);
    jButton1.setText(mes.getString("aceptar"));
    jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    jButton1_actionPerformed(e);
    jPanel1.setLayout(gridBagLayout2);
    this.getContentPane().add(jTextPane1, new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0
    ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    this.getContentPane().add(jPanel1, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0
    ,GridBagConstraints.SOUTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 10, 0), 0, 0));
    jPanel1.add(jButton1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
    ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(5, 157, 5, 158), 0, 0));
    this.getRootPane().setDefaultButton(jButton1);
    jButton1.requestDefaultFocus();
    jButton1.requestFocus();
    void jButton1_actionPerformed(ActionEvent e)
    this.dispose();
    }

  • Adding a button when a system form is opened

    Hiya, I'm trying to add a button to a system form in vb.net.  For some reason when i run my code the button will add to the form succesfully only when I have that form open in SAP.  If the form isn't open I get the error 'Form - Not found'  Can anyone show how to just add the button when the user opens the form rather than the button appearing from the form being already open. 
    My code is like this:
    Private Sub SBO_Application_ItemEvent(ByVal FormType As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
            Select Case pVal.EventType
                Case SAPbouiCOM.BoEventTypes.et_FORM_LOAD
                    If pVal.FormType = 152 And pVal.BeforeAction = False Then
                        If pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD And Not pVal.BeforeAction Then
                            CreateMySimpleForm()
                        End If
                    End If
            End Select
        End Sub
    Public Sub CreateMySimpleForm()
            Dim oItem As SAPbouiCOM.Item
            Dim oButton As SAPbouiCOM.Button
            oForm = SBO_Application.Forms.GetForm("152", 0)
            oItem = oForm.Items.Add("51", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
            oItem.Left = 88
            oItem.Width = 95
            oItem.Top = 558
            oItem.Height = 21
            oItem.FromPane = 24
            oItem.Visible = True
            oButton = oItem.Specific
            oButton.Caption = "View Document"
            oForm.Visible = True
            oForm.Update()
        End Sub
    Any help would be appreciated

    ok guys I've solved the problem.....this code adds a button to the Open Items List and its in vb.net
    Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
            If ((pVal.FormType = 152 And pVal.EventType <> SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD) And (pVal.Before_Action = True)) Then
                oForm = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
                If ((pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD) And (pVal.Before_Action = True)) Then
                    Try
                        oItem = oForm.Items.Add("ViewDocBtn", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
                        oItem.Left = 88
                        oItem.Width = 95
                        oItem.Top = 295
                        oItem.Height = 21
                        oItem.Visible = True
                        oButton = oItem.Specific
                        oButton.Caption = "View Document"
                        oForm.Visible = True
                        oForm.Update()
                    Catch
                        SBO_Application.MessageBox("button not added")
                    End Try
                End If
            End If
        End Sub

  • Show form on button click

    Hello, I am using JDeveloper 11.1.2.3.0
    I have one button and one form on my jsf page. I want the form to be rendered when I click the button (to be visible). How can this be done in ADF?
    Thank you

    No offence, but have you read the post? I shows exactly your use case. OK, the title and the content is more about creating page variables. If you store the flag to hide/show the panel at a different place this is OK, still the actions you need to do are the same.
    Timo

  • How do I get a button to show in a list only when a survey is filled?

    I am using cf9 with mySQl 5+. I have two tables:
    Signups -  where people signup to take a course.
    Course_eval – once the course is completed, the student fills in the course evaluation
    I use an inner join on userID in both tables.
    I have a page, showsignups.cfm, that lists all of the students by course. Once a student finishes the survey, a button will show up next to the student in the showsignups.cfm page where it can be clicked on to show the survey by the individual student.
    My problem is instead of showing all students with or without the survey buttons, it only shows the students who have finished the survey. It should show:
    Student’s name | survey button
    Student’s name |
    Student’s name | survey button
    Student's name |
    I thought using a cfloop through the students would give me the effect I want, but alas, no. Here is the code I am using for the cfquery:
    <cfquery name="getsignups" datasource="#application.dsn#">
    select signups.courseTitle,signups.property,signups.calendardate,signups.company,signups.firstna me,signups.lastname,signups.email,signups.phone,signups.userID,signups.signup_id,signups.r id,course_eval.userID,course_eval.id
    from signups INNER JOIN course_eval ON signups.userID = course_eval.userID
    where signups.rid = #rid#
    </cfquery>
    (Rid is the courseID)
    Here is the output I am using:
    <cfoutput>
    <cfloop query="getsignups">
    <tr>
    <td>#rid# - #firstname# #lastname#  |   <a href="mailto:#email#">#email#</a></td><td>Ph: #phone#</td>
    <td width="24"><a href="showsignups.cfm?signup_id=#signup_id#&go=go" class="button">Remove</a></td>
    <cfif isdefined("id")>
    <td width="24"><a href="../../forms/surveys.cfm?userID=#userID#" class="button">Survey</a></td>
    </cfif>
    </tr>
    </cfloop>           
    </cfoutput>
    I know this is a long post, but I wanted to make sure any body who reads this understands what I am trying to accomplish. Any ideas on what I am doing wrong?

    Don't use an inner join:
    <cfquery name="getsignups" datasource="#application.dsn#">
    select signups.courseTitle,signups.property,signups.calendardate,signups.com pany,signups.firstname,signups.lastname,signups.email,signups.phone,si gnups.userID,signups.signup_id,signups.rid,course_eval.userID,course_e val.id
    from signups LEFT OUTER JOIN course_eval ON signups.userID = course_eval.userID
    where signups.rid = #rid#
    </cfquery>
    <cfoutput>   <cfloop query="getsignups">    <tr>      <td>#rid# - #firstname# #lastname#  |   <a href="mailto:#email#">#email#</a></td><td>Ph: #phone#</td>      <td width="24"><a href="showsignups.cfm?signup_id=#signup_id#&go=go" class="button">Remove</a></td>      <cfif isdefined("id")>        <td width="24"><a href="../../forms/surveys.cfm?userID=#userID#" class="button">Survey</a></td>      </cfif>    </tr>  </cfloop>            </cfoutput>  
    Use:
    <cfif id neq "">
    Message was edited by: Eddie Lotter (Typo)

  • Hello! I have the Acrobat XI test version installed, got the registration Mail and confirmed it. When i have the program opened and try to convert the file from a pdf to a word and press the convert button, it shows a the message "application failed" (in

    Hello! I have the Acrobat XI test version installed, got the registration Mail and confirmed it. When i have the program opened and try to convert the file from a pdf to a word and press the convert button, it shows a the message "application failed" (in german "Fehler bei der Anmeldung"). I hope have explained the issue on the right way with my bad english. Do you have a solution for it?? Best regards, Marcus Wenk

    yes, you are right. it is the adobe reader via exportPDF. but it should be the acrobat. it was written on the internetpage...

  • Import button remains grayed out when adding existing folder to LR 4

    Greetings.  I'm following the steps in the following link from Adobe:
    http://help.adobe.com/en_US/Lightroom/3.0/Using/WSE828B644-9097-46ab-98A7-E2719BBB6647.htm l
    The final step, after selecting the folder I want to add, is to select Import.  Except, the Import button remains grayed out.  I'm not sure what to do in order to select Import and add the folder I already have.
    Thanks,
    Mike H.

    Thank you for the information.  Yes, that seems to make sense based on what I've discovered using LR 4.  Still trying to come up to speed.  Appreciate everyone's help with their tips and insight.
    Date: Tue, 24 Apr 2012 01:44:25 -0600
    From: [email protected]
    To: [email protected]
    Subject: Import button remains grayed out when adding existing folder to LR 4
        Re: Import button remains grayed out when adding existing folder to LR 4
        created by LRuser42 in Photoshop Lightroom - View the full discussion
    Folders per se cannot be imported - only pictures (or movies) in a folder can. So, you have to select a folder containing at least one picture or movie (all pictures and movies found are automatically selected when the import dialog opens). This is probably not the case for the folder you want to add, so "no photos found" is displayed in the dialog center and the "Import" button is greyed out.
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4356518#4356518
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4356518#4356518. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Photoshop Lightroom by email or at Adobe Forums
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • I cannot get the Output Module to work. I was able to get the button to show up, but when I click on it, nothing happens. i need to export a PDF asap

    I cannot get the Output Module to work. I was able to get the button to show up, but when I click on it, nothing happens. i need to export a PDF asap. I am trying to export 33 PSD files in BRIDGE to a PDF like I used to do on my other computer with bridge.

    Let's start with the general things.
    When you have a problem with one particular site, a good "first thing to try" is clearing your Firefox cache and deleting your saved cookies for the site.
    (1) Bypass Firefox's Cache
    Use Ctrl+Shift+r to reload the page fresh from the server.
    Alternately, you also can clear Firefox's cache completely using:
    orange Firefox button (or Tools menu) > Options > Advanced
    On the Network mini-tab > Cached Web Content : "Clear Now"
    If you have a large hard drive, this might take a few minutes.
    (2) Remove the site's cookies (save any pending work first). While viewing a page on the site, try either:
    * right-click and choose View Page Info > Security > "View Cookies"
    * Alt+t (open the classic Tools menu) > Page Info > Security > "View Cookies"
    In the dialog that opens, you can remove the site's cookies individually.
    Then try reloading the page. Does that help?

  • ICal Crashes when clicking "calendar" button to show available calendars

    After doing the Lion upgrade I've troupbe with iCal. iCal just opens fine - but when trying to access "calendar" button it shows no reaction at all. In some cases a popout callout appears which is empty (and does not show one single calendar out of my existing 10). If I repeat clicking the button iCal crashes.
    Any help is highly appreciated.

    BusyCal is not at the root cause - it has s.th to do with the user account. As described in an other post you can fix it by deleting the prefs of iCal:
    https://discussions.apple.com/message/15709996#15709996
    When it comes to BusyCal there is only one thing with Lion that might be unexpected. Lion fires off iCal each time iCal receives a Push from Mobile Me. In practice you may add an event to BusyCal and iCal will be started immediately. Same for notification. The only way to get rid of this is to change iCal update interval from push to s.th. different. Unfortunately Apple limited Mobile Me Push to iCal only. Other Apps have no access to..
    Almi

  • I have a pdf doc that I have email buttons attached to button when I go to upload it to forms central so I can add a submit button to it it enables my email buttons.

    I have a pdf doc that I have email buttons attached to button when I go to upload it to forms central so I can add a submit button to it it enables my email buttons.

    You select the printer properties and set the appropriate page size (I think there is a place to set it in PDF Maker too, but not sure). In the printer, this is equivalent to putting the proper paper in the printer.

  • Is it possible write code inside pdf form when click submit button in pdf form

    can write code to pdf form
    for eg:
    we have to write code in Excel sheet using Macro features Like that any possible to write code in pdf form
    when i downloaded pdf form from site then filled up the details then click the save button the pdf form will send to the corresponding server then stored in DB
    pls reply me soon

    You have posted in a completely wrong forum. This one is exclusively for participants testing features of the site.
    You may want to try reposting in the appropriate Acrobat forum, which you can find here:
    http://forums.adobe.com/community/acrobat?view=overview

  • Hide buttons when movie loads and then show

    I have a movie that loads another video. When it goes to
    video by hitting button
    I can hide buttons underneath.
    When I unload the movie, I need the buttons to show up again
    and clickable.
    I added the onEnterFrame, but makes no difference.
    Can someone help as to how I can bring the buttons back when
    movie that was loaded is unloaded?
    Thank you in advance.

    > onEnterFrame(_root.VideoBtn.enabled._visible = true);
    Where did you find that syntax? It's incorrect, check the
    docs..
    However, I don't why you would do that, all that will do is
    make sure it's never invisible.
    To make the visible again, you do the same thing you did to
    make them invisible -- you set the _visible property to true,
    wherever you are unloading the movie.

  • Showing a top of page button when user scroll down

    Hi,
    I need some help please, to show a top of page button when the user scroll down either with the vertical scroll bar or the center mouse button.
    I could design and develop the actions for using the button.
    But I am unable to trigger the showing when the user scroll down.
    I have found an example about what I would like on the following website: http://www.commentcamarche.net/news/5854741-hp-presente-sa-nouvelle-gamme-de-pc-pour-le-pr emier-semestre-2011#top
    Thank you for your help.
    Regards

    I apparently misunderstood your first post. Sorry. If you look at the code for the example you cited in your OP, you'll find:
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script>
    <script src="http://static.ccm2.net/www.commentcamarche.net/_skin/_common/js/jsbottom.php?m=bottom%7Csimili&201103311506" type="text/javascript"></script>
    <div id="gotop"><a href="#top"></a></div>
    [To find the section yourself and view it in relation to the whole page, open the page, view the source code, and do a find on "#top."]
    I would take a look at those scripts and see how you might adapt them to your site.
    Good luck.
    Chris

  • Radio Buttons & Check Boxes Replaced w/ Rectangles, when printing Form w/ Adobe Reader XI (11.0.03)

    Hello.  I need to be able to print a .pdf copy of a completed web page form.  The form is completed by entering data into text boxes and text areas, and selecting various radio buttons and check boxes.  When the form is complete, it is saved, which converts the form into a .pdf file.
    When I open the saved .pdf file, it looks completely normal.  I will then select the print button, which is built into the display window for the form.  The printed form will appear, but the radio buttons and check boxes will have been replaced with the outline of rectangles.
    This is what the source form looks like, before printing:
    This is what the printed image looks like, after printing.  NOTE: All check boxes and radio buttons (and the data that they contained) are gone:
    I am not sure if this is a setting that needs to be changed in Adobe REader XI, or something else.
    Please let me know what you think it might be.
    Thanks,
    Rick

    Michael,
    It is a web/html form.
    The forms are built and used inside of a software program called WebEOC.
    WebEOC is used to allow for sharing information between different
    emergency response entities (like a State, and the counties within the
    State).
    The form I am working with was built with a web page editing program.  The
    form uses html, xhtml, xml, CSS and javascript.
    A for user would launch the WebEOC form (after logging into WebEOC), and
    they would fill out the form.  Text goes into text boxes and text areas,
    dropdown menu selections are made, and some information is entered using
    radio buttons and check boxes.
    When the form is complete, it is saved within the WebEOC database, as a
    .pdf file.
    You can then open the .pdf file in order to see the form, in it's
    completed state, as a pdf.
    When I try to pint this pdf file of the completed form, the check boxes
    and radio buttons are replaced with rectangles.  Any selections made in
    the radio buttons or checkboxes is lost.
    Thanks,
    Rick
    [signature removed]

  • Default Radio button when form opens

    Is there a way to make a radio button when form opens?
    for e.g. when we open key flexfield value sets form, key flexfield radio button is default. i want to do when i open the form value set button is defaultly checked.
    thanking you in advance.

    User personalization.
    Find the name of the field for that radio button.
    Write a when-new-form-instance personalization.
    Make the action type =property
    And make the action as default value/initial value = the value corresponding to the default you want.
    Also check http://it.toolbox.com/blogs/apps-traction-blog/oracle-form-personalization-basic-example-11936
    Hope this answers your question,
    Sandeep Gandhi
    Edited by: Sandeep Gandhi, Independent Consultant on Feb 4, 2011 11:43 AM

Maybe you are looking for