本文整理汇总了Java中org.jfree.ui.HorizontalAlignment类的典型用法代码示例。如果您正苦于以下问题:Java HorizontalAlignment类的具体用法?Java HorizontalAlignment怎么用?Java HorizontalAlignment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HorizontalAlignment类属于org.jfree.ui包,在下文中一共展示了HorizontalAlignment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ImageTitle
import org.jfree.ui.HorizontalAlignment; //导入依赖的package包/类
/**
* Creates a new image title with the given image scaled to the given
* width and height in the given location.
*
* @param image the image (<code>null</code> not permitted).
* @param height the height used to draw the image.
* @param width the width used to draw the image.
* @param position the title position.
* @param horizontalAlignment the horizontal alignment.
* @param verticalAlignment the vertical alignment.
* @param padding the amount of space to leave around the outside of the
* title.
*/
public ImageTitle(Image image, int height, int width,
RectangleEdge position,
HorizontalAlignment horizontalAlignment,
VerticalAlignment verticalAlignment,
RectangleInsets padding) {
super(position, horizontalAlignment, verticalAlignment, padding);
if (image == null) {
throw new NullPointerException("Null 'image' argument.");
}
this.image = image;
setHeight(height);
setWidth(width);
}
示例2: paintDeviationChart
import org.jfree.ui.HorizontalAlignment; //导入依赖的package包/类
public void paintDeviationChart(Graphics graphics, int width, int height) {
prepareData();
JFreeChart chart = createChart(this.dataset);
// set the background color for the chart...
chart.setBackgroundPaint(Color.white);
// legend settings
LegendTitle legend = chart.getLegend();
if (legend != null) {
legend.setPosition(RectangleEdge.TOP);
legend.setFrame(BlockBorder.NONE);
legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
}
Rectangle2D drawRect = new Rectangle2D.Double(0, 0, width, height);
chart.draw((Graphics2D) graphics, drawRect);
}
示例3: TextTitle
import org.jfree.ui.HorizontalAlignment; //导入依赖的package包/类
/**
* Creates a new title.
*
* @param text the text for the title (<code>null</code> not permitted).
* @param font the title font (<code>null</code> not permitted).
* @param paint the title paint (<code>null</code> not permitted).
* @param position the title position (<code>null</code> not permitted).
* @param horizontalAlignment the horizontal alignment (<code>null</code> not permitted).
* @param verticalAlignment the vertical alignment (<code>null</code> not permitted).
* @param spacer the space to leave around the outside of the title.
*/
public TextTitle(String text,
Font font,
Paint paint,
RectangleEdge position,
HorizontalAlignment horizontalAlignment,
VerticalAlignment verticalAlignment,
Spacer spacer) {
super(position, horizontalAlignment, verticalAlignment, spacer);
if (text == null) {
throw new NullPointerException("Null 'text' argument.");
}
if (font == null) {
throw new NullPointerException("Null 'font' argument.");
}
if (paint == null) {
throw new NullPointerException("Null 'paint' argument.");
}
this.text = text;
this.font = font;
this.paint = paint;
this.backgroundPaint = null;
}
示例4: testEquals
import org.jfree.ui.HorizontalAlignment; //导入依赖的package包/类
/**
* Some checks for the equals() method.
*/
public void testEquals() {
// use the TextTitle class because it is a concrete subclass
Title t1 = new TextTitle();
Title t2 = new TextTitle();
assertEquals(t1, t2);
t1.setPosition(RectangleEdge.LEFT);
assertFalse(t1.equals(t2));
t2.setPosition(RectangleEdge.LEFT);
assertTrue(t1.equals(t2));
t1.setHorizontalAlignment(HorizontalAlignment.RIGHT);
assertFalse(t1.equals(t2));
t2.setHorizontalAlignment(HorizontalAlignment.RIGHT);
assertTrue(t1.equals(t2));
t1.setVerticalAlignment(VerticalAlignment.BOTTOM);
assertFalse(t1.equals(t2));
t2.setVerticalAlignment(VerticalAlignment.BOTTOM);
assertTrue(t1.equals(t2));
}
示例5: ImageTitle
import org.jfree.ui.HorizontalAlignment; //导入依赖的package包/类
/**
* Creates a new image title with the given image scaled to the given
* width and height in the given location.
*
* @param image the image ({@code null} not permitted).
* @param height the height used to draw the image.
* @param width the width used to draw the image.
* @param position the title position.
* @param horizontalAlignment the horizontal alignment.
* @param verticalAlignment the vertical alignment.
* @param padding the amount of space to leave around the outside of the
* title.
*/
public ImageTitle(Image image, int height, int width,
RectangleEdge position,
HorizontalAlignment horizontalAlignment,
VerticalAlignment verticalAlignment,
RectangleInsets padding) {
super(position, horizontalAlignment, verticalAlignment, padding);
if (image == null) {
throw new NullPointerException("Null 'image' argument.");
}
this.image = image;
setHeight(height);
setWidth(width);
}
示例6: Title
import org.jfree.ui.HorizontalAlignment; //导入依赖的package包/类
/**
* Creates a new title.
*
* @param position the position of the title (<code>null</code> not
* permitted).
* @param horizontalAlignment the horizontal alignment of the title (LEFT,
* CENTER or RIGHT, <code>null</code> not
* permitted).
* @param verticalAlignment the vertical alignment of the title (TOP,
* MIDDLE or BOTTOM, <code>null</code> not
* permitted).
* @param padding the amount of space to leave around the outside of the
* title (<code>null</code> not permitted).
*/
protected Title(RectangleEdge position,
HorizontalAlignment horizontalAlignment,
VerticalAlignment verticalAlignment, RectangleInsets padding) {
ParamChecks.nullNotPermitted(position, "position");
ParamChecks.nullNotPermitted(horizontalAlignment, "horizontalAlignment");
ParamChecks.nullNotPermitted(verticalAlignment, "verticalAlignment");
ParamChecks.nullNotPermitted(padding, "padding");
this.visible = true;
this.position = position;
this.horizontalAlignment = horizontalAlignment;
this.verticalAlignment = verticalAlignment;
setPadding(padding);
this.listenerList = new EventListenerList();
this.notify = true;
}
示例7: ImageTitle
import org.jfree.ui.HorizontalAlignment; //导入依赖的package包/类
/**
* Creates a new image title with the given image scaled to the given
* width and height in the given location.
*
* @param image the image (<code>null</code> not permitted).
* @param height the height used to draw the image.
* @param width the width used to draw the image.
* @param position the title position.
* @param horizontalAlignment the horizontal alignment.
* @param verticalAlignment the vertical alignment.
* @param padding the amount of space to leave around the outside of the
* title.
*/
public ImageTitle(Image image, int height, int width,
RectangleEdge position,
HorizontalAlignment horizontalAlignment,
VerticalAlignment verticalAlignment,
RectangleInsets padding) {
super(position, horizontalAlignment, verticalAlignment, padding);
if (image == null) {
throw new NullPointerException("Null 'image' argument.");
}
this.image = image;
setHeight(height);
setWidth(width);
}
示例8: createAlignedRectangle2D
import org.jfree.ui.HorizontalAlignment; //导入依赖的package包/类
/**
* Creates a rectangle that is aligned to the frame.
*
* @param dimensions the dimensions for the rectangle.
* @param frame the frame to align to.
* @param hAlign the horizontal alignment.
* @param vAlign the vertical alignment.
* @return A rectangle.
*/
private Rectangle2D createAlignedRectangle2D(Size2D dimensions, Rectangle2D frame, HorizontalAlignment hAlign,
VerticalAlignment vAlign) {
double x = Double.NaN;
double y = Double.NaN;
if (hAlign == HorizontalAlignment.LEFT) {
x = frame.getX();
} else if (hAlign == HorizontalAlignment.CENTER) {
x = frame.getCenterX() - (dimensions.width / 2.0);
} else if (hAlign == HorizontalAlignment.RIGHT) {
x = frame.getMaxX() - dimensions.width;
}
if (vAlign == VerticalAlignment.TOP) {
y = frame.getY();
} else if (vAlign == VerticalAlignment.CENTER) {
y = frame.getCenterY() - (dimensions.height / 2.0);
} else if (vAlign == VerticalAlignment.BOTTOM) {
y = frame.getMaxY() - dimensions.height;
}
return new Rectangle2D.Double(x, y, dimensions.width, dimensions.height);
}
示例9: createLegendTitles
import org.jfree.ui.HorizontalAlignment; //导入依赖的package包/类
/**
* Creates {@link LegendTitle}s for all dimensions from the PlotConfiguration of this Plotter2D.
* Expects that all {@link ValueSource} s in the provided PlotConfiguration use the same
* {@link DimensionConfig} s.
*/
private List<LegendTitle> createLegendTitles() {
List<LegendTitle> legendTitles = new LinkedList<LegendTitle>();
LegendConfiguration legendConfiguration = plotInstance.getCurrentPlotConfigurationClone().getLegendConfiguration();
LegendTitle legendTitle = new SmartLegendTitle(this, new FlowArrangement(HorizontalAlignment.CENTER,
VerticalAlignment.CENTER, 30, 2), new ColumnArrangement(HorizontalAlignment.LEFT, VerticalAlignment.CENTER,
0, 2));
legendTitle.setItemPaint(legendConfiguration.getLegendFontColor());
RectangleEdge position = legendConfiguration.getLegendPosition().getPosition();
if (position == null) {
return legendTitles;
}
legendTitle.setPosition(position);
if (legendConfiguration.isShowLegendFrame()) {
legendTitle.setFrame(new BlockBorder(legendConfiguration.getLegendFrameColor()));
}
ColoredBlockContainer wrapper = new ColoredBlockContainer(legendConfiguration.getLegendBackgroundColor());
wrapper.add(legendTitle.getItemContainer());
wrapper.setPadding(3, 3, 3, 3);
legendTitle.setWrapper(wrapper);
legendTitles.add(legendTitle);
return legendTitles;
}
示例10: ImageTitle
import org.jfree.ui.HorizontalAlignment; //导入依赖的package包/类
/**
* Creates a new image title.
*
* @param image the image.
* @param position the title position.
* @param horizontalAlignment the horizontal alignment.
* @param verticalAlignment the vertical alignment.
*/
public ImageTitle(Image image, RectangleEdge position,
HorizontalAlignment horizontalAlignment,
VerticalAlignment verticalAlignment) {
this(image,
image.getHeight(null),
image.getWidth(null),
position,
horizontalAlignment,
verticalAlignment,
Title.DEFAULT_SPACER);
}
示例11: Title
import org.jfree.ui.HorizontalAlignment; //导入依赖的package包/类
/**
* Creates a new title, using default attributes where necessary.
*
* @param position the position of the title (<code>null</code> not permitted).
* @param horizontalAlignment the horizontal alignment of the title
* (<code>null</code> not permitted).
* @param verticalAlignment the vertical alignment of the title
* (<code>null</code> not permitted).
*/
protected Title(RectangleEdge position,
HorizontalAlignment horizontalAlignment,
VerticalAlignment verticalAlignment) {
this(position,
horizontalAlignment, verticalAlignment,
Title.DEFAULT_SPACER);
}
示例12: setHorizontalAlignment
import org.jfree.ui.HorizontalAlignment; //导入依赖的package包/类
/**
* Sets the horizontal alignment for the title and sends a {@link TitleChangeEvent} to
* all registered listeners.
*
* @param alignment the horizontal alignment (<code>null</code> not permitted).
*/
public void setHorizontalAlignment(HorizontalAlignment alignment) {
if (alignment == null) {
throw new IllegalArgumentException("Null 'alignment' argument.");
}
if (this.horizontalAlignment != alignment) {
this.horizontalAlignment = alignment;
notifyListeners(new TitleChangeEvent(this));
}
}
示例13: testEquals
import org.jfree.ui.HorizontalAlignment; //导入依赖的package包/类
/**
* Problem that the equals(...) method distinguishes all fields.
*/
public void testEquals() {
// use the TextTitle class because it is a concrete subclass
Title t1 = new TextTitle();
Title t2 = new TextTitle();
assertEquals(t1, t2);
t1.setPosition(RectangleEdge.LEFT);
assertFalse(t1.equals(t2));
t2.setPosition(RectangleEdge.LEFT);
assertTrue(t1.equals(t2));
t1.setHorizontalAlignment(HorizontalAlignment.RIGHT);
assertFalse(t1.equals(t2));
t2.setHorizontalAlignment(HorizontalAlignment.RIGHT);
assertTrue(t1.equals(t2));
t1.setVerticalAlignment(VerticalAlignment.BOTTOM);
assertFalse(t1.equals(t2));
t2.setVerticalAlignment(VerticalAlignment.BOTTOM);
assertTrue(t1.equals(t2));
t1.setSpacer(new Spacer(Spacer.ABSOLUTE, 5.0, 10.0, 15.0, 20.0));
assertFalse(t1.equals(t2));
t2.setSpacer(new Spacer(Spacer.ABSOLUTE, 5.0, 10.0, 15.0, 20.0));
assertTrue(t1.equals(t2));
}
示例14: testEquals
import org.jfree.ui.HorizontalAlignment; //导入依赖的package包/类
/**
* Check that the equals() method distinguishes all fields.
*/
public void testEquals() {
TextTitle t1 = new TextTitle();
TextTitle t2 = new TextTitle();
assertEquals(t1, t2);
t1.setText("Test 1");
assertFalse(t1.equals(t2));
t2.setText("Test 1");
assertTrue(t1.equals(t2));
Font f = new Font("SansSerif", Font.PLAIN, 15);
t1.setFont(f);
assertFalse(t1.equals(t2));
t2.setFont(f);
assertTrue(t1.equals(t2));
t1.setTextAlignment(HorizontalAlignment.RIGHT);
assertFalse(t1.equals(t2));
t2.setTextAlignment(HorizontalAlignment.RIGHT);
assertTrue(t1.equals(t2));
// paint
t1.setPaint(new GradientPaint(1.0f, 2.0f, Color.red,
3.0f, 4.0f, Color.blue));
assertFalse(t1.equals(t2));
t2.setPaint(new GradientPaint(1.0f, 2.0f, Color.red,
3.0f, 4.0f, Color.blue));
assertTrue(t1.equals(t2));
// backgroundPaint
t1.setBackgroundPaint(new GradientPaint(4.0f, 3.0f, Color.red,
2.0f, 1.0f, Color.blue));
assertFalse(t1.equals(t2));
t2.setBackgroundPaint(new GradientPaint(4.0f, 3.0f, Color.red,
2.0f, 1.0f, Color.blue));
assertTrue(t1.equals(t2));
}
示例15: Title
import org.jfree.ui.HorizontalAlignment; //导入依赖的package包/类
/**
* Creates a new title.
*
* @param position the position of the title (<code>null</code> not
* permitted).
* @param horizontalAlignment the horizontal alignment of the title (LEFT,
* CENTER or RIGHT, <code>null</code> not
* permitted).
* @param verticalAlignment the vertical alignment of the title (TOP,
* MIDDLE or BOTTOM, <code>null</code> not
* permitted).
* @param padding the amount of space to leave around the outside of the
* title (<code>null</code> not permitted).
*/
protected Title(RectangleEdge position,
HorizontalAlignment horizontalAlignment,
VerticalAlignment verticalAlignment,
RectangleInsets padding) {
// check arguments...
if (position == null) {
throw new IllegalArgumentException("Null 'position' argument.");
}
if (horizontalAlignment == null) {
throw new IllegalArgumentException(
"Null 'horizontalAlignment' argument.");
}
if (verticalAlignment == null) {
throw new IllegalArgumentException(
"Null 'verticalAlignment' argument.");
}
if (padding == null) {
throw new IllegalArgumentException("Null 'spacer' argument.");
}
this.position = position;
this.horizontalAlignment = horizontalAlignment;
this.verticalAlignment = verticalAlignment;
setPadding(padding);
this.listenerList = new EventListenerList();
this.notify = true;
}