initialize fonts early

This commit is contained in:
Ralf Wisser
2019-11-07 10:02:04 +01:00
parent 670b7f88c1
commit fd7704eb76
2 changed files with 39 additions and 10 deletions
+18 -1
View File
@@ -102,6 +102,7 @@ import net.sf.jailer.ddl.DDLCreator;
import net.sf.jailer.extractionmodel.ExtractionModel.IncompatibleModelException;
import net.sf.jailer.progress.ProgressListener;
import net.sf.jailer.ui.databrowser.BrowserContentPane.TableModelItem;
import net.sf.jailer.ui.databrowser.DetailsView;
import net.sf.jailer.ui.databrowser.Row;
import net.sf.jailer.ui.scrollmenu.JScrollC2PopupMenu;
import net.sf.jailer.ui.scrollmenu.JScrollPopupMenu;
@@ -1244,8 +1245,24 @@ public class UIUtil {
/**
* Triggers UI initializations.
*/
@SuppressWarnings("serial")
public static void prepareUI() {
new RSyntaxTextAreaWithSQLSyntaxStyle(false, false);
try {
new RSyntaxTextAreaWithSQLSyntaxStyle(false, false);
new DetailsView() {
@Override
protected void onSelectRow(Row row) {
}
@Override
protected void onRowChanged(int row) {
}
@Override
protected void onClose() {
}
};
} catch (Throwable t) {
// ignore
}
}
/**
@@ -146,14 +146,26 @@ public abstract class DetailsView extends javax.swing.JPanel {
setCurrentRow(rowIndex, showSpinner);
}
private final Font font = new JLabel().getFont();
private final Font nonbold = new Font(font.getName(), font.getStyle() & ~Font.BOLD, font.getSize());
private final Font italic = new Font(font.getName(), font.getStyle() & ~Font.BOLD | Font.ITALIC, font.getSize());
private final Color BG1 = new Color(255, 255, 255);
private final Color BG2 = new Color(242, 255, 242);
private final Color BG3 = blend(new Color(196, 234, 255), BG1);
private final Color BG3_2 = blend(new Color(184, 226, 255), BG2);
private final Color FG1 = new Color(155, 0, 0);
/**
* Default constructor.
*/
protected DetailsView() {
this.table = null;
this.showSpinner = false;
this.session = null;
this.rows = null;
this.rowSorter = null;
this.rowIdSupport = null;
}
private static final Font font = new JLabel().getFont();
private static final Font nonbold = new Font(font.getName(), font.getStyle() & ~Font.BOLD, font.getSize());
private static final Font italic = new Font(font.getName(), font.getStyle() & ~Font.BOLD | Font.ITALIC, font.getSize());
private static final Color BG1 = new Color(255, 255, 255);
private static final Color BG2 = new Color(242, 255, 242);
private static final Color BG3 = blend(new Color(196, 234, 255), BG1);
private static final Color BG3_2 = blend(new Color(184, 226, 255), BG2);
private static final Color FG1 = new Color(155, 0, 0);
private List<JLabel> labels = new ArrayList<JLabel>();
private List<Color> labelColors = new ArrayList<Color>();
@@ -161,7 +173,7 @@ public abstract class DetailsView extends javax.swing.JPanel {
jScrollPane1.setBorder(BorderFactory.createEtchedBorder(color, Color.GRAY));
}
private Color blend(Color a, Color b) {
private static Color blend(Color a, Color b) {
final double f = 0.6;
return new Color(
(int)(a.getRed() * f + b.getRed() * (1 - f)),