Autopsy  4.21.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
ContentViewerDefaults.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2021 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.layout;
20 
21 import java.awt.Font;
22 import java.awt.Insets;
23 import java.awt.Toolkit;
24 import java.awt.Color;
25 import javax.swing.UIManager;
26 
30 public class ContentViewerDefaults {
31 
32  private static final Font DEFAULT_FONT = UIManager.getDefaults().getFont("Label.font");
33 
34  // based on https://stackoverflow.com/questions/5829703/java-getting-a-font-with-a-specific-height-in-pixels/26564924#26564924
35  private static final Double PT_TO_PX = Toolkit.getDefaultToolkit().getScreenResolution() / 72.0;
36 
37  private static final int DEFAULT_FONT_PX = (int) Math.round(DEFAULT_FONT.getSize() * PT_TO_PX);
38 
39  private static final Font SUB_HEADER_FONT = DEFAULT_FONT.deriveFont(Font.BOLD);
40 
41  private static final Font HEADER_FONT = DEFAULT_FONT.deriveFont(Font.BOLD, DEFAULT_FONT.getSize() + 2);
42 
43  private static final Font MESSAGE_FONT = DEFAULT_FONT.deriveFont(Font.ITALIC);
44 
45  private static final Font MONOSPACED_FONT = new Font(Font.MONOSPACED, Font.PLAIN, DEFAULT_FONT.getSize());
46 
47  private static final Insets DEFAULT_PANEL_INSETS = UIManager.getDefaults().getInsets("TextPane.margin");
48 
49  private static final int DEFAULT_INDENT = DEFAULT_FONT_PX;
50  private static final int DEFAULT_SECTION_SPACING = DEFAULT_FONT_PX;
51 
52  private static final int DEFAULT_COLUMN_SPACING = (int) Math.round((double) DEFAULT_FONT_PX / 3);
53 
54  private static final int DEFAULT_LINE_SPACING = (int) Math.round((double) DEFAULT_FONT_PX / 5);
55 
56  private static final Color DEFAULT_BACKGROUND = UIManager.getColor("Panel.background");
57 
63  public static int getColumnSpacing() {
65  }
66 
72  public static Font getFont() {
73  return DEFAULT_FONT;
74  }
75 
81  public static Font getMessageFont() {
82  return MESSAGE_FONT;
83  }
84 
90  public static Font getHeaderFont() {
91  return HEADER_FONT;
92  }
93 
99  public static Font getSubHeaderFont() {
100  return SUB_HEADER_FONT;
101  }
102 
108  public static Font getMonospacedFont() {
109  return MONOSPACED_FONT;
110  }
111 
117  public static Insets getPanelInsets() {
118  return DEFAULT_PANEL_INSETS;
119  }
120 
126  public static Integer getSectionIndent() {
127  return DEFAULT_INDENT;
128  }
129 
135  public static Integer getSectionSpacing() {
137  }
138 
144  public static Integer getLineSpacing() {
145  return DEFAULT_LINE_SPACING;
146  }
147 
153  public static Color getPanelBackground() {
154  return DEFAULT_BACKGROUND;
155  }
156 
164  public static Double getPtToPx() {
165  return PT_TO_PX;
166  }
167 }

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