On 4/29/20 8:29 pm, Prasanta Sadhukhan wrote:
I could understand that we need to use some specific GC instead of null(which is
the default), but a force to use GC instead of another non-null GC sounds not 
good, isn't it?

I couldn't get what you are trying to say...You have a problem with using 
getPreferredSize() in BasicToolTipUI#paint and you asked why can't we use the same 
setSize() as it is now. I found we cannot use that because JPanel.setSize() is wrong 
because it's GC was null when the "size" was calculated.

As I mentioned, in the fix you do not replace the null value, but replace any 
value if they are not equal to the current screen, is that intentionally?

 852             if (component.getGraphicsConfiguration() !=
 853                     contents.getGraphicsConfiguration()) {
 854                 AWTAccessor.getComponentAccessor().
 855                         setGraphicsConfiguration((Component) component,
 856                                           
contents.getGraphicsConfiguration());
 857             }

If we fix the JPanel's GC with the default GC (the same way we fix ToolTip's 
GC) then we can continue to use setSize() in paint. If you do not have problem 
with how we fix JTooltip's GC ,then what is the problem with fixing JPanel's GC?

It is unclear why we need to change GC of the panel. In the case of TIP it is 
needed to calculate the size of the text which is set to the TIP, but the panel 
does not have any text so why the GC of the panel matters?


--
Best regards, Sergey.

Reply via email to