-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.1
-
sparc
-
solaris_2.5.1
Performance and rendering functionality of JEditorPane/JTextPane
is bad when trying to display any file larger than 100K.
JTextComponent --> JEditorPane --> JTextPane
Run the following code on any large text file greater than 100K or the attaced
text file. run with "java editorpane <filename>"
use the scroller to scroll through the text and you'll notice the rendering
problems along with performance of the scrlling window.....
import java.awt.*;
import java.io.*;
import java.beans.*;
import java.awt.event.*;
import com.sun.java.swing.*;
import com.sun.java.swing.event.*;
public class editorpane extends JEditorPane {
boolean ToolBarVisible = true;
JToolBar toolbar;
JScrollPane scroller;
JPanel panel;
JViewport vp;
editorpane () {
super();
scroller = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
vp = scroller.getViewport();
vp.add(this);
vp.setBackingStoreEnabled(true);
panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add("Center", scroller);
}
public void OpenFile(String fileName) {
Thread loader = new fileloader(fileName);
loader.start();
}
class fileloader extends Thread {
String file;
fileloader(String myfile) {
setPriority(3);
file = myfile;
}
public void run() {
File f = new File(file);
try {
Reader in = new FileReader(f);
read(in, f);
}
catch (IOException e) {
System.err.println(e.toString());
}
}
}
public static void main(String[] args) {
try {
UIManager myui = new UIManager();
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
} catch (Exception exc) {
System.err.println("Error loading L&F: " + exc);
}
f.pack();
f.setSize(600, 400);
f.setVisible(true);
myeditor.setBackground(Color.white);
myeditor.setFont(new Font("Courier", 0, 12));
myeditor.OpenFile(args[0]);
}
}
mehdi.ghazizadeh@eng 1998-09-18
is bad when trying to display any file larger than 100K.
JTextComponent --> JEditorPane --> JTextPane
Run the following code on any large text file greater than 100K or the attaced
text file. run with "java editorpane <filename>"
use the scroller to scroll through the text and you'll notice the rendering
problems along with performance of the scrlling window.....
import java.awt.*;
import java.io.*;
import java.beans.*;
import java.awt.event.*;
import com.sun.java.swing.*;
import com.sun.java.swing.event.*;
public class editorpane extends JEditorPane {
boolean ToolBarVisible = true;
JToolBar toolbar;
JScrollPane scroller;
JPanel panel;
JViewport vp;
editorpane () {
super();
scroller = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
vp = scroller.getViewport();
vp.add(this);
vp.setBackingStoreEnabled(true);
panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add("Center", scroller);
}
public void OpenFile(String fileName) {
Thread loader = new fileloader(fileName);
loader.start();
}
class fileloader extends Thread {
String file;
fileloader(String myfile) {
setPriority(3);
file = myfile;
}
public void run() {
File f = new File(file);
try {
Reader in = new FileReader(f);
read(in, f);
}
catch (IOException e) {
System.err.println(e.toString());
}
}
}
public static void main(String[] args) {
try {
UIManager myui = new UIManager();
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
} catch (Exception exc) {
System.err.println("Error loading L&F: " + exc);
}
f.pack();
f.setSize(600, 400);
f.setVisible(true);
myeditor.setBackground(Color.white);
myeditor.setFont(new Font("Courier", 0, 12));
myeditor.OpenFile(args[0]);
}
}
mehdi.ghazizadeh@eng 1998-09-18
- duplicates
-
JDK-4174947 JEditorPane, JTextPane rendering has problems with files > 100k
-
- Closed
-
-
JDK-4138673 Graphics coordinate overflow with sizes larger than Short.MAX_VALUE
-
- Closed
-