mgarin / weblaf

WebLaF is a fully open-source Look & Feel and component library written in pure Java for cross-platform desktop Swing applications.
http://weblookandfeel.com
GNU General Public License v3.0
1.14k stars 235 forks source link

WebPopup in MAC I set rounded corners to have a white background color. How can I set transparent rounded corners #699

Open xcfdszzr opened 2 years ago

xcfdszzr commented 2 years ago

image

  WebPopup in MAC I set rounded corners to have a white background color.
  How can I set transparent rounded corners

        <style type="popup" id="element-choose">
                <component>
                    <opaque>false</opaque>
                    <foreground>black</foreground>
                </component>
                <painter>
                    <decorations>
                        <decoration >
                            <WebShape round="10"/>
        <!--                    <WebShadow type="outer" width="0" />-->
                            <LineBorder color="237,237,237,0"/>
                            <ColorBackground color="255,255,255"/>
                        </decoration>
                        <decoration states="mac">
                            <WebShape round="30"/>
                            <WebShadow type="outer" width="1"/>
                            <LineBorder color="0,0,0"/>
                            <ColorBackground color="255,255,255"/>
                        </decoration>
                    </decorations>
                </painter>
            </style>
mgarin commented 2 years ago

I've tried the same example on Windows and it seems to work just fine, will test this on a Mac a bit later to see if I can reproduce the problem there.

In the meantime, here are a few additional questions:

mgarin commented 2 years ago

Just for reference, this is how I displayed the popup -

new WebButton ( "test", e -> {
    final WebPopup popup = new WebPopup ( StyleId.of ( "element-choose" ) );

    final WebStyledLabel content = new WebStyledLabel ( "{Sample:b}" );
    content.setPreferredSize ( 500, 400 );
    popup.add ( content );

    final Component src = ( Component ) e.getSource ();
    popup.showPopup ( src, 0, src.getHeight () );
} )

And I used the exact popup style you have provided.

xcfdszzr commented 2 years ago
    mac os 12.3.1
    jdk 1.8

  public RunErrorPopup(EditorTree editorTree, String message, String detailMsg) {
          super(StyleId.of("element-choose"));
      }

    this.setPreferredSize(480, 160);

    public static void showRunErrorPopup(EditorTree editorTree, String message, String detailMsg, int x, int y) {
          if (runErrorPopup != null) {
              runErrorPopup.hidePopup();
          }
          runErrorPopup = new RunErrorPopup(editorTree, message,detailMsg);
          runErrorPopup.setVisible(true);
          runErrorPopup.showPopup(editorTree, x, y);
      }
mgarin commented 2 years ago

jdk 1.8

What is the specific update number/vendor? It rarely matters, but I seen a few cases where some features worked differently within the same major version.