Bug 29547 - setText (String) of JButton does not work with HTML code (but JLabel works)
Summary: setText (String) of JButton does not work with HTML code (but JLabel works)
Status: RESOLVED WORKSFORME
Alias: None
Product: classpath
Classification: Unclassified
Component: swing (show other bugs)
Version: 0.92
: P3 normal
Target Milestone: 0.93
Assignee: Roman Kennke
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-22 13:46 UTC by Debian GCC Maintainers
Modified: 2006-10-23 19:33 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Debian GCC Maintainers 2006-10-22 13:46:35 UTC
[forwarded from http://bugs.debian.org/392791]

Suppose the following program: 
----- 
import javax.swing.*; 
import java.awt.*; 
 
class M extends JFrame{ 
    private JLabel l = new JLabel ("a<br>b"); 
    private JButton b = new JButton ("a<br>b"); 
    M (){ 
        setLayout (new GridLayout (2, 1)); 
        getContentPane().add (l); 
        getContentPane().add (b); 
        setDefaultCloseOperation (EXIT_ON_CLOSE); 
        setSize (200, 200); 
        setVisible (true); 
    } 
    public static void main (String args[]){ 
        new M (); 
    } 
} 
--- 
 
JLabel honors HTML breakline, while JButton does not. 
 
(In fact, what I need is to break lines in JButton's text.  And I know 
there is a workaround by using a JLabel inside the JButton.) 
 
gcj-4.2-20060923-1 has the same problem.
Comment 1 Roman Kennke 2006-10-22 18:12:39 UTC
There has been a lot of work on HTML for the upcoming 0.93 release of GNU Classpath. Your particular testprogram works now. (In fact, it seems that it doesn't work with Sun's JDK, most likely it doesn't detect your strings as HTML while Classpath does).
Comment 2 Audrius Meškauskas 2006-10-23 19:33:30 UTC
I confirm the correct work of our current CVS version. The bug is no longer reproducible.