Java Code Examples for org.jdesktop.swingx.painter.AbstractLayoutPainter.HorizontalAlignment#CENTER

The following examples show how to use org.jdesktop.swingx.painter.AbstractLayoutPainter.HorizontalAlignment#CENTER . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SplashImageCreator.java    From Pixelitor with GNU General Public License v3.0 5 votes vote down vote up
private static void addTextLayer(Composition comp, String text,
                                 Color textColor, Font font,
                                 int translationY, BlendingMode blendingMode,
                                 float opacity, boolean dropShadow) {
    TextLayer layer = addNewTextLayer(comp, text);

    AreaEffects effects = null;
    if (dropShadow) {
        effects = new AreaEffects();
        var dropShadowEffect = new ShadowPathEffect(0.6f);
        dropShadowEffect.setEffectWidth(3);
        dropShadowEffect.setOffset(Utils.offsetFromPolar(4, 0.7));
        effects.setDropShadow(dropShadowEffect);
    }

    var settings = new TextSettings(text, font, textColor, effects,
        HorizontalAlignment.CENTER,
        VerticalAlignment.CENTER, false, 0);

    layer.setSettings(settings);

    layer.startMovement();
    layer.moveWhileDragging(0, translationY);
    layer.endMovement();

    layer.setOpacity(opacity, true);
    layer.setBlendingMode(blendingMode, true);
}
 
Example 2
Source File: TextSettings.java    From Pixelitor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Default settings
 */
public TextSettings() {
    areaEffects = null;
    color = WHITE;
    font = calcDefaultFont();
    horizontalAlignment = HorizontalAlignment.CENTER;
    text = DEFAULT_TEXT;
    verticalAlignment = VerticalAlignment.CENTER;
    watermark = false;
    rotation = 0;
}