KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > swt > graphics > LineAttributes


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.swt.graphics;
12
13 import org.eclipse.swt.*;
14
15 /**
16  * <code>LineAttributes</code> defines a set of line attributes that
17  * can be modified in a GC.
18  * <p>
19  * Application code does <em>not</em> need to explicitly release the
20  * resources managed by each instance when those instances are no longer
21  * required, and thus no <code>dispose()</code> method is provided.
22  * </p>
23  *
24  * @see GC#getLineAttributes()
25  * @see GC#setLineAttributes(LineAttributes)
26  *
27  * @since 3.3
28  */

29 public class LineAttributes {
30
31     /**
32      * The line width.
33      */

34     public float width;
35
36     /**
37      * The line style.
38      *
39      * @see org.eclipse.swt.SWT#LINE_CUSTOM
40      * @see org.eclipse.swt.SWT#LINE_DASH
41      * @see org.eclipse.swt.SWT#LINE_DASHDOT
42      * @see org.eclipse.swt.SWT#LINE_DASHDOTDOT
43      * @see org.eclipse.swt.SWT#LINE_DOT
44      * @see org.eclipse.swt.SWT#LINE_SOLID
45      */

46     public int style;
47
48     /**
49      * The line cap style.
50      *
51      * @see org.eclipse.swt.SWT#CAP_FLAT
52      * @see org.eclipse.swt.SWT#CAP_ROUND
53      * @see org.eclipse.swt.SWT#CAP_SQUARE
54      */

55     public int cap;
56
57     /**
58      * The line join style.
59      *
60      * @see org.eclipse.swt.SWT#JOIN_BEVEL
61      * @see org.eclipse.swt.SWT#JOIN_MITER
62      * @see org.eclipse.swt.SWT#JOIN_ROUND
63      */

64     public int join;
65
66     /**
67      * The line dash style for SWT.LINE_CUSTOM.
68      */

69     public float[] dash;
70
71     /**
72      * The line dash style offset for SWT.LINE_CUSTOM.
73      */

74     public float dashOffset;
75
76     /**
77      * The line miter limit.
78      */

79     public float miterLimit;
80
81 /**
82  * Create a new line attributes with the specified line width.
83  *
84  * @param width the line width
85  */

86 public LineAttributes(float width) {
87     this(width, SWT.CAP_FLAT, SWT.JOIN_MITER, SWT.LINE_SOLID, null, 0, 10);
88 }
89     
90 /**
91  * Create a new line attributes with the specified line cap, join and width.
92  *
93  * @param width the line width
94  * @param cap the line cap style
95  * @param join the line join style
96  */

97 public LineAttributes(float width, int cap, int join) {
98     this(width, cap, join, SWT.LINE_SOLID, null, 0, 10);
99 }
100
101 /**
102  * Create a new line attributes with the specified arguments.
103  *
104  * @param width the line width
105  * @param cap the line cap style
106  * @param join the line join style
107  * @param style the line style
108  * @param dash the line dash style
109  * @param dashOffset the line dash style offset
110  * @param miterLimit the line miter limit
111  */

112 public LineAttributes(float width, int cap, int join, int style, float[] dash, float dashOffset, float miterLimit) {
113     this.width = width;
114     this.cap = cap;
115     this.join = join;
116     this.style = style;
117     this.dash = dash;
118     this.dashOffset = dashOffset;
119     this.miterLimit = miterLimit;
120 }
121 }
122
Popular Tags