package com.poly; import javax.imageio.ImageIO; import javax.swing.*; import java.awt.*; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.geom.GeneralPath; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Random; public class LoadImageApp { BufferedImage img; int segmentSize=5; int segmentWidth = 400; int rowSize=20; int rowHeight = 90; int titleHeight = 110; int noWidth = 100;//序号长度 int timeAddedWidth = 300;//时间增量长度 int middleWidth = segmentWidth*(segmentSize+1);//中间部分的长度 int briefWidth = 400;//摘要长度 int headDown = 65; // int padding = 20; // int halfPadding = padding/2; public LoadImageApp() { try { img = new BufferedImage(noWidth+timeAddedWidth+middleWidth+briefWidth,rowHeight*rowSize,BufferedImage.TYPE_INT_ARGB); } catch (Exception e) { e.printStackTrace(); } int imgWidth = img.getWidth(); int imgHeight = img.getHeight(); Color green = new Color(55,105,86); Color grey = new Color(221,221,221); Color deepGrey = new Color(221,227,231); Color moreGrey = new Color(242,247,250); Font font = new Font("微软雅黑", Font.BOLD, 36); Graphics2D g2 = img.createGraphics(); //背景 g2.setBackground(Color.WHITE); g2.clearRect(0,0,img.getWidth(),img.getHeight()); //head线 g2.setStroke(createStroke(6)); g2.setColor(green); g2.drawLine(0,titleHeight,imgWidth,titleHeight); //head填充 g2.setColor(deepGrey); g2.fillRect(0,0,imgWidth,titleHeight); g2.setStroke(createStroke(4)); // g2.setColor(grey); //偶数行填充深灰色 for(int i=1;i