How to clear a JList ?

Hello,
I have the following code.
    JList  jl = new JList();
     Vector v = new Vector(5000);
                    then I fill the vector with Strings loaded  from a MYSQL table
      jl.setListData(v);
  Later I refill entirely the vector with other values. If I issue again
           jl.setListData(v);
  I got a ArrayIndexOutOfBoundsException exception. I don't understand why
anyway, How can I just clear all lines in my JList, before to fill it again.
Thanks a lot in advance
Gege

>
anyway, How can I just clear all lines in my JList,
, before to fill it again.
Thanks a lot in advance
Gegehi,
you might need to declare your list like this
DefaultListModel listModel = new DefaultListModel();
JList list = new JList(listModel);then to clear the list at any stage
listModel.clear();i have recently used this code to list user names in a chat room.
so it should do the job for you!
cheers
RC

Similar Messages

  • How to clear a  JList correctly.

    Hello,
    I haven't found yet how to clear a JList whitout raising an exception.
    I have defined a JList, that I initialize with a Vector. For example :
       JList mylist = new JList();
       Vector v =  new Vector(5);
       for (init i = 0; i<5; i++ )  v.add("Line " + i);
       mylist.setListData(v);
          .When the user needs to erase all lines, he has to click on a JButton. In the actionPerformed method, I'm doing the following
       Vector v = new  Vector();
       mylist.setListData(v);It works, but I got an ArrayOutBoundException. I tried many other things such as
    v.clear();
    mylist.setListData(v);
    but I got the same exception. So I was obliged to embed my instructions in a
    try-catch block:
       try
            Vector v = new  Vector();
            mylist.setListData(v);
      catch (Exception ex){}In fact , I do not like what I did , and I'm pretty sure it exists a much better way .
    Thanks in advance for any suggestion
    Gege

    This link has answer...
    http://forum.java.sun.com/thread.jspa?threadID=718897&messageID=4149627

  • How do I clear a JList?

    Hello,
    I would like to know how do I clear a Jlist of all it's content when I click on a button "Clear". I have all the codes working, except, I don't know what is the code line to do this...
    I have found this: list.setModel(new DefaultListModel());
    but it doesn't work...unless there is another problem with my codes?
    Anyone can tell me what is the code the Clear the JList?
    Thanks
    Sylvie

    All of these will work. I think I ran accross the JComboBox class which didn't have so many convenience methods, so I used the setModel(new DefaultComboBoxModel()) to clear out my combobox with a single line.
    void setListData(Object[] listData)
    Constructs a ListModel from an array of objects and then applies setModel to it.
    void setListData(Vector listData)
    Constructs a ListModel from a Vector and then applies setModel to it.
    void setModel(ListModel model)
    Sets the model that represents the contents or "value" of the list and clears the list selection after notifying PropertyChangeListeners.

  • How to clear completed reminders in iCal

    Has anyone figured out how to clear completed (checked done) reminders in iCal?

    Joe,
    That clarifies the question for me. Go to iCal>Preferences>Advanced and make your choices:

  • How to clear text fields when the user navigates back to the screen

    Hi,
    Does anyone have any idea on how to clear the text input fields and dropdown boxes when the user navigates back to the screen, say for e.g. create screen?
    My issue is that i have plenty of fields in the create screen within a form. Is there a way to avoid programaticaly blanking out every field and just do it at the form level using an api to reset to a state before the user entry?
    Thanks

    This code allows you to make it more generic, and you would need to tweak it if there are more than TextInput controls, but it should provide some ideas.
    As far as using states, you could use SetProperty to set the text to empty, but that might be messier.
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
      <mx:Script>
        <![CDATA[
          import mx.containers.FormItem;
          import mx.controls.TextInput;
          import mx.events.IndexChangedEvent;
          import mx.core.Container;
          private function clearSreen(evt:IndexChangedEvent):void{
            var view:Container = tn.selectedChild as Container;
            for each(var child:Object in view.getChildren()){
              if(child is FormItem){
                var subchild:DisplayObject = child.getChildAt(0);
                if(subchild is TextInput){
                  TextInput(subchild).text = "";
        ]]>
      </mx:Script>
      <mx:TabNavigator id="tn" resizeToContent="true"
        change="clearSreen(event)">
        <mx:Form id="frm1" label="View Number One">
          <mx:FormItem label="First name:">
            <mx:TextInput/>
          </mx:FormItem>
          <mx:FormItem label="Last name:">
            <mx:TextInput/>
          </mx:FormItem>
        </mx:Form>
        <mx:Form id="frm2" label="View Number Two">
          <mx:FormItem label="Address1:">
            <mx:TextInput/>
          </mx:FormItem>
          <mx:FormItem label="Address2:">
            <mx:TextInput/>
          </mx:FormItem>
          <mx:FormItem label="City:">
            <mx:TextInput/>
          </mx:FormItem>
          <mx:FormItem label="State:">
            <mx:TextInput/>
          </mx:FormItem>
          <mx:FormItem label="Zip code:">
            <mx:TextInput/>
          </mx:FormItem>
        </mx:Form>
      </mx:TabNavigator>
    </mx:Application>
    If this post answers your question or helps, please mark it as such. Thanks!
    http://www.stardustsystems.com
    Adobe Flex Development and Support Services

  • How to clear vendor open items with customer open items in APP?

    Hi Experts,
    Our vendor is our customer - in this scenario how to clear vedor open items against customer open items. I have defined vedor is customer means I have given customer number in vendor master record, selected chek box 'clear with customer'.  Still problem is not solved, hence I am requesting you to help me in this regard.
    Thank you very much,
    Regards,
    Ganesh.

    Hi
    In FBCJ after payment you have clear manually vendor balance in F-44.
    If you want SPL GL in FBCJ then write a Substitution .
    1. step 001 - Special G/L Substitution
    2. Prerequisite - Transaction code = 'FBCJ'
    3. Substitution posting key -- Exit (need help from abap) exit name
                                              G/L Exit (need help from abap) exit name
                                              Special G/L Ind Exit (need help from abap) exit name
    you can't do this without ABAP help
    Best Of Luck
    Tanmoy

  • How to clear vendor open items if vendor invoice currency and payment currency different

    Hi All.
    How to clear vendor open items through f-44 if vendor invoice currency is EUR , payment currency is USD  but local currency is INR
    while clearing through f-44 system showing error as "to large for clearing clearing is not possible"
    I checked all configuration, configuration wise no problem
    BR.
    Chandra

    Hi Chandra,
    You chose any one of the currency i.e. EUR/INR/USD for clearing in F-44. After selecting line items for clearing, system will show a difference. Click on over view button and manually write off the difference by selecting any one account i.e. dummy or small diff.account, after that click on process open items then system will show the difference 0 and simulate the document, here system will post gain/loss exchange GL postings along with other line items. After save the document, manually pass journal entry to dummy account and gain/loss account. I have explained clearly in the below example.
    Invoice is in USD - 1000 & INR - 60000
    Payment is in INR - 60000
    Now I am going to clear these in INR currency in F-44 on 31.03.2015. On this date the exchange rate for USD is 60.10. At the time of clearing system will post the below entry
    Vendor A/c Dr 60000 (invoice)
    Vendor A/c Cr 60000 (Payment)
    Gain from exchange rate A/c Cr  100 (60000 - 60100)
    Small diff.write off A/c (or) Dummy A/c Dr 100
    After done the above posting, we have to pass below manual JV in FB01
    Gain from exchange rate A/c Dr  100
    Small diff.write off A/c (or) Dummy A/c Cr 100
    Regards,
    Mukthar

  • How to clear the open documents in case if document currency and local curr

    Hi,
        Can anyboday advise how to clear the open document of a particular vendor for a particular company code. Here the issue is that balace is netted to Zero in the document currency but not in the local currency. The document was posted in Currency CAD and the local currency is GBP.
    When i check the FBL1N, there is it showing net balance is ZERO, but document is still in open
    status. I tried using Transaction code F-44, but it is not allowing me.
    Can anyboday advise how to perform this. Points will be awarded.
    Regards,
    Sree.

    Hi,
    In the Company code global parameters(OBY6),select the check box "NO FOREX RATE DIFF.WHEN CLEARING IN LC"
    and try clearing again.(You can have a F1 help on the check box to see what exactly it is).
    Hope this will resolve
    Assign points if useful
    Thanks
    Aravind
    Edited by: Aravind Aitipamula on May 22, 2008 1:36 AM

  • How to clear vendor open documents

    How to clear vendor open documents, I had previously tried to clear the documents in PRD with transaction F-44 and I get the following message.
    X. Ex.rate diff.accts are incomplete for account 00015080 currency CAD

    You can clear using the t code F-44 which is manual or by using F.13 which is automatic.
    The error you are getting is with refernce to a transaction between your Local currency and Currency "CAD"
    Maintain a transalation ratio and the exchange rate. Here the system also looks for a exchange loss or gain on such conversion also. Map those accounts and you will be clearing the transaction.
    If you are using automacti clearing you need to decide on the link(Common feild)  between the DR open item and CR open item and these open items after having this as a refernce can be cleared automatcially in F.13.
    Hope you understood.
    Reward points if useful.
    sarma

  • How to clear UWL items ?

    Hi,
    We are having so many entries or pending tasks in UWL of each user .
    How to clear them ? And I did not find any delete or remove button by selecting any entry .
    How to delete those entries one by one and all entries at once ?
    Thanks,
    Surya

    Hi,
    I hope you should clear them in workflow of backend .
    consult workflow forum
    Remove from transaction SWIA, choose logically delete on the highest
    level
    Koti Reddy

  • How to clear GR/IR account when criteria is not matching

    Hi All,
    I have issue in clearing GR/IR account done by F.13.  Criteria field XREF3 in Criteria 3 given is not matching in WE and RE, so I cannot clear, this happend to once particular GR/IR only.
    So how to clear this GR/IR when Criteria is not matching.
    Syam

    Hi,
    You can clear it manually using F-03. In that T-Code it is a manual clearing and not automatic clearing...so you can select any line items you want to clear, only thing is that their balance should be Zero.
    Regards,
    SAPFICO

  • How to clear Autocomplete text in Jquery.

    Hi All,
    I have implemented a Autocomplete text item using jquery.Every thing looks fine, but when we clear the country the corresponding state should be cleared.
    Here is the code, can any body hep me out where and how to clear the values.
    <script type="text/javascript">
    $( function() {
        $("#P16_ENG_CTRY").autocomplete({
            source : function( request , response) {
                            data = getCountry(request.term);
                            response( data );
            focus  : function(event , ui){
                        event.preventDefault();
    function getCountry(key)
       document.getElementById('P16_ENG_CTRY')=='';
       var ajaxRequest = new htmldb_Get( null , '&APP_ID.' , 'APPLICATION_PROCESS=GET_COUNTRY' , 0);
       ajaxRequest.add( 'G_MX01' , key);
       ajaxResult = ajaxRequest.get();
       return ((ajaxResult.length>0)? ajaxResult.split( '~' ):null);
    $( function() {
        $("#P16_ENG_STATE").autocomplete({
            source : function( request , response) {
                            data = getStateJ(request.term);
                            response( data );
            focus  : function(event , ui){
                        event.preventDefault();
    function getStateJ(key)
    document.getElementById('P16_ENG_STATE')=='';
          var ajaxRequest = new htmldb_Get( null , '&APP_ID.' , 'APPLICATION_PROCESS=GET_JSTATE' , 0);
              ajaxRequest.add('G_MX01',document.getElementById('P16_ENG_CTRY').value);       
              ajaxRequest.add( 'G_MX03' , key);
              ajaxResult = ajaxRequest.get();
       return ((ajaxResult.length>0)? ajaxResult.split( '~' ):null);
    $( function() {
        $("#P16_ENG_CITY").autocomplete({
            source : function( request , response) {
                            data = getCityJ(request.term);
                            response( data );
            focus  : function(event , ui){
                        event.preventDefault();
    });Thanks,
    Anoo..

    Thanks VC for a quick turn around, i have made changes like this which wroks fine but when i click the event outside then it is clearing the list fo state.
    Is it possible to clear when i had tried to remove the country manually the sate should clear at at time insted of click the event.
    <script type="text/javascript">
    $( function() {
        $("#P16_ENG_CTRY").autocomplete({     
            source : function( request , response) {
                            data = getCountry(request.term);
                            response( data );
            focus  : function(event , ui){
                        event.preventDefault();
            change : function(event,ui) {
                     if ($('P16_ENG_CTRY').val()==null || $('P16_ENG_CTRY').val()==""){
                  $("#P16_ENG_STATE").val('');}}  
    Thanks,
    Anoo..

  • How to clear UNB table in the payroll result?

    Hi,
    We are getting the payroll error- The gross wages do not cover the negative offset that has been forwarded. Therefore, no gross up is permitted while running the Grossup.
    I see the below table "UNB table" in the last payroll result. "UNB - Unbalance table used for tax retrocalculation" .
    I think we are getting the above error because of this UNB table, can anyone help me to how to clear this table?
    When we run the regular payroll, no tax is being deducted.
    Please help
    Saurabh

    Hi Arti,
    Thanks for your reply!!..
    Seeing your reply, it gives me bit confidence to crack the existing problem, however, I'm still not clear with your answer... let me explain you the problem-
    1. Employee was given 350,000 though Taxable Bonus WT with regular pay check
    2. Later it came to know- out of the above amount, 75000 was Grossup amount
    3. So in next payroll run, they entered -75000/- in regular Taxable bonus WT and +75000 in Grossup WT and also they deleted one IT210 record of GA tax authority which was wrongly created; and ran the payroll
    4. Since then, in next payroll period- No tax is being deducted, so we are creating IT221 infotypes with Tax wagetype
    5. If we are running the Grossup wage, payroll error- The gross wages do not cover the negative offset that has been forwarded; therefore, no grossup is permitted.
    While running the regular payroll, overpayment Wagetype is being generated.
    Now, I saw this UNB table is created and the below wagetype are there in the UNB table-
    WT /5UT amount 0.00
    WT 5430 amount -75000
    WT 0200 amount 12500 ( Monthly salary)
    WT 4530 amount 350000
    Now I am thinking, if we are deducting tax through IT221,if we clear this UNB table, our problem might get resolved
    It will be a great help for me if you can tell-
    1. how to check, claims process is implemented or not?
    2. I have good HCM experiece but this claims process is very new to me- pls guide me how to do that
    Waiting for your reply, thanks in advance
    Saurabh Garg

  • How to clear parameters defined in selection screen on back button

    Hi,
    I have a report with parameters, few being input fields, and check boxes. After report is executed when user selects the back button, the selection screen is displayed again but with the old selection values. I want to clear them.
    So in the Initialization even I added the code to clear all these parameters;
    CLEAR: p_aaa, p_bbb, p_ccc.
    I debugged and control passes through this code but still the fields are not cleared and they retain the old input values.
    How to clear them ?
    thnks

    >
    Rob Burbank wrote:
    > Yes he did. My mistake.
    >
    > But isn't this what he wants? To clear the Selection screen so that something has to be entered?
    >
    > Rob
    IMO, he only wants to clear the selection screen parameters on the click of 'BACK' button
    in the list screen. If the OP clears the selection screen variables in AT SELECTION-SCREEN OUTPUT
    even, the values assinged to the selection parameters in the INITIALIZATION and with the DEFAULT addition of the PARAMETERS and SELECTION-OPTIONS statements will also be overwritten even when the report is executed for the
    first time.
    -Rajesh.

  • How to clear tab settings in Designer in 7.0

    I imported an existing form and added text fields/drop downs, etc. I used copy/paste throughout. When I went to set tab order there are in some cases 3 or 4 numbers beside a single field and even straight text fields are numbered. I can't figure out how to clear all of these out so that I can properly set the tab order. When I did advanced>accessibility>full check in the form in acrobat it said that "WARNING: Since the PDF file contains Adobe XML form fields, you must use Adobe Designer to repair errors" and "All of the pages in this document have tab order that may be inconsistent with the structure order".
    I am brand-new to using this software so as detailed an explanation as possible would be greatly appreciated.
    Thanks!

    Hello Devi,
    There are three ways you can load Master Data in BPC
    1) Copy and paste.
    Download master data in flat file .Copy the  master data and paste in members of dimension after that process the dimension.
    2) Using SISS Pakage - load Flat File into BPC-Cube
    3) Using SQL Command.
    Thanks.
    With regards,
    Anand Kumar

Maybe you are looking for

  • DO'S & DONT DO'S with new Nokia N900

    Hello, Already lost 1 N900 due to some internal IC damage so buying a new one What precautions should i take for max utilisation of N900 Which applications are must and which are defly avoiadable. Hope somebody helps. Thanks Regards, Ketan

  • Custom Documents INBOUND FileChannel : Agreement not found

    Hello Gurus Version is 11.1.1.3 1) I have setup an INBOUND Agreemnt between ACME and GC on Host GC i.e direction of the message is ACME->GC Message Exchange is INBOUND FromTP=ACME, ToTP=GC, DOCTYPE=MAK, DOCTYPE_REVISION=3.5 2) I have setup a "Generic

  • User managed Backups

    We put tablespace/database offline, before taking backup , The user can't access that particular table/application in that time frame, right? what would be the suggestion to keep it online all the time with user managed backups?

  • Email through exchange account is not sending but I am receiving

    Having issue with exchange email account.  I'm able to receive but not send emails.  Any solutions?  I've deleted and added account back.  All settings appear to be in order.  Appreciate the help.

  • Just moved from PC to iMac-Mavericks and Tbird now crashes when I try to access Address Books.

    When entering an email address, Tbird apparently checks address books since it gives me a list of possible addressees as I enter the name. But when I click on the Address Book icon to get in to make a change or new entry, I get an error saying Tbird