1 /*
2 * Autopsy Forensic Browser
3 *
4 * Copyright 2013-2014 Basis Technology Corp.
5 * Contact: carrier <at> sleuthkit <dot> org
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19 package org.sleuthkit.autopsy.contentviewers;
20
21 import javax.swing.JTextPane;
22 import javax.swing.text.html.HTMLEditorKit;
23 import javax.swing.text.html.StyleSheet;
24 import javax.swing.text.rtf.RTFEditorKit;
25
31
33 pane.setContentType("text/html;charset=UTF-8"); //NON-NLS
34 HTMLEditorKit kit = new HTMLEditorKit();
35 pane.setEditorKit(kit);
36 StyleSheet styleSheet = kit.getStyleSheet();
37 /*
38 * I tried to play around with inheritence on font-size and it didn't
39 * always work. Defined all of the basics just in case. @@@
40 * IngestInboxViewer also defines styles similar to this. Consider a
41 * method that sets consistent styles for all viewers and takes font
42 * size as an argument.
43 */
44 styleSheet.addRule("body {font-family:Arial, 'ヒラギノ角ゴ Pro W3','Hiragino Kaku Gothic Pro','メイリオ',Meiryo,'MS Pゴシック','MS PGothic',sans-serif;font-size:14pt;}"); //NON-NLS
45 styleSheet.addRule("p {font-family:Arial, 'ヒラギノ角ゴ Pro W3','Hiragino Kaku Gothic Pro','メイリオ',Meiryo,'MS Pゴシック','MS PGothic',sans-serif;font-size:14pt;}"); //NON-NLS
46 styleSheet.addRule("li {font-family:Arial, 'ヒラギノ角ゴ Pro W3','Hiragino Kaku Gothic Pro','メイリオ',Meiryo,'MS Pゴシック','MS PGothic',sans-serif;font-size:14pt;}"); //NON-NLS
47 styleSheet.addRule("td {font-family:Arial, 'ヒラギノ角ゴ Pro W3','Hiragino Kaku Gothic Pro','メイリオ',Meiryo,'MS Pゴシック','MS PGothic',sans-serif;font-size:14pt;overflow:hidden;padding-right:5px;padding-left:5px;}"); //NON-NLS
48 styleSheet.addRule("th {font-family:Arial, 'ヒラギノ角ゴ Pro W3','Hiragino Kaku Gothic Pro','メイリオ',Meiryo,'MS Pゴシック','MS PGothic',sans-serif;font-size:14pt;overflow:hidden;padding-right:5px;padding-left:5px;font-weight:bold;}"); //NON-NLS
49 styleSheet.addRule("p {font-family:Arial, 'ヒラギノ角ゴ Pro W3','Hiragino Kaku Gothic Pro','メイリオ',Meiryo,'MS Pゴシック','MS PGothic',sans-serif;font-size:14pt;}"); //NON-NLS
50 }
51
53
54 pane.setContentType("text/html;charset=UTF-8"); //NON-NLS
55 RTFEditorKit rtfkit = new RTFEditorKit();
56 pane.setEditorKit(rtfkit);
57 }
58 }
static void configureTextPaneAsRtf(JTextPane pane)
static void configureTextPaneAsHtml(JTextPane pane)