/** * Instantiates a new node figure. * * @param name the name * @param width the weight */ public SimpleNodeFigure(Node node, int width, MouseListener mouseListener) { super(); this.node = node; LineBorder b = new LineBorder(); b.setColor(NodeUtil.FG_COLOR); setBorder(b); textFigure = new RectangleFigure(); text = new Label(getNodeName()); text.setForegroundColor(NodeUtil.FG_COLOR_DARK); setSize(width, 10); textFigure.add(text); hideButton = new RectangleFigure(); hideSymbol = new Label(getSymbol()); hideSymbol.setSize(10, 10); hideSymbol.setTextAlignment(PositionConstants.CENTER); hideSymbol.setFont(hideButtonFont); hideSymbol.setForegroundColor(NodeUtil.FG_COLOR_DARK); hideButton.add(hideSymbol); hideButton.setBackgroundColor(exitClor); hideButton.addMouseListener(mouseListener); hideButton.addMouseMotionListener( new MouseMotionListener() { @Override public void mouseMoved(MouseEvent me) {} @Override public void mouseHover(MouseEvent me) {} @Override public void mouseExited(MouseEvent me) { hideButton.setBackgroundColor(exitClor); } @Override public void mouseEntered(MouseEvent me) { hideButton.setBackgroundColor(entredClor); } @Override public void mouseDragged(MouseEvent me) {} }); hideButton.setSize(10, 10); setLayoutManager(new XYLayout()); add(textFigure); }
/** @generated */ protected void updateLabel(Label target) { Label source = (Label) getHostFigure(); target.setText(source.getText()); target.setTextAlignment(source.getTextAlignment()); target.setFont(source.getFont()); }