<AWT Dev> <Swing Dev> design question regarding UI defaults and painting
Sergey.Bylokhov at oracle.com
Tue Nov 17 20:35:35 UTC 2015
On 13.11.15 0:41, Alan Snyder wrote:
> I am curious about a design decision that was made in the implementation
> of textured window backgrounds in the Aqua LAF/AWT.
> In a nutshell, a textured window background is an optional NSWindow
> background style that involves gradients.
Right. It is not necessary should be applied to all application windows.
> I am wondering why a more straightforward solution was not chosen --
> making isOpaque()==false and background==Color(0,0,0,0) the default for
> all components that normally reveal the window background.
> (I tried this and it seems to work. I see various comments in the code
> that there must be an opaque component at the top of the hierarchy, but
> I have not found that to be true on OS X.)
> Is this a performance issue? A compatibility issue? An architectural issue?
This solution was selected because it does not require the changes in
the components or in the UI delegates and automatically applies to the
most of our components. For example how you will handle the situation,
when the component was created, but was not added to the window, what
background it will have? and when it will be changed to 0,0,0,0?
> The components that would need to change are JPanel, JRootPane,
> JLayeredPane, JOptionPane, JSplitPane, JToolBar.
Best regards, Sergey.
More information about the awt-dev