GP-4154 - Theming - Fixed font issues; updated font usage with attributes

This commit is contained in:
dragonmacher 2024-02-23 13:13:06 -05:00
parent c5bad0a88f
commit b586d65a3b
91 changed files with 1309 additions and 1191 deletions

View file

@ -15,11 +15,9 @@
*/
package ghidra.machinelearning.functionfinding;
import java.awt.Font;
import java.util.List;
import javax.swing.JTable;
import javax.swing.table.TableModel;
import docking.widgets.table.AbstractDynamicTableColumn;
import docking.widgets.table.TableColumnDescriptor;
import ghidra.docking.settings.Settings;
@ -48,7 +46,7 @@ public class SimilarStartsTableModel extends AddressBasedTableModel<SimilarStart
* Construct a table model for a table to display the closest function starts to
* a potential function start
* @param plugin owning program
* @param program program
* @param program program
* @param rows similar function starts
* @param randomForestRow model and params
*/
@ -123,9 +121,10 @@ public class SimilarStartsTableModel extends AddressBasedTableModel<SimilarStart
@Override
public GColumnRenderer<String> getColumnRenderer() {
final GColumnRenderer<String> monospacedRenderer = new AbstractGColumnRenderer<>() {
@Override
protected void configureFont(JTable table, TableModel model, int column) {
setFont(getFixedWidthFont());
protected Font getDefaultFont() {
return fixedWidthFont;
}
@Override

View file

@ -15,7 +15,8 @@
*/
package ghidra.examples;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.*;
import javax.swing.*;
@ -30,8 +31,8 @@ import ghidra.util.HelpLocation;
import ghidra.util.Msg;
public class HelloWorldComponentProvider extends ComponentProviderAdapter {
private final static HelpLocation HELP = new HelpLocation("SampleHelpTopic",
"SampleHelpTopic_Anchor_Name");
private final static HelpLocation HELP =
new HelpLocation("SampleHelpTopic", "SampleHelpTopic_Anchor_Name");
private MyButton activeButtonObj;
private JPanel mainPanel;
private DockingAction action;
@ -64,8 +65,8 @@ public class HelloWorldComponentProvider extends ComponentProviderAdapter {
// the menu item will appear on the local toolbar drop down.
Icon icon = new GIcon("icon.sample.action.hello.world");
action.setMenuBarData(new MenuData(new String[] { "Misc", "Hello World" }, icon));
action.setKeyBindingData(new KeyBindingData(KeyStroke.getKeyStroke(KeyEvent.VK_W,
InputEvent.CTRL_MASK)));
action.setKeyBindingData(
new KeyBindingData(KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_MASK)));
// puts the action on the local toolbar.
action.setToolBarData(new ToolBarData(icon));
@ -81,11 +82,11 @@ public class HelloWorldComponentProvider extends ComponentProviderAdapter {
public void actionPerformed(ActionContext context) {
announce("Hello World");
// To get the context object,
// To get the context object,
Object contextObject = context.getContextObject();
// ...now we can cast activeObj to be a object of MyButton
// if that is necessary, as the overridden isAddToPopup() method below
// if that is necessary, as the overridden isAddToPopup() method below
// will not add the popup action if the context object is not our button
@SuppressWarnings("unused")
@ -120,8 +121,6 @@ public class HelloWorldComponentProvider extends ComponentProviderAdapter {
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
panel.setBorder(BorderFactory.createTitledBorder("Example of a Component"));
activeButtonObj = new MyButton("Hello World");
Font f = activeButtonObj.getFont();
activeButtonObj.setFont(f.deriveFont(Font.BOLD, 14));
panel.add(activeButtonObj);
mainPanel.add(panel, BorderLayout.CENTER);
}