Problem with combobox

I have a panel in table view. One of the fields, I have changed to a combo box. It works good except for one problem. When testing, I set the text in the field using the combo box. If I go directly to another record, in the same column, when i change that record, the one i had changed in the previous record changes also. It's like it has never lost focus of the previous record. I can click in another field in the previous record before going to the new record and it works OK. Any suggestions???
Thanks, William

Look in the API under combobox, there are 2 constructors there that may interest you--one for an array and another for a vector. Make your return object of either of those and you'll be fine.He's been told to use an array as the parameter several times, all to no avail. I'm beginning to lose hope for this one.Ok I'm sorry I've not got it yet but I just don't understand. Let me try again.
I have a method in my other class
private ArrayList< String > Quizbook= new ArrayList< String >(); // at the top of the program declaring it.
public ArrayList getwhole() // the method to return it
return Quizbook;
}So that method returns the Quizbook which is an Array? am I right so far?
Then in my other class I have
JComboBox Answer = new JComboBox(Vector (Q.getwhole));Q is an object in that previous class and '.getwhole' bieng the above method. that returns the array Quizbook. so surely I am using the array as the parameter?
And then I looked up the api and it says:
JComboBox
public JComboBox(Vector items)
Creates a JComboBox that contains the elements in the specified Vector. By default the first item in the vector and therefore the data model) becomes selected.
Parameters:
items - an array of vectors to insert into the combo box
See Also:
DefaultComboBoxModel
so if items is the parameter that you are saying should be an array then how come it isn't in the way I'm doing it the method I'm telling it to call getwhole which returns the array??
I know its probaly very tedious repeating things but It would help me alot if you could just go over it again explaining exactly where I'm going wrong.

Similar Messages

  • HTMLLoader problem with comboBox

    hi guys
    I'm trying to loader pdf file using XML to retrieve the URL  and I have CombBox to list all the files ,and I need to load another file every time I change the silder for the CombBox
    the problem is the pdf file load only first time and dosent  change if I select another one from the list, I dont know what the the probelm I tried manything like removeChild and I tried to use container but no change, only first time the file loaded
    this is the code
    cb_list.addEventListener(
    SliderEvent.CHANGE,changehandler);
    function changehandler(e:Event):void {
        var sort1:String=cb_list.value;
        var id:String = myXML.tip.(title == sort1)[email protected]();
         //trace(id)
        var slectedtip = myXML.tip.(title == sort1).fulltip.text();
        tit_label.text=myXML.tip.(@ID == id).title .text();
        date_label.text=myXML.tip.(@ID == id).date.text();
        full_tip.text=myXML.tip.(@ID == id).fulltip.text();
         var flashfileURL = myXML.tip.(@ID == id).picURL.text();
        swfURL.text=flashfileURL;
        var url:String = new String();
        url= myXML.tip.(@ID == id).picURL.text().toXMLString();
        var requestpdf:URLRequest=new URLRequest(url);
         var container:Sprite = new Sprite();
        var pdf = new HTMLLoader();
        pdf.height=stage.stageHeight-150;
        pdf.width=stage.stageWidth-270;
        pdf.y=100;
        pdf.x=260;
        pdf.load(requestpdf);
           pdf.addEventListener(Event.COMPLETE, completeHandler);
        function completeHandler(event:Event):void {
            addChild(pdf);

    [problem with combobox comes infront of popup window|http://forum.java.sun.com/thread.jspa?threadID=5291468]

  • Problem with combobox gets dispalyed infront of popup window

    when ever popup window is open and kept on combobox ,combobox appears in front or overlaps the popup window,where exactly i have to check the code.which place of code i have to look into... plz help if there is any problem with css then plz specify which property i have to look into..

    [problem with combobox comes infront of popup window|http://forum.java.sun.com/thread.jspa?threadID=5291468]

  • Problem with ComboBox / Matrix

    Hi all,
    I have this problem... when I try to populate a column with comboxbox ...
    Code:
            Set co = lmatrix.Columns.Add("orgDist", it_COMBO_BOX)
                co.TitleObject.Caption = "Dist"
                co.Editable = True
                co.Visible = True
                co.DataBind.SetBound True, "@DIST", "Code"
            Set DBSource = lfrm.DataSources.DBDataSources.Item("@DIST")
                DBSource.Query
                For x = 0 To DBSource.Size - 1
                    tp1 = Trim(DBSource.GetValue("Code", x))
                    tp2 = Trim(DBSource.GetValue(3, x))
                    co.ValidValues.Add tp1, tp2
                    DBSource.Offset = x
                Next
    - at the 'co.ValidValues.Add tp1,tp2' I receive this error
      'Valid Value - The Value Exceed boundaries'
    - tp1 max value is of 8 Char
    - tp2 max value is of 50 Char
    I've try to insert manually the value like validvalue.add "101","23123123....213" and it work correctly..
    where is my error??
    Bye!!
    PS: Sorry for my english

    Hi,
    There's no problem with your code itself (however you don't need to set the DBDataSource offset, if you are only filling the ComboBox - GetValue picks the right data anyway...). It works fine (at least with 2004 PL23 + 2005 Build 119).
    Looks like a problem with your data (or some "old" bug, but this would be the first time I heard about it...)?
    ...or did you solve it in the meantime?
    Regards,
    Frank

  • Custom DataGrid problems with Comboboxes

    I am using a custom datagrid with comboboxes and
    colorpickers. I found this code on the web and adapted it to work
    with my code. The only problem is that if you pull down a combobox
    and then click somewhere outside without selecting anything, it
    seems to erase the data in the dataprovider arraycollection and so
    'value' in the set data method becomes null.

    This is not a bug if I understand you properly. I believe most people would wish anything which is obtained via the tv to be backed up, which is why the content is transferred. If you want it to remain available on the tv you will need to sync it back to it.

  • Problem with comboBox editor

    Hi experts,
    i am keeping a combobox renderer and editor in my JTable for 2 columns say 5th column and 7th column.
    In renderer no Problem.
    But while i am editing ,whenever i am choosing a perticular item from the drop down in the first row of table,it is affecting the remaining set of rows.,not all the rows also.
    for example,next 5 rows are getting the same selected value.
    next some 2 rows are getting affected.
    the below 2 class are my renderer and editor.public class ComboBoxRenderer extends JComboBox implements TableCellRenderer {
            public ComboBoxRenderer(String[] items) {
                            super(items);
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                    if (isSelected) {
                    // Select the current value
                    setSelectedItem(value);
                    return this;
    }My ComboBox editor is public class ComboBoxEditor extends DefaultCellEditor {
            public ComboBoxEditor(String[] items) {
                   super(new JComboBox(items));
    }so i am using this render and editor in my swing screen by the following codeString strSP[] = {"P", "O", "H", " "};
    column5.setCellEditor(new ComboBoxEditor(strSP));
    column5.setCellRenderer(new ComboBoxRenderer(strSP));I am sure like the problem with my renderer and editoronly,but i am helpless.
    Please if someone help me to come out of this problem,it will be much helpful for me .
    thanks

    Hi,
    Thanks for u'r reply
    I tried in so many ways.
    I tried with u'r editor,and sun forum examples also.
    I brief what i want.
    I am having table with 3 column.
    The zeroth col, and the 2 col is a combo box.so i am rendering.
    when i choose a one from zeroth col combo Box ,the 2nd col ComboBox value has to change into YES
    when i choose a apart from one from zeroth col combo Box ,the 2nd col combo Box value has to change into NO.
    Here my Problem is
    When ever i am choosing the particular value from the 1st combo box,it is affecting the all the combobox values below(set of values,not all)..To solve that i kept the commented line in the renderer but it is creating the new problem.
    I am very seriously working to solve this problem,if any one suggest to solve this,it will be very much helpful to me.
    I am posting my code belowimport java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.TableModelEvent;
    import javax.swing.event.TableModelListener;
    import javax.swing.table.*;
    public class TableComboBox extends JFrame implements TableModelListener
         public JTable table;
            DefaultTableModel model = null;
            JComboBox editor2 = null;
         public TableComboBox()
              Object[][] data = { {" ", "A" , " "}, {" ", "B", " "}, {" ", "C", " "}, {" ", "D", " "}, {" ", "E", " "}, {" ", "F", " "}, {" ", "G", " "}, {" ", "H", " "}  };
                    String[] columnNames = {"FIRST","SECOND", "THIRD" };
                    String[] column0Items = { "one", "two", "three", "four" };
                    String column2Items[] = {"YES","NO"};
              model = new DefaultTableModel(data, columnNames);
                    model.addTableModelListener(this);
              table = new JTable(model);
              //  Set the Zeroth column to use a combobox as its editor,renderer
                    table.getColumnModel().getColumn(0).setCellRenderer(new ComboBoxRenderer(column0Items));
              table.getColumnModel().getColumn(0).setCellEditor(new ComboBoxEditor(column0Items));
                    //  Set the second column to use a combobox as its editor,renderer
                    table.getColumnModel().getColumn(2).setCellRenderer(new ComboBoxRenderer(column2Items));
              table.getColumnModel().getColumn(2).setCellEditor(new ComboBoxEditor(column2Items));
                    JScrollPane scrollPane = new JScrollPane( table );
              getContentPane().add( scrollPane );
             public void tableChanged(TableModelEvent e) {
                    int row = e.getFirstRow();
                    int column = e.getColumn();
                    if(e.getType() == TableModelEvent.INSERT) {
                    if (e.getType() == TableModelEvent.UPDATE) {
                            if(table.getEditingRow() != table.getSelectedRow())
                                    ((DefaultCellEditor)table.getCellEditor()).cancelCellEditing();                      
                   if ( column == 0 ) {
                                    if(model.getValueAt(row, 0).equals("one")) {
                                            model.setValueAt("YES", row, 2);
                                    } else if(model.getValueAt(row, 0).equals("two")){
                                            model.setValueAt("NO", row, 2);
                                    } else if(model.getValueAt(row, 0) == "three"){
                                            model.setValueAt("NO", row, 2);
                                    } else if(model.getValueAt(row, 0) == "four"){
                                            model.setValueAt("NO", row, 2);
                           }else{
                                    //do nothing
         public static void main(String[] args)
              final TableComboBox frame = new TableComboBox();
              frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
              frame.pack();
              frame.setVisible(true);
            class ComboBoxRenderer extends JComboBox implements TableCellRenderer {
                    String items[];
                    public ComboBoxRenderer(String[] items) {
                                    super(items);
                                    this.items = items;
                    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                                   if(isSelected){
                                            setSelectedItem(value.toString());
                                            return this;
                                    }/*else{
                                            setSelectedItem(items[0]));
                            return this;
            class ComboBoxEditor extends DefaultCellEditor {
                    public ComboBoxEditor(String[] items) {
                           super(new JComboBox(items));
            }

  • 2007A - Problem with Combobox.Selected with an empty value

    Hi all,
    I 've tried to launch my add-on created with SBO 2005 SP1
    on 2007 client.
    I've a problem when I try to do
    myCombobox.Selected.Value
    when the valid value is empty.
    Selected is null and I've an error.
    So I must test each Combobox by doing this :
    if( myCombobox.Selected is null)
    But I've hundreds of this case in my code.
    Does an another solution exists?
    Thanks

    you have the same problem in every business one version.
    you first have to check if the property is not null/nothing
    the only other way is that you use try / catch
    value = oform.Items.Item("cmb1").Specific.selected.value()
    Catch ex As Exception
       value = ""
    End Try
    but the effort is the same for you

  • Still having a problem with ComboBox in a Table

    In my JClient app I still can't get a ComboBox to work in a JTable. The ComboBox doesn't display in the table and my pageDef file (below) looks fine to me. Can anyone verify that a ComboBox in a JTable works in the production release or tell me what I'm doing wrong?
    <?xml version="1.0" encoding="UTF-8" ?>
    <pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel"
    version="10.1.3.36.73" id="PanelPersonAddressView8PageDef"
    Package="com.esp.test.pageDefs"
    MsgBundleClass="com.esp.test.pageDefs.PanelPersonAddressView8PageDefMsgBundle">
    <parameters/>
    <executables>
    <iterator RangeSize="-1" Binds="AppModuleDataControl.PersonAddressView1"
    DataControl="AppModuleDataControl" id="PersonAddressView1Iter"/>
    <iterator id="AddressTypeView1Iterator" RangeSize="-1"
    Binds="AddressTypeView1" DataControl="AppModuleDataControl"/>
    <iterator id="PersonAddressView1Iterator" RangeSize="10"
    Binds="PersonAddressView1" DataControl="AppModuleDataControl"/>
    </executables>
    <bindings>
    <table ColumnSort="entireCollection" id="PersonAddressView1"
    IterBinding="PersonAddressView1Iter"
    xmlns="http://xmlns.oracle.com/adfm/jcuimodel">
    <AttrNames xmlns="http://xmlns.oracle.com/adfm/uimodel">
    <Item Value="PersonId"/>
    <Item Value="AddressId"/>
    <Item Value="AddressTypeId"/>
    <Item Value="ReadOnlyAddress"/>
    </AttrNames>
    <AttrProp name="AddressTypeId">
    <EditorDef RTClass="oracle.jbo.uicli.jui.JULOVEditorPropDef"
    DTClass="oracle.adf.dt.objects.jui.JUDTLOVEditorProp"
    Name="ComboBox" binding="DCComboBox"/>
    </AttrProp>
    </table>
    <combobox id="DCComboBox" xmlns="http://xmlns.oracle.com/adfm/jcuimodel"
    StaticList="false" ListOperMode="0"
    IterBinding="PersonAddressView1Iterator"
    ListIter="AddressTypeView1Iterator">
    <AttrNames xmlns="http://xmlns.oracle.com/adfm/uimodel">
    <Item Value="AddressTypeId"/>
    </AttrNames>
    <ListAttrNames xmlns="http://xmlns.oracle.com/adfm/uimodel">
    <Item Value="AddressTypeId"/>
    </ListAttrNames>
    <ListDisplayAttrNames xmlns="http://xmlns.oracle.com/adfm/uimodel">
    <Item Value="AddressTypeDesc"/>
    </ListDisplayAttrNames>
    </combobox>
    </bindings>
    </pageDefinition>

    I have a similar problem. I have got the combobox in the jtable working (when i switched off the labels). Everything seems to works except when I select the first record in the combobox. When I tab out of the cell it becomes empty. If I first select a different record( 2-n) and then the first record the value remains when I tab out of the cell. This also looks like a bug to me. Here's my binding code:
    <pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel"
    version="10.1.3.36.73" id="OpeningsTijdenPanelPageDef"
    Package="store.ui.panel.in3_1_park.pageDefs">
    <parameters/>
    <executables>
    <iterator id="POpeningsTijdView1Iterator" RangeSize="-1"
    Binds="POpeningsTijdView1"
    DataControl="ParkerenAppModuleDataControl"/>
    <iterator id="DagView1Iterator" RangeSize="-1" Binds="DagView1"
    DataControl="ParkerenAppModuleDataControl"/>
    </executables>
    <bindings>
    <table ColumnSort="entireCollection"
    id="ActiviteitParkerenView1POpeningsTijdView1"
    IterBinding="POpeningsTijdView1Iterator"
    xmlns="http://xmlns.oracle.com/adfm/jcuimodel">
    <AttrNames xmlns="http://xmlns.oracle.com/adfm/uimodel">
    <Item Value="Dagid"/>
    <Item Value="Begintijd"/>
    <Item Value="Eindtijd"/>
    </AttrNames>
    <AttrProp name="Dagid">
    <EditorDef RTClass="oracle.jbo.uicli.jui.JULOVEditorPropDef"
    DTClass="oracle.adf.dt.objects.jui.JUDTLOVEditorProp"
    Name="ComboBox" binding="DCComboBox"/>
    </AttrProp>
    <AttrProp name="Dag">
    <EditorDef RTClass="oracle.jbo.uicli.jui.JULOVEditorPropDef"
    DTClass="oracle.adf.dt.objects.jui.JUDTLOVEditorProp"
    Name="ComboBox" binding="DCComboBox"/>
    </AttrProp>
    </table>
    <combobox id="DCComboBox" xmlns="http://xmlns.oracle.com/adfm/jcuimodel"
    StaticList="false" ListOperMode="0"
    IterBinding="POpeningsTijdView1Iterator"
    ListIter="DagView1Iterator" NullValueFlag="1">
    <AttrNames xmlns="http://xmlns.oracle.com/adfm/uimodel">
    <Item Value="Dagid"/>
    </AttrNames>
    <ListAttrNames xmlns="http://xmlns.oracle.com/adfm/uimodel">
    <Item Value="Dagid"/>
    </ListAttrNames>
    <ListDisplayAttrNames xmlns="http://xmlns.oracle.com/adfm/uimodel">
    <Item Value="Dag1"/>
    </ListDisplayAttrNames>
    </combobox>
    </bindings>
    </pageDefinition>
    Has anyone else encountered this problem?

  • Performance problems with combobox and datasource

    We have a perfomance problem, when we are connecting a datatable object or something like this to a datasource property of a combobox. Below you find the source code. The SQL-Statement reads about 40000 rows and the result (all 40000) should be listed in the combobox. There is duration about 30 second before this process has finished. Any suggestions?
    Dim ds As New DataSet
    strSQL = "Select * from am.city"
    conn = New Oracle.DataAccess.Client.OracleConnection(Configuration.ConfigurationSettings.AppSettings("conORA"))
    comm = New Oracle.DataAccess.Client.OracleCommand(strSQL)
    da = New Oracle.DataAccess.Client.OracleDataAdapter(strSQL, conn)
    conn.Open()
    da.Fill(ds)
    conn.Close()
    Dim dt As New DataTable
    dt = ds.Tables(0)
    ComboBox1.DataSource = dt
    ComboBox1.ValueMember = dv.Table.Columns("id").ColumnName
    ComboBox1.DisplayMember = dv.Table.Columns("city").ColumnName

    But how long does it take to fill the DataTable?
    I can fill a 40000 row datatable in under 4 seconds.
    DataBinding a combo box to that many rows is pretty expensive, and not normally recommended.
    David
    Dim strConnection As String = "Data Source=oracle;User ID=scott;Password=tiger;"
    Dim conn As OracleConnection = New OracleConnection(strConnection)
    conn.Open()
    Dim cmd As New OracleCommand("select * from (select * from all_objects union all select * from all_objects) where rownum <= 40000", conn)
    Dim ds As New DataSet()
    Dim da As New OracleDataAdapter(cmd)
    Dim begin As Date = Now
    da.Fill(ds)
    Console.WriteLine(ds.Tables(0).Rows.Count & " rows loaded in " & Now.Subtract(begin).TotalSeconds & " seconds")
    outputs
    40000 rows loaded in 3.734375 seconds

  • Problem with combobox.select method in 2007A

    Hi,
    When I'm trying to select the empty validvalue with a combo in SBO 2007 A, I've the error "Out of Range"
    myCombo.Select( 0, BoSearchKey.psk_Index);
    However I'm sure that the item 0 of my ValidValues is blank.
    I tried to do the same thing by value or description and it's the same problem.
    Can anyone help me ?
    Thanks
    (I'm using 2005 version of SAPboui/bobsCom.dll)

    Hi Julien,
    i tried it as
    oComboBox.ValidValues.Add("1", "Combo Value 1")
            oComboBox.ValidValues.Add("", "") - as you wrote
            oComboBox.ValidValues.Add("2", "Combo Value 2")
            oComboBox.ValidValues.Add("3", "Combo Value 3")
            oComboBox.Select("", SAPbouiCOM.BoSearchKey.psk_ByValue)
            oComboBox.Select(1, SAPbouiCOM.BoSearchKey.psk_Index)
    and both select method work. Are you sure that you have added this blank value?
    Try to debug it as
            Dim q As Integer
            Dim s As String
            For q = 0 To oComboBox.ValidValues.Count - 1
                s = oComboBox.ValidValues.Item(q).Value
            Next
    maybe it helps you.
    Petr

  • [Solved]probleme with combobox

    hi,
    i create a frame using ADF BC in which i drag and drop the departmentVO and i set it a combobox.
    in my database i have 60 department, when i open the combobox i fond only 10 departments and i want to find it all in the combobox.
    can any body help me.
    thanks
    Message was edited by:
    7rouz

    Hi 7rouz,
    Go into your pageDef, find the iterator on which your list is based, then change the "rangeSize" option to -1 (which means "get all entries", i assume it is set to 10 for the moment and so displays only 10 entries)
    Hope that works,
    Regards,
    Tif

  • Problem with userdefined combobox selection

    Hi guys,
    Have an "AutoSearchComboBox" as follows for searching the combolist fast.Have some problems with the selection in the AutoSearchComboBox.
    *public class AutoSearchComboBox extends JComboBox {*
    private static final long serialVersionUID = 1L;
    *public AutoSearchComboBox(){*
    setEditable(true);
    setModel(new AutoSearchComboBoxModel());
    setEditor(new MyComboBoxEditor());
    public class AutoSearchComboBoxModel extends AbstractListModel
    *implements MutableComboBoxModel{*
    private static final long serialVersionUID = 1L;
    private Vector items,filteredItems;
    private Filter filter;
    private Object selectedItem;
    *public AutoSearchComboBoxModel(){*
    this.items = new Vector();
    this.filteredItems = new Vector();
    this.filter = null;
    updateFilteredItems();
    *public void addElement(Object obj) {*
    items.add(obj);
    updateFilteredItems();
    public void insertElementAt(Object obj, int index) {}
    *public void removeElement(Object obj) {*
    items.remove(obj);
    updateFilteredItems();
    *public void removeElementAt(int index) {*
    items.remove(index);
    updateFilteredItems();
    *public Object getSelectedItem() {*
    return selectedItem;
    *public void setSelectedItem(Object anItem) {*
    if ((selectedItem==null) && (anItem==null))
    return;
    if ((selectedItem != null) && (selectedItem.equals(anItem)))
    return;
    if(anItem!= null && anItem.equals(selectedItem))
    return;
    selectedItem = anItem;
    fireContentsChanged(this, -1,-1);
    *public Object getElementAt(int index) {*
    return filteredItems.get(index);
    *public int getSize() {*
    return filteredItems.size();
    *public void setFilter(Filter filter){*
    this.filter = filter;
    updateFilteredItems();
    *public void updateFilteredItems(){*
    fireIntervalRemoved(this,0,filteredItems.size());
    filteredItems.clear();
    if(filter==null)
    filteredItems.addAll(items);
    else
    *for(Iterator iter = items.iterator(); iter.hasNext();){*
    Object item = iter.next();
    if (filter.accept(item))
    filteredItems.add(item);
    fireIntervalAdded(this,0, filteredItems.size());
    *public static interface Filter{*
    public boolean accept(Object obj);
    *class FilterItems implements Filter{*
    private String prefix;
    *public FilterItems(String prefix){*
    this.prefix = prefix;
    *public boolean accept(Object obj){*
    return doesStartsWithThePrefix(obj.toString(),prefix);
    *private boolean doesStartsWithThePrefix(String str1,String str2){*
    return str1.toUpperCase().startsWith(str2.toUpperCase());
    *public class MyComboBoxEditor implements ComboBoxEditor,DocumentListener{*
    private JTextField text;
    private volatile boolean filtering = false;
    private volatile boolean setting = false;
    *public MyComboBoxEditor(){*
    text = new JTextField(15);
    text.getDocument().addDocumentListener(this);
    *public void addActionListener(ActionListener l) {*
    *// TODO Auto-generated method stub*
    *public void removeActionListener(ActionListener l) {*
    *// TODO Auto-generated method stub*
    *public Component getEditorComponent() {*
    return text;
    *public void setItem(Object anObject) {*
    if(filtering)
    return;
    setting = true;
    String newText = (anObject==null)? "":anObject.toString();
    text.setText(newText);
    setting = false;
    *public Object getItem() {*
    return text.getText();
    *public void selectAll() {*
    text.selectAll();
    *public void changedUpdate(DocumentEvent e) {*
    *// TODO Auto-generated method stub*
    *public void insertUpdate(DocumentEvent e) {*
    handleChange();
    *public void removeUpdate(DocumentEvent e) {*
    handleChange();
    *public void handleChange(){*
    if(setting)
    return;
    filtering = true;
    Filter filter = null;
    if(text.getText().length()>0)
    filter = new FilterItems(text.getText());
    *((AutoSearchComboBoxModel)getModel()).setFilter(filter);*
    setPopupVisible(false);
    if (getModel().getSize()>0)
    setPopupVisible(true);
    filtering = false;
    Iam creating the combo boxes as follows from another source file.
    private AutoSearchComboBox indexTagCombo,indexValueCombo
    //The following function is called for loading the comboBoxes.
    private void loadInitialIndexTagValues()
    indexTagCombo.removeAllItems();
    //Getting values to be fiiled in the comboBox.
    Set tags = this.model.getAvailableIndexTags();
    // Iterating over the elements in the set
    Iterator tagIter = tags.iterator();
    while (tagIter.hasNext()) {
    indexTagCombo.addItem(tagIter.next());
    //Loading index values.
    String currTag = (String)indexTagCombo.getSelectedItem(); //Selection problem 1
    The statement above returns me null & the follwing code doesnt fill the other comboBox.
    Set values = model.getAllValues(currTag);
    indexValueCombo.removeAllItems();
    Iterator valIter = values.iterator();
    while (valIter.hasNext()) {
    indexValueCombo.addItem(valIter.next());
    Have added an "itemListener" to the indexTagCombo as follows:
    indexTagCombo.addItemListener(new ItemListener(){
    public void itemStateChanged(ItemEvent e)
    indexTagSelection(e);
    private void indexTagSelection(ItemEvent e) {
    if (e.getStateChange() == ItemEvent.SELECTED)
    //The "getStateChange" is never ItemEvent.SELECTED,so that it never gets in to this loop.//Another problem
    //code goes Here
    There is some problem with the defined "AutoSearchComboBox" with selection.When I change the privately defined "AutoSearchComboBox" to JComboBox and make it editable,all the selection problems are gone.
    In short all the "getSelectedItem" from the "AutoSearchComboBox" and the "itemstate" events defined are not going to the "ItemEvent.SELECTED"
    What should I fix in the "AutoSearchComboBox" so that the selections work.
    Any help is greatly appreciated.
    Thanks
    P

    Hi Smita,
    When you create the Transaction code either thru Se80 or thru Se93... please see that you are giving the screen number asked there as 1000, which is the default screen number for the selection screen.
    Also, please see if the checkboxes for the GUI Support are ticked. I think it iwll solve you problem.
    Regards,
    Jayant

  • Problem with Background image and JFrame

    Hi there!
    I've the following problem:
    I created a JFrame with an integrated JPanel. In this JFrame I display a background image. Therefore I've used my own contentPane:
    public class MContentPane extends JComponent{
    private Image backgroundImage = null;
    public MContentPane() {
    super();
    * Returns the background image
    * @return Background image
    public Image getBackgroundImage() {
    return backgroundImage;
    * Sets the background image
    * @param backgroundImage Background image
    public void setBackgroundImage(Image backgroundImage) {
    this.backgroundImage = backgroundImage;
    * Overrides the painting to display a background image
    protected void paintComponent(Graphics g) {
    if (isOpaque()) {
    g.setColor(getBackground());
    g.fillRect(0, 0, getWidth(), getHeight());
    if (backgroundImage != null) {
    g.drawImage(backgroundImage,0,0,this);
    super.paintComponent(g);
    Now the background image displays correct. But as soon as I click on some combobox that is placed within the integrated JPanel I see fractals of the opened combobox on the background. When I minimize
    the Frame they disappear. Sometimes though I get also some fractals when resizing the JFrame.
    It seems there is some problem with the redrawing of the background e.g. it doesn't get redrawn as often as it should be!?
    Could anyone give me some hint, on how to achieve a clear background after clicking some combobox?
    Thx in advance

    I still prefer using a border to draw a background image:
    import java.awt.*;
    import java.awt.image.*;
    import javax.swing.border.*;
    public class CentredBackgroundBorder implements Border {
        private final BufferedImage image;
        public CentredBackgroundBorder(BufferedImage image) {
            this.image = image;
        public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
            int x0 = x + (width-image.getWidth())/2;
            int y0 = y + (height-image.getHeight())/2;
            g. drawImage(image, x0, y0, null);
        public Insets getBorderInsets(Component c) {
            return new Insets(0,0,0,0);
        public boolean isBorderOpaque() {
            return true;
    }And here is a demo where I load the background image asynchronously, so that I can launch the GUI before the image is done loading. Warning: you may find the image disturbing...
    import java.awt.*;
    import java.io.*;
    import java.net.URL;
    import javax.imageio.*;
    import javax.swing.*;
    import javax.swing.border.*;
    public class BackgroundBorderExample {
        public static void main(String[] args) throws IOException {
            JFrame.setDefaultLookAndFeelDecorated(true);
            JFrame f = new JFrame("BackgroundBorderExample");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JTextArea area = new JTextArea(24,80);
            area.setForeground(Color.WHITE);
            area.setOpaque(false);
            area.read(new FileReader(new File("BackgroundBorderExample.java")), null);
            final JScrollPane sp = new JScrollPane(area);
            sp.setBackground(Color.BLACK);
            sp.getViewport().setOpaque(false);
            f.getContentPane().add(sp);
            f.setSize(600,400);
            f.setLocationRelativeTo(null);
            f.setVisible(true);
            String url = "http://today.java.net/jag/bio/JagHeadshot.jpg";
            final Border bkgrnd = new CentredBackgroundBorder(ImageIO.read(new URL(url)));
            Runnable r = new Runnable() {
                public void run() {
                    sp.setViewportBorder(bkgrnd);
                    sp.repaint();
            SwingUtilities.invokeLater(r);
    }

  • Problem with JComboBox in aTable Cell

    I try to put JComboBox in JTableCell,
    what i want to do is something like this...
    Question | Answer |
    1. what is your favourite | a. Pizza |
    food? | b. Hot Dog |
    2. what is your favourite | a. red |
    color? | b. blue |
    Object[][] data = {
    {"1.What is your favourite food?", new AnswerChoices(new String[]{"a.Pizza","b.Hot Dog"})},
    {"2.What is your favourite color?", new AnswerChoices(new String[]{"a.red","b.blue"})}
    here my code;
    //class AnswerChoicesCellEditor
    import javax.swing.table.*;
    import javax.swing.*;
    import java.awt.Component;
    import java.awt.event.MouseEvent;
    import java.util.EventObject;
    import de.falcom.table.*;
    public class AnswerChoicesCellEditor extends AbstractCellEditor implements TableCellEditor{
         protected JComboBox mComboBox;
    public AnswerChoicesCellEditor(){
         mComboBox = new JComboBox();
         mComboBox.addActionListener(this);
         mComboBox.setEditable(false);
    public Component getTableCellEditorComponent(JTable table,Object value,boolean isSelected,int row,int column){
         if(value instanceof AnswerChoices){
              AnswerChoices a = (AnswerChoices)value;
              String[] c = a.getChoices();
              mComboBox.removeAllItems();
              for(int i=0; i < c.length; i++)
                   mComboBox.addItem(c);
                   mComboBox.setSelectedIndex(a.getAnswer());
         return mComboBox;
    public Object getCellEditorValue(){
         int nchoices = mComboBox.getItemCount();
         String[] c = new String[nchoices];
         for(int i = 0; i<nchoices; i++){
              c[i] = mComboBox.getItemAt(i).toString();
         return new AnswerChoices(c,mComboBox.getSelectedIndex());
         //return mComboBox.getSelectedItem(); //here i get but after selection there is no comboBox in tableCell
    //the Renderer class
    import javax.swing.table.TableCellRenderer;
    import javax.swing.*;
    import java.awt.Component;
    public class AnswerChoicesCellRenderer extends JComboBox implements TableCellRenderer {
         private Object curValue;
    /** Creates new AnswerChoiceCellRenderer */
    public AnswerChoicesCellRenderer() {
    setEditable(false);
    public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column) {
    if (value instanceof AnswerChoices) {
    AnswerChoices nl = (AnswerChoices)value;
    String[] tList = nl.getChoices();
    if (tList != null) {
    removeAllItems();
    for (int i=0; i<tList.length; i++)
    addItem(tList[i]);
         setSelectedIndex(AnswerChoices.getAnswer());
         //this.setSelectedItem();
    //return this;
    //this.getTableCellRendererComponent(table,value,isSelected,hasFocus,row,column);
    if (table != null)
    if (table.isCellEditable(row, column))
    setForeground(CellRendererConstants.EDITABLE_COLOR);
    else
    setForeground(CellRendererConstants.UNEDITABLE_COLOR);
              setBackground(table.getBackground());
    return this;
    public class AnswerChoices {
         static int ans = 0;
         String[] choices ;
    public AnswerChoices(String[]c,int a){
              choices = c;
              ans          = a;
    public AnswerChoices(String[] c){
              this(c,0);
    public String[] getChoices(){
         return choices;
    public void setAnswer(int a){
         ans = a;
    public static int getAnswer(){
         return ans;
    //the TableModel i used in my app
    import java.awt.Color;
    import javax.swing.JTable;
    import javax.swing.ListSelectionModel;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableCellEditor;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    import javax.swing.table.TableModel;
    import javax.swing.*;
    public class FAL_Table extends JTable {
    /** Creates new FAL_Table */
    public FAL_Table(DefaultTableModel dtm) {
    super(dtm);
    setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    setRowSelectionAllowed(false);
    setColumnSelectionAllowed(false);
    setBackground(java.awt.Color.white);
    setDefaultCellEditorRenderer();
    private void setDefaultCellEditorRenderer(Class forClass, TableCellEditor editor, TableCellRenderer renderer) {
         setDefaultEditor(forClass, editor);
         setDefaultRenderer(forClass, renderer);
         private void setDefaultCellEditorRenderer() {
              // Setting default editor&renderer of Boolean
              setDefaultCellEditorRenderer(Boolean.class, new BooleanCellEditor(), new BooleanCellRenderer());
              //Setting default editor&renderer of ComboBox
              setDefaultCellEditorRenderer(JComboBox.class, new ComboBoxCellEditor( ),new ComboBoxRenderer());
              // Number class
              // Setting default editor&renderer of java.math.BigDecimal
              setDefaultCellEditorRenderer(java.math.BigDecimal.class,new NumberCellEditor(), new NumberCellRenderer());
              // Setting default editor&renderer of java.math.BigInteger
              setDefaultCellEditorRenderer(java.math.BigInteger.class,new NumberCellEditor(), new NumberCellRenderer());
              // Setting default editor&renderer of java.lang.Byte
              setDefaultCellEditorRenderer(Byte.class,new NumberCellEditor(), new NumberCellRenderer());
              // Setting default editor&renderer of Double
              setDefaultCellEditorRenderer(Double.class,new NumberCellEditor(), new NumberCellRenderer());
              // Setting default editor&renderer of Float
              setDefaultCellEditorRenderer(Float.class,new NumberCellEditor(), new NumberCellRenderer());
              // Setting default editor&renderer of Integer
              setDefaultCellEditorRenderer(Integer.class,new NumberCellEditor(), new NumberCellRenderer());
              // Setting default editor&renderer of Long
              setDefaultCellEditorRenderer(Long.class,new NumberCellEditor(), new NumberCellRenderer());
              // Setting default editor&renderer of Short
              setDefaultCellEditorRenderer(Short.class,new NumberCellEditor(), new NumberCellRenderer());
              // Setting default editor&renderer of String
              setDefaultCellEditorRenderer(String.class,new StringCellEditor(), new StringCellRenderer());
              // Setting default editor&renderer of FileName
              setDefaultCellEditorRenderer(FileName.class,new FileNameCellEditor(), new FileNameCellRenderer());
              // Setting default editor&renderer of Color
              setDefaultCellEditorRenderer(Color.class,new ColorCellEditor(), new ColorCellRenderer());
              setDefaultCellEditorRenderer(AnswerChoices.class, new AnswerChoicesCellEditor(), new AnswerChoicesCellRenderer());
              setDefaultCellEditorRenderer(JSpinner.class, new SpinnerCellEditor(), new SpinnerRenderer());
    public Class getCellClass(int row,int col) {
    TableModel model = getModel();
    if (model instanceof FAL_TableModel) {
    FAL_TableModel ptm = (FAL_TableModel)model;
    return ptm.getCellClass(row,convertColumnIndexToModel(col));
    return model.getColumnClass(convertColumnIndexToModel(col));
    public TableCellRenderer getCellRenderer(int row, int column) {
    TableColumn tableColumn = getColumnModel().getColumn(column);
    TableCellRenderer renderer = tableColumn.getCellRenderer();
    if (renderer == null) {
    renderer = getDefaultRenderer(getCellClass(row,column));
    return renderer;
    public TableCellEditor getCellEditor(int row, int column) {
    TableColumn tableColumn = getColumnModel().getColumn(column);
    TableCellEditor editor = tableColumn.getCellEditor();
    if (editor == null) {
    editor = getDefaultEditor(getCellClass(row,column));
    return editor;
    import javax.swing.table.*;
    import java.util.Vector;
    import java.awt.event.MouseEvent;
    import java.util.EventObject;
    public class FAL_TableModel extends DefaultTableModel implements TableModel {
    public FAL_TableModel() {
    this((Vector)null, 0);
    public FAL_TableModel(int numRows, int numColumns) {
    super(numRows,numColumns);
    public FAL_TableModel(Vector columnNames, int numRows) {
    super(columnNames,numRows);
    public FAL_TableModel(Object[] columnNames, int numRows) {
    super(convertToVector(columnNames), numRows);
    public FAL_TableModel(Vector data, Vector columnNames) {
    setDataVector(data, columnNames);
    public FAL_TableModel(Object[][] data, Object[] columnNames) {
    setDataVector(data, columnNames);
         public boolean isCellEditable(int row, int col) {
    //Note that the data/cell address is constant,
    //no matter where the cell appears onscreen.
    Object obj = getValueAt(row,col);
    if (col != 1){
    return false;
         }else{
              return true;
    public Class getCellClass(int row,int col) {
    Object obj = getValueAt(row,col);
    if (obj != null)
         return obj.getClass();
         else
         return Object.class;
    public Object getCellValue(int row,int col) {
    Object obj = getValueAt(row,col);
              return obj;      
    my problem is, when i select an item from one of the comboBox in the table the value of the other cells changes too and i have the same problem with JSpinner.
    please help i am stuck
    Gebi

    and when i try to get the current value oa a cell it returns the Component class like this
    AnswerChoices@bf1f20 ...

  • Problem with checkbox on table component

    Hello i am having a problem with checkbox in table component
    i am developing something like a shopping cart app and i have a checkbox in my table component , i want users to select items from the checkbox to add to thier cart, They can select the items from cartegory combobox , my problem is when they select the items from the checkbox if they select another category the alread selected once do not display in my collection opbject please how can i maintain the state of the already selected items in my collection object

    Hi,
    Please go through the tutorial "Understanding scope and managed beans". This is available at:
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/scopes.html
    The details of the selected items need to be stored in an object that is in session scope.
    Hope this helps
    Cheers
    Girish

Maybe you are looking for

  • Query similar to FBL5n but for a given period instead of a day

    R/3 transaction FBL5n displays open items for a customer on a given day . I have the bc infocube 0FIAR_O03, I m trying to figure out how to display the equivalent of FBL5n but for everyday of the period..

  • How to find out who is owner of existing workspace?

    Hello, I would like to create Workspace. But this WS name is already exist. Can I find out who is owner of this WS? Thank you, Tomas

  • HT4970 could not set reminder

    Could not set reminder on apple4,8gb

  • Are deleted files still in Time Machine?

    I use Time Machine with Time Capsule. If I delete a file on my Macbook, will all traces of it be removed from the TC or are they still archived? If they remain archived, is there a way (through Time Machine) to remove the file completely?

  • Incorrect CF Syntax Near And

    Looks like createodbcdate is upset with me - I have attached the parameters and the query in the code. If you need more let me know. Maybe someone can shed some light. Thanks in advance. - Jon Error Executing Database Query. [Macromedia][SQLServer JD