Mega Code Archive
Search
.Net
ASP .Net
ASP .Net Tutorial
C#
C# Book
C# by API
C# Tutorial
VB.Net
VB.Net by API
VB.Net Tutorial
Visual C++ .Net
VisualBasic Script
Java
Java
Java Book
Java by API
Java Tutorial
Script
Flash ActionScript
Flex
JavaScript DHTML
JavaScript Reference
JavaScript Tutorial
Database
MSSQL
MSSQL Tutorial
MySQL
MySQL Tutorial
Oracle PLSQL
Oracle PLSQL Tutorial
PostgreSQL
Languages
Android
C
C Tutorial
C++
C++ Tutorial
Delphi
Perl
PHP
Python
Python Tutorial
Ruby
Silverlight
Office
MSOfficeExcel 2007 Tutorial
MSOfficePowerPoint 2007 Tutorial
MSOfficeWord 2007 Tutorial
Data
XML
XML Tutorial
Java Tutorial
2D Graphics 408 codes
Home
Java Tutorial
2D Graphics
1 A 3x3 kernel that blurs an image
2 A 3x3 kernel that embosses an image
3 A 3x3 kernel that sharpens an image
4 A buffered image is a type of image whose pixels can be modified
5 A button which paints on it one or more scaled arrows in one of the cardinal directions
6 A clipping area can also be created from a text string
7 A dashed stroke
8 A line is drawn using two points
9 A non-cyclic gradient
10 A reflected image
11 A texture is a bitmap image applied to a shape
12 Acyclic Gradient Paint
13 Add Image IO Read Progress Listener to ImageReader
14 Add Round Rectangle, Ellipse Arc to a shape
15 Alpha Composite with BufferedImage
16 AlphaComposite DST_IN
17 AlphaComposite DST_OUT
18 AlphaComposite DST_OVER
19 AlphaComposite SRC
20 AlphaComposite SRC_IN
21 AlphaComposite SRC_OUT
22 AlphaComposite SRC_OVER
23 Animate a clipping path to reveal different portions of an image
24 Arc2D Chord
25 Arc2D OPEN
26 Arc2D PIE
27 Area add
28 Area exclusiveOr
29 Area intersect
30 Area Subtract
31 Areas support the following boolean operations
32 Bezier Lab
33 Blur our image
34 Brighten the image by 30%
35 BufferedImage TYPE_INT_RGB
36 Calculate Rotation Transform with Math PI
37 Calculation of the mean value of an image
38 Calls stringWidth (String) to center several text messages
39 Cancelling a Print Job
40 Capture Screen
41 Center text
42 Center text based on font metrics
43 Change JFrame image icon
44 Changing the Thickness of the Stroking Pen
45 Checks, whether the given rectangle1 fully contains rectangle 2 (even if rectangle 2 has a height or width of zero!)
46 Clip between Rectangle and Ellipse2D
47 Clip Demo
48 Clipping is restricting of drawing to a certain area
49 Clips the specified line to the given rectangle
50 Color class is used to work with colors in Java 2D
51 Color Factory
52 Color fading animation
53 Combining Shapes
54 Compares two arcs and returns true if they are equal or both null
55 Compares two ellipses and returns true if they are equal or both null
56 Compares two lines are returns true if they are equal or both null
57 Complex Paths
58 Composite Demo
59 Compositing is the combining of elements from separate sources into single images
60 Composition technique in this animation
61 Compress and save an image to the disk
62 Computes the center point of the current screen device
63 Computes the maximum bounds of the current screen device If this method is called on JDK 1 4, Xinerama-aware results are retur
64 Construct Color object
65 Constructs several colors and draws various objects using these colors
66 Control the direction of Gradients
67 Convert a non-RGB image to an RGB buffered image
68 Convert an integer to an HTML RGB value
69 Convert HSB to RGB value
70 Convert RGB to HSB
71 Converting a Buffered Image (BufferedImage) from an Image
72 Converting a Colored Buffered Image to Gray
73 Converts a given string into a color
74 Converts the String representation of a color to an actual Color object
75 Coordinate Translation
76 Create a buffered image that supports transparency
77 Create a filter that can modify any of the RGB pixel values in an image
78 Create a grayscale image with Java 2D tools
79 Create a shadowed text
80 Create an complex shape by rotating an ellipse
81 Create an ellipse, and then draws it several times at different rotations
82 Create an image that does not support transparency
83 Create an image that does not support transparency from GraphicsConfiguration
84 Create an image that supports arbitrary levels of transparency
85 Create an image that supports arbitrary levels of transparency from GraphicsConfiguration
86 Create an image that supports transparent pixels
87 Create an image that supports transparent pixels from GraphicsConfiguration
88 Create Bold and Italic font
89 Create buffered image that does not support transparency
90 Create buffered images that are compatible with the screen
91 Create BufferredImage with colors based on integer array
92 Create Disabled Image from GrayFilter
93 Create font from true type font
94 Create Gradient Image
95 Create Gradient Mask
96 Create Headless BufferedImage
97 Create Translucent Image
98 Creates a diagonal cross shape
99 Creates a diamond shape
100 Creates a region surrounding a line segment by widening the line segment
101 Creates a triangle shape that points downwards
102 Creates a triangle shape that points upwards
103 Creates an image compatible with the current display
104 Creates and returns a buffered version of the specified image
105 Creates and returns a translated shape
106 Creates PNG images of the specified color that fade from fully opaque to fully transparent
107 Creating a Buffered Image from an Image
108 Creating a buffered image using Component createImage()
109 Creating a BufferedImage from an Image object
110 Creating a Image Zoomer using Graphics2D
111 Creating a Shape Using Lines and Curves
112 Creating Basic Shapes
113 Creating Serif Font
114 CubicCurve2D Float
115 Cyclic Gradient Paint
116 Darken the image by 10%
117 Dash style line
118 Demonstrate the Java 1 4 printing API
119 Demonstrate XOR mode
120 Derives a color by adding the specified offsets to the base colors hue, saturation, and brightness values
121 Detect image type
122 Detect the file type of the input stream prior to reading the image
123 Determine if antialiasing is enabled
124 Determine if full-screen mode is supported directly
125 Determining If an Image Has Transparent Pixels
126 Determining Print Job Capabilities Supported by a Print Service
127 Determining the Capabilities of a Print Service
128 Determining the Format of an Image in a File
129 Determining When a Print Job Has Finished
130 Different buffer capabilities for each GraphicsConfiguration on each GraphicsDevice
131 Disable antialiasing for shapes
132 Disable antialiasing for text
133 Discovering Available Print Services
134 Discovering Available Streaming Print Services
135 Display a text in 3 dimensions
136 Display font in a grid
137 Display font info
138 Display some lyrics on the panel
139 Display underlined text
140 Display unicode text
141 Display vertical text
142 Displaying the Page Format Dialog
143 Double buffer
144 Draw 2D shape
145 Draw a line
146 Draw a point
147 Draw a three-dimensional rectangle outline
148 Draw an Icon object
149 Draw Arc
150 Draw Arcs
151 Draw Bytes
152 Draw Chars
153 Draw Dashed
154 Draw Ellipse2D Float
155 Draw Ellipses
156 Draw font metrics
157 Draw Image
158 Draw Line from (10, 15) to (100, 115)
159 Draw Oval
160 Draw Polygon
161 Draw Rectangle
162 Draw Rectangle with Rectangle2D Float
163 Draw rectangles
164 Draw RoundRectangle2D Float
165 Draw string rotated clockwise 45 degrees
166 Draw string rotated counter-clockwise 45 degrees
167 Draw ten rectangles with different levels of transparency
168 Draw text to the center
169 Draw text to the left
170 Draw text to the right
171 Draw text with TextLayout
172 Draw unicode with Graphics2D
173 Drawing a Paragraph of Text
174 Drawing a Pie Chart
175 Drawing multi-line text
176 Drawing on a Buffered Image
177 Drawing Rotated Text
178 Drawing Simple Text
179 Drawing Text with Mixed Styles
180 Drawing with a Gradient Color
181 Drawing with Color
182 DrawRect (int, int, int, int) to draw a rectangle outline
183 DrawRoundRect (int, int, int, int, int, int) to draw a rounded rectangle outline
184 Draws a shape with the specified rotation about (x, y)
185 Draws a small dot where the user clicks the mouse
186 Enable antialiasing for shapes
187 Enable antialiasing for text
188 Encoding an image to a JPEG file
189 Enlarging an image by pixel replication
190 Enter full screen mode
191 Extend RGBImageFilter ColorFilter class
192 Extend RGBImageFilter to create AlphaFilter class
193 Extends JuliaSet1 and overrides the print() method to demonstrate the Java 1 2 printing API
194 Fill 3D Rectangle
195 Fill a solid three-dimensional rectangle
196 Fill Arc
197 Fill Oval
198 Filtering the RGB Values in an Image
199 Flip an image
200 Flip the image horizontally
201 Flip the image vertically and horizontally, equivalent to rotating the image 180 degrees
202 Flipping a Buffered Image
203 Flush an image
204 Font base line
205 Font Metrics
206 Fonts exercise
207 Full screen mode
208 Generate Shape From Text
209 Generates a table of all available display modes, enters full-screen mode and allows you to change the display mode
210 Get all fonts
211 Get average of a set of images
212 Get HTML Color String from Java Color object
213 Get list of unique MIME types that can be read
214 Get list of unique MIME types that can be written
215 Get list of unique supported read formats
216 Get list of unique supported write formats
217 Get the available font family names
218 Get the dimensions of the image; these will be non-negative
219 Getting Amount of Free Accelerated Image Memory
220 Getting and Setting Pixels in a Buffered Image
221 Getting Char with based on current font
222 Getting Number of Colors
223 Getting Refresh Rates
224 Getting Screen Sizes
225 Getting the Color Model of an Image
226 Getting the Current Screen Refresh Rate and Number of Colors
227 Getting the Default Value of a Print Job Capability
228 Getting the Dimensions of Text
229 Getting the Font Faces for a Font Family
230 Getting the Possible Values for a Print Job Capability
231 Getting the Shape from the Outline of Text
232 GlyphVector getNumGlyphs()
233 Gradients
234 Gradients in the middle
235 Gray scale image operation
236 Grow a rectangle
237 Handle screen updates
238 Hide the mouse cursor
239 Horizontal Gradients
240 How do I Draw text
241 How do I Fill shapes
242 HTML color and Java Color
243 If more than one screen is available, gets the size of each screen
244 If the buffered image supports transparency
245 If the image has transparent pixels
246 Implements Printable
247 Intersection between rectangles
248 Java awt Color
249 Java awt Dimension
250 Java awt Font
251 Java awt Point
252 Java awt Rectangle
253 Java Predefined Colors
254 Javax print API and allows you to list available printers, query a named printer, print text and image files to a printer, and
255 Leave full-screen mode (Return to normal windowed mode)
256 Line Dash Style 4
257 Line dashes style 2
258 Line2D Float
259 LineBreakMeasurer Demo
260 Lines Dashes style 3
261 List all fonts system installed
262 List Print Services
263 Listening for Print Job Attribute Changes
264 Listening for Print Job Status Changes
265 Listening for Print Service Status Changes
266 Load an Icon from a jar
267 Load an Image from a JAR file
268 Load Image and scale it
269 Load image to ImageIcon and add it to Panel
270 Load the image file from a folder or a jar file
271 Make your own animation from a series of images
272 Map colors into names and vice versa
273 Memory Image Generator
274 Mouse drag and draw
275 Move and scale graphical objects with a mouse on the panel
276 Obtain FontMetrics of different fonts
277 Off Screen Paint
278 Pagination during print
279 Paint a calendar
280 Pen Fill
281 Playing with Point Objects
282 Point class
283 Print an image out
284 Print Book
285 Print configuration
286 Print Dialog
287 Print Image
288 Print out a Swing component
289 Print Sample with java awt Graphics
290 Print with java awt PrintJob
291 PrinterJob and Printable
292 Printing Pages with Different Formats
293 Printing setting
294 Printing to a File
295 Produces a copy of the supplied image
296 Produces a resized image that is of the given dimensions
297 QuadCurve2D Float
298 Ractangle with rounded corners drawn using Java 2D Graphics API
299 Read an Image from a file
300 Read an Image from inputStream
301 Read an Image from URL
302 Reading an Image or Icon from a File
303 RenderingHints KEY_TEXT_ANTIALIASING
304 RenderingHints VALUE_TEXT_ANTIALIAS_LCD_HBGR
305 RenderingHints VALUE_TEXT_ANTIALIAS_LCD_HRGB
306 RenderingHints VALUE_TEXT_ANTIALIAS_LCD_VBGR
307 RenderingHints VALUE_TEXT_ANTIALIAS_LCD_VRGB
308 RenderingHints VALUE_TEXT_ANTIALIAS_ON
309 Rescale JPG
310 Resize a shape
311 Resize an image
312 Resizes an image
313 Resizing output to fit the current size of a window
314 Retrieve and print the graphic device information
315 Return a filled oval as an Icon
316 Returns a point based on (x, y) but constrained to be within the bounds of a given rectangle
317 Returns true if the specified file extension can be read
318 Returns true if the specified file extension can be written
319 Returns true if the specified format name can be read
320 Returns true if the specified format name can be written
321 Returns true if the specified mime type can be read
322 Returns true if the specified mime type can be written
323 RGB Gray Filter
324 Rotate a line of character (String)
325 Rotates a shape about the specified coordinates
326 Rotating a Buffered Image
327 Rotating a Drawn Image
328 Rotating a Shape
329 Rotating image using Java 2D AffineTransform class
330 Rotation and coordinate translation
331 Save To GIF
332 Save Your Drawing To a File
333 Saving a Generated Graphic to a PNG or JPEG File
334 Scaling a Buffered Image
335 Scaling a Drawn Image
336 Scaling a Shape
337 Scaling an object
338 Screen capture with crop operation
339 Select a Curve To Display Its Points and Flatness Index
340 Select the Ellipse to Move It in the Canvas
341 Set Rendering Hint and Ellipse
342 Set XOR mode to color blue
343 Setting the Clipping Area with a Shape
344 Setting the Number of Copies of a Print Job
345 Setting the Orientation of a Print Job -- Portrait or Landscape
346 Setting the Orientation of a Printed Page
347 Setting the Screen Size, Refresh Rate, or Number of Colors
348 Shearing a Buffered Image
349 Shearing a Drawn Image
350 Shearing a Shape
351 Show all Fonts installed in your system
352 Show fonts with mouse click
353 Show Image with ImageReader
354 Show ImageIO Info
355 Shrinking an image by skipping pixels
356 String gradient paint
357 Stroking or Filling with a Texture
358 Styled Text
359 System fonts display
360 Tests two polygons for equality If both are null this method returns true
361 Text justify
362 Text Layout with mouse clicking and selecting action
363 TextAttribute BACKGROUND
364 TextAttribute FONT
365 TextAttribute FOREGROUND
366 TextAttribute SIZE
367 TextAttribute STRIKETHROUGH
368 TextAttribute SUPERSCRIPT
369 TextAttribute UNDERLINE
370 TexturePaint with BufferedImage
371 TexturePaint with GIF image
372 The area of the actual page
373 The area of the printable area
374 The five new fields in java awt RenderingHints class
375 The SimpleDraw application
376 The Three Font Styles
377 This filter removes all but the red values in an image
378 To change the size andor style of a font, you call its deriveFont() method
379 To compare two Color objects you can use the equals() method
380 To get all available fonts in your system
381 To get the font names
382 Tranformation with AffineTransform getScaleInstance
383 Tranformation with AffineTransform getShearInstance
384 Tranformation with AffineTransform getTranslateInstance
385 Transform Lab
386 Translate and rotate all objects
387 Translating a Buffered Image
388 Translating a Drawn Image
389 Translating a Shape
390 TYPE_INT_RGB and TYPE_INT_ARGB are typically used
391 Union two Rectangles
392 Use a factory to create a print service
393 Use AffineTransform to draw vertical text
394 Use fonts in paint
395 Use Image IO to read an image file and display it
396 Use PixelGrabber class to acquire pixel data from an Image object
397 Use Text Attributes to style text
398 Use the getResourceAsStream method
399 Using a Printing Service
400 Using a Streaming Printing Service
401 Using color with and Bit and
402 Using FontRenderContext
403 Using mediatracker to pre-load images
404 Using the getRGB() method for comparing colors
405 Vertical Gradient Paint
406 Work with PrintRequestAttributeSet
407 Write Image with different types
408 Write Image with ImageWriter