01: /*
02: * Copyright 2007, Maxim Zakharenkov
03: * All rights reserved.
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18: *
19: * $Header: /cvs/swingexplorer/test/test/Star.java,v 1.1 2007/06/27 20:03:59 maxz1 Exp $
20: */
21: package test;
22:
23: import java.awt.Dimension;
24: import java.awt.FlowLayout;
25: import java.awt.Graphics;
26:
27: import javax.swing.JComponent;
28: import javax.swing.JFrame;
29:
30: /**
31: *
32: * @author Maxim Zakharenkov
33: */
34: public class Star extends JComponent {
35:
36: @Override
37: public void paint(Graphics g) {
38: g.drawRect(10, 10, 20, 20);
39: g.drawLine(0, 20, 40, 20);
40: g.drawLine(20, 0, 20, 40);
41: g.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
42: }
43:
44: public static void main(String[] args) {
45: JFrame frm = new JFrame();
46: frm.setTitle("Star");
47: Star star = new Star();
48: frm.setLayout(new FlowLayout());
49: star.setPreferredSize(new Dimension(40, 40));
50: frm.add(star);
51: frm.setBounds(100, 100, 80, 80);
52: frm.setVisible(true);
53: }
54: }
55:
56: /*
57: * $Log: Star.java,v $
58: * Revision 1.1 2007/06/27 20:03:59 maxz1
59: * new
60: *
61: */
|