Help with Combo box

I am having problems with displaying items on a combo box.
The combo box will allow a user to select a fixed list of values for a database column.
I created the combo box and set the dataItemUsageMode property in the property inspector to "USE FOR UPDATE". The list is bound to the corresponding column of the query RowSetInfo.
In the code, I hard coded the items to be displayed using comboboxName.addItem(). When I run the form, the list of hard coded values shows up. However, when I select an item, the selected item is not displayed on the screen.
Could anyone tell me what I am doing wrong?
null

I had a problem like this when I inserted a new row into the given Rowset.
Try setting initial value for the attribute that you are using for update.
eg. if you have this:
comboBoxControl1.setDataItemNameForUpdate("infobus:/oracle/sessionInfo1/rowSetInfo1/Status");
comboBoxControl1.addItem(new String("Silver"));
comboBoxControl1.addItem(new String("Gold"));
comboBoxControl1.addItem(new String("Platinum"));
set the attribute as follows:
StatusrowSetInfo1.getImmediateAccess().setValue(new String("Silver"));
or any other way you can set that attribute.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by kms98 ():
I am having problems with displaying items on a combo box.
The combo box will allow a user to select a fixed list of values for a database column.
I created the combo box and set the dataItemUsageMode property in the property inspector to "USE FOR UPDATE". The list is bound to the corresponding column of the query RowSetInfo.
In the code, I hard coded the items to be displayed using comboboxName.addItem(). When I run the form, the list of hard coded values shows up. However, when I select an item, the selected item is not displayed on the screen.
Could anyone tell me what I am doing wrong? <HR></BLOCKQUOTE>
null

Similar Messages

  • Help with Combo Box Component

    I am creating an application with comboboxes and using action
    script to load them. I can figure out how to change text color of
    the choices in the combo box, but can anyone tell if it is possible
    to make the text choices appear as different colors. For instance
    if I wanted all of the choices to be black text, but for the third
    choice down to appear red.
    Thanks for the help.

    You can set the backgroubd color if that helps.
    To set the second item to have a red background, attach this
    to the combobox:
    on(open){
    dropdown.setPropertiesAt(1,{backgroundColor:0xFF0000})
    }

  • Help with combo boxes

    I am currently building a site with flash / dreamweaver and
    am attempting to add two or three combo boxe that will display data
    and pictures from a database. Any ideas or assistance would be much
    appreciated...
    Many thanks in advance

    Sunil,
    I'm attempting to use the data binding technique but I'm perhaps not understanding exactly where this should go.  For now I'm fine with having a static array that just lives locally on the page.   Each of my combo boxes are being populated using the
         mx:Array --> mx:Object logic. 
    I need to fire off an event to a function that is able to determine which selection(s) from the combination of the two combo boxes were chooses.  I'm accomplishing that by using selectedIndex property of the combo boxes id.  I then have 'n' number of unique Array Collections that are basically a three dimensional array containing the numeric percentage that I need to display graphically.  I need my function to be able to choose the appropriate Collection based on the combination of selected index(es) and then update my column chart accordingly. 
    My other confusion is how to do use my data binding at the chart level.  So my page is really nothing more than two combo boxes and chart that I need to change dynamically as the selections in the combo boxes changes.  Eventually I will use a webservice to connect to a .jsp page that is using DAO to retrieve the values from the database but right now I'm fine with fetching them locally just so I'll know I'm on the right track. 
    If it would help I can include the snippet of the code that I'm working on.
    Thanks for your help
    -->Nash

  • NEED HELP WITH COMBO BOX

    i am having a heck of a time writing the php and actionscript
    to get a combo box to load a list from a data base. And then once
    that list is loaded into cb_combo1 based on the users selection
    loading the appropriate list into cb_combo2 , so for example
    user is asked to select a state.
    once a state has been selected a list of schools from a
    database is loaded into the cb_combo2 based on the users selection.
    after the user selects the school , he is redirected to
    another URL.
    Let me know if anyone can help. Its for a project in school
    and i could really use the A. and the knowledge. I have been
    googleing for about 7 days now.
    Thanks all :-)
    CH

    The perfect tutorial for you:
    http://www.adobe.com/devnet/flash/articles/flash_xmlphp.html

  • Hi! I am newbie to Reports need help with check boxes

    Hi! I am newbie to Reports need help with check boxes. I am try-in to make a new check boxes that will validate in runtime. I have created two frames and one frame is dummy and other frame has big X line on it with conditions. Is this a right way to create check box! Please help thanks!

    and one frame is dummy and other frame has big X
    line on it with conditions. Is this a right way to
    create check box! Please help thanks!Instead of creating a frame for X, you can create Ractangle and place X in it. Rest is fine.

  • Problem with combo boxes and the reset button in certain situations

    Hi Everyone,
    i have a problem to make the reset-button function properly in an what-if analysis dashboard.
    The dashboard uses two combo boxes that are not visible at the same time. In my application the second combo box only appears when a dedicated menu (label based menu button) has been activated.
    So i have combo box 1 when menu A is active an dand combo box 2 when menu 2 is active.
    After starting the dashboard initial values are fine. If you then directly change to menu 2 (seeing combo box 2 with
    the correct default value) and press the reset button, the dashboard returns to the initial view, showing
    the menu 1 with the correct default value. If you now switch back  to menu 2, you will see, that the combo box 2
    is empty (i.e. nothing selected).
    I also tracked the destination cells for the combo box value results as well as the source cells for the "selected item" and the
    destination cells for the "Insert Selected Item". All this values seem to be correct. Therefore i assume that
    this is an issue of event handling. Maybe the combo box 2 does not refresh its selected value because it is already
    invisible when the values are restored.
    This case can easily be simulated by placing two combo boxes and a push button (that changes the visibility of
    the combo boxes) and the reset button on the canvas.
    Maybe someone can help. I am able to provide a test xlf, if neccessary.
    Thanks,
    Oliver
    P.S. I am using Xcelsius SP4 (Version 5.4.0.0)

    Hello Debjit_Singha_86,
    thank you for your support. At the moment i have the following setting:
    label based menu
    - General: Insertion Type "value" from a list of ID's for the menu-items to a dedicated cell (current menu ID, say tab1!$A$1)
    - Behavior: Selected item (position) fixted to item 1
    hidden combo box
    - General: Insertion Type "position" to a dedicated cell with the current choice (say tab1!$B$1)
    - Behavior: Selected item (position) to the same cell (tab1!$B$1)
    Can you give me a hint on how to connect the two components according to your solution, so that the label based menu sets the default for the hidden combox box only in case, that the reset button is pressed?
    Thanks,
    Oliver

  • Having trouble with combo box in action script 3

    I have created a combo box in action script 3.0 and have some things working and others not. I am creating a store for shirts, caps, etc..... so need different things and rates. Can anyone help me?
    [email protected]

    Creating a STORE for my website and used combo buttons with types of shirts for one button, 2nd button with color, and third with sizes.
    Using Action Script 3.0 making these work and having trouble.
    HELP meaning if you can connect to my computer remotely and see where my problem is. I am happy to pay if works.

  • Filtering my DataGridView with Combo Boxes

    Hello everyone! I have recently started working with windows form application and I must say it is really
    awsome! I have came up with a project but I came across a little problem and I hope some of you might help me!
    I have established a local database and managed to connect it to a DataGridView, awsome I can see my database
    in my windows form! I have also made 7 combo boxes, each with its strings in it, then i added a button that should filter the data grid view according to the strings the user selected in the combo boxes. My question is, how do i do that? I mean how do i make
    the button fillter my DataGridView according to the strings selected in my combo boxes?
    Hope for a quick answer, sorry for my english and lack of knowledge in windows form!

    Maybe you could go this way:
    Populate the combobox manually, first adding "All", then adding the items from industryGroupsDataSet.Tables[0].
    Add a BindingSource between companiesDataSet.Tables[0] and dataGridView1.DataSource.
    In the SelectedIndexChanged event of the combobox, alter the Filter property of the BindingSource. If the selected index is zero ("All"), set the Filter to null, otherwise set the filter to String.Format("groupID = '{0}'", cmbBxGroupFilter.SelectedValue).
    You may also have a look at these too:
    filtering data from a
    data table to populate combo box on a datagridview based on the user selection
    How to search the datagridview
    based on values selected in combo box, just like a search based on combo box values
    Happy Coding!

  • Having trouble with combo box.

    What im trying to do is put a string array into this combo box called jComboBoxParts how do i make it show? Right now when i load it, all i see is "Item1..."Item2...etc". Here is my code.
    String[] partsString = { "oil can", "windshield", "tires", "v6 Cylinder head", "fuse"};
    JComboBox[] jComboBoxParts = new JComboBox[partsString.length];
    for(int i=0; i < partsString.length; i++)
    jComboBoxParts[i] = new *JComboBox(*partsString);
    with the bolded work i get an error. Please help.

    eva21 wrote:
    What im trying to do is put a string array into this combo box called jComboBoxParts how do i make it show? Right now when i load it, all i see is "Item1..."Item2...etc". Here is my code.
    String[] partsString = { "oil can", "windshield", "tires", "v6 Cylinder head", "fuse"};
    JComboBox[] jComboBoxParts = new JComboBox[partsString.length];
    for(int i=0; i < partsString.length; i++)
    jComboBoxParts[i] = new *JComboBox(*partsString);
    with the bolded work i get an error. Please help.
    That's ugly in so many ways...
    This:
    JComboBox[] jComboBoxParts = new JComboBox[partsString.length];does not do what you think it does. Instead, it creates an array of JComboBoxes initialized to the length of elements in your string array. So instead of a single JComboBox capable of holding 5 elements (which is what you were trying to do), you created 5 JComboBoxes capable of holding n elements.
    What you want to do is something like this:
    import javax.swing.*;
    class Demo extends JFrame {
      private JComboBox box;
      public Demo() {
        initComponents();
      private void initComponents() {
        String[] items = { "oil can", "windshield", "tires", "v6 cylinder head", "fuse" };
        box = new JComboBox(items);
        this.getContentPane().add(box);
        this.pack();
        this.setSize(200, 60);
        this.setLocationRelativeTo(null);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setTitle("Combox Box Demo");
      public static void main(String[] argv) {
        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            new Demo().setVisible(true);
    }Another alternative, if you don't have the array of strings available when you instantiate your JComboBox, you could do something like this:
    String items = { "oil can", "brakes", "windshield", "tail light", "something else", "blah", "more blah" };
    for( String item : items )
      myJComboBox.addItem(item);

  • Display issue with Combo Boxes and Logo

    Hi All,
    I am facing a couple of issues with my dashboard:
    1. Combo boxes display - I have placed a series of combo boxes one below the other. During the preview, when I click on the first combo box, the values spread below. That is, the labels, and options of the next combo box are also visible. The options in the combo box are not seen clearly. I have tried many permutations and combinations with "Bring Forward +" and "Send Back -" but none of them seem to work. For example, keeping the first combo as bring forward and next one as send back etc. Can you please help me in this regard?
    2. Logo - I have used image component and embedded a logo from my local system. Later I saved the xlf in the repository. When I import the xlf from the platform, it displays the logo fine. But however, this behavior is not constant. It sometimes doesn't show the image. Do I have to save the image also in the repository? or in a common shared folder? If I embed the logo does it not mean that the xlf hold the copy?
    Any help in this regards is highly appreciated.
    Thanks and regards,
    Sandeep.

    Hi:
       For your question
    1) Do you need your combox overlapped? I tried to overlap my comb box and preview it, seems works fine for me. it only chooses the first comb box. But I am suggesting that if you want to show/hide the different combox in the same position at run time, you can try to control the visibility by some other component.
    2) The answer is NO, the image embedded in the image component will be saved to xlf file, there is no need to save it individually. Try to clean your cache files in your machine and do it again.
    Hope it helps.

  • Need help @ listening combo box

    Hi Everyone,
    below is my code. Please find my question between '?'ed lines.
    // CREATE COMBO BOX
    if(obj.equals(CSV_COMBO_BOX))
         _combobox[_combobox_count] = new JComboBox();
         //get possible value for combo box
         String [] possible_values = get_possible_values(val[i]);
         for(int i=0; i < possible_values.length; ++i)
         _combobox[_combobox_count].addItem(possible_values[i]);
         //set the default value to usr_val[i]
         _combobox[_combobox_count].setSelectedItem(usr_val[i]);
         // add to panel
         panel.add("tab",_combobox[_combobox_count]);
         // listner
         _combobox[_combobox_count].addItemListener(new ItemListener(){
              public void itemStateChanged(ItemEvent e)
    // ? I WANT TO UPDATE usr_val[i] here ?
    // ? how could i get the value of "i" or
    // combobox_counter in this block?????????
    // ???????????????????????????????<?????
         comboboxcount++;
    Thanks & Regards
    Vikas Talwar

    Hi Everyone,
    below is my code. Please find my question between '?'ed lines.
    // CREATE COMBO BOX
    if(obj.equals(CSV_COMBO_BOX))
         _combobox[_combobox_count] = new JComboBox();
         //get possible value for combo box
         String [] possible_values = get_possible_values(val);
         for(int i=0; i < possible_values.length; ++i)
         _combobox[_combobox_count].addItem(possible_values);
         //set the default value to usr_val
         _combobox[_combobox_count].setSelectedItem(usr_val);
         // add to panel
         panel.add("tab",_combobox[_combobox_count]);
         // listner
         _combobox[_combobox_count].addItemListener(new ItemListener(){
                public void itemStateChanged(ItemEvent e)
              // ? I WANT TO UPDATE usr_val here ?
              // ? how could i get the value of "i" or
              // _combo_box_counter in this block?????????
              // ???????????????????????????????<?????
    _combobox_count++;
    }I have two arrays: one called "val" which is an array of string arrays that you use to populate a JComboBox, and the other one is called "usr_val" that holds strings and is used to set the JComboBox default values. You want to change the default value when the selected item in the corresponding JComboBox has changed. To manage your arrays and JComboBoxes, you have
    one counter "i" which seems to count the arrays of string arrays and the array with the default strings and one counter "_combobox_count" which counts the JComboBoxes that have been genererated with the help of these arrays. Obviously, the arrays could be used to generate a different JComponent as well, in which case "i" and "_combobox_count" will have different values. Both "i" and "_combobox_count" are clearly available within the if-block, so you don�t need any extra tricks to access them. What happens if you directly access "i" or "_combobox_count" from within the "itemStateChanged"-method?
    Thanks & Regards
    Vikas Talwar

  • PROBLEM WITH COMBO BOXES..

    HI,
    I AM HAVING TWO COMBO BOXES>>
    COMBO1------ DEPT NAME
    COMBO2------EMPLOYEE NAMES
    I AM COLLECTING DATA OF COMBO1 FROM THE DATABASE.....DEPENDING UPON THE FIRST COMBO i.e DEPT NAME...USING THAT DEPT NAME I HAVE TO COLLECT EMPLOYEES NAMES DATA FROM THE DATABASE AND PLACED IN COMBO2 >>....
    ANY PLS HELP ME......
    I WANT FULL CODE FOR THAT......

    You do this by combining JSPs with a central servlet. I don't know how to do it with just one JSP on its own.
    The JSP does a <form> POST to the servlet. The servlet fetches the combo box values into a List, puts it into request scope, and forwards the response back to the JSP. The JSP gets the List out of request scope and populates the drop-down. You do the same thing when there's a selection in the drop-down: onChange does a POST back to the servlet, which gets the selected value as a parameter, takes the appropriate action, and forwards the response with new data in request scope back to the JSP.
    The trick is to have the data in request scope so the JSP can get it. I think you need a servlet to do that.

  • Need help on combo box validation in jsf

    Hi All,
    I have a combo box with some options. User has to select one option and has to submit the form. If he doesnt select any option and submit the form i need to display an error message saying that PLEASE SELECT AN OPTION AND SUBMIT.
    I am using RATIONAL APPLICATION DEVELOPER 6.0 as my IDE.
    please help me its an urgent requirement

    On submit check if he has an option selected.
    If not do the following:
    FacesContext.getCurrentInstance().addMessage(componentId,
    new FacesMessage(FacesMessage.SEVERITY_ERROR,
    errorMessage,
    errorMessage));
    return null;
    The componentId is the id of the selectOneMenu

  • Problem with combo box in a Matrix column

    hi every one, i  have a user form with a matrix(uid = 37) with some columns and one column is combo box. in that combo box i have to get values  from OSTC table (Code)...i have written this code ..i dont know how to access the combo box so that i can get values to combo box when i execute the prg....
    oitem = oForm.Items.Item("37")  37 is uid of omatrix2
                oMatrix2 = oitem.Specific
                oColumns = oMatrix2.Columns
                oForm.DataSources.UserDataSources.Add("CSR1", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1)
                oColumn = oColumns.Item("V_6")                      ''for accessing the combo box item [V_6 is col uid ]
                oCombo = oColumn.Cells.Item(omatrix2.row).Specific            ''''''''problem line
                oCombo.DataBind.SetBound(True, "", "CSR1")
                rset = oDICompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                query = "select Code from OSTC"
                rset.DoQuery(query)
                Dim tc As String
                rset.MoveFirst()
                For row = 0 To rset.RecordCount - 1
                    tc = rset.Fields.Item("Code").Value
                    oCombo.ValidValues.Add(tc, row)
                    rset.MoveNext()
                Next
                oMatrix2.Columns.Item("V_6").DataBind.SetBound(True, "@SALE_CHILD", "U_Tax")

    Call objMain.objUtilities.LoadComboValuesForMatrix(FormUID, "27", "SELECT Code,Name FROM OSTC Order by Code", "V_19", objMatrix.RowCount)
    Public Sub LoadComboValuesForMatrix(ByVal FormUID As String, ByVal ItemUID As String, ByVal strQuery As String, ByVal MtrxColId As String, ByVal Rowcount As Integer)
            Dim inti As Integer
            objRecSet = objMain.objUtilities.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            Try
                Dim objmatrix As SAPbouiCOM.Matrix
                Dim objCombo As SAPbouiCOM.ComboBox
                objForm = objMain.objApplication.Forms.Item(FormUID)
                objItem = objForm.Items.Item(ItemUID)
                objmatrix = objItem.Specific
                objCombo = objmatrix.Columns.Item(MtrxColId).Cells.Item(Rowcount).Specific
                objItem.DisplayDesc = True
                objRecSet.DoQuery(strQuery)
                If objRecSet.RecordCount > 0 Then
                    If (objCombo.ValidValues.Count > 0) Then
                        For inti = 0 To objRecSet.RecordCount - 1
                            objRecSet.MoveNext()
                        Next
                    End If
                    If (objCombo.ValidValues.Count <= 0) Then
                        objCombo.ValidValues.Add("", "")
                        For inti = 0 To objRecSet.RecordCount - 1
                            objCombo.ValidValues.Add(Convert.ToString(objRecSet.Fields.Item(0).Value), Convert.ToString(objRecSet.Fields.Item(1).Value))
                            objRecSet.MoveNext()
                        Next
                    End If
                End If
            Catch ex As Exception
                Throw ex
            Finally
                System.Runtime.InteropServices.Marshal.ReleaseComObject(objRecSet)
                GC.WaitForPendingFinalizers()
                GC.Collect()
            End Try
        End Sub

  • Problem with Combo Box in a Dialog Box

    I have a dialog box that includes a combo box.
    For some reason the combo box shows up under the first text box. In other words, the combo box is not separate from the first field. It has the following:
    ComboBox with Sequence showing, then Enter Identifyer
    Textbox URL
    Textbox Enter Resource 1
    Textbox Enter Resource 2
    Textbox Enter Resource 3
    Textbox Enter Resource 4
    Textbox Enter Resource 5
    It's putting the combo box in the first text field...it should be
    ComboBox with Sequence showing
    URL Textbox
    Enter Identifyer Textbox
    Enter Resource 1 Textbox
    Enter Resource 2 Textbox...
    Here is my code:
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.event.*;
    import dl.*;
    * Dialog to enter container information
    public class AddContainer extends JDialog {
    private JTextField valueBox1;
    private JTextField valueBox2;
    private JTextField valueBox3;
    private JTextField valueBox4;
    private JTextField valueBox5;
    public String value1;
    public String value2;
    public String value3;
    public String value4;
    public String value5;
    private JTextField identifyerBox;
    private JTextField URLBox;
    private JTextField attrBox;
    public String identifyer;
    public String URL;
    public int choice;
    * Constructor.
    public AddContainer(Frame parent) {
    super(parent, "Add Container", true);
    JPanel pp = new JPanel(new DialogLayout2());
    pp.setBorder(new CompoundBorder(
    new EtchedBorder(EtchedBorder.RAISED),
    new EmptyBorder(5,5,5,5)));
    String[] ContStrings = {  "Sequence", "Bag", "Alternative" };
    // Add action listener.
    ActionListener contlst = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    JComboBox cb = (JComboBox)e.getSource();
    int choice = (int)cb.getSelectedIndex();
    //Create the combo box, select the item at index 0.
    //Indices start at 0, so 2 specifies the Alternative
    JComboBox ContList = new JComboBox(ContStrings);
    ContList.setSelectedIndex(0);
    ContList.addActionListener(contlst);
    //Add combo box to panel.
    pp.add(ContList);
    pp.add(new JLabel("Enter Identifyer"));
    identifyerBox = new JTextField(16);
    pp.add(identifyerBox);
    pp.add(new JLabel("URL"));
    URLBox = new JTextField(16);
    pp.add(URLBox);
    pp.add(new JLabel("Enter Resource 1"));
    valueBox1 = new JTextField(25);
    pp.add(valueBox1);
    pp.add(new JLabel("Enter Resource 2"));
    valueBox2 = new JTextField(25);
    pp.add(valueBox2);
    pp.add(new JLabel("Enter Resource 3"));
    valueBox3 = new JTextField(25);
    pp.add(valueBox3);
    pp.add(new JLabel("Enter Resource 4"));
    valueBox4 = new JTextField(25);
    pp.add(valueBox4);
    pp.add(new JLabel("Enter Resource 5"));
    valueBox5 = new JTextField(25);
    pp.add(valueBox5);
    JPanel p = new JPanel(new DialogLayout2());
    p.setBorder(new EmptyBorder(10, 10, 10, 10));
    p.add(pp);
    ActionListener lst = new ActionListener() {
    public void actionPerformed(ActionEvent evt) {
    identifyer = identifyerBox.getText();
    URL = URLBox.getText();
    value1 = valueBox1.getText();
    value2 = valueBox2.getText();
    value3 = valueBox3.getText();
    value4 = valueBox4.getText();
    value5 = valueBox5.getText();
    dispose();
    JButton saveButton = new JButton("ADD");
    saveButton.addActionListener(lst);
    getRootPane().setDefaultButton(saveButton);
    getRootPane().registerKeyboardAction(lst,
    KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
    JComponent.WHEN_IN_FOCUSED_WINDOW);
    p.add(saveButton);
    JButton cancelButton = new JButton("Cancel");
    lst = new ActionListener() {
    public void actionPerformed(ActionEvent evt) {
    dispose();
    cancelButton.addActionListener(lst);
    getRootPane().registerKeyboardAction(lst,
    KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
    JComponent.WHEN_IN_FOCUSED_WINDOW);
    p.add(cancelButton);
    getContentPane().add(p, BorderLayout.CENTER);
    pack();
    setResizable(false);
    setLocationRelativeTo(parent);

    Seems the problem is in your DialogLayout2 class which must be in package dl. I tried a grid layout and got something that looks like what you described. I laid out pp with a gridbag layout.
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.event.*;
    //import dl.*;
    * Dialog to enter container information
    public class jello extends JDialog {
      private JTextField valueBox1;
      private JTextField valueBox2;
      private JTextField valueBox3;
      private JTextField valueBox4;
      private JTextField valueBox5;
      public String value1;
      public String value2;
      public String value3;
      public String value4;
      public String value5;
      private JTextField identifyerBox;
      private JTextField URLBox;
      private JTextField attrBox;
      public String identifyer;
      public String URL;
      public int choice;
      * Constructor.
      public jello(JFrame parent) {
        super(parent, "Add Container", true);
        GridBagLayout gridbag = new GridBagLayout();
        GridBagConstraints gbc = new GridBagConstraints();
        JPanel pp = new JPanel(gridbag);
                            //(new GridLayout(0,2));
                            //(new DialogLayout2());
        pp.setBackground(Color.red);
        pp.setBorder(
          new CompoundBorder(
            new EtchedBorder(EtchedBorder.RAISED),
            new EmptyBorder(5,5,5,5)));
        String[] ContStrings = { "Sequence", "Bag", "Alternative" };
        // Add action listener.
        ActionListener contlst = new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JComboBox cb = (JComboBox)e.getSource();
            int choice = (int)cb.getSelectedIndex();
        //Create the combo box, select the item at index 0.
        //Indices start at 0, so 2 specifies the Alternative
        JComboBox ContList = new JComboBox(ContStrings);
        ContList.setSelectedIndex(0);
        ContList.addActionListener(contlst);
        //Add combo box to panel.
        gbc.insets = new Insets(2,2,2,2);
        gbc.anchor = gbc.WEST;
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(ContList, gbc);
        gbc.anchor = gbc.EAST;
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("Enter Identifyer"), gbc);
        identifyerBox = new JTextField(16);
        gbc.anchor = gbc.WEST;
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(identifyerBox, gbc);
        gbc.anchor = gbc.EAST;
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("URL"), gbc);
        URLBox = new JTextField(16);
        gbc.anchor = gbc.WEST;
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(URLBox, gbc);
        gbc.anchor = gbc.CENTER;
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("Enter Resource 1"), gbc);
        valueBox1 = new JTextField(25);
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(valueBox1, gbc);
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("Enter Resource 2"), gbc);
        valueBox2 = new JTextField(25);
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(valueBox2, gbc);
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("Enter Resource 3"), gbc);
        valueBox3 = new JTextField(25);
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(valueBox3, gbc);
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("Enter Resource 4"), gbc);
        valueBox4 = new JTextField(25);
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(valueBox4, gbc);
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("Enter Resource 5"), gbc);
        valueBox5 = new JTextField(25);
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(valueBox5, gbc);
        JPanel p = new JPanel();//(new DialogLayout2());
        p.setBackground(Color.blue);
        p.setBorder(new EmptyBorder(10, 10, 10, 10));
        p.add(pp);
        ActionListener lst = new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            identifyer = identifyerBox.getText();
            URL = URLBox.getText();
            value1 = valueBox1.getText();
            value2 = valueBox2.getText();
            value3 = valueBox3.getText();
            value4 = valueBox4.getText();
            value5 = valueBox5.getText();
            dispose();
        JButton saveButton = new JButton("ADD");
        saveButton.addActionListener(lst);
        getRootPane().setDefaultButton(saveButton);
        getRootPane().registerKeyboardAction(lst,
          KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
          JComponent.WHEN_IN_FOCUSED_WINDOW);
        p.add(saveButton);
        JButton cancelButton = new JButton("Cancel");
        lst = new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            dispose();
        cancelButton.addActionListener(lst);
        getRootPane().registerKeyboardAction(lst,
          KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
          JComponent.WHEN_IN_FOCUSED_WINDOW);
        p.add(cancelButton);
        parent.getContentPane().add(p, BorderLayout.CENTER);
        parent.pack();
        parent.setResizable(false);
    //    setLocationRelativeTo(parent);
        parent.setVisible(true);
      public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        new jello(frame);
        frame.setLocation(0,200);
    }

Maybe you are looking for

  • Master Data Services - Can not add new User and MDS can not Identify LOCAL Users

    Team, We are using  SQL Server 2008 R2 and system working since long and suddenly we observed mentioned two issues. The server MyServer is already restarted but did not help.  The MDS installed and configured on SAME Machine (MyServer).   I  have two

  • My mac contacts are not updating through icloud?

    I am puting new conacts on my phone and ipad but they are not being updated through to my mac any ideas?

  • Container transaction NOT rolled back after a long period of time.

    Hi, I am using Weblogic 6.1SP5 on RedHat 7.1 and I have seen an unexpected           behaviour with an MDB and I would like to know if there is any circumstance           in which a transaction is not rolled back automatically by the container       

  • Extending C: Drive in windows 2012

    We have windows 2012 server, and im trying to increase the C: Drive's disk space. The C: drive is 40 GB and I have only 100 MBs left. There was no available space in that server, so i shrinked another volume in order to create some room. every time i

  • Batch export projects

    I have over 100 iMovie project files I would like to export. Each project takes at least 20 minutes to process and I would love to be able to "set it and forget it" overnight, otherwise this is going to take many, many hours of my attention. Is there