⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 resultedgecolor.java

📁 一个很好实用的工作流OSWORKFLOW开发例子.有着非常优秀的灵活性.
💻 JAVA
字号:
package com.opensymphony.workflow.designer.actions;import java.awt.*;import java.awt.event.ActionEvent;import javax.swing.*;import com.opensymphony.workflow.designer.ResultEdge;import com.opensymphony.workflow.designer.WorkflowGraph;import org.jgraph.graph.CellView;import org.jgraph.graph.GraphConstants;public class ResultEdgeColor extends JMenuItem{  ResultEdgeColorHandler customHandler;  static class ResultEdgeColorHandler extends AbstractAction  {    private WorkflowGraph graph;    private Point location;    private Color color;    ResultEdgeColorHandler(WorkflowGraph graph, Point location, Color color)    {      this.graph = graph;      this.location = location;      this.color = color;    }    public void actionPerformed(ActionEvent e)    {      Object cell = graph.getFirstCellForLocation(location.x, location.y);      if(cell == null)      {        return;      }      else      {        CellView view = graph.getGraphLayoutCache().getMapping(cell, false);        if(graph.getModel().isEdge(cell))        {          GraphConstants.setForeground(((ResultEdge)cell).getAttributes(), color);          view.update();          view.refresh(graph.getModel(), graph.getGraphLayoutCache(), false);          graph.getSelectionModel().setSelectionCell(view.getCell());        }      }    }  }  public ResultEdgeColor(WorkflowGraph graph, Point location, Color color, String name)  {    super(name);    setIcon(new ColorIcon(color));    customHandler = new ResultEdgeColorHandler(graph, location, color);    addActionListener(customHandler);  }  class ColorIcon implements Icon  {    private Color color;    public ColorIcon(Color color)    {      this.color = color;    }    public void paintIcon(Component c, Graphics g, int x, int y)    {      g.setColor(color);      g.fillRect(1, 2, 16, getHeight() - 5);      g.setColor(Color.BLACK);      g.drawRect(1, 2, 16, getHeight() - 5);    }    public int getIconWidth()    {      return 16;    }    public int getIconHeight()    {      return getHeight();    }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -