Last change
on this file since 330 was
330,
checked in by vmipsl, 12 years ago
|
Import du projet Ether pour le nouveau look 2012
|
File size:
1.4 KB
|
Line | |
---|
1 | package com.ether; |
---|
2 | |
---|
3 | import org.jetbrains.annotations.NotNull; |
---|
4 | |
---|
5 | import javax.imageio.ImageIO; |
---|
6 | import javax.swing.*; |
---|
7 | import java.awt.*; |
---|
8 | import java.awt.image.BufferedImage; |
---|
9 | import java.io.File; |
---|
10 | import java.io.Serializable; |
---|
11 | import java.text.ParseException; |
---|
12 | |
---|
13 | /** |
---|
14 | * @author vmipsl |
---|
15 | * @date 2011 |
---|
16 | */ |
---|
17 | public class EtherTest |
---|
18 | { |
---|
19 | @NotNull |
---|
20 | protected double[] createDataArray( @NotNull final Integer size, @NotNull final Integer begin ) |
---|
21 | throws ParseException |
---|
22 | { |
---|
23 | final double[] datas = new double[size]; |
---|
24 | for( int i = 0; i < size; i++ ) |
---|
25 | { |
---|
26 | datas[i] = Double.valueOf( i + begin ); |
---|
27 | } |
---|
28 | return datas; |
---|
29 | } |
---|
30 | |
---|
31 | protected void copyToFile( @NotNull final JFrame frame, @NotNull final String fileName ) |
---|
32 | { |
---|
33 | final BufferedImage image = new BufferedImage( frame.getWidth(), frame.getHeight(), BufferedImage.TYPE_INT_RGB ); |
---|
34 | |
---|
35 | final Graphics2D g2 = image.createGraphics(); |
---|
36 | frame.paint( g2 ); |
---|
37 | g2.dispose(); |
---|
38 | |
---|
39 | try |
---|
40 | { |
---|
41 | final File out = new File( fileName ); |
---|
42 | ImageIO.write( image, "JPEG", out ); |
---|
43 | } |
---|
44 | catch( Exception e ) |
---|
45 | { |
---|
46 | } |
---|
47 | } |
---|
48 | |
---|
49 | protected <T extends Serializable> void displayArray( @NotNull final T[] objectsArray ) |
---|
50 | { |
---|
51 | for( int i = 0; i < objectsArray.length; i++ ) |
---|
52 | System.out.println( objectsArray[i].toString() ); |
---|
53 | } |
---|
54 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.