📄 htmlviewerframe.java
字号:
/*
* Copyright (c) 1996-2001 Borland Software Corporation. All Rights Reserved.
*
* This SOURCE CODE FILE, which has been provided by Borland Software as part
* of an Borland Software product for use ONLY by licensed users of the product,
* includes CONFIDENTIAL and PROPRIETARY information of Borland Software.
*
* USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS
* OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
* THE PRODUCT.
*
* IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND SOFTWARE, ITS
* RELATED COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY
* CLAIMS OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR
* DISTRIBUTION OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES
* ARISING OUT OF OR RESULTING FROM THE USE, MODIFICATION, OR
* DISTRIBUTION OF PROGRAMS OR FILES CREATED FROM, BASED ON, AND/OR
* DERIVED FROM THIS SOURCE CODE FILE.
*/
//------------------------------------------------------------------------------
// Copyright (c) 1996-2001 Borland Software Corporation. All Rights Reserved.
//------------------------------------------------------------------------------
package com.borland.samples.dbswing.htmlviewer;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import com.borland.dbswing.*;
public class HtmlViewerFrame extends JFrame {
JPanel jPanel1 = new JPanel();
JTextPane jTextPane1 = new JTextPane();
JButton helpButton = new JButton();
JButton exitButton = new JButton();
public HtmlViewerFrame() {
try {
jbInit();
}
catch(Exception e) {
DBExceptionHandler.handleException(e);
}
}
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if(e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
private void jbInit() throws Exception {
this.setTitle("dbSwing: HTML Help Viewer Sample");
this.setSize(new Dimension(500, 275));
jTextPane1.setText("\nThis sample demonstrates a simple help system built " +
"from a JdbNavTree, a JdbTable, and a JdbEditorPane. It works like this:\n" +
" 1. The user selects a help topic in the JdbNavTree\n" +
" 2. The JdbNavTree navigates to the corresponding row in the JdbTable\n" +
" 3. The JdbEditorPane loads the HTML page for the URL in that row.\n\n" +
"In this sample, the help content explains how to work with data-aware tree " +
"components and how this sample was built. Please select Help to see the " +
"sample in action.");
jTextPane1.setEditable(false);
jTextPane1.setFont(new java.awt.Font("SansSerif", 1, 13));
helpButton.setText("Help");
helpButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
helpButton_actionPerformed(e);
}
});
exitButton.setText("Exit");
exitButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
exitButton_actionPerformed(e);
}
});
this.getContentPane().add(jPanel1, BorderLayout.SOUTH);
jPanel1.add(helpButton, null);
jPanel1.add(exitButton, null);
this.getContentPane().add(jTextPane1, BorderLayout.CENTER);
}
void helpButton_actionPerformed(ActionEvent e) {
HtmlViewerHelpDialog dlg = new HtmlViewerHelpDialog(this);
dlg.setSize(600, 450);
Dimension dlgSize = dlg.getPreferredSize();
Dimension frmSize = getSize();
Point loc = getLocation();
dlg.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, loc.y);
dlg.setModal(false);
dlg.show();
}
void exitButton_actionPerformed(ActionEvent e) {
System.exit(0);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -