001: /**
002: * Caption: Zaval Java Resource Editor
003: * $Revision: 0.37 $
004: * $Date: 2002/03/28 9:24:42 $
005: *
006: * @author: Victor Krapivin
007: * @version: 1.3
008: *
009: * Zaval JRC Editor is a visual editor which allows you to manipulate
010: * localization strings for all Java based software with appropriate
011: * support embedded.
012: *
013: * For more info on this product read Zaval Java Resource Editor User's Guide
014: * (It comes within this package).
015: * The latest product version is always available from the product's homepage:
016: * http://www.zaval.org/products/jrc-editor/
017: * and from the SourceForge:
018: * http://sourceforge.net/projects/zaval0002/
019: *
020: * Contacts:
021: * Support : support@zaval.org
022: * Change Requests : change-request@zaval.org
023: * Feedback : feedback@zaval.org
024: * Other : info@zaval.org
025: *
026: * Copyright (C) 2001-2002 Zaval Creative Engineering Group (http://www.zaval.org)
027: *
028: * This program is free software; you can redistribute it and/or
029: * modify it under the terms of the GNU General Public License
030: * (version 2) as published by the Free Software Foundation.
031: *
032: * This program is distributed in the hope that it will be useful,
033: * but WITHOUT ANY WARRANTY; without even the implied warranty of
034: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
035: * GNU General Public License for more details.
036: *
037: * You should have received a copy of the GNU General Public License
038: * along with this program; if not, write to the Free Software
039: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
040: *
041: */package org.zaval.awt;
042:
043: import java.awt.*;
044: import java.util.*;
045:
046: public class StubbComponent extends Canvas {
047: // private Image img;
048: private int size = 16;
049:
050: public Dimension preferredSize() {
051: return new Dimension(size, size);
052: }
053:
054: public StubbComponent() {
055: setBackground(Color.lightGray);
056: }
057:
058: public void setSize(int s) {
059: if (size == s)
060: return;
061: size = s;
062: invalidate();
063: }
064:
065: public void paint(Graphics g) {
066: /* Dimension d = size();
067: if (img == null || img.getWidth(this) != d.width || !isValid())
068: {
069: img = createImage(d.width, d.width);
070: Graphics gr = img.getGraphics(); */
071: draw(g);
072: /* }
073: g.drawImage(img,0,0, this);*/
074: }
075:
076: protected void draw(Graphics g) {
077: Dimension d = size();
078: g.setColor(Color.lightGray);
079: g.fillRect(0, 0, d.width, d.height);
080:
081: int stap = size / 3;
082: int x = stap;
083: int y = stap;
084: for (; x <= (d.width * 2); x += stap, y += stap) {
085: g.setColor(Color.white);
086: g.drawLine(x, 0, 0, y);
087:
088: g.setColor(Color.gray);
089: g.drawLine(x + 1, 0, 0, y + 1);
090: }
091: }
092:
093: public boolean mouseEnter(Event e, int x, int y) {
094: return true;
095: }
096:
097: public boolean mouseExit(Event e, int x, int y) {
098: return true;
099: }
100: }
|