1 47 48 package org.jfree.chart.title; 49 50 import java.awt.Color ; 51 import java.awt.Font ; 52 import java.awt.Paint ; 53 import java.io.Serializable ; 54 import java.text.DateFormat ; 55 import java.util.Date ; 56 import java.util.Locale ; 57 58 import org.jfree.ui.HorizontalAlignment; 59 import org.jfree.ui.RectangleEdge; 60 import org.jfree.ui.RectangleInsets; 61 import org.jfree.ui.VerticalAlignment; 62 63 77 public class DateTitle extends TextTitle implements Serializable { 78 79 80 private static final long serialVersionUID = -465434812763159881L; 81 82 90 public DateTitle() { 91 92 this(DateFormat.LONG); 93 94 } 95 96 106 public DateTitle(int style) { 107 this( 108 style, Locale.getDefault(), 109 new Font ("Dialog", Font.PLAIN, 12), Color.black 110 ); 111 } 112 113 128 public DateTitle(int style, Locale locale, Font font, Paint paint) { 129 this( 130 style, locale, font, paint, 131 RectangleEdge.BOTTOM, 132 HorizontalAlignment.RIGHT, 133 VerticalAlignment.CENTER, 134 Title.DEFAULT_PADDING 135 ); 136 } 137 138 161 public DateTitle(int style, Locale locale, Font font, Paint paint, 162 RectangleEdge position, 163 HorizontalAlignment horizontalAlignment, 164 VerticalAlignment verticalAlignment, 165 RectangleInsets padding) { 166 super( 167 DateFormat.getDateInstance(style, locale).format(new Date ()), 168 font, paint, 169 position, horizontalAlignment, verticalAlignment, 170 padding 171 ); 172 } 173 174 187 public void setDateFormat(int style, Locale locale) { 188 setText(DateFormat.getDateInstance(style, locale).format(new Date ())); 189 } 190 191 } 192 | Popular Tags |