public Point getLocation() { if (inEditMode) { tmpLoc.x = defLoc.x; tmpLoc.y = defLoc.y; } else { tmpLoc.x = curLoc.x; tmpLoc.y = curLoc.y; } return tmpLoc; }
public void setSizeRatio(double x, double y) { xRatio = x; yRatio = y; if (x > 1.0) xRatio = x - 1.0; if (y > 1.0) yRatio = y - 1.0; if (defDim.width <= 0) defDim = getPreferredSize(); curLoc.x = (int) ((double) defLoc.x * xRatio); curLoc.y = (int) ((double) defLoc.y * yRatio); curDim.width = (int) ((double) defDim.width * xRatio); curDim.height = (int) ((double) defDim.height * yRatio); if (!inEditMode) setBounds(curLoc.x, curLoc.y, curDim.width, curDim.height); }
public void setEditMode(boolean s) { twin.setEditMode(s); setOpaque(s); if (s) { addMouseListener(ml); curLoc.x = defLoc.x; curLoc.y = defLoc.y; defDim = getPreferredSize(); curDim.width = defDim.width; curDim.height = defDim.height; } else removeMouseListener(ml); inEditMode = s; }
public void reshape(int x, int y, int w, int h) { if (inEditMode) { defLoc.x = x; defLoc.y = y; defDim.width = w; defDim.height = h; } curLoc.x = x; curLoc.y = y; curDim.width = w; curDim.height = h; super.reshape(x, y, w, h); }
public void setSizeRatio(double x, double y) { double rx = x; double ry = y; if (rx > 1.0) rx = x - 1.0; if (ry > 1.0) ry = y - 1.0; if (defDim.width <= 0) defDim = getPreferredSize(); curLoc.x = (int) ((double) defLoc.x * rx); curLoc.y = (int) ((double) defLoc.y * ry); curDim.width = (int) ((double) defDim.width * rx); curDim.height = (int) ((double) defDim.height * ry); if (!inEditMode) setBounds(curLoc.x, curLoc.y, curDim.width, curDim.height); twin.setSizeRatio(x, y); }
public void reshape(int x, int y, int w, int h) { if (inEditMode) { defLoc.x = x; defLoc.y = y; defDim.width = w; defDim.height = h; } curLoc.x = x; curLoc.y = y; curDim.width = w; curDim.height = h; if (!inEditMode) { if ((h != nHeight) || (h < rHeight)) { adjustFont(w, h); } } super.reshape(x, y, w, h); }
public void setEditMode(boolean s) { if (s) { addMouseListener(ml); setOpaque(s); if (font != null) { setFont(font); fontH = font.getSize(); rHeight = fontH; } defDim = getPreferredSize(); curLoc.x = defLoc.x; curLoc.y = defLoc.y; curDim.width = defDim.width; curDim.height = defDim.height; xRatio = 1.0; yRatio = 1.0; } else { removeMouseListener(ml); if ((bg != null) || (isActive < 1)) setOpaque(true); else setOpaque(false); } inEditMode = s; }
public Point getDefLoc() { tmpLoc.x = defLoc.x; tmpLoc.y = defLoc.y; return tmpLoc; }
public void setDefLoc(int x, int y) { defLoc.x = x; defLoc.y = y; }