Java 类javax.swing.text.html.FormSubmitEvent 实例源码

项目:javify    文件:HtmlDemo.java   
/**
 * Returns a panel with the demo content. The panel uses a BorderLayout(), and
 * the BorderLayout.SOUTH area is empty, to allow callers to add controls to
 * the bottom of the panel if they want to (a close button is added if this
 * demo is being run as a standalone demo).
 */
private void createContent()
{
  setLayout(new BorderLayout());

  JEditorPane.registerEditorKitForContentType("text/html",
                                           BrowserEditorKit.class.getName());
  html.setEditable(false);
  html.addHyperlinkListener(new HyperlinkListener()
  {

    public void hyperlinkUpdate(HyperlinkEvent event)
    {
      if (event instanceof FormSubmitEvent)
        {
          submitForm((FormSubmitEvent) event);
        }
      else
        {
          URL u = event.getURL();
          if (u != null)
            {
              setPage(u);
            }
        }
    }

  });

  JScrollPane scroller = new JScrollPane(html);
  JPanel urlPanel = new JPanel();
  urlPanel.setLayout(new BoxLayout(urlPanel, BoxLayout.X_AXIS));
  url.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
  LoadActionListener action = new LoadActionListener();
  url.addActionListener(action);
  urlPanel.add(url);
  JButton loadButton = new JButton("go");
  urlPanel.add(loadButton);
  loadButton.addActionListener(action);

  // Setup control panel.
  JToolBar controlPanel = createToolBar();
  JPanel browserPanel = new JPanel();
  browserPanel.setLayout(new BorderLayout());
  browserPanel.add(urlPanel, BorderLayout.NORTH);
  browserPanel.add(scroller, BorderLayout.CENTER);
  add(controlPanel, BorderLayout.NORTH);
  add(browserPanel, BorderLayout.CENTER);

  // Load start page.
  try
    {
      URL startpage = getClass().getResource("welcome.html");
      html.setPage(startpage);
      url.setText(startpage.toString());
      history.addLast(startpage);
    }
  catch (Exception ex)
    {
      System.err.println("couldn't load page: "/* + startpage*/);
      ex.printStackTrace();
    }
  setPreferredSize(new Dimension(800, 600));
}
项目:jvm-stm    文件:HtmlDemo.java   
/**
 * Returns a panel with the demo content. The panel uses a BorderLayout(), and
 * the BorderLayout.SOUTH area is empty, to allow callers to add controls to
 * the bottom of the panel if they want to (a close button is added if this
 * demo is being run as a standalone demo).
 */
private void createContent()
{
  setLayout(new BorderLayout());

  JEditorPane.registerEditorKitForContentType("text/html",
                                           BrowserEditorKit.class.getName());
  html.setEditable(false);
  html.addHyperlinkListener(new HyperlinkListener()
  {

    public void hyperlinkUpdate(HyperlinkEvent event)
    {
      if (event instanceof FormSubmitEvent)
        {
          submitForm((FormSubmitEvent) event);
        }
      else
        {
          URL u = event.getURL();
          if (u != null)
            {
              setPage(u);
            }
        }
    }

  });

  JScrollPane scroller = new JScrollPane(html);
  JPanel urlPanel = new JPanel();
  urlPanel.setLayout(new BoxLayout(urlPanel, BoxLayout.X_AXIS));
  url.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
  LoadActionListener action = new LoadActionListener();
  url.addActionListener(action);
  urlPanel.add(url);
  JButton loadButton = new JButton("go");
  urlPanel.add(loadButton);
  loadButton.addActionListener(action);

  // Setup control panel.
  JToolBar controlPanel = createToolBar();
  JPanel browserPanel = new JPanel();
  browserPanel.setLayout(new BorderLayout());
  browserPanel.add(urlPanel, BorderLayout.NORTH);
  browserPanel.add(scroller, BorderLayout.CENTER);
  add(controlPanel, BorderLayout.NORTH);
  add(browserPanel, BorderLayout.CENTER);

  // Load start page.
  try
    {
      URL startpage = getClass().getResource("welcome.html");
      html.setPage(startpage);
      url.setText(startpage.toString());
      history.addLast(startpage);
    }
  catch (Exception ex)
    {
      System.err.println("couldn't load page: "/* + startpage*/);
      ex.printStackTrace();
    }
  setPreferredSize(new Dimension(800, 600));
}
项目:JamVM-PH    文件:HtmlDemo.java   
/**
 * Returns a panel with the demo content. The panel uses a BorderLayout(), and
 * the BorderLayout.SOUTH area is empty, to allow callers to add controls to
 * the bottom of the panel if they want to (a close button is added if this
 * demo is being run as a standalone demo).
 */
private void createContent()
{
  setLayout(new BorderLayout());

  JEditorPane.registerEditorKitForContentType("text/html",
                                           BrowserEditorKit.class.getName());
  html.setEditable(false);
  html.addHyperlinkListener(new HyperlinkListener()
  {

    public void hyperlinkUpdate(HyperlinkEvent event)
    {
      if (event instanceof FormSubmitEvent)
        {
          submitForm((FormSubmitEvent) event);
        }
      else
        {
          URL u = event.getURL();
          if (u != null)
            {
              setPage(u);
            }
        }
    }

  });

  JScrollPane scroller = new JScrollPane(html);
  JPanel urlPanel = new JPanel();
  urlPanel.setLayout(new BoxLayout(urlPanel, BoxLayout.X_AXIS));
  url.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
  LoadActionListener action = new LoadActionListener();
  url.addActionListener(action);
  urlPanel.add(url);
  JButton loadButton = new JButton("go");
  urlPanel.add(loadButton);
  loadButton.addActionListener(action);

  // Setup control panel.
  JToolBar controlPanel = createToolBar();
  JPanel browserPanel = new JPanel();
  browserPanel.setLayout(new BorderLayout());
  browserPanel.add(urlPanel, BorderLayout.NORTH);
  browserPanel.add(scroller, BorderLayout.CENTER);
  add(controlPanel, BorderLayout.NORTH);
  add(browserPanel, BorderLayout.CENTER);

  // Load start page.
  try
    {
      URL startpage = getClass().getResource("welcome.html");
      html.setPage(startpage);
      url.setText(startpage.toString());
      history.addLast(startpage);
    }
  catch (Exception ex)
    {
      System.err.println("couldn't load page: "/* + startpage*/);
      ex.printStackTrace();
    }
  setPreferredSize(new Dimension(800, 600));
}
项目:classpath    文件:HtmlDemo.java   
/**
 * Returns a panel with the demo content. The panel uses a BorderLayout(), and
 * the BorderLayout.SOUTH area is empty, to allow callers to add controls to
 * the bottom of the panel if they want to (a close button is added if this
 * demo is being run as a standalone demo).
 */
private void createContent()
{
  setLayout(new BorderLayout());

  JEditorPane.registerEditorKitForContentType("text/html",
                                           BrowserEditorKit.class.getName());
  html.setEditable(false);
  html.addHyperlinkListener(new HyperlinkListener()
  {

    public void hyperlinkUpdate(HyperlinkEvent event)
    {
      if (event instanceof FormSubmitEvent)
        {
          submitForm((FormSubmitEvent) event);
        }
      else
        {
          URL u = event.getURL();
          if (u != null)
            {
              setPage(u);
            }
        }
    }

  });

  JScrollPane scroller = new JScrollPane(html);
  JPanel urlPanel = new JPanel();
  urlPanel.setLayout(new BoxLayout(urlPanel, BoxLayout.X_AXIS));
  url.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
  LoadActionListener action = new LoadActionListener();
  url.addActionListener(action);
  urlPanel.add(url);
  JButton loadButton = new JButton("go");
  urlPanel.add(loadButton);
  loadButton.addActionListener(action);

  // Setup control panel.
  JToolBar controlPanel = createToolBar();
  JPanel browserPanel = new JPanel();
  browserPanel.setLayout(new BorderLayout());
  browserPanel.add(urlPanel, BorderLayout.NORTH);
  browserPanel.add(scroller, BorderLayout.CENTER);
  add(controlPanel, BorderLayout.NORTH);
  add(browserPanel, BorderLayout.CENTER);

  // Load start page.
  try
    {
      URL startpage = getClass().getResource("welcome.html");
      html.setPage(startpage);
      url.setText(startpage.toString());
      history.addLast(startpage);
    }
  catch (Exception ex)
    {
      System.err.println("couldn't load page: "/* + startpage*/);
      ex.printStackTrace();
    }
  setPreferredSize(new Dimension(800, 600));
}