use of com.jsql.view.swing.console.SimpleConsoleAdapter in project jsql-injection by ron190.
the class PanelConsoles method initializeTabsConsoles.
private void initializeTabsConsoles() {
this.chunkTextArea = new JPopupTextArea(new JTextAreaPlaceholderConsole("Raw data extracted during injection")).getProxy();
this.chunkTextArea.setEditable(false);
this.binaryTextArea = new JPopupTextArea(new JTextAreaPlaceholderConsole("Characters extracted during blind or time injection")).getProxy();
this.binaryTextArea.setEditable(false);
this.chunkTextArea.setLineWrap(true);
this.binaryTextArea.setLineWrap(true);
var consoleTextPane = new SimpleConsoleAdapter("Console", "Event logging");
// Object creation after customization
consoleTextPane.getProxy().setEditable(false);
JTextPaneAppender.register(consoleTextPane);
this.tabConsoles.setUI(new CustomMetalTabbedPaneUI() {
@Override
protected int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics) {
return Math.max(80, super.calculateTabWidth(tabPlacement, tabIndex, metrics));
}
});
this.tabConsoles.setBorder(BorderFactory.createEmptyBorder(1, 0, 0, 0));
this.buildI18nTab("CONSOLE_MAIN_LABEL", "CONSOLE_MAIN_TOOLTIP", UiUtil.ICON_CONSOLE, new LightScrollPane(1, 0, 0, 0, consoleTextPane.getProxy()), 0);
// Order is important
var preferences = Preferences.userRoot().node(InjectionModel.class.getName());
if (preferences.getBoolean(UiUtil.JAVA_VISIBLE, false)) {
this.insertJavaTab();
}
if (preferences.getBoolean(UiUtil.NETWORK_VISIBLE, true)) {
this.insertNetworkTab();
}
if (preferences.getBoolean(UiUtil.CHUNK_VISIBLE, true)) {
this.insertChunkTab();
}
if (preferences.getBoolean(UiUtil.BINARY_VISIBLE, true)) {
this.insertBooleanTab();
}
// Reset Font when tab is selected
this.tabConsoles.addChangeListener(changeEvent -> {
JTabbedPane tabs = this.tabConsoles;
if (tabs.getSelectedIndex() > -1) {
var currentTabHeader = tabs.getTabComponentAt(tabs.getSelectedIndex());
if (currentTabHeader != null) {
currentTabHeader.setFont(currentTabHeader.getFont().deriveFont(Font.PLAIN));
currentTabHeader.setForeground(Color.BLACK);
}
}
});
}
Aggregations