Package javax.swing

Examples of javax.swing.JEditorPane$PageLoader


    super(null);
  }

  @Override
  protected JTextComponent createTextComponent() {
    return new JEditorPane();
  }
View Full Code Here


    return new JEditorPane();
  }

  @Override
  protected Component newWidget() {
    return new JEditorPane();
  }
View Full Code Here

public class HTMLTest {
    public static void main(String[] argv) throws Exception {
        JFrame f = new JFrame("HTML test");
        f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        f.setSize(400, 400);
        JEditorPane ep = new JEditorPane();
        f.add(new JScrollPane(ep));
        if (argv.length == 0) {
            ep.setText(
                "No arguments found on command line\n\norg.jnode.test.gui.HTMLTest <url>\n\turl\tURL of page to load.");
        } else {
            ep.setPage(argv[0]);
        }
        f.setVisible(true);
    }
View Full Code Here

* values the behavior should be like DO_NOTHING_ON_CLOSE</p>
*/
public class getScrollableTracks implements Testlet {
 
  public void test(TestHarness harness) {
          JEditorPane pane = new JEditorPane();
         
          harness.checkPoint("default value");
          harness.check (pane.getScrollableTracksViewportWidth() == false);
          harness.check (pane.getScrollableTracksViewportHeight() == false);
         
          harness.checkPoint("after putting in scrollpane");
          JScrollPane js = new JScrollPane(pane);
          harness.check (pane.getScrollableTracksViewportWidth() == false);
          harness.check (pane.getScrollableTracksViewportHeight() == false);

          harness.checkPoint("after adding to a JFrame and packing");
          JFrame jf = new JFrame();
          jf.add(js);
          jf.pack();
          harness.check (pane.getScrollableTracksViewportWidth());
          harness.check (pane.getScrollableTracksViewportHeight());
  }
View Full Code Here

public class ConstructorsAndTypes implements Testlet
{
 
  public void test(TestHarness harness)
  {
    JEditorPane pane = new JEditorPane();
    harness.check
      (pane.getEditorKit().getClass().getName(),
       "javax.swing.JEditorPane$PlainEditorKit");
   
    try
      {
        pane = new JEditorPane("http://www.gnu.org");
        harness.check
          (pane.getEditorKit().getClass(), HTMLEditorKit.class);
      }
    catch (Exception e)
      {
        harness.debug(e);
      }
   
    pane = new JEditorPane ("text/rtf", "hello");
    harness.check
      (pane.getEditorKit().getClass(), RTFEditorKit.class);
   
    pane = new JEditorPane ("application/rtf", "hello");
    harness.check
      (pane.getEditorKit().getClass(), RTFEditorKit.class);   
 
View Full Code Here

public class setText implements Testlet
{
  public void test(TestHarness harness)
  {
    JEditorPane pane = new JEditorPane();
    harness.check(pane.getText(), "");
    pane.setText(pane.getText());
    harness.check(pane.getText(), "");
    pane.setText("");
    harness.check(pane.getText(), "");
    pane.setText(null);
    harness.check(pane.getText(), "");
    pane.setText("GNU");
    harness.check(pane.getText(), "GNU");
    pane.setText(pane.getText());
    harness.check(pane.getText(), "GNU");
    pane.setText("");
    harness.check(pane.getText(), "");
    pane.setText(null);
    harness.check(pane.getText(), "");
  }
View Full Code Here

* Tests whether a newly created JEditorPane has the proper View type.
*/
public class ViewType implements Testlet {
 
  public void test(TestHarness harness) {
          JEditorPane pane = new JEditorPane();
          harness.check
            (pane.getUI().getRootView(pane).getView(0).getClass() ==
             javax.swing.text.WrappedPlainView.class);
  }
View Full Code Here

* set up for different content types.
*/
public class ContentType implements Testlet {
 
  public void test(TestHarness harness) {
          JEditorPane pane = new JEditorPane();
          harness.checkPoint ("Default EditorKits for content types");
          harness.check
            (pane.getEditorKitForContentType
             ("text/plain").getClass().getName(),
             "javax.swing.JEditorPane$PlainEditorKit");
          harness.check
            (JEditorPane.getEditorKitClassNameForContentType("text/plain"),
             "javax.swing.JEditorPane$PlainEditorKit");

          harness.check
            (pane.getEditorKitForContentType
             ("text/html").getClass(), HTMLEditorKit.class);
          harness.check
            (pane.getEditorKitForContentType
             ("text/rtf").getClass(), RTFEditorKit.class);
          harness.check
            (pane.getEditorKitForContentType
             ("application/rtf").getClass(), RTFEditorKit.class);

         
          harness.checkPoint ("Registering an EditorKit for a content type");
          harness.check
            (pane.getEditorKitForContentType
             ("foobar").getClass().getName(),
             "javax.swing.JEditorPane$PlainEditorKit");
          harness.check (JEditorPane.getEditorKitClassNameForContentType("foobar") == null);
          harness.check
            (JEditorPane.createEditorKitForContentType("foobar") == null);
          JEditorPane.registerEditorKitForContentType
            ("foobar", "javax.swing.text.html.HTMLEditorKit");
          harness.check
            (pane.getEditorKitForContentType("foobar").getClass(),
             HTMLEditorKit.class);  
          harness.check
            (JEditorPane.createEditorKitForContentType("foobar").getClass(),
             HTMLEditorKit.class);

          // Explicitly setting the EditorKit takes precedence over the
          // registered type
          pane.setEditorKitForContentType ("foobar", new RTFEditorKit());
          harness.check
            (pane.getEditorKitForContentType("foobar").getClass(),
             RTFEditorKit.class);  

          // We can set the EditorKit for content types previously unintroduced
          pane.setEditorKitForContentType ("tony", new RTFEditorKit());
          harness.check
            (pane.getEditorKitForContentType("tony").getClass(),
             RTFEditorKit.class);  
          // But this only affects the instance of JEditorPane, not the class itself
          harness.check (JEditorPane.createEditorKitForContentType("tony") == null);
    
  }
View Full Code Here

       
        for(JEditorPane pane : editors) {
            pane.setBackground(actions.getCurrentTheme().backgroundColor);
        }
       
        JEditorPane pane = editors.get(0);              
        //fix up the actions. this should eventually move to some new location
       
        Action cutAction = ActionUtils.getAction(pane, DefaultEditorKit.CutAction.class);
        cutAction.putValue(Action.NAME, "Cut");
        cutAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("meta X"));
View Full Code Here

    // ... with a semi-transparent background
    AWTUtilities.setWindowOpacity(this, normalTransparecy);

    // need to display the text somehow ...
    this.textPane = new JEditorPane();
    this.textPane.setContentType("text/html");
    this.textPane.setEditable(false);
    this.textPane.setOpaque(true);
    this.textPane.setBackground(this.backgroundcolor);
    this.textPane.setForeground(this.textcolor);
View Full Code Here

TOP

Related Classes of javax.swing.JEditorPane$PageLoader

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.