Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6320343

Using HTML with a DefaultTableCellRenderer ignores Table Font Changes

XMLWordPrintable

    • b53
    • x86
    • windows_2000

      J2SE Version (please include all output from java -version flag):
      java version "1.6.0-ea"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b47)
      Java HotSpot(TM) Client VM (build 1.6.0-ea-b47, mixed mode, sharing)

      Does this problem occur on J2SE 1.4.x or 5.0.x ? Yes / No (pick one)
      Yes

      Operating System Configuration Information (be specific):
      Microsoft Windows 2000 [Version 5.00.2195]

      Hardware Configuration Information (be specific):
      Desktop

      Bug Description:
      Using HTML with a DefaultTableCellRenderer ignores Table Font Changes

      Due to the DefaultTableCellRenderer overriding firePropertyChange the
      BasicHTML is not getting notified that the table font has changed.

      Steps to Reproduce (be specific):
      1) Run the code below
      2) Press the Change Font Button
      (both tables should show text with the new font)

      import static java.awt.Font.*;
      import java.awt.*;
      import java.awt.event.*;
      import static javax.swing.JFrame.*;
      import javax.swing.*;

      public class Test {
        public static void main(String[] args) {
          JFrame frame = new JFrame();
          frame.setLayout(new FlowLayout());
          final JTable table1 = new JTable(new Object[][] {{"<HTML>HTML
      Text"}}, new Object[] {"<HTML>HTML Text"});
          frame.add(new JScrollPane(table1));
          final JTable table2 = new JTable(new Object[][] {{"Normal Text"}},
      new Object[] {"Normal Text"});
          frame.add(new JScrollPane(table2));
          frame.add(new JButton(new AbstractAction("Change Font") {
            public void actionPerformed(ActionEvent e) {
              Font newFont = new Font(null, BOLD, 20);
              table1.setFont(newFont);
              table2.setFont(newFont);
            }
          }));
          frame.setExtendedState(MAXIMIZED_BOTH);
          frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
          frame.setVisible(true);
        }
      }

            shickeysunw Shannon Hickey (Inactive)
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: