-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
b53
-
x86
-
windows_xp
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2131266 | 5.0u7 | Igor Kushnirskiy | P4 | Resolved | Fixed | b01 |
Name: js151677 Date: 06/14/2004
FULL PRODUCT VERSION :
J2SE 1.5 -beta1-beta2
ADDITIONAL OS VERSION INFORMATION :
Linux/WindowsXP
A DESCRIPTION OF THE PROBLEM :
In J2SE 1.5 beta release, the swing JEditorPane and JTextPane does not support font created on the fly(that is, a font that is not insatalled on the underlying OS but created using the java.awt.Font.createFont() method). However, all other swing components support this. This feature was supported by all swing components, including JEditorPane and JTextPane, in earlier release of JDK,.
REPRODUCIBILITY :
This bug can be reproduced always.
Release Regression From : 1.4.2
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Incident Review ID: 277251)
======================================================================
The test case is:
/*
* TextPaneDemo.java
*
* Created on September 7, 2004, 10:19 AM
*/
/**
*
* @author mshahriar
*/
import java.io.*;
import java.awt.*;
import javax.swing.text.html.*;
public class TextPaneDemo extends javax.swing.JFrame {
/** Creates new form TextPaneDemo */
public TextPaneDemo() throws Exception {
initComponents();
//we want to use font named amoraboti-unicode.
the font file name
//is amoraboti_unicode.ttf. this file contains
Bangla (unicode name
//is Bengali) character set. suppose this font
is not installed in
//the system, so we want to create it
manually.
//NOTE:
File fontFile = new
File("amoraboti_unicode.ttf");
FileInputStream inStream = new
FileInputStream(fontFile);
Font banglaFont =
Font.createFont(Font.TRUETYPE_FONT,inStream);
banglaFont =
banglaFont.deriveFont(Font.PLAIN,12);
//set the font of the text field
textField.setFont(banglaFont);
//insert some text in the textfield, the text
is in Bangla. this works
//fine in all JDKs greater than or equal to
1.4 and also in the 1.5 beta.
String text =
"\u09AC\u09BE\u0982\u09B2\u09BE";
textField.setText(text);
//set font and text in first text pane. this
works fine in JDK greater
//than or equal to 1.4 but not in JDK 1.5
beta.
textPane1.setFont(banglaFont);
textPane1.setText(text);
//set some html text in first text pane. this
works fine in JDK greater
//than or equal to 1.4 but not in JDK 1.5
beta.
String html = "<html><body><font
face=\"amoraboti-unicode\" size=\"4\">" +
text + "</font></body></html>";
textPane2.setEditorKit(new HTMLEditorKit());
textPane2.setText(html);
}
/** This method is called from within the
constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content
of this method is
* always regenerated by the Form Editor.
*/
private void initComponents()
{//GEN-BEGIN:initComponents
textField = new javax.swing.JTextField();
midPanel = new javax.swing.JPanel();
scrollPane1 = new javax.swing.JScrollPane();
textPane1 = new javax.swing.JTextPane();
scrollPane2 = new javax.swing.JScrollPane();
textPane2 = new javax.swing.JTextPane();
getContentPane().setLayout(new
java.awt.BorderLayout(5, 5));
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
textField.setPreferredSize(new
java.awt.Dimension(11, 25));
getContentPane().add(textField,
java.awt.BorderLayout.NORTH);
midPanel.setLayout(new java.awt.GridLayout(1,
2, 5, 5));
scrollPane1.setViewportView(textPane1);
midPanel.add(scrollPane1);
scrollPane2.setViewportView(textPane2);
midPanel.add(scrollPane2);
getContentPane().add(midPanel,
java.awt.BorderLayout.CENTER);
java.awt.Dimension screenSize =
java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setBounds((screenSize.width-428)/2,
(screenSize.height-329)/2, 428, 329);
}//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) throws
Exception {
new TextPaneDemo().setVisible(true);
}
// Variables declaration - do not
modify//GEN-BEGIN:variables
private javax.swing.JPanel midPanel;
private javax.swing.JScrollPane scrollPane1;
private javax.swing.JScrollPane scrollPane2;
private javax.swing.JTextField textField;
private javax.swing.JTextPane textPane1;
private javax.swing.JTextPane textPane2;
// End of variables declaration//GEN-END:variables
}
###@###.### 2004-09-08
###@###.### 10/21/04 18:30 GMT
FULL PRODUCT VERSION :
J2SE 1.5 -beta1-beta2
ADDITIONAL OS VERSION INFORMATION :
Linux/WindowsXP
A DESCRIPTION OF THE PROBLEM :
In J2SE 1.5 beta release, the swing JEditorPane and JTextPane does not support font created on the fly(that is, a font that is not insatalled on the underlying OS but created using the java.awt.Font.createFont() method). However, all other swing components support this. This feature was supported by all swing components, including JEditorPane and JTextPane, in earlier release of JDK,.
REPRODUCIBILITY :
This bug can be reproduced always.
Release Regression From : 1.4.2
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Incident Review ID: 277251)
======================================================================
The test case is:
/*
* TextPaneDemo.java
*
* Created on September 7, 2004, 10:19 AM
*/
/**
*
* @author mshahriar
*/
import java.io.*;
import java.awt.*;
import javax.swing.text.html.*;
public class TextPaneDemo extends javax.swing.JFrame {
/** Creates new form TextPaneDemo */
public TextPaneDemo() throws Exception {
initComponents();
//we want to use font named amoraboti-unicode.
the font file name
//is amoraboti_unicode.ttf. this file contains
Bangla (unicode name
//is Bengali) character set. suppose this font
is not installed in
//the system, so we want to create it
manually.
//NOTE:
File fontFile = new
File("amoraboti_unicode.ttf");
FileInputStream inStream = new
FileInputStream(fontFile);
Font banglaFont =
Font.createFont(Font.TRUETYPE_FONT,inStream);
banglaFont =
banglaFont.deriveFont(Font.PLAIN,12);
//set the font of the text field
textField.setFont(banglaFont);
//insert some text in the textfield, the text
is in Bangla. this works
//fine in all JDKs greater than or equal to
1.4 and also in the 1.5 beta.
String text =
"\u09AC\u09BE\u0982\u09B2\u09BE";
textField.setText(text);
//set font and text in first text pane. this
works fine in JDK greater
//than or equal to 1.4 but not in JDK 1.5
beta.
textPane1.setFont(banglaFont);
textPane1.setText(text);
//set some html text in first text pane. this
works fine in JDK greater
//than or equal to 1.4 but not in JDK 1.5
beta.
String html = "<html><body><font
face=\"amoraboti-unicode\" size=\"4\">" +
text + "</font></body></html>";
textPane2.setEditorKit(new HTMLEditorKit());
textPane2.setText(html);
}
/** This method is called from within the
constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content
of this method is
* always regenerated by the Form Editor.
*/
private void initComponents()
{//GEN-BEGIN:initComponents
textField = new javax.swing.JTextField();
midPanel = new javax.swing.JPanel();
scrollPane1 = new javax.swing.JScrollPane();
textPane1 = new javax.swing.JTextPane();
scrollPane2 = new javax.swing.JScrollPane();
textPane2 = new javax.swing.JTextPane();
getContentPane().setLayout(new
java.awt.BorderLayout(5, 5));
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
textField.setPreferredSize(new
java.awt.Dimension(11, 25));
getContentPane().add(textField,
java.awt.BorderLayout.NORTH);
midPanel.setLayout(new java.awt.GridLayout(1,
2, 5, 5));
scrollPane1.setViewportView(textPane1);
midPanel.add(scrollPane1);
scrollPane2.setViewportView(textPane2);
midPanel.add(scrollPane2);
getContentPane().add(midPanel,
java.awt.BorderLayout.CENTER);
java.awt.Dimension screenSize =
java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setBounds((screenSize.width-428)/2,
(screenSize.height-329)/2, 428, 329);
}//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) throws
Exception {
new TextPaneDemo().setVisible(true);
}
// Variables declaration - do not
modify//GEN-BEGIN:variables
private javax.swing.JPanel midPanel;
private javax.swing.JScrollPane scrollPane1;
private javax.swing.JScrollPane scrollPane2;
private javax.swing.JTextField textField;
private javax.swing.JTextPane textPane1;
private javax.swing.JTextPane textPane2;
// End of variables declaration//GEN-END:variables
}
###@###.### 2004-09-08
###@###.### 10/21/04 18:30 GMT
- backported by
-
JDK-2131266 REG: JEditorPane/JTextPane(J2SE1.5) No support for dynamic Fonts
- Resolved
- relates to
-
JDK-6361892 Printing of HTML through JEditorPane is broken since Mustang-b53
- Closed
-
JDK-4950815 JEDITORPANE DOESN'T USE CREATED FONTS
- Closed
-
JDK-6376865 JCK-Runtime-15a StyleSheet.setgetTests StyleSheet 2021: Failed to getFont for 5.0_u7_b1
- Resolved