logindocumentpanel.java

来自「一个类似QQ的在线通讯聊天软件原码,适合初学者参考学习。」· Java 代码 · 共 85 行

JAVA
85
字号
package openicq.gui;import javax.swing.*;import javax.swing.event.HyperlinkEvent;import openicq.Start;import openicq.data.Default;import org.javalib.document.Document;import org.javalib.document.HTML3Document;import org.javalib.gui.model.DocumentPanelModel;import org.javalib.util.BrowserControl;import org.javalib.util.TitledList;/** * The <code>LoginDocumentPanel</code> class contains the HTML panel of the * login frame. * @author Hansgeorg Schwibbe * @copyright 2004 */public class LoginDocumentPanel extends DocumentPanelModel{  private TitledList localized = Start.env.getLocalizedList();  private JFrame parent;  /**   * Initializes a new instance of the class <code>LoginDocumentPanel</code>.   * @param parent the parent frame   */  public LoginDocumentPanel(JFrame parent)  {    this.parent = parent;    this.setBorder(BorderFactory.createEtchedBorder());  }  /**   * (non-Javadoc)   * @see org.javalib.gui.model.DocumentPanelModel#onHyperlinkUpdate(javax.swing.event.HyperlinkEvent)   */  protected void onHyperlinkUpdate(HyperlinkEvent e)  {    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)    {      try      {        BrowserControl.openURL(e.getDescription());      }      catch (Exception ex)      {        String msg, title;        msg = ((String[]) localized.get("errorMessages"))[17];        title = ((String[]) localized.get("messageTitles"))[0];        JOptionPane.showMessageDialog(parent, msg, title,                                      JOptionPane.ERROR_MESSAGE);      }    }  }  /**   * (non-Javadoc)   * @see org.javalib.gui.model.DocumentPanelModel#getDocument()   */  protected Document getDocument()  {    HTML3Document htmlDoc = new HTML3Document();    synchronized (Start.env)    {      localized = Start.env.getLocalizedList();      String link;      htmlDoc.printText(((String[]) localized.get("documentPanel"))[3] + " ");      link = ((String[]) localized.get("documentPanel"))[0];      htmlDoc.printLink(Default.WEBLINK_WHITEPAGES, link);      htmlDoc.printBr();      htmlDoc.printText(((String[]) localized.get("documentPanel"))[1] + " ");      link = ((String[]) localized.get("documentPanel"))[0];      htmlDoc.printLink(Default.WEBLINK_REGISTER, link);      htmlDoc.printBr();      htmlDoc.printText(((String[]) localized.get("documentPanel"))[2] + " ");      link = ((String[]) localized.get("documentPanel"))[0];      htmlDoc.printLink(Default.WEBLINK_PASSWORD, link);    }    return htmlDoc;  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?