Results 1 to 5 of 5
  1. #1
    simmi is offline Member
    Join Date
    Apr 2009
    Posts
    29
    Rep Power
    0

    Default Data in JteaxtArea getting corrupt

    Hi,

    I have added a JtextArea in Jscrollpane.When huge amount is added to the Jteaxarea,the data gets corrupted when i run it on Solaris 5.10 system.On windows opertaing system,it works fine.

    Can anyone please suggest some solution.

    Thanks in Advance,
    Simmi

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    You may wish to try to isolate the minimal code required to demonstrate the problem and the precise conditions as well. I'd also search the Java bug database to see if it's been reported. If not, and others can reproduce the problem, you may wish to report a bug yourself.

  3. #3
    simmi is offline Member
    Join Date
    Apr 2009
    Posts
    29
    Rep Power
    0

    Default

    Hi ,

    Please find below the code snippet to reproduce the problem.


    Java Code:
    import java.awt.Dimension;
    
    import javax.swing.*;
    
    public class Test{
    
        public JPanel createContentPane (){
    
              JPanel totalGUI = new JPanel();
            
            // This is the text to be stored in Jtextarea.
            String story =       "Testing JtextArea Text\n\n"+
             "data gets corrupted when there is huge amount of data\n\n"+
             "The Internet Foundation Classes (IFC) were a graphics \n\n"+
                                    "library for Java originally developed by Netscape Communications\n "+
                                    "Corporation and first released on December 16, 1996.\n\n"+
                                    "On April 2, 1997, Sun Microsystems and Netscape Communications\n"+
                                    " Corporation announced their intention to combine IFC with other\n"+
                                    " technologies to form the Java Foundation Classes. In addition \n"+
                                    "to the components originally provided by IFC, Swing introduced \n"+
                                    "a mechanism that allowed the look and feel of every component \n"+
                                    "in an application to be altered without making substantial \n"+
                                    "changes to the application code. The introduction of support \n"+
                                    "for a pluggable look and feel allowed Swing components to \n"+
                                    "emulate the appearance of native components while still \n"+
                                    "retaining the benefits of platform independence. This feature \n"+
                                    "also makes it easy to have an individual application's appearance \n"+
                                    "look very different from other native programs.\n\n"+
                                    "Originally distributed as a separately downloadable library, \n"+
                                    "Swing has been included as part of the Java Standard Edition \n"+
                                    "since release 1.2. The Swing classes are contained in the \n"+
                                    "javax.swing package hierarchy.\n";
                          
            
            // We create the TextArea and pass the textarea in as an argument.
            JTextArea storyArea = new JTextArea(story);
            /*setEditable is set to true so that we can add more text into it for testing*/
            storyArea.setEditable(true);
            storyArea.setLineWrap(true);
            storyArea.setWrapStyleWord(true);
            
            /* We create the ScrollPane and instantiate it with the TextArea as an argument*/
            // along with two constants that define the behaviour of the scrollbars.
            JScrollPane area = new JScrollPane(storyArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                               JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
            
            // We then set the preferred size of the scrollpane.
            area.setPreferredSize(new Dimension(300, 200));
            
            // and add it to the GUI.
            totalGUI.add(area);
            totalGUI.setOpaque(true);
            return totalGUI;
        }
    
        private static void createAndShowGUI() {
    
            JFrame.setDefaultLookAndFeelDecorated(true);
            JFrame frame = new JFrame("[=] Embrace of the JScrollPane [=]");
    
            Test demo = new Test();
            frame.setContentPane(demo.createContentPane());
            
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(350, 300);
            frame.setVisible(true);
        }
    
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
                }
            });
        }
    }
    I have set textarea editable property to true.
    So to reproduce the problem run above program on Solaris System and then copy the text in story string around 50 times in textArea.The data will be corrupt.

    Thanks,
    Simmi

  4. #4
    simmi is offline Member
    Join Date
    Apr 2009
    Posts
    29
    Rep Power
    0

    Default

    Hi,

    Any get back on this.

    Thanks,
    simmi

  5. #5
    simmi is offline Member
    Join Date
    Apr 2009
    Posts
    29
    Rep Power
    0

    Default

    Hi,

    It seems it is a bug.Can anyone suggest me the workaround for this.
    Wherein I can use some other component to display huge amount of data along with the scroll bars.

    Thanks,
    simmi

Similar Threads

  1. data structure and data base??
    By ahmed13 in forum Advanced Java
    Replies: 8
    Last Post: 03-27-2009, 06:48 AM
  2. how to store the data in data base
    By eclipse3.4ide in forum New To Java
    Replies: 5
    Last Post: 02-03-2009, 05:25 AM
  3. error while retrieving data from data base
    By kirtesh4u in forum New To Java
    Replies: 5
    Last Post: 11-15-2008, 05:10 PM
  4. Replies: 0
    Last Post: 10-31-2008, 03:13 PM
  5. Data Sorting in a .data file using java
    By stutiger99 in forum New To Java
    Replies: 2
    Last Post: 10-08-2008, 03:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •