Autopsy  4.20.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
Utilities.java
Go to the documentation of this file.
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 
30 public class Utilities {
31 
32  public static void configureTextPaneAsHtml(JTextPane pane) {
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 
52  public static void configureTextPaneAsRtf(JTextPane pane) {
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)
Definition: Utilities.java:52
static void configureTextPaneAsHtml(JTextPane pane)
Definition: Utilities.java:32

Copyright © 2012-2022 Basis Technology. Generated on: Tue Aug 1 2023
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.