Probably NetBeans but: jList RE-populating

This probably is a NetBeans question but maybe you all can help:
I am having difficulty with NetBeans populating a jList anytime after it is initially populated/initialized by the GUI.
Here is code I wrote and added to NetBeans "Post-Adding" code that works fine the first time (and it is way for us humans to interact with the GUI's generated code):
jScrollPane1.setViewportView(jList1);
listModel = new DefaultListModel();
List<String> GUI_ReadFile_ls=new ArrayList<String>();
GUI_ReadFile_ls=RF_Call.ls;
Iterator it=GUI_ReadFile_ls.iterator();
while(it.hasNext())
String value=(String)it.next();
listModel.addElement(value);
//System.out.println("LIST Value from GUI :"+value);
jList1 .setModel(listModel);
That code works fine and populates the list.
(RF_Call is my ReadFile class which reads an ascii text file that is used here to populate the jList).
But I added a button and I want it to read another file and re-populate the same jList.
My button-press code is
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String sTheFile=new String("C:/MyDir/Docs/MyCarData.txt");
RF_Call.LoadFile(sTheFile);
But the jList doesn't get populated.
How do you populate a jList after it has already been populated - and how do you get that displayed?
Thanks,
Matt

jList1.setModel(new javax.swing.AbstractListModel() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
public int getSize() { return strings.length; }
public Object getElementAt(int i) { return strings; }
jScrollPane1.setViewportView(jList1);
listModel = new DefaultListModel();
List<String> GUI_ReadFile_ls=new ArrayList<String>();
GUI_ReadFile_ls=RF_Call.ls;
Iterator it=GUI_ReadFile_ls.iterator();
while(it.hasNext())
String value=(String)it.next();
listModel.addElement(value);
//System.out.println("LIST Value from GUI :"+value);
jList1 .setModel(listModel);
Oh, man the code markers didn't work that time either.
Now Kevin will really be pissed.
I'll post that as a separate question as well.
Matt                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • JAR Executable works in netbeans but not under Dos?

    Hi all,
    I have created a jar executable and it works fine in netbeans(it was not created in netbeans) but I can't get it to run on the command line. If I type java ClassName.MainClass it will run but not using the command java JarFile.jar or java -jar JarFile.jar
    Any help would be most appreciated.

    When creating the manifest file did you add a carriage return at the end of the manifest? e.g.
    Main-Class:Hello.class
    (carriage return here on new line)
    I think it runs into problems if you dont add a carriage return ( a new blank line after manifest).
    Hope this helps
    Riz

  • Every tune in my library is marked with an explanation mark and produces a report " The song ..... could not be used because the original file could not be found. Would you like to locate it?"  Probably yes - but how ?

    Every song in my library, both purchased or downloaded from a CD, is marked with an exclamation mark and produces a report " The song ......... could not be used because the original file could not be found.  Would you like to locate it ?"     Well, probably yes - but how ? and why necessary ?  HELP !

    It would help to have more background about your iTunes collection such as if you keep it on an external drive, or if you have moved or renamed anything recently.  iTunes is very sensitive to you renaming or moving files or folders involved with your media.  iTunes only keeps a reference to where a media file is located  and then goes to look for it when you try to play it. If you have changed things since it was added to itunes then it's like me sending you to look for a friend in my addressbook but that friend has moved.
    The other possibility is your computer is starting to lose files.  Again, the computer uses a reference database to tell it where on the drive to look for a file. If that database gets corrupt then it starts losing files.  Use Dsk Utility's first aid to verify your hard drive.

  • This is probably useless, but I'll try anyway. My iPhone5 got drenched in water, is there any way saving it without having to buy another phone?

    This is probably useless, but I'll try anyway. My iPhone5 got drenched in water, is there any way saving it without having to buy another phone?

    Take it to the Apple Store
    Confess the error of your ways with the soaking of your iPhone
    Ask them to check it out
    They will charge you $229
    Allan

  • My form builder create the fmx but its not populating. what is the reason?

    Hi,
    if i execute the form builder it wil create the fmx file but its not populating. if i want to use i have to run the fmx file..
    can any body help the reason why it's not populating?
    and one more proble is my form call the report but it's running. yester day it was work well. but today its not working. i didn't change any thing in that today.

    Your question is quite unclear. Also, I think you should review this:
    http://blogs.oracle.com/shay/entry/10_commandments_for_the_otn_fo
    In the future, please be sure to include the complete product version and platform you are using. By version, I mean the numbers and not the name. For example, 10g is not a product version - it is a name.
    You said,
    ...if i execute the form builder it wil create the fmx file but its not populating. if i want to use i have to run the fmx file... What do you mean it doesn't populate+ ? Then you say, "... I have to run the fmx...". The fmx is the file you need to run. You cannot run the fmb as this is the source code file.

  • Application working under NetBeans but not as a *.jar file

    Hello,
    recently I found a little problem. I wrote application that shows all available ports in my computer. When I am running this applications under NetBeans it works with no problem - finds all available ports. Then I am building it to the *.jar file. Application is working with no problem but command:
    Enumeration PortIds = CommPortIdentifier.getPortIdentifiers();
    is not returning any identifiers - PortIds is empty.
    Anyone knows a solution for this type of problems? Thanks

    Hi Venkatesh,
    Few questions.
    1. What is your JDeveloper version? (Always better to post your JDev version along with the question, which would help us to help you better).
    2. Did you try adding webserviceclient.jar to the classpath? (Search in your JDev installation directory for the location of this jar file).
    -Arun

  • Program run in Netbeans but NOT running as jar file

    Dear all ,
    i hope any help in this problem.
    i am writing program to access parallel port i put next files :
    1. [ comm.jar + javax.comm.properties ] in
    [ C:\Program Files\Java\jdk1.6.0_18\lib ] and [ C:\Program Files\Java\jdk1.6.0_18\jre\lib ]
    2. [ win32com.dll ] in [ C:\WINDOWS\system32 ]
    when i run application in NetBeans IDE 6.8 work fine and every think is ok
    BUT when i produce jar file , generated jar file does not work [GUI appear but can not get ports on PC]
    - I try to set Environment Variable as next :
    CLASSPATH = .;C:\Program Files\Java\jdk1.6.0_18\lib\comm.jar
    also does not work
    any tip please ?
    Thanks in advance
    Nabil

    First of all, leave the lib and jre/lib directories of the JRE alone. Never ever touch them again. Remove any jars you have put there yourself, or better yet completely remove and reinstall the JRE to make sure you put it back in a correct state.
    After you do that, learn how to properly work with the classpath in both the IDE and the command line.
    Netbeans: you define the classpath by adding jars to the project (right click on the libraries node in the project tree to get the appropriate options).
    Command line: this depends on if you run a single class, or you invoke an executable jar.
    Single class: you use the -cp command line switch to define the classpath
    Executable jar: the jar itself defines the classpath in its META-INF/manifest.mf file. The -cp command line switch is ignored.
    Since you use Netbeans, you'll get an executable jar so make sure to learn how such a jar is structured.

  • The application runs from netbeans, but not the command-line

    Hi
    I have developed a GUI application using NetBeans. All source code files are compiling without problems and the program runs just fine when i press "run <app name>" in NetBeans. However, when i try to execute the jar file using the command "java -jar <name of jar>", then i get this error message (im standing in the same directory as the jar file which is the dist directory:
    $ java -jar /home/icebyte/NetBeansProjects/TripPlanner/dist/TripPlanner.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: tripplanner/Main
    Caused by: java.lang.ClassNotFoundException: tripplanner.Main
    at java.net.URLClassLoader$1.run(URLClassLoader.java:221)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:209)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:324)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:269)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:337)
    Error: Could not find the main class.
    Error: A JNI error has occurred, please check your installation and try again
    Does someone know why i am getting this error ? I would be nice to find out. I have also tried to go into the src directory of the netbeans project and compile all files there which works fine, but when i try to run the program with "java <file that contains main method>" i get this error:
    Exception in thread "main" java.lang.NoClassDefFoundError: MainMenu (wrong name: tripplanner/MainMenu)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:638)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:143)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:281)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:74)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:216)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:209)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:324)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:269)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:337)
    Error: Could not find the main class.
    Error: A JNI error has occurred, please check your installation and try again
    I have JDK and JRE installed on the system (it came with netbeans). I have tried setting the JAVA_HOME variable, but there is no difference. Anyone? Thanks for all help.

    Hmm, i solved the problem now. I looked at this problem yesterday and couldnt find out why i was getting these stack traces, but now i know :)

  • My SSD probably died, but any help is appreciated just in case

    I have an Asus Zenbook with a "hybrid" drive, that is, it has a 24GB SSD and a 500GB HDD. The HDD holds the UEFI-part, /boot, swap and /home while the SSD is /.
    Today, I started to get strange "Input/Output error"-messages for any command that wasn't already in memory; for example, "ls" would work as I had used it previously, "dmesg" wouldn't. I tried to shutdown the laptop properly, but that wouldn't work,
    Now when I try to boot the laptop, it takes ages to get to either the BIOS or grub2. BIOS sees the SSD on a separate SATA channel, but when I try to boot with grub I get a few "COMRESET failed errno=-16" messages, after it tells me it cannot find /dev/disk/by-uuid/$UUID-OF-ROOT-DRIVE. I can continue from there, but obviously without a working root it fails.
    I'm typing this from a Ubuntu USB stick - /dev/sda* is there (the HDD) and everything seems to be in order. /dev/sdb(1) is there are well, that's the USB stick. There's also /dev/sdc (no numbers), but trying to run cfdisk on it returns "FATAL ERROR: Cannot open disk drive" while gparted says "Error opening /dev/sdc: No medium found".
    So I'm guessing the drive is dead, as strage as it is (this laptop is only a few months old), but any ideas how to fix it if possible are more than welcome.

    Sorry, that really doesn't apply. The laptop worked fine for a few months, now it just seems that /dev/sdc (well, that'd be /dev/sdb if I didn't run from USB) is gone/nonfunctional. That, and the fact that it takes like a minute to get to the BIOS or grub tells me that it's probably time to take it back to the shop.

  • This is probably impossible but....

    I have a server that streams internet radio from WMAs using a
    standard ASX format for the playlist. Switching to streaming MP3s
    is not an option.
    I would like to make a flash player which people can embed in
    myspace ect and also use as a desktop app via Air.
    My question is this, is there any way to capture the ASX
    stream and play it within a Flash movie?
    Thanks for any advice.

    Hi John
    interesting...  I had seen that field many times and it never clicked. 
    What is odd is that I had posted about this and my work around in several blogs, and a couple of well known couple LR experts had commented my work around was probably a good approach given LR limitations.  
    As I think through this, I wonder if it is a matter of the list of choices from Adobe that made several of us think they meant something else. 
    "Unknown" does not seem to fit if "I know that I have not filed for registration"; would have been nice to have a little more granularity or clarity as in "Registration Pending" as a choice, but it comes down to semantics.
    Certainly your workflow approach works, and probably will start using this approach, while hoping that Adobe will give me one more choice !!
    Thanks again.
    -- Luis

  • Settin singleton property false for child node but entire column populated

    hai all,
           I have set the singleton property of child node as false but still in my wdmodifyview when i load a value help with values from backend based on the user selection in 1st column of table the entire column gets populated.
    coding used by me:
    public static void wdDoModifyView(IPrivateSalesdet wdThis, IPrivateSalesdet.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
        //@@begin wdDoModifyView
       try
       String partfn=wdContext.currentTablepartnersElement().getPartnerfn();
         if(partfn.equals("ShiptoParty"))
    IWDAttributeInfo partattributeInfo=wdContext.nodeTablepartners().nodeTablepartnerssubnode().getNodeInfo().getAttribute(IPrivateSalesdet.ITablepartnerssubnodeElement.PARTNERS);
    ISimpleTypeModifiable part  = partattributeInfo.getModifiableSimpleType();
          //     Set field label and populate valueset
      part.setFieldLabel("key");
    IModifiableSimpleValueSet partvalueSet =  part.getSVServices().getModifiableSimpleValueSet();     
      for (int i = 0; i < wdThis.wdGetSalescustomctrllerController().wdGetContext().nodeLt_Kna1().size();i++)
    partvalueSet.put(wdThis.wdGetSalescustomctrllerController().wdGetContext().nodeLt_Kna1().getLt_Kna1ElementAt(i).getKunnr(),wdThis.wdGetSalescustomctrllerController().wdGetContext().nodeLt_Kna1().getLt_Kna1ElementAt(i).getName1());
    I need to populate only the table cell wch is next to the cell in wch user has made a selection  and not the entire column.plz help me in this issue.

    First, you should not place this code in wdDoModifyView().
    Second, I assume you want to have a value help only on a specific table cell, not for all cells in the same column, is that correct?
    This cannot be done by modification of the DDIC type because the type is used for all cells of a column. This has nothing to do with singleton vs. non-singleton.
    What exactly is your use case?
    Armin

  • Probably nothing, but: how much (external) pressure can MBP take?

    I'm visiting my grandparents, and had my MBP closed on a firm leather sofa (atop a binder I was using as a flat surface). I was off the couch, so my grandpa decides to sit where I was sitting. He lowers himself into the seat with one hand on the armrest, and +one atop my MBP+! I don't think he even saw or noticed!
    Now, I'm obviously using it now, but I was just wondering: how much pressure can the case take? My grandfather's almost 90, so he's most likely not that heavy; he certainly doesn't look it. Anything I should watch out for as far as possible signs of trouble? The MBP's probably fine, isn't it?
    This concern will most likely come to nothing, but it seemed like a worthwhile question regardless, so I decided to ask. Thanks in advance!

    LeaperBP wrote:
    Come to think of it, does the TSA let laptops go through the machines without taking it out?  I thought they only allowed that for the soft cloth sleeves.
    I have yet had a TSA agent ask me to remove my computer from my notebook carrying bag.  I just put the whole bag right onto the bin. 
    Never had a TSA agent put another bin on top of mine either.  If this ever happened, I would have filed a complaint or asked to speak with a TSA supervisor.

  • Under manage search engines, i would delete "Ask" search engine, but it keep populating when I close and re-open firefox.

    After deleting "Ask" search engine it would repopulate when firefox is closed and reopened. I also tried to move the order of the search engines but "Ask" is always set to the primary search engine.

    After deleting "Ask" search engine it would repopulate when firefox is closed and reopened. I also tried to move the order of the search engines but "Ask" is always set to the primary search engine.

  • Microphone probably broken but I don't know.

    So I have an IPhone 5c. My problem is Siri doesn't respond to my voice. I've tried it over and over again and nothing happens. Also when I try to record a video on my phone the sound doesn't work. In the video I will be talking but when I playback the video no sound comes out. I know your phone has to be off silent and I is but still no luck. With both of these examples I think something is wrong with my phones microphone or something. This just started happening out of nowhere and I didn't do anything to make this happen. Please help!

    Have you tried a reset since this all started? Follow the procedure below:
    Close all open apps by double-tapping the home button, then swiping up and off the screen with the app window (not the smaller icon).
    Reset your device: hold down the home button along with the sleep/wake button until the screen goes black and you see the Apple, then let go. (No data loss)

  • It is probably obvious but I can't find this VI (get all references)...

    Where is this VI (LV2009 and 2013)?
    Thanks
    Jean-Marc
    LV2009 and LV2013
    Free PDF Report with iTextSharp

    There is a quick drop which shows the file location on disk.
    https://decibel.ni.com/content/docs/DOC-22461
    I also wrapped this functionality into my quick drop function with the shift modifier.
    https://decibel.ni.com/content/docs/DOC-31302
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

Maybe you are looking for

  • Trying to transfer a movie file from my ipod to my pc

    I am trying to put a movie file I have saved on my ipod classic and transfer it over to my pc. Now the ipod is set up to work with my macbook so when I hook it up to the pc it wants me to reformat it. I am using the ipod as an external storage so the

  • Display excel file on clicking JButton

    Hi, I have a requirement wherein when the user clicks a JButton, an excel file (which is already present in the app), will open, i.e. Excel 2003 / Xp will get started & display that file. Appreciate any help on this. Best regards, AJ

  • Setting audio volume

    Hi, I can't figure out how to set the volume level of the audio I have dragged into the opening screens. The volume is always way too loud when I put the DVD in. I want to be able to match the volume of the content to what is in the main pages and ch

  • Error occurred when launch browser from BEx

    Dear All, i have problem when i tried to display my query from Bex to Web browser. or the same problem occurred when i open the portal BI open tab Business Intelligent --> BEx Web Analyzer. i already maintained the parameter for icm/host_name_full. p

  • Help! Blackberry curve emails......

    Hi ~ For some reason my blackberry email cursor jumps to the last entry with X, at the beginning of my emails/texts. How in the world do I get it back to the top - without rolling the ball to the beginning... any help would be GREATLY APPRECIATED. Th