Package javax.swing.text

Examples of javax.swing.text.StyleContext


   * De constructor maakt het StyledDocument en de DefaultListModel aan.
   * @param login De naam van degene die ingelogd is
   */
  protected IRC (String login)
  {
    StyleContext styleContext = new StyleContext();
    style = styleContext.getStyle(StyleContext.DEFAULT_STYLE);
    styledDocument = new DefaultStyledDocument(styleContext);
   
    listModel = new DefaultListModel();
    listModel.addElement(login);
  }
View Full Code Here


    prefs1.store(out, "Color preferences for annotation viewer.");
  }

  public void loadColorPreferences(File file) throws IOException {
    Style parent = this.styleMap.get(CAS.TYPE_NAME_ANNOTATION);
    StyleContext sc = StyleContext.getDefaultStyleContext();
    Properties prefs1 = new Properties();
    FileInputStream in = new FileInputStream(file);
    prefs1.load(in);
    String typeName, value;
    Style style;
    Color color;
    int pos;
    Iterator<?> it = prefs1.keySet().iterator();
    while (it.hasNext()) {
      typeName = (String) it.next();
      value = prefs1.getProperty(typeName);
      style = sc.addStyle(typeName, parent);
      pos = value.indexOf('+');
      if (pos <= 0) {
        continue;
      }
      // Set foreground.
View Full Code Here

public class addAttribute implements Testlet
{
  public void test(TestHarness h)
  {
    h.checkPoint("StyleContext");
    StyleContext sc = new StyleContext();
    SimpleAttributeSet as = new SimpleAttributeSet();

    try
      {
        sc.addAttribute(as, "key", null);
        h.fail("StyleContext.addAttribute must not accept null value");
      }
    catch (NullPointerException ex)
      {
        h.check(true);
View Full Code Here

public class NamedStyleInit implements Testlet
{
  public void test(TestHarness h)
  {
    h.checkPoint("StyleContext.NamedStyle");
    StyleContext sc = new StyleContext();

    try
      {
        StyleContext.NamedStyle ns = sc.new NamedStyle("key", null);
        h.check(true);
View Full Code Here

public class NamedStyleSetResolveParent implements Testlet
{
  public void test(TestHarness h)
  {
    h.checkPoint("StyleContext.NamedStyle");
    StyleContext sc = new StyleContext();

    try
      {
        StyleContext.NamedStyle ns = sc.new NamedStyle("key", null);
        ns.setResolveParent(null);
View Full Code Here

public class addStyle implements Testlet
{
  public void test(TestHarness h)
  {
    h.checkPoint("StyleContext.addStyle");
    StyleContext sc = new StyleContext();

    try
      {
        sc.addStyle("key", null);
        h.check(true);
      }
    catch (NullPointerException ex)
      {
        h.fail("StyleContext.addStyle must accept null value");
View Full Code Here

   {
      super.restoreDefaults(fontInfo.createFont());
      Style[] stylesBuf = new Style[SquirrelTokenMarker.getNumTokenTypes()];
      System.arraycopy(styles, 0, stylesBuf, 0, styles.length);

      StyleContext sc = StyleContext.getDefaultStyleContext();


      Font boldFont = sc.getFont(fontInfo.getFamily(), Font.BOLD, fontInfo.getSize());
      Font italicFont = sc.getFont(fontInfo.getFamily(), Font.ITALIC, fontInfo.getSize());


//      stylesBuf[SquirrelTokenMarker.TOKEN_IDENTIFIER_TABLE] = new Style(Color.green, null);
//      stylesBuf[SquirrelTokenMarker.TOKEN_IDENTIFIER_DATA_TYPE] = new Style(new Color(178,178,0), null, boldFont);
//      stylesBuf[SquirrelTokenMarker.TOKEN_IDENTIFIER_COLUMN] = new Style(new Color(102,102,0), null, boldFont);
View Full Code Here

   * @param font The non-bold font.
   * @return A bold version of the font.
   */
  protected static Font getBoldFont(Font font) {
    //return font.deriveFont(Font.BOLD);
    StyleContext sc = StyleContext.getDefaultStyleContext();
    return sc.getFont(font.getFamily(), Font.BOLD, font.getSize());
  }
View Full Code Here

    prefs1.store(out, "Color preferences for annotation viewer.");
  }

  public void loadColorPreferences(File file) throws IOException {
    Style parent = this.styleMap.get(CAS.TYPE_NAME_ANNOTATION);
    StyleContext sc = StyleContext.getDefaultStyleContext();
    Properties prefs1 = new Properties();
    FileInputStream in = new FileInputStream(file);
    prefs1.load(in);
    String typeName, value;
    Style style;
    Color color;
    int pos;
    Iterator<?> it = prefs1.keySet().iterator();
    while (it.hasNext()) {
      typeName = (String) it.next();
      value = prefs1.getProperty(typeName);
      style = sc.addStyle(typeName, parent);
      pos = value.indexOf('+');
      if (pos <= 0) {
        continue;
      }
      // Set foreground.
View Full Code Here

        }
    }


    public void append(String s) {
        StyleContext sc = StyleContext.getDefaultStyleContext();
        SimpleAttributeSet attributes = new SimpleAttributeSet();
        attributes.addAttribute(StyleConstants.Foreground, currentFG);
        //if(currentBG.getRGB()!=this.getBackground().getRGB()){
        attributes.addAttribute(StyleConstants.Background, currentBG);
        //}
View Full Code Here

TOP

Related Classes of javax.swing.text.StyleContext

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.