Hi,
I have added a JtextArea and Jtable in Jscrollpane.When huge amount is added to the Jteaxarea/Jtable,the data gets corrupted when i run it on Solaris 5.10 system.On windows opertaing system,it works fine.
Please find below the sample application.I have set textarea editable property to true.
So to reproduce the problem run below program on Solaris System and then copy the text in story string around 50 times in textArea.The data will be corrupt.
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_CLOS E);
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();
}
});
}
}
Please suggest some solution.
Thanks in Advance,
Ruchika