Package javax.swing.text

Examples of javax.swing.text.TabSet


    for(int j = 0; j < tabs.length; j++) {
      int tab = j + 1;
      tabs[j] = new TabStop(tab * tabWidth);
    }

    TabSet tabSet = new TabSet(tabs);
    SimpleAttributeSet attributes = new SimpleAttributeSet();
    StyleConstants.setTabSet(attributes, tabSet);
    int length = getDocument().getLength();
    getStyledDocument().setParagraphAttributes(0, length, attributes, false);
  }
View Full Code Here


        int tabSize = GUISaveState.getInstance().getTabSize();
        for (int i = 0; i < tabs.length; i++) {
            tabs[i] = new TabStop(width * (tabSize + tabSize * i));
        }
        TAB_SET = new TabSet(tabs);
        StyleConstants.setTabSet(commentAttributes, TAB_SET);
        StyleConstants.setTabSet(javadocAttributes, TAB_SET);

        StyleConstants.setTabSet(quotesAttributes, TAB_SET);

View Full Code Here

  {
    TabStop ts1 = new TabStop(1.0f);
    TabStop ts2 = new TabStop(2.0f);
    TabStop ts3 = new TabStop(3.0f);
    TabStop[] tabs = new TabStop[] {ts1, ts2, ts3};
    TabSet s = new TabSet(tabs);
    harness.check(s.getTabIndexAfter(-1.0f), 0);
    harness.check(s.getTabIndexAfter(0.0f), 0);
    harness.check(s.getTabIndexAfter(0.5f), 0);
    harness.check(s.getTabIndexAfter(1.0f), 0);
    harness.check(s.getTabIndexAfter(1.5f), 1);
    harness.check(s.getTabIndexAfter(2.0f), 1);
    harness.check(s.getTabIndexAfter(2.5f), 2);
    harness.check(s.getTabIndexAfter(3.0f), 2);
    harness.check(s.getTabIndexAfter(3.5f), -1);
  }
View Full Code Here

  {
    TabStop ts1 = new TabStop(1.0f);
    TabStop ts2 = new TabStop(2.0f);
    TabStop ts3 = new TabStop(3.0f);
    TabStop[] tabs = new TabStop[] {ts1, ts2, ts3};
    TabSet s = new TabSet(tabs);
    harness.check(s.getTabIndex(ts1), 0);
    harness.check(s.getTabIndex(ts2), 1);
    harness.check(s.getTabIndex(ts3), 2);
   
    harness.check(s.getTabIndex(new TabStop(2.0f)), -1);
   
    harness.check(s.getTabIndex(null), -1);
  }
View Full Code Here

    // check default
    harness.check(StyleConstants.getTabSet(s), null);
   
    // check local setting
    TabStop[] tabs1 = new TabStop[] {new TabStop(8.0f)};
    TabSet ts1 = new TabSet(tabs1);
    StyleConstants.setTabSet(s, ts1);
    harness.check(StyleConstants.getTabSet(s), ts1);
   
    // check resolving parent setting
    s.removeAttribute(StyleConstants.TabSet);
    SimpleAttributeSet parent = new SimpleAttributeSet();
    s.setResolveParent(parent);
    TabStop[] tabs2 = new TabStop[] {new TabStop(10.0f)};
    TabSet ts2 = new TabSet(tabs2);
    StyleConstants.setTabSet(parent, ts2);
    harness.check(StyleConstants.getTabSet(s), ts2);   
   
    // try null argument
    boolean pass = false;
View Full Code Here

  {
    SimpleAttributeSet s = new SimpleAttributeSet();
   
    // check local setting
    TabStop[] tabs1 = new TabStop[] {new TabStop(8.0f)};
    TabSet ts1 = new TabSet(tabs1);
    StyleConstants.setTabSet(s, ts1);
    harness.check(StyleConstants.getTabSet(s), ts1);
   
    // try null value
    boolean pass = false;
View Full Code Here

public class equals implements Testlet
{
  public void test(TestHarness harness)
  {
    TabSet tsA = new TabSet(null);
    TabSet tsB = new TabSet(null);
    harness.check(tsA.equals(tsB));
   
    tsA = new TabSet(new TabStop[] {});
    tsB = new TabSet(new TabStop[] {});
    harness.check(tsA.equals(tsB));
   
    tsA = new TabSet(new TabStop[] {new TabStop(1.0f)});
    tsB = new TabSet(new TabStop[] {new TabStop(1.0f)});
    harness.check(tsA.equals(tsB));

    tsA = new TabSet(new TabStop[] {new TabStop(1.1f, TabStop.ALIGN_CENTER,
            TabStop.LEAD_DOTS)});
    harness.check(!tsA.equals(tsB));
    tsB = new TabSet(new TabStop[] {new TabStop(1.1f, TabStop.ALIGN_CENTER,
            TabStop.LEAD_DOTS)});
    harness.check(tsA.equals(tsB));
 
    harness.check(!tsA.equals(null));
    harness.check(!tsA.equals("a string"));
View Full Code Here

public class toString implements Testlet
{
  public void test(TestHarness harness)
  {
    TabSet s = new TabSet(null);
    harness.check(s.toString(), "[  ]");

    s = new TabSet(new TabStop[] {});
    harness.check(s.toString(), "[  ]");
 
    s = new TabSet(new TabStop[] {new TabStop(1.0f)});
    harness.check(s.toString(), "[ tab @1.0 ]");

    s = new TabSet(new TabStop[] {new TabStop(1.0f), new TabStop(2.0f)});
    harness.check(s.toString(), "[ tab @1.0 - tab @2.0 ]");
  }
View Full Code Here

  {
    TabStop ts1 = new TabStop(1.0f);
    TabStop ts2 = new TabStop(2.0f);
    TabStop ts3 = new TabStop(3.0f);
    TabStop[] tabs = new TabStop[] {ts1, ts2, ts3};
    TabSet s = new TabSet(tabs);
    harness.check(s.getTabCount(), 3);
   
    harness.check(new TabSet(null).getTabCount(), 0);
  }
View Full Code Here

  {
    TabStop ts1 = new TabStop(1.0f);
    TabStop ts2 = new TabStop(2.0f);
    TabStop ts3 = new TabStop(3.0f);
    TabStop[] tabs = new TabStop[] {ts1, ts2, ts3};
    TabSet s = new TabSet(tabs);
    harness.check(s.getTabCount(), 3);
    harness.check(s.getTab(0), ts1);
    harness.check(s.getTab(1), ts2);
    harness.check(s.getTab(2), ts3);
   
    // try negative
    boolean pass = false;
    try
    {
      s.getTab(-1);
    }
    catch (IllegalArgumentException e)
    {
      pass = true;
    }
    harness.check(pass);
   
    // try too large
    pass = false;
    try
    {
      s.getTab(3);
    }
    catch (IllegalArgumentException e)
    {
      pass = true;
    }
View Full Code Here

TOP

Related Classes of javax.swing.text.TabSet

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.