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,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);
}