`
yutianapple
  • 浏览: 32511 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论
文章列表
//从文件先读出原有的内容,然后再写入新的内容+上老内容     public boolean regUser(String user[])     {                 String filename = "G://zhnagtao//test.txt";         File file = new File(filename);                 try         {             String s;             StringBuffer bf = new StringBuffer();            ...
//从文件读入流(每行读取)     public boolean validate(String str)     {         // 设置按钮已经被点击         if (!f)         {             f = true;         }                 String s;         try         {             FileInputStream is = new FileInputStream("G://zhnagtao//test.txt"); // 读出指定的文件,二进制流        ...
DRAW2D中的 滚动条
package Draw2D_1; import org.eclipse.draw2d.Label; public class RoleName extends Label{ private String name; private int fid; private Chip chip; public RoleName(String name,Chip chip){ super.setText(name); this.name = name; this.chip = chip; } public String getName() { re ...
package Draw2D_1; import org.eclipse.draw2d.RectangleFigure; /** * * 银角 * <功能详细描述> * * @author  zKF26792 * @version  [版本号, 2010-4-21] * @see  [相关类/方法] * @since  [产品/模块版本] */ public class Role extends RectangleFigure {     private int id;     private Chip d;         public Role(int ...
package Draw2D_1; public class PointXY {     private int x;     private int y;         public PointXY(int x,int y){         this.x = x;         this.y = y;     }         public int getX()     {         return x;     }     public void setX(int x)     {         this.x = x;     }     public int getY( ...
package Draw2D_1; import org.eclipse.draw2d.RectangleFigure; import org.eclipse.swt.graphics.Font; public class NodeBd extends RectangleFigure {     private int id;     private Chip chip;                 @Override     public void setFont(Font f)     {         // TODO Auto-generated method stub   ...
// 初始化芯片槽 public static void initChipTrough() { int k = 0; // 槽的初始化 for (int i = 40; i <= 720; i = i + 200) { for (int j = 40; j <= 720; j = j + 200) { k++; PointXY temp = new PointXY(j, i); Button label = new Button(); // 初始化的芯片槽都没有芯片 chipTrough = new ChipTrough(k ...
// 如果芯片槽已经存在芯片 返回原位 else { f.getChip().getBd().setBounds( new Rectangle(p1.x, p1.y, 135, 135)); f.getChip().setBounds( new Rectangle(p1.x + 14, p1.y + 12, 115, 115)); // 拖动图形银角和图形一起动 f.getChip().getOutput().setBounds( new Rectangle(p1.x + ...
/** * //拖动芯片方法 */ public void repainChip(Point oldPoint, Point newPoint, ChipFont f) { // 鼠标释放坐标 Point p = newPoint; Point p1 = oldPoint; Dimension delta = p.getDifference(oldPoint); // last = p; // 获得你鼠标释放的figur // 判断芯片槽是否已经存放了芯片 for (int i = 1; i < 17; i++) { ...
/** * 鼠标按住移动 */ public void mouseDragged(MouseEvent e) { Point p = e.getLocation(); Dimension delta = p.getDifference(chipLast); chipLast = p; // 获得你鼠标点击的figure if (e.getSource() instanceof ChipFont) { ChipFont f = (ChipFont) e.getSource(); // 设置拖动的Figure的位置 f.setB ...
// 如果芯片槽已经存在芯片 返回原位 else { f.getChip().getBd().setBounds( new Rectangle(p1.x, p1.y, 135, 135)); f.getChip().setBounds( new Rectangle(p1.x + 14, p1.y + 12, 115, 115)); // 拖动图形银角和图形一起动 f.getChip().getOutput().setBounds( new ...
// 判断芯片槽是否已经存放了芯片 for (int i = 1; i < 17; i++) { if ((p.x > ((ChipTrough) map.get(i)).getXy().getX()) && (p.x < ((ChipTrough) map.get(i)).getXy().getX() + 120) && (p.y > ((ChipTrough) map.get(i)).getXy().getY()) && (p.y < ((ChipTrou ...
/** * 鼠标释放 */ public void mouseReleased(MouseEvent e) { System.out.println("鼠标释放: " + e.getSource().getClass().getName()); // 第二次鼠标释放产生连接线 if (clickNumber == 1 && conn1 == null) { conn = new PolylineConnection(); conn.setForegroundColor(ColorConstants.ye ...
/** * 实现对图形的移动进行监听 * * @author */ static class Dragger extends MouseMotionListener.Stub implements MouseListener { int clickFrigure = 0; public Dragger(IFigure figure) { figure.addMouseMotionListener(this); figure.addMouseListener(this); } // 声 ...
Global site tag (gtag.js) - Google Analytics