예제 #1
0
      public void paintComponent(Graphics g) {
        super.paintComponent(g);

        if (isTargetNode) {
          DefaultMutableTreeNode destinyNode = (DefaultMutableTreeNode) dropTargetNode;
          DefaultMutableTreeNode dropNode = (DefaultMutableTreeNode) draggedNode;
          DefaultMutableTreeNode selectedNode =
              (DefaultMutableTreeNode) dragAndDropTree.getLastSelectedPathComponent();
          if ((dropNode.getAllowsChildren()
                  && !dropNode.isNodeDescendant(destinyNode)
                  && !destinyNode.isNodeChild(dropNode))
              || (!dropNode.getAllowsChildren()
                  && !destinyNode.getUserObject().equals(selectedNode.getUserObject()))) {
            g.setColor(new Color(0, 29, 255, 100));
            g.fillRect(17, 0, getSize().width - 17, getSize().height - 1);
          }
        } else g.setColor(new Color(0, 29, 255, 0));
      }
예제 #2
0
 @Override
 protected void paintComponent(Graphics g) {
   GuiUtil.makeTextLookLessRubbish(g);
   super.paintComponent(g);
 }