How to insert new Item in JCombox through setEditable?

Hey guys,
Is there somebody who can help me on how to insert new Item in the JComboBox through setEditable?
JComboBox box  = new JComboBox();
box.addItem("");box.addItem("a");
box.addItem("b");
box.setEditable(true);
When I run it and selected the index 0 which the one which color red, I want to edit it and when I press enter key it will add a new item, but preserving this " box.addItem(""); , what I want is to add like this one, box.addItem("The new text entered"); "
Can you help me with this one... Thanks

hello,
the following demo may help,
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
* comobo.java
* Version 1.0
* Date Jan 3, 2006
* Copyright spatika
public class comobo extends JFrame implements ActionListener{
     JComboBox jc = new JComboBox();
     DefaultComboBoxModel lm = new DefaultComboBoxModel();
     JButton jb = new JButton("add");
     public comobo(){
          lm.addElement("");
          lm.addElement("1");
          lm.addElement("2");
          lm.addElement("3");
          jc.setModel(lm);
          jc.setEditable(true);
          jb.addActionListener(this);
          getContentPane().add(jb,BorderLayout.NORTH);
          getContentPane().add(jc,BorderLayout.SOUTH);
          pack();
          setVisible(true);
          setDefaultCloseOperation(EXIT_ON_CLOSE);
     public void actionPerformed(ActionEvent i){
          Object text = jc.getSelectedItem();
          jc.setSelectedItem(null);
          lm.addElement(text);
     public static void main(String artgs[]){
          new comobo();
}thanks
daya

Similar Messages

  • How Insert new item in old PO ?

    Hii,
       how to Insert new item in old PO . also give related links to this whare i can find my ans.. with some example.
    Thanks & Regards,
    Arya

    Hi
    Go through the below link
    adding new items to existing purchase order
    Regards
    Pavan

  • How to insert more items for each tab in WAD  7.0

    Hello to everyone,
    My problem is confined to the WAD 7.0
    I would like to insert 4 different queries into a new Web Template.
    Two of them have to stay in one page and the others in one page each; therefore, the result would be a Web Template with three tabs.
    Unfortunately the system creates automatically four different tabs with one query each.
    Anybody knows how to insert more items in one page/tab?
    Thank you very much
    Savino Pompa

    Hi Savino
    In the WAD bring up the properites of the tabstrip_container web item, under the Internal Display group in the Tab Panel List, create 3 tabs, then drag 3 contatiner_layout web items into the tab web item.
    In each conatiner item drag the analysis web item, 2 in the first container, then 1 each for the others, then point each analysis web item at a dataprovider(query).
    Setup the contatiners so that the analysis items displays, to do this in the container properties create a row then on the following screen a column and then set the Subordinate web item to the analysis item, these web items control layout and are useful for dealing with multiple web items, for the first tab with 2 queries you will need to play with the layout, either 1 row 2 column or 2 row 1 column.
    For each tab you created add the corresponding contatiner as the Subordinate Web Item in the Tab Panel parameters for each tab.
    Hope this helps
    Josh

  • How to insert new line in the copied schema with transaction code PE01?

    Dear Experts,
             I have copied HKT0 to ZKT0 , i want to insert new line between  line 150 and line 160 in ZKT0, I don't know how to insert new line 160, who can tell me ?
             Looking forward to your reply.
    Best Regards,
    Merry

    Hi,
    1. Open your schema,
    2. In first colume "Line" select line where you want to add new line,
    3. Replace first value in the column field (that indicates number of line) with character I (means insert),
    4. Press enter
    The line will be added. The same way you can add lines to PCR.
    To delete use character D.
    Cheers

  • How to insert new line break in XSLT mapping

    Hi experts,
    I am doing file to mail scenario, i am sending the text file as an attachment using reciever mail adapter.
    I did everything, i can able to send the mail with text file attachment, but with in the file i got multiple rows, i need to put line break in XSLT mapping.
    I did use following statement but it is inserting small rectangle between the records, the records are not separating with new lines, all are in one line.
    <xsl:text>*#xA;</xsl:text>   
    note: in real coding replace * with &
    Can anyone suggest me how to insert new line in XSLT mapping.
    My XSLT mapping as look like:
    <?xml version='1.0'?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ns0="http://www.Coj.co.za/SapIsuToABSA/DirectDebitFile">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:variable name="break">&lt;br/&gt;</xsl:variable>
    <xsl:variable name="space"> </xsl:variable>
    <xsl:variable name="newline"><xsl:text></xsl:text></xsl:variable>
    <xsl:template match="/">
    <ns1:Mail xmlns:ns1="http://sap.com/xi/XI/Mail/30">
    <Subject>Please Check Attached Direct Debit File</Subject>
    <From>S@za</From>
    <To>P@za</To>
    <Content_Type>text/plain</Content_Type>
    <Content>
    <xsl:for-each select="MT_SapIsuToABSA_DirectDebitFile/DirectDebitRec/Body">
    <xsl:value-of select="Space1"/>
    <xsl:value-of select="Cust_AccNo"/>
    <xsl:value-of select="Reserve_1"/>
    <xsl:value-of select="Cust_Name"/>
    <xsl:value-of select="Cust_Name1"/>
    <xsl:value-of select="Cust_Bank_AccNo"/>
    <xsl:value-of select="Space2"/>
    <xsl:value-of select="Cust_Bank_BranchNo"/>
    <xsl:value-of select="Reserve_2"/>
    <xsl:value-of select="Space3"/>
    <xsl:value-of select="Cust_AccNo_1"/>
    <xsl:value-of select="Space4"/>
    <xsl:value-of select="Reserve_3"/>
    <xsl:value-of select="Deduction_Amnt"/>
    <xsl:value-of select="Space5"/>
    <xsl:value-of select="Reserve_4"/>
    <xsl:value-of select="Space6"/>
    <xsl:value-of select="Action_Date"/>
    <xsl:value-of select="Space7"/>
    <xsl:value-of select="Reserve_5"/>
    <xsl:text>*#xA;</xsl:text>   
    note: in real coding replace * with &
    </xsl:for-each>
    </Content>
      </ns1:Mail>
      </xsl:template>
      </xsl:stylesheet>
    Kind regards,
    Praveen

    Hi,
    I think <xsl:text>#xa;</xsl:text> should do the trick, but depending on which OS (ux or win), the "new line" chars sequence is different (win would require a CRLF like <xsl:text>#xd;*#xa;</xsl:text>)
    Chris
    -> &
    Edited by: Christophe PFERTZEL on Apr 14, 2010 2:16 PM

  • How to insert new line character?

    Hi all,
    I have two lines to print.
    out.println("Available number of columns="+cols);
    out.println("Number of columns must be present=10");My problem is:
    i want both the lines to be printed one below the other. But, it is displayed in one single line.....
    Can anyone please tell me how to insert new line character?
    I tried with \n, '\n' and \r\n but, in vain......
    Thanks for your time.
    Regards,
    Ashvini

    You should never use "\n" directly.
    The line separator character is different on different operating systems.
    And putting quotes around it in your string will make absolutely no difference in the JSP.
    To find out what the line separator is you should use System.getProperty("line.separator");
    The JSPWriter and PrintWriter classes will automatically use this property with a println statement, so a println will always finish with a line separator.
    The issue here was that HTML by default ignores all whitespace.
    The solutions provided
    - use a <br> tag instead of a carriage return
    - use <pre> tags, which tells the browser not to ignore whitespace. That can be troublesome in JSP which generates a lot of extraneous carriage returns into the code.
    Cheers,
    evnafets

  • How to add new item in more options dialog box

    Hi all,
    Can anyone tell me how to add new item in more options dialog box(site actions -> more options). I want to add new item there to the new page layout which I created but I didn't find any way to do it. can anyone assist me for this.

    Good point, in order to add a Page into that area, you will need to define a Custom Action. You can learn more about creating Custom Actions here:
    http://msdn.microsoft.com/en-us/library/hh500259(v=office.14).aspx
    As an example, Microsoft uses the following Custom Action to add the "Publishing Page" to that Create Silverlight control when enabling the Publishing features:
    <CustomAction
    Id="CreatePublishingPage"
    GroupId="WebPages"
    Location="Microsoft.SharePoint.Create"
    Sequence="100"
    Title="$Resources:cmscore,Create_WebPages_PublishedPage;"
    Description="$Resources:cmscore,Create_WebPages_PublishedPage_Description;"
    ImageUrl="/_layouts/images/ltpp.png">
    <UrlAction Url="_Layouts/CreatePage.aspx" />
    </CustomAction>
    Dimitri Ayrapetov (MCSE: SharePoint)

  • HT3737 how to delete news items?

    how to delete news items?

    Reading List items?
    "To remove webpages from the Reading List, use one of these methods:
    Click the "x" icon that appears on the right of the webpage preview in the Reading List column when the cursor hovers over it.
    Control-click on the webpage preview in the Reading list and select "Remove item"."
    Quoting from below linked article from Apple.
    Reading List
    http://support.apple.com/kb/HT5364

  • How to insert new values in dropdown box through coding

    hi,
      I want to insert new values in dropdown box in a table.
    Please provide me the corresponding coding.i already did this code but result is empty dropdown.I mapped the context properly..
    int sklength=wdContext.nodeSkills().size();
          for(int i=0;i<sklength;i++)
        String getsub=wdContext.currentSkillsElement().getSubject();
        if(getsub.equals("50000138"))
             //IPrivateDetails1.INewskillElement el=wdContext.createNewskillElement();
             List lis=new ArrayList();
             //lis.add("Abap");
             //lis.add("Workflow");
             IPrivateDetails1.INewskillElement el=wdContext.createNewskillElement();
             el.setTskill("abap");
             lis.add(el);
              el.setTskill("workflow");
              lis.add(el);
              wdContext.nodeNewskill().bind(lis);
              //wdContext.nodeMonthsOfYear().bind(MonthsOfYear);
              wdContext.nodeNewskill().setLeadSelection(1);
        else
              wdContext.currentNewskillElement().setTskill("C++");
    waiting for a positive reply......
    with regards,
    S.Kiruthika

    kiruthika,
    Too many logical errors to explian.
    Should be:
    IPrivateDetails1.ISkillsNode nSkills = wdContext.nodeSkills();
    IPrivateDetails1.INewskillNode nNewSkill = wdContext.nodeNewskill();
    int sklength = nSkills.size();
    boolean cppAdded = false;
    for(int i=0;i<sklength;i++)
      String getsub=nSkills.getSkillsElementAt(i).getSubject();
      if(getsub.equals("50000138"))
        List lis=new ArrayList();
        IPrivateDetails1.INewskillElement el1 = nNewSkill.createNewskillElement();
        el1.setTskill("abap");
        lis.add(el1);
        IPrivateDetails1.INewskillElement el2 = nNewSkill.createNewskillElement();
        el2.setTskill("workflow");
        lis.add(el2);
        nNewSkill.bind(lis);
        nNewSkill.setLeadSelection(1);
      else if (!cppAdded)
        cppAdded = true;
        IPrivateDetails1.INewskillElement elCpp = nNewSkill.currentNewskillElement();   
        if (null ==  elCpp) {
          elCpp = nNewSkill.createNewskillElement();
          nNewskill.addElement(elCpp);
          nNewskill.setLeadSelection( nNewskill.size() - 1);
        elCpp.setTskill("C++");
    VS

  • Urgent help : how when insert new record navigation off

    hi master
    Sir
    when i insert new record by mistake press down key and curser move to next record and my need is
    When I insert new record or change any record that time my form navigation musht be off and no move to next record how I restrict to navigation please give me idea which event and what code I use
    Thanking you
    aamir

    If u want the cursor not to move ahead from a particular field when the records are inserted or updated on that field then u can just write null to the
    key-next-item trigger of that particular item.
    ie IN key-next-item
    null;
    Hope this is what you wanted.

  • How to insert new service condition in PO using BAPI_PO_CHANGE?

    Hi all,
    I'm trying to insert a new condition under a service line in a PO. This can be seen in ME23N under the services tab of the PO item. Then click on conditions (the button with the dollar and yen symbol).
    I tried using the internal table POCOND and POCONDX. But these tables update the conditions of the PO item itself and not the service conditions. In ME23N this is the conditions tab of the PO item.
                build condition item table
                  wa_conditem-change_id = 'I'.
                  wa_conditem-itm_number   = wa_items-po_item.
                  wa_conditem-cond_type    = c_condtypz.
                  wa_conditem-cond_value   = l_plndisamt.
                  wa_conditem-currency     = l_poheader-currency.
                  APPEND wa_conditem TO it_conditem.
                  CLEAR wa_conditem.
                build condition item change parameter table.
                  wa_conditemx-itm_number    = wa_items-po_item.
                  wa_conditemx-itm_numberx   = 'X'.
                  wa_conditemx-cond_type     = 'X'.
                  wa_conditemx-cond_value    = 'X'.
                  wa_conditemx-currency      = 'X'.
                  wa_conditemx-change_id     = 'X'.
                  APPEND wa_conditemx TO it_conditemx.
                  CLEAR wa_conditemx.
      CALL FUNCTION 'BAPI_PO_CHANGE'
        EXPORTING
          purchaseorder    = wa_ekpo_u-ebeln
        TABLES
          return           = it_return
          poitem           = it_poitem
          poitemx          = it_poitemx
          pocond           = it_conditem
          pocondx          = it_conditemx
        EXCEPTIONS
          OTHERS           = 1.
    I tried using the internal tables POCONDHEADER and POCONDHEADERX but this doesn't seem to insert anything.
    Can anyone guide me how to insert a new service condition?
    thanks,
    Shafiq

    Found a SAP note 499626 quoted below. So it seems that it's not possible to use BAPI_PO_CHANGE.
    "Can I create or change conditions on the service level with BAPI_PO_CREATE1 or BAPI_PO_CHANGE?
    Answer:
    Such a function is currently not available."
    Anybody know any FM to do this?
    Edited by: shafiq shamsuddin on Mar 16, 2011 4:38 AM

  • How to insert data in to msaccess through jsp

    i am doin a project in jsp, which i am new to. i have completed the design part in jsp now i am supposed to work with backend and stuffs.
    yesterday i had asked how to connect jsp with msaccess and Mr sharma had helped me in that and now that part is up and running. i am able to retrieve data from the table
    now my problem is how to insert data that i get from the user through the forms in to a table
    i have a registration form in jsp that contains the username, password, age etc. how can i get add these informations in to access.pls help me
    thanks in advance

    Hi....
    Simply obtain a jdbc connection to your ms access database.
    one u have a connection u can use , Statement Or PreparedStatement to
    execute queries against database
    Here is an example of mysql...
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    public class SqlAuthenticationHandler{
         private Connection conn;
         private PreparedStatement statement;
         private ResultSet rs;
         public SqlAuthenticationHandler(){
    /** Load ur JDBC driver **/
    try{
                   Class.forName("com.mysql.jdbc.Driver");
    conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/JDrive","root","password");
              }catch(Exception ex){
                   ex.printStackTrace();
    public void insertUser(String name, String password){
    try{
    /** Create a statement **/
    statement=conn.prepareStatement("INSERT into user values(?,?)");
    statement.setString(1,name);
    statement.setString(2,password);
    statement.executeUpdate();
    statement.close()
    }catch(SQLException e){
                        e.printStackTrace();
    Here replace "com.mysql.jdbc.Driver" with class name of your type 4 Ms Access Driver.
    replace jdbc:mysql://localhost:3306/JDrive","root","password" with url of ur access database
    check out this jdbc tutorial
    http://java.sun.com/docs/books/tutorial/jdbc/overview/index.html
    Sudhir Nimavat (Sudhir_nimavat at yahoo dot com)

  • How to create new items in Puchase Requisition.

    Hi
    I've have a requirement where I need to fill purchase requisition with new items when user insert first item, I've some code lines but I don't know how to stop to back to T/C ME51N.
    lo_header = im_item->get_requisition( ).
        lo_item = lo_header->create_item( im_item = im_item ).
      lo_item = lo_header->create_item( ).
       ls_item = lo_item->get_data( ).
       ls_itemx = lo_item->get_datax( ).
        ls_item-BNFPO = 2.
        ls_item-matnr = 'MIC360RG'.
        ls_item-menge = 1.
        ls_itemx-BNFPO = 'X'.
        ls_itemx-matnr = 'X'.
        ls_itemx-menge = 'X'.
        lo_item->set_data( im_data = ls_item ).
        lo_item->set_datax( im_datax = ls_itemx ).
    BAdI : ME_PROCESS_REQ_CUST
    Method: PROCESS_ITEM
    I apologize if I'm doing something wrong, but I really need to make it work, thanks in advance.

    Hi Dear,
    There is some link will help you to create Purchase Requisition and other MM Documents.
    http://www.docstoc.com/docs/11307932/SAP-MM-Manual-Create-Purchase-Requistion
    http://www.r3.duke.edu/training/stepbystep/#purch
    http://sapdocs.info/sap/materials-management-2/download-sap-purchasing-user-training-ppt-material/
    Regards
    Aamir

  • How to insert new line in a text file

    hi all,
    i wnat to know how can i insert a new line in a text file using java.
    for example i want the formate of the text like this
    1 2 3
    4 5 6
    until now i know only how to insert data but not new line.
    Thanks in advandce

    Hi you can put a new line in a text file using System.getProperty("line.separator"). This implementation will work for every OS.
    import java.io.*;
    class Demo{
    public static void main(String args[]) throws Exception {
    FileWriter fr = new FileWriter("FileDemo.txt");
         fr.write("AAAAAAAAAA");
    fr.write(System.getProperty("line.separator"));
    fr.write("AAAAAAAAAAA");
    fr.close();
    }

  • How to add new item-descriptors in ATG Merchandising 10.0.3 Browse-find tab

    Hi,
    We are using ATG 10.0.3 and Weblogic5.
    And in my project we have lots of new item descriptors in customCatalog.xml.
    We are managing Catalog using ATG BCC and it populates only ATG OOTB item descriptors. So I am finding hard to configure other item descriptors in BCC to forward my work.
    We configured item descriptors in CatalogBrowseTabConfiguration.properties file as well as taskConfiguration.xml. But its not working as expoected. Anybody have any idea how can we configure it in ATg10.0.3 mainly? The Configuration in ATg9 is not working in ATG 10.0.3, that is what I noticed.
    Thanks
    Mini

    If you're trying to modify the Merchandising view and you have custom item types in customCatalog.xml that don't extend the out of the box types (Category, Product, etc.), you may find the two links below to be helpful.
    Customizing the "Browse" view:
    [http://blog.credera.com/topic/technology-solutions/java/atg-10-merchandising-customizing-the-browse-view/|http://blog.credera.com/topic/technology-solutions/java/atg-10-merchandising-customizing-the-browse-view/]
    Customizing the "Find" view, i.e. search.
    [http://blog.credera.com/topic/technology-solutions/java/atg-10-merchandising-customizing-the-find-view/|http://blog.credera.com/topic/technology-solutions/java/atg-10-merchandising-customizing-the-find-view/]

Maybe you are looking for

  • Cd STUCK in my mac book pro?

    hello, i have a 15 inch mac book pro. a few months ago i was burning a cd and when it was finished burning and time to eject, it wouldnt successfully come out. i looked online and saw the giant list of different ways to eject (such as restarting and

  • Slow cd import with imac 24 vs dual G5

    my new imac 24 is much slower at importing cd's (converting to mp3 at 192) than my G5... something like 7-8x with the imac vs 18-20x with the G5... ??? is this typical for your results or do I have a bum setting??? stephen

  • Older nVidia NVS104M driver needed

    I can't get my hands on the original release of the WinXP NVS 140M driver, for the T61.  (Only the original release, 6.14.11.0133 from 5/18/2007, supports a certain video accessory card we have been using on the T60's)  I searched all of the video dr

  • Lost My Collections in Bridge

    I recently installed Lightroom 3 and moved all my photos to an external hard drive.  Now Bridge shows my photos, but all the collections and keywords I assigned in Bridge have disappeared.  I want to refer to those collections and keywords to help se

  • SDM & JSPM

    Hi Experts please explain me about  SDM & JSPM, what is diffrence between SDM & JSPM and why we use both tools. please provide me any documents or any links about SDM & JSPM. Regards BANDLA