Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-4173

FlatLaf: Partial render selected BeanTreeView element

    XMLWordPrintableJSON

Details

    Description

      When using FlatLaf Look and Feel, incorrect rendering of tree item under the context menu in the BeanTreeView component occurs. This problem can be easily reproduced by the following simple example.

      import com.formdev.flatlaf.FlatLightLaf;
      import org.openide.explorer.ExplorerManager;
      import org.openide.explorer.view.BeanTreeView;
      import org.openide.nodes.AbstractNode;
      import org.openide.nodes.Children;
      
      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.ActionEvent;
      
      public class SampleFrame extends JFrame implements ExplorerManager.Provider {
          private final ExplorerManager explorerManager = new ExplorerManager();
      
          public SampleFrame() throws HeadlessException {
              setSize(300, 400);
              explorerManager.setRootContext(new SampleNode());
              BeanTreeView beanTreeView = new BeanTreeView();
              getContentPane().add(beanTreeView, BorderLayout.CENTER);
          }
      
          @Override
          public ExplorerManager getExplorerManager() {
              return explorerManager;
          }
      
      
          private static class SampleNode extends AbstractNode {
              public SampleNode() {
                  super(Children.LEAF);
                  setName("SampleNode");
              }
      
              @Override
              public Action[] getActions(boolean context) {
                  AbstractAction action = new AbstractAction() {
                      @Override
                      public void actionPerformed(ActionEvent e) {
      
                      }
                  };
                  action.putValue(Action.NAME, "Sample");
                  return new Action[]{action};
              }
          }
      
          public static void main(String[] args) {
              SwingUtilities.invokeLater(() -> {
                  FlatLightLaf.install();
      
                  SampleFrame frame = new SampleFrame();
                  frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
                  frame.setVisible(true);
              });
          }
      }
      

      Netbeans Services Window

       

      Attachments

        1. image-2020-04-16-13-16-17-044.png
          44 kB
          Lucas Friedmann
        2. Netbeans Services Windows after fix_FlatLaf.png
          42 kB
          Lucas Friedmann

        Activity

          People

            devcharly Karl Tauber
            lcsfried88 Lucas Friedmann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1.5h
                1.5h