Cannot display JLabel text in JTable

Hi, This is a simple but frustrating little problem
I am having trouble displaying the label text in a column of a JTable.
I have hacked up a copy of TableDialogEditDemo.java from the tutorials
on using JTables. This uses a renderer and editor models to deal with a
column of colors.
I have changed it to use JLabels instead. What want is for the label
text to appear and when the user selects the cell be allowed to launch
a dialog box (such as the demo program does with colorchooser).
The dialog launching funcionalty works fine but the label text does not display.
I end up with the column of JLabels as blank, even though the values
are properly set. It seems like the TableCellRenderer doesn't display the
controls text.
I've spent the better part of two work days trying to get this one to work.
Compiling and just running the code (without any interaction with the table)
shows the problem. The second column of items will be blank instead of
cells with text.
Help!
Thanks!
/Steve McCauley
Sanera Systems
[email protected]
Here is the code:
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;
import javax.swing.DefaultCellEditor;
import javax.swing.table.TableCellRenderer;
import javax.swing.JLabel;
import javax.swing.JDialog;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JColorChooser;
import javax.swing.BorderFactory;
import javax.swing.border.Border;
import javax.swing.JScrollPane;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import java.awt.*;
import java.awt.event.*;
* This is like TableEditDemo, except that it substitutes a
* Favorite Color column for the Last Name column and specifies
* a custom cell renderer and editor for the color data.
public class TableDialogEditDemo extends JFrame {
private boolean DEBUG = false;
public TableDialogEditDemo() {
super("TableDialogEditDemo");
MyTableModel myModel = new MyTableModel();
JTable table = new JTable(myModel);
table.setPreferredScrollableViewportSize(new Dimension(500, 70));
//Create the scroll pane and add the table to it.
JScrollPane scrollPane = new JScrollPane(table);
//Set up renderer and editor for the Favorite Color column.
setUpColorRenderer(table);
setUpColorEditor(table);
//Set up real input validation for integer data.
setUpIntegerEditor(table);
//Add the scroll pane to this window.
getContentPane().add(scrollPane, BorderLayout.CENTER);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
class ColorRenderer extends JLabel
implements TableCellRenderer {
Border unselectedBorder = null;
Border selectedBorder = null;
boolean isBordered = true;
public ColorRenderer(boolean isBordered) {
super();
this.isBordered = isBordered;
// setOpaque(true); //MUST do this for background to show up.
public Component getTableCellRendererComponent(
JTable table, Object color,
boolean isSelected, boolean hasFocus,
int row, int column) {
// setBackground((Color)color);
setForeground(Color.black);
setBackground(Color.white);
System.out.println(" Label: " + ((JLabel)color).getText());
if (isBordered) {
if (isSelected) {
if (selectedBorder == null) {
selectedBorder = BorderFactory.createMatteBorder(2,5,2,5,
table.getSelectionBackground());
setBorder(selectedBorder);
} else {
if (unselectedBorder == null) {
unselectedBorder = BorderFactory.createMatteBorder(2,5,2,5,
table.getBackground());
setBorder(unselectedBorder);
return this;
private void setUpColorRenderer(JTable table) {
table.setDefaultRenderer(JLabel.class,
new ColorRenderer(true));
//Set up the editor for the Color cells.
private void setUpColorEditor(JTable table) {
//First, set up the button that brings up the dialog.
final JButton button = new JButton("") {
public void setText(String s) {
//Button never shows text -- only color.
button.setBackground(Color.white);
button.setBorderPainted(false);
button.setMargin(new Insets(0,0,0,0));
//Now create an editor to encapsulate the button, and
//set it up as the editor for all Color cells.
final ColorEditor colorEditor = new ColorEditor(button);
table.setDefaultEditor(JLabel.class, colorEditor);
//Set up the dialog that the button brings up.
final JColorChooser colorChooser = new JColorChooser();
ActionListener okListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
colorEditor.currentLabel = new JLabel("xxx");
final JDialog dialog = JColorChooser.createDialog(button,
"Pick a Color",
true,
colorChooser,
okListener,
null); //XXXDoublecheck this is OK
//Here's the code that brings up the dialog.
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// button.setBackground(colorEditor.currentColor);
// colorChooser.setColor(colorEditor.currentColor);
//Without the following line, the dialog comes up
//in the middle of the screen.
//dialog.setLocationRelativeTo(button);
dialog.show();
* The editor button that brings up the dialog.
* We extend DefaultCellEditor for convenience,
* even though it mean we have to create a dummy
* check box. Another approach would be to copy
* the implementation of TableCellEditor methods
* from the source code for DefaultCellEditor.
class ColorEditor extends DefaultCellEditor {
JLabel currentLabel = null;
public ColorEditor(JButton b) {
super(new JCheckBox()); //Unfortunately, the constructor
//expects a check box, combo box,
//or text field.
editorComponent = b;
setClickCountToStart(1); //This is usually 1 or 2.
//Must do this so that editing stops when appropriate.
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
fireEditingStopped();
protected void fireEditingStopped() {
super.fireEditingStopped();
public Object getCellEditorValue() {
return currentLabel;
public Component getTableCellEditorComponent(JTable table,
Object value,
boolean isSelected,
int row,
int column) {
((JButton)editorComponent).setText(value.toString());
currentLabel = (JLabel)value;
return editorComponent;
private void setUpIntegerEditor(JTable table) {
//Set up the editor for the integer cells.
final WholeNumberField integerField = new WholeNumberField(0, 5);
integerField.setHorizontalAlignment(WholeNumberField.RIGHT);
DefaultCellEditor integerEditor =
new DefaultCellEditor(integerField) {
//Override DefaultCellEditor's getCellEditorValue method
//to return an Integer, not a String:
public Object getCellEditorValue() {
return new Integer(integerField.getValue());
table.setDefaultEditor(Integer.class, integerEditor);
class MyTableModel extends AbstractTableModel {
final String[] columnNames = {"First Name",
"Favorite Color",
"Sport",
"# of Years",
"Vegetarian"};
// final Object[][] data = {
// {"Mary", new Color(153, 0, 153),
// "Snowboarding", new Integer(5), new Boolean(false)},
// {"Alison", new Color(51, 51, 153),
// "Rowing", new Integer(3), new Boolean(true)},
// {"Kathy", new Color(51, 102, 51),
// "Chasing toddlers", new Integer(2), new Boolean(false)},
// {"Mark", Color.blue,
// "Speed reading", new Integer(20), new Boolean(true)},
// {"Philip", Color.pink,
// "Pool", new Integer(7), new Boolean(false)}
final Object[][] data = {
{"Mary", new JLabel("label-1"),
"Snowboarding", new Integer(5), new Boolean(false)},
{"Alison", new JLabel("label-2"),
"Rowing", new Integer(3), new Boolean(true)},
{"Kathy", new JLabel("label-3"),
"Chasing toddlers", new Integer(2), new Boolean(false)},
{"Mark", new JLabel("label-4"),
"Speed reading", new Integer(20), new Boolean(true)},
{"Philip", new JLabel("label-5"),
"Pool", new Integer(7), new Boolean(false)}
public int getColumnCount() {
return columnNames.length;
public int getRowCount() {
return data.length;
public String getColumnName(int col) {
return columnNames[col];
public Object getValueAt(int row, int col) {
return data[row][col];
* JTable uses this method to determine the default renderer/
* editor for each cell. If we didn't implement this method,
* then the last column would contain text ("true"/"false"),
* rather than a check box.
public Class getColumnClass(int c) {
return getValueAt(0, c).getClass();
* Don't need to implement this method unless your table's
* editable.
public boolean isCellEditable(int row, int col) {
//Note that the data/cell address is constant,
//no matter where the cell appears onscreen.
if (col < 1) {
return false;
} else {
return true;
public void setValueAt(Object value, int row, int col) {
if (DEBUG) {
System.out.println("Setting value at " + row + "," + col
+ " to " + value
+ " (an instance of "
+ value.getClass() + ")");
data[row][col] = value;
fireTableCellUpdated(row, col);
if (DEBUG) {
System.out.println("New value of data:");
printDebugData();
private void printDebugData() {
int numRows = getRowCount();
int numCols = getColumnCount();
for (int i=0; i < numRows; i++) {
System.out.print(" row " + i + ":");
for (int j=0; j < numCols; j++) {
System.out.print(" " + data[i][j]);
System.out.println();
System.out.println("--------------------------");
public static void main(String[] args) {
TableDialogEditDemo frame = new TableDialogEditDemo();
frame.pack();
frame.setVisible(true);

You pretty much hit the nail on the head. Thank!
Just didn't realize I needed to set the text of the component but with your
tip and thinking about it, it makes sense.
Actually I needed to use:
setText(t_label.getText());
Using toString got me: "java.swing......" (the components text representation)
Thanks a bunch!
/Steve

Similar Messages

  • Cannot display the text in Hyp Planning via ODI

    Hi,
    has anyone follow the tutorial from John Goodwin here:
    "http://john-goodwin.blogspot.com/2008/10/odi-getting-text-data-into-planning.html" ??
    I'd tried the tutorial in order to able to display text in Planning.
    However, I still cannot display the text in the end, only the numeric id values - taken from the HSP_TEXT_CELL_VALUE table.
    Here the steps I've done:
    - getting the list of id and text values to be inserted into HSP_TEXT_CELL_VALUE table
    - make a new interface to load data into planning
    - I want to load data from flat file to Planning, so I dragged flat file and also the HSP_TEXT_CELL_VALUE table into the source column, and then join the "MP3" column from flat file with values column from HSP_TEXT_CELL_VALUE table (like written in the tutorial ""http://john-goodwin.blogspot.com/2008/10/odi-getting-text-data-into-planning.html")
    - after that, I dragged the Account dimension, and then join them. For the MP3 column in target column, I mapped it with "id" column from HSP_TEXT_CELL_VALUE table.
    - Then I execute. The data loaded into Planning, but when I tried to open in report, the MP3 column shows the "id" instead of "values".
    Am I missing something?
    Has anyone experienced the same as mine?
    Any help would be appreciated.
    Thanks

    Hi,
    I may have followed the blog :)
    First have you loaded the values into the HSP_TEXT_CELL_VALUE table, have you checked the values are now in the table ?
    Also, you will unfortunately have to restart the planning service after you have loaded them as the table is cached and a restart clears the cache.
    When you load into planning you need to map the "Value" field in HSP_TEXT_CELL_VALUE to your data source, and load in the id to planning.
    If you are only getting numerical values it is either because you have not restarted planning or the HSP_TEXT_CELL_VALUE has not been updated correctly.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Cannot display chinese texts in info package

    How to solve that replaced chinese texts as ###### in infopackage
    appreciate for help

    Hi Jeff,
    Are you using a unicode system? I guess that the R3/ERP system is unicode?
    BR
    Stefan

  • How to display Long text in a JLabel with multiline??

    Hi,
    Suppose I have a label that displays a long text....
    ""This is an example label that displays long text, how to break the line????.........""
    how to display it like below with one label?
    ""This is an example label
    that displays long text, how
    to break the line????.........""
    Thanks

    so basically do this
    JLabel myLabel = new JLabel();
    String theText = "<html>This is an example label<br>
                                  that displays long text, how<br>
                                  to break the line????.........</html>";
    myLabel.setText(theText);Obivously, u dont have to use a separate string, u could just call setText or pass it into the JLabel constructor, i just separated it to make it easier to see what your supposed to do.
    GOod Luck

  • Display a text  with icon in a JTable cell and a textarea on click of icon

    Hello,
    I need to modify the JTable, so that in some cells I can display a text with a small icon or symbol, on click of the the icon or symbol a small JTextArea or a display should open exactly at the position of mouse click to display list of text values.
    I searched this forum, but could not find the right solution... a code example will be good....
    Eagerly waiting....
    Serj

    Are you using an annonymous inner class for your mouse listener? I think this coudl cause some problems in your case.
    Try creating your own listener class e.g.
    class myListener extends MouseListener(){....}
    in this class, add a field such as 'name' - set with the constructor. So when you create your "outer table" write something like..
    outerTable.addMouseListener(new myListener("outer"));
    And when you create the inner table, write something like
    innerTable.addMouseListener(new myListener("inner"));
    Then when you capture Mouse click events, you can work out whether the click came from an outer table or inner table:
    public void mouseClicked(MouseEvent e){
    if(this.name.equals("inner")).....
    else.....
    In this way you should avoid the problem of knowing which table was clicked on...and still us the same mouse listener.
    I hope this is what you mean!
    Chris.

  • Cannot see Display as Text (based on lov, saves state)

    I have raised this question on the HTMLDB forum (Where is "Display as Text (based on LOV, saves state)" but in case its XE specific I am posting here too.
    I have a tabular form in the XE version of HTMLDB, and wish to use the "Display as Text (based on LOV, saves state)" option. However, this option does is not available to me - are there some conditions necessary for this option to be displayed?
    Thanks, Rob

    Rob,
    I doubt it's an XE specific issue. I've asked for more information in the original thread.
    Sergio

  • I want  to display a text when button pressed

    Hi guys
    I want to display a text when a button is pressed , but the compiler says cannot resolve variable text ,can you please help me
    here is my program
    import  java.awt.Color .*;   import java.awt .*; import java.awt.event.*; import java.awt.event.*;   import javax.swing.*; import javax.swing.JTable.*;   public class sannaa extends JFrame implements  ActionListener {[code] public sannaa( )  {
    super("����� ������" ); setLayout(new FlowLayout()); TextField text = new TextField(20); JButton ok=new JButton( "return"   ); add(text); ok.addActionListener(this);  
    Container   contentPane  =  getContentPane(    ); 
    JLabel hellolabel=new JLabel("google"); hellolabel.setForeground(Color.black); hellolabel.setBackground(Color.blue);   String[ ] columnNames =
    {"First Name",   "Last Name", "Sport",
                             "# of Years",
                             "Vegetarian"};
                            Object [    ][     ] data =
    {"Mary", "Campione", "Snowboarding", new Integer(5), new Boolean(false)},
    {"Alison", "Huml", "Rowing", new Integer(3), new Boolean(true)},
    {"Kathy", "Walrath", "Knitting", new Integer(2), new Boolean (false)},
    {"Sharon", "Zakhour", "Speed reading", new Integer(20), new Boolean(true)},
    {"Philip", "Milne", "Pool", new Integer(10), new Boolean(false)} };
    JTable table = new JTable(data, columnNames); JButton enter=new JButton( "search"   ); ok.setBackground(Color.pink); ok.setForeground(Color.white); JFrame frame=new JFrame("EL  "); enter.setMaximumSize(new Dimension(900,
                                           100)); enter.setForeground(Color.blue); contentPane.setBackground( Color.white); for(int i=0;i<10;i++) {[code]JButton rami=new JButton( ""+ "" +i );
    contentPane.add(rami);
    rami.setBackground(Color.blue); }
    contentPane.add(ok);
    JPanel panel=new JPanel(new BorderLayout(500,500) ); contentPane.setLayout(new FlowLayout( )); contentPane.add(panel); panel.add(enter,  BorderLayout.PAGE_START); panel.add(table, BorderLayout.PAGE_START); panel.add(hellolabel,  BorderLayout.PAGE_START); panel.setBackground( Color.white ); panel.setLayout(new BorderLayout()); panel.add(table.getTableHeader(),BorderLayout.PAGE_START )  panel.add(table, BorderLayout.CENTER); panel.add(hellolabel,BorderLayout.PAGE_END);   setVisible(true); }
    public void actionPerformed(ActionEvent   e  ) {  [code] text.setText("Button Clicked ");
    public static void main (String [] args) {[code] sannaa van=new sannaa( );
    } }  

    Thanks
    I have changed my program to the following and its compiled truely, but when I press thte button in the application no text appeared?
    help me please
    import  java.awt.Color .*;   import java.awt .*; import java.awt.event.*; import java.awt.event.*;   import javax.swing.*; import javax.swing.JTable.*;    public class sannaa extends JFrame implements  ActionListener { 
    public sannaa(   ) {
    super("����� ������" ); JButton ok=new JButton( "return"   );
    ok.addActionListener(this);  
    Container   contentPane  =  getContentPane(
    JLabel hellolabel=new JLabel("google");
    hellolabel.setForeground(Color.black); hellolabel.setBackground(Color.blue);
        String[ ] columnNames =
    {"First Name",   "Last Name", "Sport",
                             "# of Years",
      "Vegetarian"};
                            Object [    ][     ] data =
    {"Mary", "Campione", "Snowboarding", new Integer(5),
    new Boolean(false)},
    {"Alison", "Huml", "Rowing", new Integer(3), new
    Boolean(true)},
    {"Kathy", "Walrath", "Knitting", new Integer(2),
    new Boolean (false)},
    "Sharon", "Zakhour", "Speed reading", new
    Integer(20), new Boolean(true)},
    {"Philip", "Milne", "Pool", new Integer(10),
    new Boolean(false)} };
    JTable table = new JTable(data,
      columnNames); JButton enter=new JButton( "search"
         ); ok.setBackground(Color.pink); ok.setForeground(Color.white); JFrame frame=new JFrame("EL  "); enter.setMaximumSize(new Dimension(900,
      100));
    enter.setForeground(Color.blue); contentPane.setBackground( Color.white);
    for(int i=0;i<10;i++) {  [code]JButton rami=new JButton( ""+ "" +i );
    contentPane.add(rami);
    rami.setBackground(Color.blue); }
    contentPane.add(ok);
    JPanel panel=new JPanel(new
      BorderLayout(500,500) ); contentPane.setLayout(new FlowLayout(
      )); contentPane.add(panel); panel.add(enter,  BorderLayout.PAGE_START);
      panel.add(table,
      BorderLayout.PAGE_START); panel.add(hellolabel,
       BorderLayout.PAGE_START); panel.setBackground( Color.white ); panel.setLayout(new BorderLayout());   panel.add(table.getTableHeader(),BorderLayout.PAGE_START ) ;
       panel.add(table, BorderLayout.CENTER);
    panel.add(hellolabel,BorderLayout.PAGE_END);
       setVisible(true); }
    public void actionPerformed(ActionEvent   e  )
      {  [code] TextField text=new TextField ("") ;
    text.setText("Button Clicked     ");     }
    public static void main (String [] args)
    sannaa van=new sannaa( ); } }  

  • Cannot display square root symbol in cvi

    I don't understand why this would be an issue, but if I'm writing in the source window (with the default font of NIEditor), I cannot display a square root symbol "√" - every time I type alt+251, I get "v". Ok, not a huge deal in the source window, but it is a big deal if THAT is what's being stored in a string variable I'm writing out to a file. Additionally, if I use the following to format a string:
    "Fmt(setpointUOM, "%s<W%cT/P3", 251);", then setpointUOM = "WüT/P3". If I display this variable in a string control, it displays as "W√T/P3", which is correct, but if I use it in a Text Box or save it to a sql database, it displays "WüT/P3" which is unacceptable.
    I've tried changing the fonts but nothing works or I get even stranger results. I've been dealing with/ignoring this since CVI7 and I'm currently at CVI10. Thanks for any help.
    Solved!
    Go to Solution.

    The difference in the display between W√T/P3 and WüT/P3 has to do with the character set that you select for the UI control. From what I can tell, only the OEM code pages map the √ symbol to character 251, so if you want to see √ for that character, you should pick the OEM character set, in that control.
    Entering √ with the keyboard in a CVI window seems like a much more problematic task. When you type Alt+251 on a CVI window, the keyboard driver is converting the 251 to 118 (the letter v). I don't know why it does that, but I noticed that the code that it converts 251 to varies, depending on your input language (which you can change in Control Panel>>Region and Language>>Change keyboards or other input methods). When english is selected in the language bar, it converts it to 118. With other languages, it converts it to other codes. I tried entering the unicode value for √ directly, which is Alt+221A (to enter unicode characters using the keypad, you have to follow the steps described here). But it didn't work. It still converted it to 118. I suspect the keyboard driver is doing this because it tries to map 221A to some symbol that is valid in the code page that corresponds to the input language, isn't able to, and picks what it thinks is the closest match.
    In lots of other applications (but not all) you can type Alt+251 or Alt+221A and it works just fine. This is because those applications accept unicode characters directly. Unfortunately, CVI isn't one of them. It uses code pages (a.k.a. character sets, or multibyte sequences) instead of unicode, and symbols don't have a universal meaning; they depend on the code page.
    Even if all this were not an impediment, you'd still run into the problem that in CVI 2010 you cannot change the font of the CVI source window to use an OEM character set. So, you'd still see it displayed as a v or a ü. In CVI 2012 you can change the change it, and so if you were using CVI 2012 you could conceivably use the clipboard to paste the √, but there is a bug in CVI that is preventing OEM characters from being pasted correctly (I realize the description says that it affects tree tooltips, but it's also generally affecting clipboard operations of some less commonly used character sets).
    So, to make a long story short, I think you should continue entering the code directly with the Fmt function, at least until this bug is fixed. And make sure that all UI controls that need to display this string are using the OEM character set.
    Luis

  • IE + SVG = "Cannot display XML page" ?

    Dear friends,
       I am from Taiwan.  I have a question about SVG display on IE. 
       I have a very simply SVG file as the following code.  I installed Ferdora R12 with apache web server (192.168.0.8) inside my company.
    I installed Tomcat 6.0 on my PC(192.168.0.100, window 7 with IE8.0).  I put this SVG file on Fedora, and I can see the vector graphs through
    Chrome and Firefox, but not IE(already installed SVG viewer, with the error message as following).  I put this SVG file on my PC, I can see the vector graphs by IE, Chrome and Firefox through Tomcat or opening file directly. I even put this SVG file on the web server of my company, and vector graphs can be displayed well through all of IE, Chrome and Firefox.
      The problem seems only happen in the situation "Fedora R12 + IE".  Do you have any idea of this problem?  I really need your help.
      Thank you.
    ======= Code =============
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.//EN"
    "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
    <svg id="svg00" version="1.1" xmlns="http://www.w3.org/2000/svg" >
    <svg id="svg01" x="0" y="0" width="654.1" height="654.1" version="1.1" xmlns="http://www.w3.org/2000/svg"
    xmlns:xlink="http://www.w3.org/1999/xlink">
        <a xlink:href="http://www.w3.org//Graphics//SVG//Overview.htm8">
            <rect x="10" y="10" width="100" height="30" rx="10" ry="10"
                  style="fill:lightgrey"/>
            <text x="30" y="30" font-size="12">Click here</text>
        </a>
        <a xlink:href="http://www.ibm.com//developerworks/">
            <circle cx="100" cy="100" r="50" style="fill:grey"/>
            <text x="80" y="100" font-size="12">Or here</text>
        </a>
        <a xlink:href="http://www.ibm.com/" target="new">
            <polygon
                  points="60 160,165 172,180 60,290 290,272 280,172 285,250 255"
                  style="fill:dimgrey"/>
            <text x="160" y="200" font-size="12">Or even here</text>
        </a>
    </svg>
    </svg>
    ==========================
    The error message is in Chinese, but I translate it as possible as I can.
    ====== Error message ==========
    Cannot display XML page
    Cannot use style table (or form) to view XML input. Please correct this problem and reload this page, or try again later.
    Unidentified error with processing resourse
    There is something wrong with 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'
    =============================

    Hi,
    The string is not correctly formed ( a quote and a concatenation ) :
    Your url :
    v_url:=nvl(v_rep_port,'http://'||v_rep_HOST ||':'||v_rep_port||')||'/reports/rwservlet/getjobid'||substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server='||v_rep_svr;
    The Correction :
    v_url:=nvl(v_rep_port,'http://'||v_rep_HOST ||':'||v_rep_port)||'/reports/rwservlet/getjobid'||substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server='||v_rep_svr;
    Hope it helps
    Mohamed Dadi

  • Cannot display BIG5 characters for web applications deployed to 9iAS

    I have just installed the J2EE and Webcache module of Oracle9iAS Release 2 to
    my Windows NT Server 4.0 and deployed a simple web application to it. However,
    I found that the JSP cannot display chinese (Big5) characters correctly. My JSP
    is something like:
    <%@ page contentType="text/html; charset=BIG5" %>
    <HTML><BODY>
    <% String s = SOME_BIG5_CHARACTERS; %>
    <%= s %>
    </BODY></HTML>
    On the other hand, I tried to re-direct the standard output to a log file and
    do the following in my servlet.
    System.out.println(SOME_BIG5_CHARACTERS);
    Now, the Big5 characters CAN be displayed correctly in the log file. So, I am
    confused with where the problem is.
    Here are my settings to my 9iAS:
    1) Using regedit, I have set the NLS_LANG variable of the corresponding
    ORACLE_HOME to TRADITIONAL CHINESE_TAIWAN.ZHT16BIG5
    2) In the file %ORACLE_HOME%\Apache\Jserv\conf\jserv.properties, I have
    inserted the following line:
    wrapper.env=NLS_LANG=TRADITIONAL CHINESE_TAIWAN.ZHT16BIG5
    3) In the file %ORACLE_HOME%\Apache\Apache\conf\httpd.conf, I have added the
    following line:
    PassEnv NLS_LANG
    4) In the file %ORACLE_HOME%\opmn\conf\opmn.xml, I have added the following
    line to the corresponding OC4J instance:
    <environment>
    <prop name="NLS_LANG" value="TRADITIONAL CHINESE_TAIWAN.ZHT16BIG5"/>
    </environment>
    5) For my application server, I set the java option with -Dfile.encoding=Big5
    6) I have replaced the file font.properties with font.properties.zh_TW under
    %ORACLE_HOME%\jdk\jre\lib.
    7) I have set the following in the file orion-web.xml of my web application:
    <orion-web-app
    deployment-version="9.0.2.0.0"
    default-charset="Big5"
    jsp-cache-directory="./persistence"
    temporary-directory="./temp"
    internationalize-resources="false"
    default-mime-type="application/octet-stream"
    servlet-webdir="/servlet/">
    </orion-web-app>
    Anyone have idea on fixing my problem? Thanks in advance.
    Regards,
    Kae

    I met a similar problem before but not exactly your case. When I compile the JSP by Jdeveloper, it will convert the chinese characters to strange characters. It makes me crazy to handle the chinese characters ...
    Anyway, by my experience, you better isolate the chinese characters from your JSP or Java programs. Instead, put all language dependent text in a properties file and then use native2ascii to covert your properties file into Unicode. Of course, u need to change your page charset to UTF-8.
    U can get more idea from the following site.
    Brief Description of Internationalization:
    http://java.sun.com/products/jdk/1.2/docs/guide/internat/faq.html
    Detail Tutorial:
    http://java.sun.com/docs/books/tutorial/i18n/
    Native-to-ASCII converter:
    http://java.sun.com/products/jdk/1.2/docs/tooldocs/win32/native2ascii.html

  • Display Chinese Text in Form 6i

    Hi,
    I am trying to put Chinese text on forms under Form 6i and allow users to enter double-byte Chinese characters.
    But Form 6i cannot display the Chinese text that I entered. A double-byte Chinese text is always displayed as '?' in the Form.
    I have changed all NLS_LANG registry entry to be AMERICAN_AMERICA.US7ASCII in all three my Windows 98/NT/2000 English PCs. The problem still can't be solved.... 8-(
    I uses Chinese Star to allow me to enter Chinese characters.
    Can someone enlight me on this issue?
    Thanks!

    Hi :
    1) change your NLS_LANG registry entry to be SIMPLIFIED CHINESE_CHINA.ZHS16GBK
    2) open the Chinese Star
    3) run your application
    I think this will solve this problem.

  • SuperFrench is found but this font can not display any text

    "SuperFrench" font comes from Autodesk. this fonts's real file name is supef__.ttf
    If it is placed in C:\Windows\Fonts folder then it is available for Windows native apps such as MS Excel.
    Java GraphicsEnvironment finds "SuperFrench" font
    but this font can not display any text.
    This happens in both Java6(1.6.0_34) and Java7(1.7.0_06)
    try this
    import javax.swing.*;
    import java.awt.*;
    import java.util.*;
    public class FontTest01 {
      public static void main( String[] args ){
        FontTest01 app = new FontTest01();
        app.run();
      void run() {
        String fontName = "SuperFrench"; //** SuperFrench font
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        String[] existFontNames = ge.getAvailableFontFamilyNames(Locale.ENGLISH);
        boolean fontExists = false;
        for( int i=0 ; i<existFontNames.length ; i++ ){
          if( existFontNames.equals( fontName ) ){
    fontExists = true; break;
    if( fontExists==false ){
    System.out.println( fontName +" does not exist" );
    System.exit(-1);
    JLabel label = new JLabel( "ABCDEFG" );
    Font font = new Font( fontName, Font.PLAIN, 20 );
    System.out.println( font.getFontName() );
    label.setFont( font );
    JFrame f = new JFrame();
    f.add( label );
    f.setSize( 180, 120 );
    f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    f.setVisible(true);
    Edited by: TadashiOhmura on 2012/06/17 23:04
    Edited by: TadashiOhmura on 2012/06/18 7:50                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Thank you for your replay.
    I face the same trouble with JavaFX
    I report this problem into Jira and filed as RT-22641
    Some members of Oracle developer team write comments for this issue.
    http://javafx-jira.kenai.com/browse/RT-22641
    This font has some irreguler structure.
    I hope Java font system will deal with it.

  • Cannot display Chinese Character in ver 10.1.3

    Hello,
    I would like to ask one more question, when i run my program, it contain two jsp pages,
    the first one is to ask the user to input some chinese character, then the second one is to display the input data in the second page. I found out that the second one cannot display the input chinese character, but other chinese character in the second one can be display.
    Some of my code in the second one are as follow:
    String firstName = request.getParameter("firstName");
    &#20013;&#25991; <%=firstName%>
    The result are displayed are displayed as follow:
    &#20013;&#25991; ?T???\!
    It seems to me that the text can display but the variable cannot display, does any one know the reason?
    One of the replies from the JDeveloper forum are as follow:
    I seem to recall there was a bug in the 10.1.3 OC4J with passing parameters on the URL in other languages. You might want to ask on the OC4J forum:
    OC4J
    Regards,
    Alan 20/11/2005

    chulongjiang,
    i solve the problem with your advice, thanks lot!
    Regards,
    Alan 24/11/2005

  • Warp text in JTable

    hi,
    I have an application with Jtable.
    In the Jtable I want to display warp text.
    In order to do so I use HTML tags.
    My problem is that when i try to get the height of the cell in order to ditrminate the row height I get wrong height.
    I think that the height that return from the cell is one row text height althoght the cell contains more then one row.
    I'll be glad to get help with that.
    thanks, yaniv

    Maybe this article will help:
    [http://www.javaspecialists.eu/archive/Issue106.html|http://www.javaspecialists.eu/archive/Issue106.html]

  • Acroread 8.1.2 cannot display some Japanese documents

    For details and a test .pdf file see:
    http://bugzilla.novell.com/show_bug.cgi?id=376856
    acroread 8.1.2 cannot display some Japanese documents although
    the Japanese font package and the CMaps are installed.
    Checking which fonts are used in the testfile ~RubiJapanese.pdf~:
    mfabian@magellan:~/test-texts/pdf/japanese$ pdffonts RubiJapanese.pdf
    name type emb sub uni object ID
    MS-Mincho CID TrueType no no no 10 0
    Arial-Black TrueType no no no 14 0
    Arial-BlackItalic TrueType no no no 15 0
    mfabian@magellan:~/test-texts/pdf/japanese$
    I.e., this document uses the ~MS-Mincho~ font which comes with
    Microsoft Windows. It is not embedded, therefore Acroread has to
    search for it on the system and if it cannot find it it should replace
    it with a fallback Japanese font.
    I have this font installed on the Machine where I am testing but
    acroread fails to use it, complains about missing CJK support
    (which is not true) and displays only dots instead of Japanese
    characters.
    You can get the test document from the above mentioned
    bugreport, it is attached to comment #1:
    http://bugzilla.novell.com/show_bug.cgi?id=376856#c1

    Neha,
    Thanks for the response.
    We are running acroread headlessly since it is on a remote server that we access via telnet. Without an XServer session, I can't tell whether acroread is able to read and display the PDF files normally. However, we can view the PDFs with Adobe Reader 8.1.2 on Windows and the acroread -toPostScript command-line that we are using does work properly with other PDFs.
    I will email you a copy of a problematic PDF shortly.
    Regards,
    Steven Dickson

Maybe you are looking for

  • Can't sync my Photos due to windows error

    Everytime I try to sync my photos on itunes 7, I get this message from windows "Tunes has encountered a problem and needs to close. We are sorry for the inconvenience". Does anybody have any idea how to correct this problem?

  • All the anwers to your Dreamweaver questions

    ...are probably on the NNTP side. Most questions here originate from people that use the forums, while most answers come from people that use nntp . For the past two days, posts to this forum from the Adobe news servers are not being propagated. So,

  • Why aren't all selected music/playlists showing up on my iPhone 5S?

    I just purchased my iPhone 5S (upgraded from the 4S) last night.  Software has been updated to the newest iOS 7 version and latest version of iTunes.  All of my music won't fit on my phone, so I only have certain playlists selected.  The playlists sh

  • An error has occurred in variant ZBPRVBIL

    Hi All, While running a billing run, I am getting the below issue. An error has occurred in variant ZBPRVBIL. Note the following information: o   Rate: B-S-GEN o   Schema: B-S-GEN o   Consecutive number of variant in schema: 0021 Can someone help me

  • Loaded osx wrong.  cant fihure out what to do

    Forgive my ignorance. Based on the prodding of a co-worker, this is my first mac. It is an i-book g3 500mhz. Came with os9 and i tried to load OSX. I formatted during install and now OSX works, but has lost the dvd and cdrw programs plus who knows wh