How to save JList items!

hello,
i m creating a class that has three JList components.
My problem is how to save the each JList items into a seperate logfile(ie. text file).

More info required:
What are in the JList? Strings? Custom objects?
Do you know basic file IO?
http://java.sun.com/docs/books/tutorial/essential/io/index.html
What you will need to do is get the model, ilterate over each element, then write that element out. If the element is a string, then that is easy, just create a FileWriter, and write the string, followed by a new line.
If it is a custom object, then the task is harder, and you need to decide how that object should be represented.
If you are after a computer readable view of the model, rather than a human readable, which can easily be read by Java back into a ListModel, then you want to look at XMLEncoder and XMLDecode, or the Serializing Objects tutorial.
http://java.sun.com/docs/books/tutorial/uiswing/components/list.html

Similar Messages

  • How to save formula items in oracle forms?

    Dear All........
    I am nw in this forrum, can anybody plz tell me how to save forumula items in database, I also make that fields as a database field but it is not save in database. plz tell me. thx.

    Dear!
    Steps to take formula column value into database field, follow following steps:
    1. Draw a text field named "Formula_Cell"and set its properties which you want for formula. Now, goto its "Database" property set to "No".
    Now, goto its "Canvas" Property set to "Null".
    2. Now, in Pre-Insert or Pre-Update trigger use following code:
    Suppose database field name is AMOUNT then:
    :AMOUNT := :FORMULA_CELL;
    If you want to mension block names with this then you may do.
    Remeber, Formula Column's property of Database must be set to No.
    Now, try to save I hope you will got a good solution...

  • How to center JList  items

    Hi,
    I want to center my Jlist item instead of leave them in the left like usual. My List contains pictures and for the beauty of the design it's better to have the image in the center of each cells. How to do it?
    thanks.

    Do you know how to make a JLabel which contains a centred icon? Now make a ListCellRenderer that uses one of those to render your images in the JList.

  • How to save the item without displaying into the Page

    hi
    I have the reqt to save the item without displaying into the Page.
    thanx

    In your yyy Table View Object create one attribute for BusinessGroupId as you want to save it in your yyy table VO.
    Now on click of save button capture this ViewObject and set this VO Attribute at run time. I am assuming that yyytableVO is EO based.
    Snippet
    Controller PFR Code
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    pageContext.getParameter("Save") != null)
      OAViewObject vo = (OAViewObject)am.findViewObject("yyyTableVO");
      if (vo != null)
         vo.getCurrentRow.setAttribute("BusinessGroupId", value);//value is what you have capture from pageContext.getparameter
    }Thanks
    --Anil                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Rendering JList items instantly

    hi friends
    I wanna know how to rendering JList items instantly without selecting any item,so the rendering of the item has to be automatically.
    thank you very much

    Well how does the icon change? Normally changes to the data are done by updating the model, in which case the list will get painted automatically.
    If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.
    Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.

  • In microsoft office word, how do I delete items from the recent documents tableau? I have options for new, open, save, save as, etc. but no option to delete.

    In microsoft office word, how do I delete items from the recent documents tableau? I have options for new, open, save, saveas, etc. but no option to delete. Thank you.

    Hello.
    I have no idea and you should contact Microsoft for support. This is Firefox's support forum.
    Thank you for your understanding.

  • How to save List

    hello,
    i m creating a class that has three JList components.
    My problem is how to save the JList items into a seperate logfile(ie. text file).

    That is just one of the over 110 features removed in Pages 5.2.
    If you still have it use Pages '09 in your Applications/iWork folder.
    Peter

  • How to add Excise item with out chapter id

    Dear all,
    How to add Excise item with out chapter id?
    Chapter id of purchae items will be known only after receiving Invoice/gate pass/delivery  chalan from supplier/vendor
    To send a purchase order we need to create that particular item in the master, but with out assigning chapter id system is  not allowing to save without chapter id.
    How to solve this?
    I am with SAP 8.8 and PL 10
    Thanks in advance
    regards,
    Kumar

    Hi Kumar,
    Refer the book of chapter ID or find out on internet you will get the chapter ID.
    Still if you not able to get  the chapter id then consult with excise advisory.
    But you can add Excise PO until you have the excise details in Item master.
    Regards,
    Datta Kharat

  • I need to erase the contents of my phone and restore to factory settings. Does anybody know how to save your texts so you don't lose them?  Can I back those up to iCloud?  My phone was very likely hacked (Apple's advice was to call the police!)

    "I need to erase the contents of my phone and restore to factory settings. Does anybody know how to save your texts so you don't lose them?  Can I back those up to iCloud?  My phone was very likely hacked (Apple's advice was to call the police!)"
    That was all I could put in the initial "box."  Then it brought me to this page with instructions on how to write a good sentence.
    Proceeding ...
    After going back and forth between Apple, AT&T and the police (all telling me to go to the other two) I took AT&Ts suggestion and got a new number. One tech warned against doing a backup, especially on my Mac, saying if my phone had been hacked then whatever bug was there would then invade my computer. But nobody knows how to determine if the phone has been hacked or a virus was planted there. Unfortunately I know who would have reason to do such a thing and all I can say is that he is at the top technologically and could easily do it. Almost impossible to prove, however.
    So I need to preserve my text messages and my emails as well. I backed up my photos to that Microsoft product (One-Drive) and it froze (Surprise, Surprise) with four short videos to go, and no way of stopping that (when I tried it crashed repeatedly) so I'm in crisis mode here.
    Help ...
    Running 8.0 on 5S
    Thanks!

    Betty I don't know if you fixed your hacking problem but I feel your pain. I've seen some strange things going on between my iMac and my iPhone and Apple has told me the same thing, call the police which I have done. The hackers have stole 500.00 out of my checking account have access to every internet account I use and no matter how often I change the password their right back on the account. I closed my FB account 3 times only to have someone reopen it. Right now I've got a link in my reading list (Safari) that if I click on it, it allows me to log onto my FB account anonymously.
    I've seen a green folder come out of no where while I was trying to delete my passwords out of keychain when that green folder was put into the key chain I was immediately locked out. I than went into system preferences to try to make changes to my security settings, when I clicked on the icon it wouldn't open. I've seen log files of automator receiving commands and sending out my personal information thats on my computer.
    I have a legitamate program called iExplorer that allows you to look at the contents of your iPhone back ups and saw a transaction someone made at the Apple store for some full length movies, some albums, ibooks and other apps but when I called the iTunes store and they said none of those items were showing up on my account. If their not on my account how can they be on my iPhone 6? One day someone was using my gmail account and unknowingly used google maps to search for an Italian restaurant, than a Mexican restaurant than a coffee shop and their search showed up on my iPhone but I didn't have my gmail account installed on my iPhone 6. Using my computer I logged onto my gmail account and looked at the maps history and sure enough there were the searches when I'd hover my curser over the link it gave me the longitude and latitude of the where the hacker was when he was using google maps. I know whoever reads this thinks Im crazy but I've documented everything and can prove the things that I have mentioned in this post actually happened.
    One day I had my laptop (pc) and my iMac next to each other as I was using both. when I clicked on airport it showed that my laptop and my iMac had made a connection and were actually communicating with each other. I know I didn't do it I don't know how. The iMac was logged into my iCloud account while my laptop wasn't. I have formatted my iPhone at least a dozen times, Apple and an Apple retailer have formatted my hard drive not to mention the numerous times I have formatted it but the hackers keep getting on my devices. Im formatting my lap top at this very second because during the course of the night I left the ethernet cable plugged into it and they locked me out of my c: drive, and configured the system so I can't download any updates from Microsoft, overtime I type in www.microsoft.com it changes to ww38.microsoft.com which takes me to a blank page. I right clicked on the page I was redirected to and read the java script and couldn't believe that someone had actually configured Internet Explorer to redirect me to a blank page when I tried to go to Microsoft. Apples answer to all this is there was nothing wrong with my iPhone or my iMac and if I thought there was a problem to call the police which I have done.
    Theres no doubt the hackers are reading this while I type it or will read it and I simply don't care anymore. I no longer email anyone, don't use my iCloud account and have taken precautions to protect my credit but if I ever find out who has invaded my privacy to this extreme the police are going to want to talk to me because Im going to hurt them like they've never been hurt before

  • How to stop workitem complete or how to keep work item in inbox based on conditions even if it completed

    Hi,
    my requirement is to call webdyn pro screen from workflow..
    i am calling webdynpro screen by using FM :CALL_BROWSER from workflow.
    when webdyn pro screen is called user will enter some values . if user closed webdyn pro screen with out entering any values we need show this workitem in his inbox. so that user can again open it and enter values in the webdyn pro screen.
    Please help how to stop work item complete based on conditions.
    Thanks,
    phani

    Hi,
    As per my understanding, this is not a proper approach toy call web dynpro using FM CALL_BROWSER. is the web dynpro screen being called when user clicks on the work item from portal UWL OR from SAP SBWP ?
    if you are calling web dynpro screen from portal UWL when user clicks on work item link, better you achieve it using SWFVISU tcode. in SWFVISU tcode you can maintain which web dynpro. application to call when particualr work item task come in user's inbox. in your web dynpro code, then you can write your buisiness logic when user clicks for example SUBMIT/SAVE button. on action submit/save button you can use FM SAP_WAPI_WORKITEM_COMPLETE to complete the worktiem once the user clicks on final submit/save button. in this way the workitem will get removed from user inbox only upon clicking on submit/save button.
    You can refer below link for web dynpro for workitem:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/70648e99-4cc1-2c10-879d-9c61003c69d6?QuickLink=index&…

  • New to Photoshop;Viewing TV and want to save to MY Library to view later. Can't figure out how to save. When I open or click on My Library it shows I need to sign in and within a few seconds it shows my sign in but nothing changes on page.

    Trying to figure out how to save Adobe TV episode as I am new to Photoshop and need insruction... trying to open & save to My Library to view later. It instructs me to sign in but I am already signed in. Anyone know how?

    Those are the instructions for your computer's iTunes (i.e. using the Store menu at the top of your computer's iTunes and selecting 'View My Account' on it). If you are doing it on your iPad then are you following the instructions for iOS devices :
    To unhide your purchases
    Depending on the content type, open the App Store, iBooks, or iTunes Store on your device.
    Scroll to the bottom of the main page.
    If you're not already signed in, tap Sign In.
    Tap your Apple ID name, then tap View Account.
    Scroll down on the Account pane, and tap Hidden Purchases.
    Locate the item you would like to unhide then tap the Unhide button.

  • How to save info in a meta-data of a jpg file?

    hi, i need to know how to save info in a meta-data of a jpg file:
    this is my code (doesn't work):
    i get an exception,
    javax.imageio.metadata.IIOInvalidTreeException: JPEGvariety and markerSequence nodes must be present
    at com.sun.imageio.plugins.jpeg.JPEGMetadata.mergeNativeTree(JPEGMetadata.java:1088)
    at com.sun.imageio.plugins.jpeg.JPEGMetadata.mergeTree(JPEGMetadata.java:1061)
    at playaround.IIOMetaDataWriter.run(IIOMetaDataWriter.java:59)
    at playaround.Main.main(Main.java:14)
    package playaround;
    import java.io.*;
    import java.util.Iterator;
    import java.util.Locale;
    import javax.imageio.*;
    import javax.imageio.metadata.IIOMetadata;
    import javax.imageio.metadata.IIOMetadataNode;
    import javax.imageio.plugins.jpeg.JPEGImageWriteParam;
    import javax.imageio.stream.*;
    import org.w3c.dom.*;
    public class IIOMetaDataWriter {
    public static void run(String[] args) throws IOException{
    try {
    File f = new File("C:/images.jpg");
    ImageInputStream ios = ImageIO.createImageInputStream(f);
    Iterator readers = ImageIO.getImageReaders(ios);
    ImageReader reader = (ImageReader) readers.next();
    reader.setInput(ImageIO.createImageInputStream(f));
    ImageWriter writer = ImageIO.getImageWriter(reader);
    writer.setOutput(ImageIO.createImageOutputStream(f));
    JPEGImageWriteParam param = new JPEGImageWriteParam(Locale.getDefault());
    IIOMetadata metaData = writer.getDefaultStreamMetadata(param);
    String MetadataFormatName = metaData.getNativeMetadataFormatName();
    IIOMetadataNode root = (IIOMetadataNode)metaData.getAsTree(MetadataFormatName);
    IIOMetadataNode markerSequence = getChildNode(root, "markerSequence");
    if (markerSequence == null) {
    markerSequence = new IIOMetadataNode("JPEGvariety");
    root.appendChild(markerSequence);
    IIOMetadataNode jv = getChildNode(root, "JPEGvariety");
    if (jv == null) {
    jv = new IIOMetadataNode("JPEGvariety");
    root.appendChild(jv);
    IIOMetadataNode child = getChildNode(jv, "myNode");
    if (child == null) {
    child = new IIOMetadataNode("myNode");
    jv.appendChild(child);
    child.setAttribute("myAttName", "myAttValue");
    metaData.mergeTree(MetadataFormatName, root);
    catch (Throwable t){
    t.printStackTrace();
    protected static IIOMetadataNode getChildNode(Node n, String name) {
    NodeList nodes = n.getChildNodes();
    for (int i = 0; i < nodes.getLength(); i++) {
    Node child = nodes.item(i);
    if (name.equals(child.getNodeName())) {
    return (IIOMetadataNode)child;
    return null;
    static void displayMetadata(Node node, int level) {
    indent(level); // emit open tag
    System.out.print("<" + node.getNodeName());
    NamedNodeMap map = node.getAttributes();
    if (map != null) { // print attribute values
    int length = map.getLength();
    for (int i = 0; i < length; i++) {
    Node attr = map.item(i);
    System.out.print(" " + attr.getNodeName() +
    "=\"" + attr.getNodeValue() + "\"");
    Node child = node.getFirstChild();
    if (child != null) {
    System.out.println(">"); // close current tag
    while (child != null) { // emit child tags recursively
    displayMetadata(child, level + 1);
    child = child.getNextSibling();
    indent(level); // emit close tag
    System.out.println("</" + node.getNodeName() + ">");
    } else {
    System.out.println("/>");
    static void indent(int level) {
    for (int i = 0; i < level; i++) {
    System.out.print(" ");
    }

    Hi,
    Yes, you need store data to table, and fetch it when page is opened.
    Simple way is create table with few columns and e.g. with CLOB column and then create form based on that table.
    Then modify item types as you like, e.g. use HTML editor for CLOB column
    Regards,
    Jari

  • How to Save Camera Calibration and Lens Correction in Camera raw 6.1

    I downloaded and installed the Camera Raw 6.1 release candidate.  I open an image and set the camera calibration and the lens correction to auto for Nikon.  I save these settings as new Camera raw defaults, but when I open other images, the changes were not made.  How can I save these items as defaults?
    Swila

    Swila, were your "other images" previously edited in Camera Raw? I.e., do they already have saved image settings? The defaults that you save via the flyout menu will only apply to new images, or if you reset an existing image to the defaults. (e.g., choose "Camera Raw Defaults" from the flyout menu).
    Eric

  • How to save a report in server

    ...so it can be accessed by all.
    In BEX, I create a query, save it to a role and everybody can access the query. How does this work in BPC? What are the keywords for this?
    Thanks in advance!
    Rgds,
    Christian

    I'm sorry, I am a bit a confused about these all Open / Save menu items.
    Okay, by now I created a report with User 1 and saved this by eTools->Save Dynamic Template (this saves the current report locally.) With eTools -> Open Dynamic Template I could open this template again (but only for User 1).
    I start AdminClient and change the version of the Application Set, as well as I hit "Refresh Client-side dimension files".
    Then I start the OffcieClient and logon with User 2.
    Which menu must I open, to see the report which was originally created by user 1? I can't find it anywhere.
    Any help is appreciated!
    Rgds,
    fischmir

  • How to save a value in form jsp?

    hi all,
    i have a dropdown list in my struts web app,
    i am having a form in which a bean is instatiated(bean has 2 properties "name" and "code").
    i am using like this in the jsp:
    <td><html:select property="item.code">
                             <logic:iterate id="itemType"
                                  name="<%=WebConstants.getItemTypeListName()%>">
                                  <option value='<bean:write name="ItemType" property="code"/>'><bean:write
                                       name="ItemType" property="name" /></option>                              
                             </logic:iterate>                         
                        </html:select></td>
    each "itemType" has "code" and "name".
    when the user clicks on the item name on the dropdown item beans "code" is populating.now i need to populate "name" aswell at the sametime using hidden property.
    i want to save tha value of name in the jsp to use it later to populate "name" in my form using hidden property?
    do anyone have idea how to save the value in jsp?
    regards and thanks in advance

    Thank you. I execute the program below. I can now retrive the data from the Lt.txt. But the value is limited to 3 digits. For example, the content of my file is 777888.
    When I run the program, I only get 777. How can I retrive the whole exact number?               
    import java.io.*;
                   class Test {     
                   public static void main(String args[]) {          
                   try {               
                   File inputFile = new File("Lt.txt");               
                   File outputFile = new File("outagain.txt");                    
                   FileReader in = new FileReader("Lt.txt");               
                   FileWriter out = new FileWriter(outputFile);               
                   char[] tmp = new char[3];               
                   int cnt = in.read(tmp);                              
                   System.out.print("\nRead: ");               
                   for (int i = 0; i < cnt; i++) {                    
                   System.out.print(tmp);               }               
                   System.out.println(" ");               
                   in.close();          }
                   catch (IOException ex) {               
                   System.out.println("IOException:"+ex.toString());          }     }}

Maybe you are looking for

  • Upgrade from AMD 64 to AMD X2 64

    Hello : I think to upgrade from AMD Athlon 64 3200+ to AMD Athlon 64 X2 3800+ (Dual Core), but i don't know if my motherboard support it. Motherboard : MSI K8N Neo4 Platinum Edition (MS-7125)                     06/23/2005-MS-7125-6A61FM49C-00 PCB :

  • WHAT IS GOING ON WITH VERIZON THAT THEY CAN'T DO WHAT THEY SAY THEY ARE GOING TO DO? HELP PLEASE!!!!

    Over the last month and a half I have called and spoke to 3 or 4 different Verizon customer service agents about a problem with my account & every time I am told that the problem will be fixed only to have nothing happen. What is going on here? Aroun

  • Aperture 3, Catapult Plug In and Capture NX2

    Does anyone use Aperture and the plug-in Catapult for exporting files to an external editor like Nikon's Capture NX2? I've been using the trial version of Catapult and it seemed to be working fine, and then today, it will not re-import files edited i

  • TDS amount needs to be displayed in three decimal digit!

    Dear All, System calculates the TDS amount in one digit decimal but it should be three digit decimal as per requirement. Please navigate me to get the same... Thanks...

  • Custom validation template

    Hello, I have issue with validation template. Order Management Super User ->Setup->Rules->Security->Validation templates I made own validation template. It is the same like "Regular Line". I run Tools -> Create validation packages. After this I go to