Package jimm.datavision.field

Examples of jimm.datavision.field.Format


* Formats the label according to the field's formatting specifications.
*/
public void format() {
    JTextPane textPane = (JTextPane)getComponent();

    Format format = field.getFormat();
    Style style = StyleContext.getDefaultStyleContext()
  .getStyle(StyleContext.DEFAULT_STYLE);

    // Save selection and select all text
    int selStart = textPane.getSelectionStart();
    int selEnd = textPane.getSelectionEnd();
    textPane.selectAll();

    StyleConstants.setBold(style, format.isBold());
    StyleConstants.setItalic(style, format.isItalic());
    StyleConstants.setUnderline(style, format.isUnderline());
    StyleConstants.setFontSize(style, (int)format.getSize());
    StyleConstants.setFontFamily(style, format.getFontFamilyName());

    // Color is based on visibility flag of field
    StyleConstants.setForeground(style, getColor(format));

    // Align
    switch (format.getAlign()) {
    case Format.ALIGN_CENTER:
  StyleConstants.setAlignment(style, StyleConstants.ALIGN_CENTER);
  break;
    case Format.ALIGN_RIGHT:
  StyleConstants.setAlignment(style, StyleConstants.ALIGN_RIGHT);
View Full Code Here

TOP

Related Classes of jimm.datavision.field.Format

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.