Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #37368

Re: how to convert html?

Newsgroups comp.lang.java.programmer
Date 2017-08-31 07:12 -0700
References (2 earlier) <a53e0873-5233-4509-8099-b7c57b7c974e@googlegroups.com> <oo74pl$3q4$1@dont-email.me> <8e62a8c5-8a8c-4f32-96a2-adbd437a9726@googlegroups.com> <0df9b410-65f7-4064-8748-f35691ef7355@googlegroups.com> <804837be-8404-48df-8f3c-b6a1672e3a3a@googlegroups.com>
Message-ID <8a035a47-e940-4153-b595-c3a65da887ec@googlegroups.com> (permalink)
Subject Re: how to convert html?
From Eric Douglas <e.d.programmer@gmail.com>

Show all headers | View raw


On Thursday, August 31, 2017 at 8:56:45 AM UTC-4, Eric Douglas wrote:
> 
> Actually, I forgot, I am still creating the style sheet somewhere.  It doesn't look right if you don't do this, no idea why.

I'm getting there...
javax.swing.plaf.basic.BasicToolTipUI.paint
...
        View v = (View) c.getClientProperty(BasicHTML.propertyKey);
        if (v != null) {
            v.paint(g, paintTextR);
        } else {
            g.setFont(font);
            SwingUtilities2.drawString(c, g, tipText, paintTextR.x,
                                  paintTextR.y + metrics.getAscent());
        }

So if I call setText on my JToolTip with a plain string then call this getClientProperty it returns null.  If I call setText, string starting with <html> then call this getClientProperty, it returns a javax.swing.plaf.basic.BasicHTML$Renderer.

So I trace that to the source
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/javax/swing/plaf/basic/BasicHTML.java?av=f

and find that I can just call setFont() on my JToolTip, then for html font I call BasicHTML.updateRenderer(myToolTip,myToolTip.getTipText()).  That uses that style sheet logic and updates it from the JToolTip's font, except it doesn't do underlines..

http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/sun/swing/SwingUtilities2.java#SwingUtilities2.displayPropertiesToCSS%28java.awt.Font%2Cjava.awt.Color%29

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

how to convert html? Eric Douglas <e.d.programmer@gmail.com> - 2017-08-30 07:03 -0700
  Re: how to convert html? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2017-08-30 10:59 -0500
    Re: how to convert html? Eric Douglas <e.d.programmer@gmail.com> - 2017-08-30 11:41 -0700
      Re: how to convert html? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2017-08-30 14:52 -0500
        Re: how to convert html? Eric Douglas <e.d.programmer@gmail.com> - 2017-08-30 14:00 -0700
          Re: how to convert html? Eric Douglas <e.d.programmer@gmail.com> - 2017-08-31 05:47 -0700
            Re: how to convert html? Eric Douglas <e.d.programmer@gmail.com> - 2017-08-31 05:56 -0700
              Re: how to convert html? Eric Douglas <e.d.programmer@gmail.com> - 2017-08-31 07:12 -0700
                Re: how to convert html? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2017-08-31 13:20 -0500
                Re: how to convert html? Eric Douglas <e.d.programmer@gmail.com> - 2017-08-31 11:49 -0700
                Re: how to convert html? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2017-08-31 14:52 -0500
                Re: how to convert html? Eric Douglas <e.d.programmer@gmail.com> - 2017-08-31 13:37 -0700

csiph-web