GT-2698 - convert JRadioButton to GRadioButton

This commit is contained in:
dev747368 2019-04-16 18:21:28 -04:00
parent 3c0484cae3
commit d7410690ff
54 changed files with 529 additions and 344 deletions

View File

@ -35,6 +35,7 @@ import docking.action.ToolBarData;
import docking.menu.ActionState;
import docking.menu.MultiStateDockingAction;
import docking.widgets.*;
import docking.widgets.button.GRadioButton;
import docking.widgets.label.GDLabel;
import docking.widgets.label.GLabel;
import ghidra.examples.graph.layout.SampleGraphPluginDependencyLayoutProvider;
@ -189,9 +190,9 @@ public class SampleGraphProvider extends ComponentProviderAdapter {
//
// How should we display the filtered-out vertices?
//
fadedButton = new JRadioButton("Faded");
fadedButton = new GRadioButton("Faded");
fadedButton.setToolTipText("Filtered vertices remain in the graph, but are grayed-out");
removedButton = new JRadioButton("Removed");
removedButton = new GRadioButton("Removed");
removedButton.setToolTipText("Filtered vertices are removed from the graph");
ButtonGroup group = new ButtonGroup();

View File

@ -22,6 +22,7 @@ import java.awt.event.ItemListener;
import javax.swing.*;
import javax.swing.event.ChangeListener;
import docking.widgets.button.GRadioButton;
import docking.widgets.label.GDLabel;
import docking.widgets.label.GLabel;
import ghidra.app.merge.MergeConstants;
@ -96,9 +97,9 @@ class CategoryConflictPanel extends JPanel {
labelPanel.add(Box.createHorizontalStrut(5));
labelPanel.add(categoryLabel);
latestRB = new JRadioButton("Use Latest");
myRB = new JRadioButton("Use My Version");
originalRB = new JRadioButton("Use Original");
latestRB = new GRadioButton("Use Latest");
myRB = new GRadioButton("Use My Version");
originalRB = new GRadioButton("Use Original");
latestRB.setName(LATEST_BUTTON_NAME);
myRB.setName(CHECKED_OUT_BUTTON_NAME);
originalRB.setName(ORIGINAL_BUTTON_NAME);

View File

@ -23,6 +23,7 @@ import java.awt.event.ItemListener;
import javax.swing.*;
import docking.widgets.MultiLineLabel;
import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.label.GIconLabel;
import ghidra.app.merge.MergeConstants;
@ -114,15 +115,15 @@ class DataTypeMergePanel extends JPanel {
}
};
latestRB = new JRadioButton(MergeConstants.LATEST_TITLE);
latestRB = new GRadioButton(MergeConstants.LATEST_TITLE);
latestRB.setName(LATEST_BUTTON_NAME);
latestRB.addItemListener(listener);
myRB = new JRadioButton(MergeConstants.MY_TITLE);
myRB = new GRadioButton(MergeConstants.MY_TITLE);
myRB.setName(CHECKED_OUT_BUTTON_NAME);
myRB.addItemListener(listener);
originalRB = new JRadioButton(MergeConstants.ORIGINAL_TITLE);
originalRB = new GRadioButton(MergeConstants.ORIGINAL_TITLE);
originalRB.setName(ORIGINAL_BUTTON_NAME);
originalRB.addItemListener(listener);

View File

@ -23,6 +23,7 @@ import java.awt.event.ItemListener;
import javax.swing.*;
import docking.widgets.MultiLineLabel;
import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.label.GIconLabel;
import ghidra.app.merge.MergeConstants;
@ -113,15 +114,15 @@ class SourceArchiveMergePanel extends JPanel {
}
};
latestRB = new JRadioButton(MergeConstants.LATEST_TITLE);
latestRB = new GRadioButton(MergeConstants.LATEST_TITLE);
latestRB.setName(LATEST_BUTTON_NAME);
latestRB.addItemListener(listener);
myRB = new JRadioButton(MergeConstants.MY_TITLE);
myRB = new GRadioButton(MergeConstants.MY_TITLE);
myRB.setName(CHECKED_OUT_BUTTON_NAME);
myRB.addItemListener(listener);
originalRB = new JRadioButton(MergeConstants.ORIGINAL_TITLE);
originalRB = new GRadioButton(MergeConstants.ORIGINAL_TITLE);
originalRB.setName(ORIGINAL_BUTTON_NAME);
originalRB.addItemListener(listener);

View File

@ -22,6 +22,7 @@ import java.awt.event.ItemListener;
import javax.swing.*;
import docking.widgets.EmptyBorderButton;
import docking.widgets.button.GRadioButton;
import docking.widgets.fieldpanel.FieldPanel;
import docking.widgets.fieldpanel.internal.FieldPanelCoordinator;
import docking.widgets.label.GIconLabel;
@ -224,19 +225,19 @@ class ExternalAddConflictPanel extends JPanel implements CodeFormatService {
}
};
keepLatestRB = new JRadioButton(MergeConstants.LATEST_TITLE);
keepLatestRB = new GRadioButton(MergeConstants.LATEST_TITLE);
keepLatestRB.setName(KEEP_LATEST_BUTTON_NAME);
keepLatestRB.addItemListener(listener);
keepMyRB = new JRadioButton(MergeConstants.MY_TITLE);
keepMyRB = new GRadioButton(MergeConstants.MY_TITLE);
keepMyRB.setName(KEEP_MY_BUTTON_NAME);
keepMyRB.addItemListener(listener);
keepBothRB = new JRadioButton("Both");
keepBothRB = new GRadioButton("Both");
keepBothRB.setName(KEEP_BOTH_BUTTON_NAME);
keepBothRB.addItemListener(listener);
mergeBothRB = new JRadioButton("Merge");
mergeBothRB = new GRadioButton("Merge");
mergeBothRB.setName(MERGE_BOTH_BUTTON_NAME);
mergeBothRB.addItemListener(listener);

View File

@ -25,6 +25,7 @@ import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeListener;
import javax.swing.table.TableModel;
import docking.widgets.button.GRadioButton;
import docking.widgets.label.GDLabel;
import docking.widgets.table.AbstractSortedTableModel;
import docking.widgets.table.GTable;
@ -253,7 +254,7 @@ class ListChoice extends JPanel {
setLayout(new BorderLayout());
rb = new JRadioButton("UNKNOWN");
rb = new GRadioButton("UNKNOWN");
rb.addItemListener(radioButtonListener);
group.add(rb);
add(rb, BorderLayout.NORTH);

View File

@ -25,6 +25,8 @@ import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeListener;
import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.label.GDLabel;
import docking.widgets.label.GLabel;
import ghidra.app.merge.util.ConflictUtility;
@ -547,7 +549,7 @@ public class VariousChoicesPanel extends ConflictPanel {
}
}
private class MyRadioButton extends JRadioButton {
private class MyRadioButton extends GRadioButton {
private final static long serialVersionUID = 1;
/**
@ -592,7 +594,7 @@ public class VariousChoicesPanel extends ConflictPanel {
}
}
private class MyCheckBox extends JCheckBox {
private class MyCheckBox extends GCheckBox {
private final static long serialVersionUID = 1;
/**

View File

@ -24,6 +24,7 @@ import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeListener;
import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.label.GDLabel;
import docking.widgets.label.GLabel;
@ -105,7 +106,7 @@ public class VerticalChoicesPanel extends ConflictPanel {
add(rowPanel, BorderLayout.CENTER);
rowPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
JRadioButton rb = new JRadioButton();
GRadioButton rb = new GRadioButton();
JCheckBox cb = new GCheckBox();
indent = Math.max(rb.getPreferredSize().width, cb.getPreferredSize().width);
@ -504,7 +505,7 @@ public class VerticalChoicesPanel extends ConflictPanel {
}
}
private class MyRadioButton extends JRadioButton {
private class MyRadioButton extends GRadioButton {
private final static long serialVersionUID = 1;
private int option;
@ -560,7 +561,7 @@ public class VerticalChoicesPanel extends ConflictPanel {
}
private class MyCheckBox extends JCheckBox {
private class MyCheckBox extends GCheckBox {
private final static long serialVersionUID = 1;
private int option;

View File

@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -22,6 +21,8 @@ import java.awt.event.ItemListener;
import javax.swing.*;
import javax.swing.event.ChangeListener;
import docking.widgets.button.GRadioButton;
/**
* Panel to show radio buttons to choose a name or a set of permissions
* for a memory block, or to resolve the conflict for the image base
@ -89,6 +90,7 @@ class BlockConflictPanel extends JPanel {
group = new ButtonGroup();
ItemListener itemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
listener.stateChanged(null);
@ -96,13 +98,13 @@ class BlockConflictPanel extends JPanel {
}
};
latestRB = new JRadioButton("Latest");
latestRB = new GRadioButton("Latest");
latestRB.setName(MemoryMergePanel.LATEST_BUTTON_NAME);
latestRB.addItemListener(itemListener);
myRB = new JRadioButton("My");
myRB = new GRadioButton("My");
myRB.addItemListener(itemListener);
myRB.setName(MemoryMergePanel.MY_BUTTON_NAME);
originalRB = new JRadioButton("Original");
originalRB = new GRadioButton("Original");
originalRB.addItemListener(itemListener);
originalRB.setName(MemoryMergePanel.ORIGINAL_BUTTON_NAME);

View File

@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,15 +15,16 @@
*/
package ghidra.app.merge.memory;
import ghidra.app.merge.MergeConstants;
import ghidra.util.layout.PairLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.*;
import javax.swing.event.ChangeListener;
import docking.widgets.button.GRadioButton;
import ghidra.app.merge.MergeConstants;
import ghidra.util.layout.PairLayout;
/**
* Panel that shows the block comments; has radio buttons to choose
* which comment to use.
@ -123,8 +123,9 @@ class CommentsConflictPanel extends JPanel {
case MergeConstants.ORIGINAL:
str = MergeConstants.ORIGINAL_TITLE;
}
JRadioButton rb = new JRadioButton("Use comments from " + str);
GRadioButton rb = new GRadioButton("Use comments from " + str);
rb.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
listener.stateChanged(null);

View File

@ -22,6 +22,7 @@ import java.awt.event.ItemListener;
import javax.swing.*;
import javax.swing.event.ChangeListener;
import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.label.GDLabel;
import ghidra.app.merge.MergeConstants;
@ -140,9 +141,9 @@ class ConflictPanel extends JPanel {
namePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 10, 5));
namePanel.add(propertyGroupLabel);
latestRB = new JRadioButton("Use " + MergeConstants.LATEST_TITLE);
myRB = new JRadioButton("Use " + MergeConstants.MY_TITLE);
originalRB = new JRadioButton("Use " + MergeConstants.ORIGINAL_TITLE);
latestRB = new GRadioButton("Use " + MergeConstants.LATEST_TITLE);
myRB = new GRadioButton("Use " + MergeConstants.MY_TITLE);
originalRB = new GRadioButton("Use " + MergeConstants.ORIGINAL_TITLE);
latestRB.setName(LATEST_BUTTON_NAME);
myRB.setName(CHECKED_OUT_BUTTON_NAME);

View File

@ -24,6 +24,7 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import docking.widgets.EmptyBorderButton;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.fieldpanel.FieldPanel;
import docking.widgets.fieldpanel.internal.FieldPanelCoordinator;
import docking.widgets.fieldpanel.support.BackgroundColorModel;
@ -607,7 +608,7 @@ public class ListingMergePanel extends JPanel
}
class LockComponent extends JCheckBox {
class LockComponent extends GCheckBox {
private static final Icon lock = ResourceManager.loadImage("images/lock.gif");
private static final Icon unlock = ResourceManager.loadImage("images/unlock.gif");

View File

@ -22,6 +22,7 @@ import java.awt.event.ItemListener;
import javax.swing.*;
import javax.swing.event.ChangeListener;
import docking.widgets.button.GRadioButton;
import docking.widgets.label.GDLabel;
import docking.widgets.label.GIconLabel;
import ghidra.app.merge.MergeConstants;
@ -134,9 +135,9 @@ class NameConflictsPanel extends JPanel {
iconPanel.add(conflictsLabel);
iconPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
keepOtherRB = new JRadioButton("Keep 'Other' Name");
addOrRenameRB = new JRadioButton("Rename 'My' name to My.username");
originalRB = new JRadioButton("Use 'Original' name");
keepOtherRB = new GRadioButton("Keep 'Other' Name");
addOrRenameRB = new GRadioButton("Rename 'My' name to My.username");
originalRB = new GRadioButton("Use 'Original' name");
keepOtherRB.setName(ProgramTreeMergePanel.KEEP_OTHER_BUTTON_NAME);
addOrRenameRB.setName(ProgramTreeMergePanel.RENAME_PRIVATE_BUTTON_NAME);

View File

@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,8 +15,6 @@
*/
package ghidra.app.merge.tree;
import ghidra.app.merge.MergeConstants;
import java.awt.BorderLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
@ -25,6 +22,9 @@ import java.awt.event.ItemListener;
import javax.swing.*;
import javax.swing.event.ChangeListener;
import docking.widgets.button.GRadioButton;
import ghidra.app.merge.MergeConstants;
/**
* Panel for resolving name conflicts among program trees when private
* name of tree does not exist in destination program.
@ -88,10 +88,10 @@ class NamePanel extends JPanel {
panel.setLayout(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
keepOtherRB = new JRadioButton("Keep 'Other' Name");
keepMyRB = new JRadioButton("Keep 'My' Name");
newTreeRB = new JRadioButton("Add New Tree");
originalRB = new JRadioButton("Use Original Name");
keepOtherRB = new GRadioButton("Keep 'Other' Name");
keepMyRB = new GRadioButton("Keep 'My' Name");
newTreeRB = new GRadioButton("Add New Tree");
originalRB = new GRadioButton("Use Original Name");
keepOtherRB.setName(ProgramTreeMergePanel.KEEP_OTHER_BUTTON_NAME);
keepMyRB.setName(ProgramTreeMergePanel.KEEP_PRIVATE_BUTTON_NAME);
@ -112,6 +112,7 @@ class NamePanel extends JPanel {
add(panel);
ItemListener itemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (listener != null) {
listener.stateChanged(null);

View File

@ -27,6 +27,7 @@ import javax.swing.text.Document;
import docking.ToolTipManager;
import docking.widgets.OptionDialog;
import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.label.GDLabel;
import ghidra.program.model.data.Category;
@ -332,9 +333,9 @@ public class CompEditorPanel extends CompositeEditorPanel {
}
private void setupMinimumAlignment() {
defaultMinAlignButton = new JRadioButton("none ");
machineMinAlignButton = new JRadioButton("machine ");
byValueMinAlignButton = new JRadioButton();
defaultMinAlignButton = new GRadioButton("none ");
machineMinAlignButton = new GRadioButton("machine ");
byValueMinAlignButton = new GRadioButton();
minAlignValueTextField = new JTextField();
setupDefaultMinAlignButton();
setupMachineMinAlignButton();
@ -519,8 +520,8 @@ public class CompEditorPanel extends CompositeEditorPanel {
}
private void setupPacking() {
noPackingButton = new JRadioButton("none ");
byValuePackingButton = new JRadioButton();
noPackingButton = new GRadioButton("none ");
byValuePackingButton = new GRadioButton();
packingValueTextField = new JTextField();
setupNoPackingButton();
setupByValuePackingButton();

View File

@ -29,6 +29,7 @@ import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import docking.DialogComponentProvider;
import docking.widgets.button.GRadioButton;
import docking.widgets.table.*;
import ghidra.app.services.DataTypeManagerService;
import ghidra.app.util.ToolTipUtils;
@ -245,8 +246,8 @@ public class CreateStructureDialog extends DialogComponentProvider {
matchingStylePanel.setBorder(
new TitledBorder(BorderFactory.createEmptyBorder(), "Matching: "));
exactMatchButton = new JRadioButton("Exact");
sizeMatchButton = new JRadioButton("Size");
exactMatchButton = new GRadioButton("Exact");
sizeMatchButton = new GRadioButton("Size");
exactMatchButton.setToolTipText(
"Match structures with the same " + "number and type of data elements");

View File

@ -21,6 +21,7 @@ import java.awt.event.*;
import javax.swing.*;
import docking.DialogComponentProvider;
import docking.widgets.button.GRadioButton;
import docking.widgets.label.GIconLabel;
import docking.widgets.label.GLabel;
import ghidra.util.HelpLocation;
@ -119,9 +120,9 @@ public class ConflictDialog extends DialogComponentProvider {
};
ButtonGroup bg = new ButtonGroup();
renameRB = new JRadioButton("Rename new data type to " + newDTName, true);
replaceRB = new JRadioButton("Replace existing data type");
useExistingRB = new JRadioButton("Use existing data type");
renameRB = new GRadioButton("Rename new data type to " + newDTName, true);
replaceRB = new GRadioButton("Replace existing data type");
useExistingRB = new GRadioButton("Use existing data type");
renameRB.addItemListener(listener);
useExistingRB.addItemListener(listener);

View File

@ -26,6 +26,7 @@ import javax.swing.*;
import docking.*;
import docking.action.ToggleDockingAction;
import docking.action.ToolBarData;
import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GHtmlCheckBox;
import docking.widgets.combobox.GhidraComboBox;
import docking.widgets.filter.FilterListener;
@ -243,11 +244,11 @@ class FilterAction extends ToggleDockingAction {
JPanel enablePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
ButtonGroup group = new ButtonGroup();
enableButton = new JRadioButton("Enabled", true);
enableButton = new GRadioButton("Enabled", true);
enableButton.addKeyListener(listener);
enablePanel.add(enableButton);
group.add(enableButton);
disableButton = new JRadioButton("Disabled", false);
disableButton = new GRadioButton("Disabled", false);
disableButton.addKeyListener(listener);
enablePanel.add(disableButton);
group.add(disableButton);

View File

@ -25,6 +25,7 @@ import java.util.ArrayList;
import javax.swing.*;
import docking.DialogComponentProvider;
import docking.widgets.button.GRadioButton;
import docking.widgets.label.GLabel;
import ghidra.app.util.bean.FixedBitSizeValueField;
import ghidra.program.model.lang.Register;
@ -77,8 +78,8 @@ public class ProcessorStateDialog extends DialogComponentProvider {
mainPanel.add(scrollPane, BorderLayout.CENTER);
JPanel radioPanel = new JPanel(new FlowLayout());
mainPanel.add(radioPanel, BorderLayout.SOUTH);
JRadioButton hexButton = new JRadioButton("Hex");
JRadioButton decimalButton = new JRadioButton("Decimal");
GRadioButton hexButton = new GRadioButton("Hex");
GRadioButton decimalButton = new GRadioButton("Decimal");
hexButton.setSelected(true);
ButtonGroup group = new ButtonGroup();
group.add(hexButton);

View File

@ -27,6 +27,7 @@ import javax.swing.event.ChangeListener;
import docking.DialogComponentProvider;
import docking.ToolTipManager;
import docking.widgets.button.GRadioButton;
import docking.widgets.label.GDLabel;
import ghidra.app.util.AddressInput;
import ghidra.program.model.address.Address;
@ -231,7 +232,7 @@ class FallThroughDialog extends DialogComponentProvider implements ChangeListene
panel.setLayout(bl);
ButtonGroup group = new ButtonGroup();
defaultRB = new JRadioButton("Default", true);
defaultRB = new GRadioButton("Default", true);
defaultRB.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) {
@ -240,7 +241,7 @@ class FallThroughDialog extends DialogComponentProvider implements ChangeListene
});
ToolTipManager.setToolTipText(defaultRB, "Use default fallthrough address");
userRB = new JRadioButton("User", false);
userRB = new GRadioButton("User", false);
userRB.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) {

View File

@ -20,6 +20,8 @@ import java.awt.event.ActionEvent;
import javax.swing.*;
import docking.widgets.button.GRadioButton;
/**
* Allows the user to define a custom search range for the {@link InstructionSearchDialog}.
*
@ -126,7 +128,7 @@ public class SearchDirectionWidget extends ControlPanelWidget {
* @return
*/
private JRadioButton createSearchRB(AbstractAction action, String name, String tooltip) {
JRadioButton button = new JRadioButton(action);
GRadioButton button = new GRadioButton(action);
button.setText(name);
button.setToolTipText(tooltip);
button.setAlignmentX(Component.LEFT_ALIGNMENT);

View File

@ -22,6 +22,7 @@ import java.util.List;
import javax.swing.*;
import docking.widgets.button.GRadioButton;
import ghidra.app.plugin.core.instructionsearch.util.InstructionSearchUtils;
/**
@ -59,8 +60,8 @@ public class SelectionModeWidget extends ControlPanelWidget {
@Override
protected JPanel createContent() {
JPanel rbPanel = new JPanel();
hexRB = new JRadioButton("hex");
binaryRB = new JRadioButton("binary");
hexRB = new GRadioButton("hex");
binaryRB = new GRadioButton("binary");
ButtonGroup inputGroup = new ButtonGroup();
inputGroup.add(hexRB);
inputGroup.add(binaryRB);
@ -93,15 +94,17 @@ public class SelectionModeWidget extends ControlPanelWidget {
// 1. Get the whitespace map so we can restore it after conversion.
// 2. Get the group map so we can group bytes just as in the hex display.
// 3. Convert and display.
List<String> whitespaces = InstructionSearchUtils.getWhitespace(parent.getInputString().trim());
List<String> whitespaces =
InstructionSearchUtils.getWhitespace(parent.getInputString().trim());
List<Integer> groups;
try {
groups =
InstructionSearchUtils.getGroupSizes(parent.getInputString().trim(), InputMode.BINARY);
groups = InstructionSearchUtils.getGroupSizes(parent.getInputString().trim(),
InputMode.BINARY);
// Now convert whatever is in the input box to binary.
String hexStr = InstructionSearchUtils.toHex(parent.getInputString().trim(), true);
String hexStr =
InstructionSearchUtils.toHex(parent.getInputString().trim(), true);
// Restore grouping.
hexStr =
@ -139,15 +142,17 @@ public class SelectionModeWidget extends ControlPanelWidget {
// 1. Get the whitespace map so we can restore it after conversion.
// 2. Get the group map so we can group bytes just as in the hex display.
// 3. Convert and display.
List<String> whitespaces = InstructionSearchUtils.getWhitespace(parent.getInputString().trim());
List<String> whitespaces =
InstructionSearchUtils.getWhitespace(parent.getInputString().trim());
List<Integer> groups;
try {
groups =
InstructionSearchUtils.getGroupSizes(parent.getInputString().trim(), InputMode.HEX);
groups = InstructionSearchUtils.getGroupSizes(parent.getInputString().trim(),
InputMode.HEX);
// Now convert whatever is in the input box to binary.
String binaryStr = InstructionSearchUtils.toBinary(parent.getInputString().trim());
String binaryStr =
InstructionSearchUtils.toBinary(parent.getInputString().trim());
// Restore grouping.
binaryStr = restoreGroupingAndWhitespace(binaryStr, groups, whitespaces,
@ -176,9 +181,9 @@ public class SelectionModeWidget extends ControlPanelWidget {
inputMode = InputMode.HEX;
}
else if (binaryRB.isSelected()) {
inputMode = InputMode.BINARY;
inputMode = InputMode.BINARY;
}
return inputMode;
}

View File

@ -21,6 +21,7 @@ import java.util.*;
import javax.swing.*;
import docking.widgets.button.GRadioButton;
import ghidra.app.plugin.core.instructionsearch.InstructionSearchPlugin;
import ghidra.program.model.address.AddressRange;
import ghidra.program.model.address.AddressRangeIterator;
@ -36,7 +37,7 @@ public class SelectionScopeWidget extends ControlPanelWidget {
private JRadioButton searchSelectionRB;
// Stores the current search range settings.
private List<AddressRange> searchRanges = new ArrayList<AddressRange>();
private List<AddressRange> searchRanges = new ArrayList<>();
private InstructionSearchDialog dialog;
private InstructionSearchPlugin plugin;
@ -183,7 +184,7 @@ public class SelectionScopeWidget extends ControlPanelWidget {
* @return
*/
private JRadioButton createSearchRB(AbstractAction action, String name, String tooltip) {
JRadioButton button = new JRadioButton(action);
GRadioButton button = new GRadioButton(action);
button.setName(name);
button.setText(name);
button.setToolTipText(tooltip);

View File

@ -22,6 +22,7 @@ import javax.swing.*;
import javax.swing.event.*;
import docking.DialogComponentProvider;
import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.combobox.GhidraComboBox;
import docking.widgets.label.GDLabel;
@ -379,11 +380,11 @@ class AddBlockDialog extends DialogComponentProvider implements ChangeListener {
panel.setLayout(bl);
ButtonGroup radioGroup = new ButtonGroup();
initializedRB = new JRadioButton("Initialized", false);
initializedRB = new GRadioButton("Initialized", false);
initializedRB.setName(initializedRB.getText());
initializedRB.addActionListener(ev -> initializeRBChanged());
uninitializedRB = new JRadioButton("Uninitialized", true);
uninitializedRB = new GRadioButton("Uninitialized", true);
uninitializedRB.setName(uninitializedRB.getText());
uninitializedRB.addActionListener(ev -> uninitializedRBChanged());

View File

@ -21,6 +21,7 @@ import java.awt.event.*;
import javax.swing.*;
import docking.DialogComponentProvider;
import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GCheckBox;
import ghidra.util.HelpLocation;
@ -85,16 +86,16 @@ public class PrintOptionsDialog extends DialogComponentProvider {
group = new ButtonGroup();
selection = new JRadioButton("Selected area(s)");
selection = new GRadioButton("Selected area(s)");
selection.addKeyListener(key);
rangePanel.add(selection);
group.add(selection);
selection.setEnabled(selectionEnabled);
visible = new JRadioButton("Code visible on screen");
visible = new GRadioButton("Code visible on screen");
visible.addKeyListener(key);
rangePanel.add(visible);
group.add(visible);
view = new JRadioButton("Current view");
view = new GRadioButton("Current view");
view.addKeyListener(key);
rangePanel.add(view);
group.add(view);

View File

@ -15,15 +15,6 @@
*/
package ghidra.app.plugin.core.references;
import ghidra.framework.options.SaveState;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressSetView;
import ghidra.program.model.listing.CodeUnit;
import ghidra.program.model.listing.Program;
import ghidra.program.model.symbol.Reference;
import ghidra.util.HelpLocation;
import ghidra.util.exception.AssertException;
import java.awt.*;
import javax.swing.*;
@ -34,6 +25,15 @@ import javax.swing.event.ChangeListener;
import org.jdom.Element;
import docking.DialogComponentProvider;
import docking.widgets.button.GRadioButton;
import ghidra.framework.options.SaveState;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressSetView;
import ghidra.program.model.listing.CodeUnit;
import ghidra.program.model.listing.Program;
import ghidra.program.model.symbol.Reference;
import ghidra.util.HelpLocation;
import ghidra.util.exception.AssertException;
public class EditReferenceDialog extends DialogComponentProvider {
@ -98,26 +98,24 @@ public class EditReferenceDialog extends DialogComponentProvider {
JPanel topPanel = new JPanel(new BorderLayout());
instrPanel =
new InstructionPanel(5, 5, 5, 5, null, plugin,
new InstructionPanelListener() {
@Override
public boolean dropSupported() {
return false;
}
instrPanel = new InstructionPanel(5, 5, 5, 5, null, plugin, new InstructionPanelListener() {
@Override
public boolean dropSupported() {
return false;
}
@Override
public void operandSelected(int opIndex, int subIndex) {
if (!initializing) {
setAddOpIndex(opIndex, subIndex);
}
}
@Override
public void operandSelected(int opIndex, int subIndex) {
if (!initializing) {
setAddOpIndex(opIndex, subIndex);
}
}
@Override
public void selectionDropped(AddressSetView set, CodeUnit cu, int opIndex) {
throw new UnsupportedOperationException();
}
});
@Override
public void selectionDropped(AddressSetView set, CodeUnit cu, int opIndex) {
throw new UnsupportedOperationException();
}
});
topPanel.add(instrPanel, BorderLayout.NORTH);
JPanel refTypePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5));
@ -135,13 +133,13 @@ public class EditReferenceDialog extends DialogComponentProvider {
}
};
memRefChoice = new JRadioButton("Memory");
memRefChoice = new GRadioButton("Memory");
memRefChoice.addChangeListener(refChoiceListener);
extRefChoice = new JRadioButton("External");
extRefChoice = new GRadioButton("External");
extRefChoice.addChangeListener(refChoiceListener);
stackRefChoice = new JRadioButton("Stack");
stackRefChoice = new GRadioButton("Stack");
stackRefChoice.addChangeListener(refChoiceListener);
regRefChoice = new JRadioButton("Register");
regRefChoice = new GRadioButton("Register");
regRefChoice.addChangeListener(refChoiceListener);
ButtonGroup refChoices = new ButtonGroup();

View File

@ -24,6 +24,7 @@ import javax.swing.border.TitledBorder;
import docking.DialogComponentProvider;
import docking.DockingWindowManager;
import docking.help.HelpService;
import docking.widgets.button.GRadioButton;
import docking.widgets.label.GLabel;
import docking.widgets.textfield.IntegerTextField;
import ghidra.app.plugin.core.scalartable.RangeFilterTextField.FilterType;
@ -143,8 +144,8 @@ public class ScalarSearchDialog extends DialogComponentProvider {
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.setBorder(new TitledBorder("Search Scope"));
searchSelectionRadioButton = new JRadioButton("Search Selection");
searchAllRadioButton = new JRadioButton("Search All");
searchSelectionRadioButton = new GRadioButton("Search Selection");
searchAllRadioButton = new GRadioButton("Search All");
searchSelectionRadioButton.setToolTipText("Search only the current selection");
searchAllRadioButton.setToolTipText("Search the entire program");
@ -258,8 +259,8 @@ public class ScalarSearchDialog extends DialogComponentProvider {
setLayout(new BorderLayout());
setBorder(new TitledBorder("Search Type"));
searchAllScalars = new JRadioButton("Scalars in Range:");
searchAScalar = new JRadioButton("Specific Scalar:");
searchAllScalars = new GRadioButton("Scalars in Range:");
searchAScalar = new GRadioButton("Specific Scalar:");
searchAllScalars.setToolTipText(
"Search program (or selection) for scalar operands or defined scalar data types with values in the following range:");

View File

@ -15,9 +15,6 @@
*/
package ghidra.app.plugin.core.searchmem;
import ghidra.util.HTMLUtilities;
import ghidra.util.exception.AssertException;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -27,16 +24,20 @@ import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import docking.widgets.button.GRadioButton;
import ghidra.util.HTMLUtilities;
import ghidra.util.exception.AssertException;
public class DecimalSearchFormat extends SearchFormat {
private static final String MINUS_SIGN = "-";
private static final int BYTE = 0;
private static final int WORD = 1;
private static final int DWORD = 2;
private static final int QWORD = 3;
private static final int FLOAT = 4;
private static final int DOUBLE = 5;
private static final int WORD = 1;
private static final int DWORD = 2;
private static final int QWORD = 3;
private static final int FLOAT = 4;
private static final int DOUBLE = 5;
private int decimalFormat = WORD;
public DecimalSearchFormat(ChangeListener listener) {
@ -44,53 +45,59 @@ public class DecimalSearchFormat extends SearchFormat {
}
@Override
public String getToolTip() {
public String getToolTip() {
return HTMLUtilities.toHTML(
"Interpret values as a sequence of\n"+
"decimal numbers, separated by spaces");
"Interpret values as a sequence of\n" + "decimal numbers, separated by spaces");
}
private void setDecimalFormat(int format) {
decimalFormat = format;
changeListener.stateChanged(new ChangeEvent(this));
}
@Override
public JPanel getOptionsPanel() {
public JPanel getOptionsPanel() {
ButtonGroup decimalGroup = new ButtonGroup();
JRadioButton decimalByte = new JRadioButton("Byte", false);
JRadioButton decimalWord = new JRadioButton("Word", true);
JRadioButton decimalDWord = new JRadioButton("DWord", false);
JRadioButton decimalQWord = new JRadioButton("QWord", false);
JRadioButton decimalFloat = new JRadioButton("Float", false);
JRadioButton decimalDouble = new JRadioButton("Double", false);
GRadioButton decimalByte = new GRadioButton("Byte", false);
GRadioButton decimalWord = new GRadioButton("Word", true);
GRadioButton decimalDWord = new GRadioButton("DWord", false);
GRadioButton decimalQWord = new GRadioButton("QWord", false);
GRadioButton decimalFloat = new GRadioButton("Float", false);
GRadioButton decimalDouble = new GRadioButton("Double", false);
decimalByte.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) {
setDecimalFormat(BYTE);
}
});
decimalWord.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) {
setDecimalFormat(WORD);
}
});
decimalDWord.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) {
setDecimalFormat(DWORD);
}
});
decimalQWord.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) {
setDecimalFormat(QWORD);
}
});
decimalFloat.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) {
setDecimalFormat(FLOAT);
}
});
decimalDouble.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) {
setDecimalFormat(DOUBLE);
}
@ -111,35 +118,37 @@ public class DecimalSearchFormat extends SearchFormat {
decimalOptionsPanel.add(decimalQWord);
decimalOptionsPanel.add(decimalFloat);
decimalOptionsPanel.add(decimalDouble);
decimalOptionsPanel.setBorder(BorderFactory
.createTitledBorder("Format Options"));
decimalOptionsPanel.setBorder(BorderFactory.createTitledBorder("Format Options"));
return decimalOptionsPanel;
}
@Override
public SearchData getSearchData( String input ) {
List<Byte> bytesList = new ArrayList<Byte>();
public SearchData getSearchData(String input) {
List<Byte> bytesList = new ArrayList<>();
StringTokenizer tokenizer = new StringTokenizer(input);
while (tokenizer.hasMoreTokens()) {
String tok = tokenizer.nextToken();
if (tok.equals(MINUS_SIGN)) {
if ( !input.endsWith(MINUS_SIGN) ) {
return SearchData.createInvalidInputSearchData( "Cannot have space after a '-'" );
}
return SearchData.createIncompleteSearchData( "" );
}
try {
bytesList.addAll(getBytes(tok));
} catch (NumberFormatException ex) {
return SearchData.createInvalidInputSearchData("");
} catch ( RuntimeException re ) {
return SearchData.createInvalidInputSearchData(re.getMessage());
}
}
return SearchData.createSearchData( input, getDataBytes(bytesList), null );
while (tokenizer.hasMoreTokens()) {
String tok = tokenizer.nextToken();
if (tok.equals(MINUS_SIGN)) {
if (!input.endsWith(MINUS_SIGN)) {
return SearchData.createInvalidInputSearchData("Cannot have space after a '-'");
}
return SearchData.createIncompleteSearchData("");
}
try {
bytesList.addAll(getBytes(tok));
}
catch (NumberFormatException ex) {
return SearchData.createInvalidInputSearchData("");
}
catch (RuntimeException re) {
return SearchData.createInvalidInputSearchData(re.getMessage());
}
}
return SearchData.createSearchData(input, getDataBytes(bytesList), null);
}
private byte[] getDataBytes(List<Byte> bytesList) {
byte[] bytes = new byte[bytesList.size()];
for (int i = 0; i < bytes.length; i++) {
@ -149,10 +158,10 @@ public class DecimalSearchFormat extends SearchFormat {
}
private List<Byte> getBytes(long value, int n) {
List<Byte> list = new ArrayList<Byte>();
List<Byte> list = new ArrayList<>();
for(int i=0;i<n;i++) {
byte b = (byte)value;
for (int i = 0; i < n; i++) {
byte b = (byte) value;
list.add(new Byte(b));
value >>= 8;
}
@ -161,68 +170,66 @@ public class DecimalSearchFormat extends SearchFormat {
}
return list;
}
private void checkValue(long value, long min, long max) {
if ( value < min || value > max ) {
// I know, icky
throw new RuntimeException( "Number must be in the range [" + min + "," + max + "]" );
}
}
private List<Byte> getBytes(String tok) {
switch(decimalFormat) {
case BYTE:
long value = Short.parseShort(tok);
checkValue( value, Byte.MIN_VALUE, 255 );
return getBytes(value, 1);
case WORD:
value = Integer.parseInt(tok);
checkValue( value, Short.MIN_VALUE, 65535 );
return getBytes(value, 2);
case DWORD:
value = Long.parseLong(tok);
checkValue( value, Integer.MIN_VALUE, 4294967295l );
return getBytes(value, 4);
case QWORD:
value = Long.parseLong(tok);
return getBytes(value, 8);
case FLOAT:
tok = preProcessFloat(tok);
float floatValue = Float.parseFloat(tok);
value = Float.floatToIntBits(floatValue);
return getBytes(value, 4);
case DOUBLE:
tok = preProcessFloat(tok);
double dvalue = Double.parseDouble(tok);
value = Double.doubleToLongBits(dvalue);
return getBytes(value, 8);
default:
throw new AssertException("Unexpected format type");
}
}
/**
* Checks for parsable characters that we don't want to allow (dDfF) and removes
* the start of an exponent expression (example 2.34e would become 2.34. So woudl 2.34-)
* @param the string that will be parsed into a float or double
* @return the parsable string
* @exception NumberFormatException thrown if the the tok contains any of "dDfF".
*/
private String preProcessFloat(String tok) {
if ((tok.indexOf('d') >= 0) ||
(tok.indexOf('D') >= 0) ||
(tok.indexOf('F') >= 0) ||
(tok.indexOf('f') >= 0)) {
throw new NumberFormatException();
}
if (tok.endsWith("E") || tok.endsWith("e")) {
tok = tok.substring(0,tok.length()-1);
}
if (tok.endsWith("E-") || tok.endsWith("e-")) {
tok = tok.substring(0,tok.length()-2);
}
return tok;
}
private void checkValue(long value, long min, long max) {
if (value < min || value > max) {
// I know, icky
throw new RuntimeException("Number must be in the range [" + min + "," + max + "]");
}
}
private List<Byte> getBytes(String tok) {
switch (decimalFormat) {
case BYTE:
long value = Short.parseShort(tok);
checkValue(value, Byte.MIN_VALUE, 255);
return getBytes(value, 1);
case WORD:
value = Integer.parseInt(tok);
checkValue(value, Short.MIN_VALUE, 65535);
return getBytes(value, 2);
case DWORD:
value = Long.parseLong(tok);
checkValue(value, Integer.MIN_VALUE, 4294967295l);
return getBytes(value, 4);
case QWORD:
value = Long.parseLong(tok);
return getBytes(value, 8);
case FLOAT:
tok = preProcessFloat(tok);
float floatValue = Float.parseFloat(tok);
value = Float.floatToIntBits(floatValue);
return getBytes(value, 4);
case DOUBLE:
tok = preProcessFloat(tok);
double dvalue = Double.parseDouble(tok);
value = Double.doubleToLongBits(dvalue);
return getBytes(value, 8);
default:
throw new AssertException("Unexpected format type");
}
}
/**
* Checks for parsable characters that we don't want to allow (dDfF) and removes
* the start of an exponent expression (example 2.34e would become 2.34. So woudl 2.34-)
* @param the string that will be parsed into a float or double
* @return the parsable string
* @exception NumberFormatException thrown if the the tok contains any of "dDfF".
*/
private String preProcessFloat(String tok) {
if ((tok.indexOf('d') >= 0) || (tok.indexOf('D') >= 0) || (tok.indexOf('F') >= 0) ||
(tok.indexOf('f') >= 0)) {
throw new NumberFormatException();
}
if (tok.endsWith("E") || tok.endsWith("e")) {
tok = tok.substring(0, tok.length() - 1);
}
if (tok.endsWith("E-") || tok.endsWith("e-")) {
tok = tok.substring(0, tok.length() - 2);
}
return tok;
}
}

View File

@ -27,6 +27,7 @@ import javax.swing.event.ChangeListener;
import javax.swing.text.*;
import docking.*;
import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.combobox.GhidraComboBox;
import docking.widgets.label.GDLabel;
@ -396,8 +397,8 @@ class MemSearchDialog extends DialogComponentProvider {
private Container buildEndienessPanel() {
ButtonGroup endianGroup = new ButtonGroup();
littleEndian = new JRadioButton("Little Endian", true);
bigEndian = new JRadioButton("Big Endian", false);
littleEndian = new GRadioButton("Little Endian", true);
bigEndian = new GRadioButton("Big Endian", false);
endianGroup.add(bigEndian);
endianGroup.add(littleEndian);
@ -450,8 +451,8 @@ class MemSearchDialog extends DialogComponentProvider {
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.setBorder(new TitledBorder("Selection Scope"));
searchSelectionRadioButton = new JRadioButton("Search Selection");
searchAllRadioButton = new JRadioButton("Search All");
searchSelectionRadioButton = new GRadioButton("Search Selection");
searchAllRadioButton = new GRadioButton("Search All");
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(searchSelectionRadioButton);
@ -497,7 +498,7 @@ class MemSearchDialog extends DialogComponentProvider {
};
for (SearchFormat element : allFormats) {
JRadioButton formatButton = new JRadioButton(element.getName(), true);
GRadioButton formatButton = new GRadioButton(element.getName(), true);
formatButton.setToolTipText(element.getToolTip());
formatGroup.add(formatButton);
@ -574,8 +575,8 @@ class MemSearchDialog extends DialogComponentProvider {
*/
private JPanel buildExtrasPanel() {
ButtonGroup memoryBlockGroup = new ButtonGroup();
loadedBlocks = new JRadioButton("Loaded Blocks", true);
allBlocks = new JRadioButton("All Blocks", false);
loadedBlocks = new GRadioButton("Loaded Blocks", true);
allBlocks = new GRadioButton("All Blocks", false);
memoryBlockGroup.add(loadedBlocks);
memoryBlockGroup.add(allBlocks);

View File

@ -26,6 +26,7 @@ import javax.swing.border.Border;
import javax.swing.text.*;
import docking.*;
import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.combobox.GhidraComboBox;
import docking.widgets.label.GLabel;
@ -345,14 +346,14 @@ class SearchTextDialog extends DialogComponentProvider {
JPanel radioPanel = new JPanel(new VerticalLayout(10));
ButtonGroup bg = new ButtonGroup();
searchFieldRB = new JRadioButton("Selected Fields", true);
searchFieldRB = new GRadioButton("Selected Fields", true);
searchFieldRB.setToolTipText(HTMLUtilities.toHTML("Search for specific fields. Use the\n" +
"checkboxes to mark which fields to search.\n" +
"This option applies to either the Program Database Search\n" +
"or the Listing Display Match Search.\n\n" +
"NOTE: Selecting all of these fields is NOT the same as selecting \"All Fields\".\n"));
searchAllRB = new JRadioButton("All Fields", false);
searchAllRB = new GRadioButton("All Fields", false);
searchAllRB.setToolTipText(
HTMLUtilities.toHTML("Search all the fields displayed in the Code Browser.\n" +
"The option applies only to the Listing Display Search."));
@ -389,7 +390,7 @@ class SearchTextDialog extends DialogComponentProvider {
ButtonGroup bg = new ButtonGroup();
programDatabaseSearchRB = new JRadioButton("Program Database", true);
programDatabaseSearchRB = new GRadioButton("Program Database", true);
programDatabaseSearchRB.setToolTipText(HTMLUtilities.toHTML(
"Searches comments, labels, instructions, function signatures, and data stored in the" +
" program database.\n This search is much faster, but does not search all text displayed in the Code Browser\n" +
@ -406,7 +407,7 @@ class SearchTextDialog extends DialogComponentProvider {
changingState = false;
});
listingDisplaySearchRB = new JRadioButton("Listing Display", false);
listingDisplaySearchRB = new GRadioButton("Listing Display", false);
listingDisplaySearchRB.setToolTipText(
HTMLUtilities.toHTML("Searches the text displayed in the Code Browser\n" +
"Listing Display. (Depending on which fields are selected)\n" +
@ -433,9 +434,9 @@ class SearchTextDialog extends DialogComponentProvider {
directionPanel.setBorder(BorderFactory.createTitledBorder("Memory Block Types"));
ButtonGroup directionGroup = new ButtonGroup();
loadedBlocksButton = new JRadioButton("Loaded Blocks", true);
loadedBlocksButton = new GRadioButton("Loaded Blocks", true);
allBlocksButton = new JRadioButton("All Blocks", false);
allBlocksButton = new GRadioButton("All Blocks", false);
loadedBlocksButton.setToolTipText(HTMLUtilities.toHTML(
"Only searches memory blocks that are loaded in a running executable.\n " +
"Ghidra now includes memory blocks for other data such as section headers.\n" +

View File

@ -24,6 +24,7 @@ import javax.swing.*;
import docking.ComponentProvider;
import docking.DialogComponentProvider;
import docking.widgets.button.GRadioButton;
import docking.widgets.label.GLabel;
import docking.widgets.textfield.IntegerTextField;
import ghidra.app.nav.Navigatable;
@ -116,7 +117,7 @@ class SelectBlockDialog extends DialogComponentProvider {
gbc.insets = new Insets(2, 2, 2, 2);
gbc.anchor = GridBagConstraints.WEST;
forwardButton = new JRadioButton("Select Forward", true);
forwardButton = new GRadioButton("Select Forward", true);
forwardButton.setName("forwardButton");
forwardButton.addActionListener(new ActionListener() {
@Override
@ -127,7 +128,7 @@ class SelectBlockDialog extends DialogComponentProvider {
}
});
buttonGroup.add(forwardButton);
backwardButton = new JRadioButton("Select Backward");
backwardButton = new GRadioButton("Select Backward");
backwardButton.setName("backwardButton");
backwardButton.addActionListener(new ActionListener() {
@Override
@ -138,7 +139,7 @@ class SelectBlockDialog extends DialogComponentProvider {
}
});
buttonGroup.add(backwardButton);
allButton = new JRadioButton("Select All");
allButton = new GRadioButton("Select All");
allButton.setName("allButton");
allButton.addActionListener(new ActionListener() {
@Override
@ -149,7 +150,7 @@ class SelectBlockDialog extends DialogComponentProvider {
});
buttonGroup.add(allButton);
toButton = new JRadioButton("To Address");
toButton = new GRadioButton("To Address");
toButton.setName("toButton");
toButton.addActionListener(new ActionListener() {
@Override

View File

@ -26,6 +26,7 @@ import javax.swing.border.TitledBorder;
import docking.DialogComponentProvider;
import docking.options.editor.ButtonPanelFactory;
import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.filechooser.GhidraFileChooser;
import docking.widgets.label.GLabel;
@ -267,8 +268,8 @@ public class SearchStringDialog extends DialogComponentProvider {
panel.setBorder(BorderFactory.createTitledBorder("Memory Block Types"));
ButtonGroup memoryBlockGroup = new ButtonGroup();
loadedBlocksRB = new JRadioButton("Loaded Blocks", true);
allBlocksRB = new JRadioButton("All Blocks", false);
loadedBlocksRB = new GRadioButton("Loaded Blocks", true);
allBlocksRB = new GRadioButton("All Blocks", false);
memoryBlockGroup.add(loadedBlocksRB);
memoryBlockGroup.add(allBlocksRB);
@ -296,8 +297,8 @@ public class SearchStringDialog extends DialogComponentProvider {
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.setBorder(new TitledBorder("Selection Scope"));
searchSelectionRB = new JRadioButton("Search Selection");
searchAllRB = new JRadioButton("Search All");
searchSelectionRB = new GRadioButton("Search Selection");
searchAllRB = new GRadioButton("Search All");
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(searchSelectionRB);

View File

@ -28,6 +28,7 @@ import javax.swing.table.TableColumnModel;
import org.apache.commons.lang3.StringUtils;
import docking.DialogComponentProvider;
import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.filter.FilterListener;
import docking.widgets.label.GDLabel;
@ -229,16 +230,16 @@ public class SetEquateDialog extends DialogComponentProvider {
titleLabel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
//long value = scalar.getSignedValue();
applyToCurrent = new JRadioButton("Current location", true);
applyToCurrent = new GRadioButton("Current location", true);
applyToCurrent.setName("applyToCurrent");
applyToCurrent.setToolTipText("Apply to current scalar operand only");
applyToSelection = new JRadioButton("Current selection", false);
applyToSelection = new GRadioButton("Current selection", false);
applyToSelection.setName("applyToSelection");
applyToSelection.setToolTipText(
"Apply to all matching, defined scalar code " + "units in current selection.");
applyToAll = new JRadioButton("Entire program", false);
applyToAll = new GRadioButton("Entire program", false);
applyToAll.setName("applyToAll");
applyToAll.setToolTipText(
"Apply to all matching, defined scalar code units " + "in entire program.");

View File

@ -21,6 +21,7 @@ import javax.swing.*;
import javax.swing.border.Border;
import docking.widgets.*;
import docking.widgets.button.GRadioButton;
import docking.widgets.label.GLabel;
import docking.widgets.textfield.IntegerTextField;
import generic.jar.ResourceFile;
@ -61,7 +62,7 @@ public class GhidraScriptSelectionDialog extends ListSelectionDialog<ResourceFil
private JComponent createButtonComponent(AnalyzerType type) {
JPanel panel = new JPanel(new HorizontalLayout(1));
Icon icon = AnalyzerUtil.getIcon(type);
JRadioButton button = new JRadioButton();
GRadioButton button = new GRadioButton();
button.setActionCommand(type.name());
button.setToolTipText(type.getDescription());
if (buttonGroup == null) {

View File

@ -20,6 +20,7 @@ import java.awt.Component;
import javax.swing.*;
import docking.DockingWindowManager;
import docking.widgets.button.GRadioButton;
import docking.widgets.label.GLabel;
import docking.widgets.textfield.IntegerTextField;
import ghidra.closedpatternmining.SequenceMiningParams;
@ -97,9 +98,9 @@ public class SequenceMiningParamsInputDialog extends InputDialogComponentProvide
boolean useBinary = Boolean.parseBoolean(
Preferences.getProperty(BINARY_SEQUENCES_PROPERTY, BINARY_SEQUENCES_DEFAULT));
binaryButton = new JRadioButton(BINARY_BUTTON_TEXT, useBinary);
binaryButton = new GRadioButton(BINARY_BUTTON_TEXT, useBinary);
binaryButton.setMnemonic(BINARY_MNEMONIC);
nibbleButton = new JRadioButton(NIBBLE_BUTTON_TEXT, !useBinary);
nibbleButton = new GRadioButton(NIBBLE_BUTTON_TEXT, !useBinary);
nibbleButton.setMnemonic(NIBBLE_MNEMONIC);
mainPanel.add(binaryButton);
mainPanel.add(nibbleButton);

View File

@ -400,10 +400,9 @@ public class VTMarkupItemsTableProvider extends ComponentProviderAdapter
JComponent nameFilterPanel = createTextFilterPanel();
parentPanel.add(nameFilterPanel, BorderLayout.CENTER);
ancillaryFilterButton = new JButton();
ancillaryFilterButton = new JButton(FILTER_ICON);
ancillaryFilterButton.addActionListener(
e -> tool.showDialog(ancillaryFilterDialog, component));
ancillaryFilterButton.setIcon(FILTER_ICON);
ancillaryFilterButton.setToolTipText("Filters Dialog");
parentPanel.add(ancillaryFilterButton, BorderLayout.EAST);

View File

@ -28,6 +28,7 @@ import javax.swing.border.TitledBorder;
import docking.DockingWindowManager;
import docking.help.HelpService;
import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.combobox.GComboBox;
import docking.widgets.label.GDLabel;
@ -843,7 +844,7 @@ public class ApplyMarkupPropertyEditor implements OptionsEditor {
}
private JRadioButton createRadioButton(final String optionName) {
final JRadioButton applyRadioButton = new JRadioButton(optionName);
final GRadioButton applyRadioButton = new GRadioButton(optionName);
applyRadioButton.addActionListener(e -> changesMade(true));
return applyRadioButton;

View File

@ -352,10 +352,9 @@ public class VTMatchTableProvider extends ComponentProviderAdapter
JComponent lengthFilterPanel = createLengthFilterPanel();
innerPanel.add(lengthFilterPanel);
ancillaryFilterButton = new JButton();
ancillaryFilterButton = new JButton(UNFILTERED_ICON);
ancillaryFilterButton.addActionListener(
e -> tool.showDialog(ancillaryFilterDialog, component));
ancillaryFilterButton.setIcon(UNFILTERED_ICON);
ancillaryFilterButton.setToolTipText("Filters Dialog");
HelpService helpService = DockingWindowManager.getHelpService();
HelpLocation filterHelpLocation =

View File

@ -25,6 +25,7 @@ import javax.swing.*;
import javax.swing.event.*;
import docking.DockingUtils;
import docking.widgets.button.GRadioButton;
import docking.widgets.label.GLabel;
import ghidra.framework.plugintool.PluginTool;
import ghidra.program.model.address.*;
@ -119,9 +120,9 @@ public class ChooseAddressSetEditorPanel extends JPanel {
JPanel chooseSourcePanel = new JPanel(new VerticalLayout(5));
ButtonGroup originGroup = new ButtonGroup();
entireProgramButton = new JRadioButton("Use Entire " + name + " Program", false);
toolSelectionButton = new JRadioButton("Use " + name + " Tool's Selection", false);
myRangesButton = new JRadioButton("Specify My Own Address Ranges", false);
entireProgramButton = new GRadioButton("Use Entire " + name + " Program", false);
toolSelectionButton = new GRadioButton("Use " + name + " Tool's Selection", false);
myRangesButton = new GRadioButton("Specify My Own Address Ranges", false);
originGroup.add(entireProgramButton);
originGroup.add(toolSelectionButton);
originGroup.add(myRangesButton);

View File

@ -27,6 +27,9 @@ import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.undo.UndoableEdit;
import org.apache.commons.lang3.StringUtils;
import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.checkbox.GHtmlCheckBox;
import docking.widgets.combobox.GComboBox;
@ -38,7 +41,9 @@ import docking.widgets.table.GTableCellRenderer;
import docking.widgets.tree.support.GTreeRenderer;
import ghidra.docking.util.DockingWindowsLookAndFeelUtils;
import ghidra.util.HTMLUtilities;
import ghidra.util.Msg;
import resources.ResourceManager;
import utilities.util.reflection.ReflectionUtilities;
/**
* <h1>Notes about how to use HTML safely:</h1>
@ -87,6 +92,7 @@ import resources.ResourceManager;
* <tr><td>{@link ListCellRenderer}<br>{@link DefaultListCellRenderer}</td><td>{@link GListCellRenderer}</td></tr>
* <tr><td>{@link TableCellRenderer}</td><td>{@link GTableCellRenderer}</td></tr>
* <tr><td>{@link TreeCellRenderer}<br>{@link DefaultTreeCellRenderer}</td><td>{@link GTreeRenderer}<br>{@link DnDTreeCellRenderer}</td></tr>
* <tr><td>{@link JRadioButton}</td><td>{@link GRadioButton}</td></tr>
* <tr><td>{@link JButton}</td><td>???tbd???</td></tr>
* </table>
*/
@ -133,6 +139,22 @@ public class DockingUtils {
return separator;
}
/**
* Helper function that logs a warning about a string text that looks like it has HTML text.
* <p>
* Use this when working with a string in a label that has already disabled HTML rendering.
* <p>
* @param text string to test for HTML and warn about
*/
public static void warnAboutHtmlText(String text) {
// #ifdef still_finding_html_labels_in_our_huge_codebase
if (StringUtils.startsWithIgnoreCase(text, "<html>")) {
Msg.warn(GLabel.class, "HTML text detected in non-HTML component: " + text,
ReflectionUtilities.createJavaFilteredThrowable());
}
// #endif
}
/**
* Turns off the HTML rendering in the specified component.
*

View File

@ -142,8 +142,7 @@ public class ErrLogDialog extends DialogComponentProvider {
sendButton.addActionListener(e -> sendDetails());
detailsPanel = new ErrorDetailsPanel();
String text = isShowingDetails ? CLOSE : DETAIL;
detailsButton = new JButton(text);
detailsButton = new JButton(isShowingDetails ? CLOSE : DETAIL);
detailsButton.addActionListener(e -> {
String label = detailsButton.getText();
showDetails(label.equals(DETAIL));

View File

@ -37,25 +37,21 @@ import docking.widgets.label.GDLabel;
public class FontPropertyEditor extends PropertyEditorSupport {
private Font font;
// private JLabel previewLabel = new GDLabel();
private JButton previewButton = new JButton();
private final static String SAMPLE_STRING = "ABCabc \u00a9\u00ab\u00a7\u0429\u05d1\u062c\u4eb9";
private JButton previewButton = new JButton(SAMPLE_STRING);
/**
* The default constructor.
*
*/
public FontPropertyEditor() {
previewButton.setText(SAMPLE_STRING);
previewButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// show the editor to get the user value
showDialog();
previewButton.addActionListener(e -> {
// show the editor to get the user value
showDialog();
// now set the new value
previewButton.setFont(font);
}
// now set the new value
previewButton.setFont(font);
});
// previewLabel.addMouseListener( new MouseAdapter() {

View File

@ -23,6 +23,7 @@ import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import docking.DialogComponentProvider;
import docking.widgets.button.GRadioButton;
import docking.widgets.combobox.GhidraComboBox;
import docking.widgets.label.GLabel;
@ -63,8 +64,8 @@ public class FindDialog extends DialogComponentProvider {
private JPanel buildMainPanel() {
ButtonGroup formatGroup = new ButtonGroup();
stringRadioButton = new JRadioButton("String", true);
regexRadioButton = new JRadioButton("Regular Expression", false);
stringRadioButton = new GRadioButton("String", true);
regexRadioButton = new GRadioButton("Regular Expression", false);
formatGroup.add(stringRadioButton);
formatGroup.add(regexRadioButton);

View File

@ -0,0 +1,118 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package docking.widgets.button;
import javax.swing.*;
import docking.DockingUtils;
/**
* A {@link JRadioButton} that disables HTML rendering.
*
*/
public class GRadioButton extends JRadioButton {
/**
* Creates a blank radio button with HTML rendering disabled.
*/
public GRadioButton() {
super();
init();
}
/**
* Creates a radio button with the specified icon, with HTML rendering disabled.
*
* @param icon image to display
*/
public GRadioButton(Icon icon) {
super(icon);
init();
}
/**
* Creates a radio button with properties taken from the specified Action, with HTML rendering
* disabled.
*
* @param a {@link Action}
*/
public GRadioButton(Action a) {
super(a);
init();
}
/**
* Creates a radio button with the specified icon and selected state, with HTML rendering
* disabled.
*
* @param icon image to display
* @param selected initial selection state, true means selected
*/
public GRadioButton(Icon icon, boolean selected) {
super(icon, selected);
init();
}
/**
* Creates a radio button with the specified text, with HTML rendering disabled.
*
* @param text string to be displayed by the label
*/
public GRadioButton(String text) {
super(text);
init();
}
/**
* Creates a radio button with the specified text and selected state, with HTML rendering
* disabled.
*
* @param text string to be displayed by the label
* @param selected initial selection state, true means selected
*/
public GRadioButton(String text, boolean selected) {
super(text, selected);
init();
}
/**
* Creates a radio button that has the specified text and icon, with HTML rendering disabled.
*
* @param text string to be displayed by the label
* @param icon image to display
*/
public GRadioButton(String text, Icon icon) {
super(text, icon);
init();
}
/**
* Creates a radio button that has the specified text, icon, and selected state, with
* HTML rendering disabled.
*
* @param text string to be displayed by the label
* @param icon image to display
* @param selected initial selection state, true means selected
*/
public GRadioButton(String text, Icon icon, boolean selected) {
super(text, icon, selected);
init();
}
private void init() {
DockingUtils.turnOffHTMLRendering(this);
}
}

View File

@ -136,4 +136,16 @@ public class GCheckBox extends JCheckBox {
DockingUtils.turnOffHTMLRendering(this);
}
/**
* See {@link JCheckBox#setText(String)}.
* <p>
* Overridden to warn about HTML text in non-HTML enabled checkbox.
*
* @param text string this label will display
*/
@Override
public void setText(String text) {
DockingUtils.warnAboutHtmlText(text);
super.setText(text);
}
}

View File

@ -27,6 +27,7 @@ import javax.swing.border.EmptyBorder;
import docking.DialogComponentProvider;
import docking.DisabledComponentLayerFactory;
import docking.widgets.InlineComponentTitledPanel;
import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.combobox.GComboBox;
import docking.widgets.label.GIconLabel;
@ -148,10 +149,10 @@ public class FilterOptionsEditorDialog extends DialogComponentProvider {
setLayout(new PairLayout(2, 2));
setBorder(BorderFactory.createTitledBorder("Text Filter Strategy"));
ButtonGroup buttonGroup = new ButtonGroup();
JRadioButton startsWithButton = new JRadioButton("Starts With");
JRadioButton containsButton = new JRadioButton("Contains");
JRadioButton matchesExactlyButton = new JRadioButton("Matches Exactly");
JRadioButton regularExpressionButton = new JRadioButton("Regular Expression");
GRadioButton startsWithButton = new GRadioButton("Starts With");
GRadioButton containsButton = new GRadioButton("Contains");
GRadioButton matchesExactlyButton = new GRadioButton("Matches Exactly");
GRadioButton regularExpressionButton = new GRadioButton("Regular Expression");
startsWithButton.setToolTipText(
"The filter will match all entries that start with the entered filter text.");
@ -437,7 +438,7 @@ public class FilterOptionsEditorDialog extends DialogComponentProvider {
ButtonGroup modeBtnGroup = new ButtonGroup();
MultitermEvaluationMode[] modes = MultitermEvaluationMode.values();
for (MultitermEvaluationMode mode : modes) {
JRadioButton modeRB = new JRadioButton(mode.name());
GRadioButton modeRB = new GRadioButton(mode.name());
modeRB.setToolTipText(mode.getDescription());
modeRB.addActionListener(e -> {
evalMode = MultitermEvaluationMode.valueOf(mode.name());

View File

@ -106,7 +106,7 @@ public class GDLabel extends JLabel {
@Override
public void setText(String text) {
GLabel.warnAboutHtmlText(text);
DockingUtils.warnAboutHtmlText(text);
super.setText(text);
}

View File

@ -155,24 +155,8 @@ public class GLabel extends JLabel {
ReflectionUtilities.createJavaFilteredThrowable());
return;
}
warnAboutHtmlText(text);
DockingUtils.warnAboutHtmlText(text);
super.setText(text);
}
/**
* Helper function that logs a warning about a string text that looks like it has HTML text.
* <p>
* Use this when working with a string in a label that has already disabled HTML rendering.
* <p>
* @param text string to test for HTML and warn about
*/
public static void warnAboutHtmlText(String text) {
// #ifdef still_finding_html_labels_in_our_huge_codebase
if (StringUtils.startsWithIgnoreCase(text, "<html>")) {
Msg.warn(GLabel.class, "HTML text detected in non-HTML component: " + text,
ReflectionUtilities.createJavaFilteredThrowable());
}
// #endif
}
}

View File

@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -29,48 +28,50 @@ import javax.swing.JCheckBox;
*/
public class PropertyBoolean extends JCheckBox implements ItemListener {
private PropertyEditor editor;
private boolean notifyEditorOfChanges = true;
private PropertyEditor editor;
private boolean notifyEditorOfChanges = true;
/**
* Constructor new PropertyText.
* @param pe bean property editor that is used to get the value
* to show in the text field
*/
public PropertyBoolean(PropertyEditor pe) {
super();
setSelected((Boolean)pe.getValue());
editor = pe;
addItemListener( this);
editor.addPropertyChangeListener(new PropertyChangeListener() {
public PropertyBoolean(PropertyEditor pe) {
super();
setSelected((Boolean) pe.getValue());
editor = pe;
addItemListener(this);
editor.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
Object value = editor.getValue();
if ((value instanceof Boolean) && !value.equals(getText())) {
notifyEditorOfChanges = false;
try {
setSelected((Boolean)value);
setSelected((Boolean) value);
}
finally {
notifyEditorOfChanges = true;
}
}
}
});
}
});
}
//----------------------------------------------------------------------
// Change listener methods.
public void itemStateChanged(ItemEvent e) {
if (notifyEditorOfChanges) {
try {
editor.setValue(isSelected() ? Boolean.TRUE : Boolean.FALSE);
} catch (IllegalArgumentException ex) {
// Quietly ignore.
//----------------------------------------------------------------------
// Change listener methods.
@Override
public void itemStateChanged(ItemEvent e) {
if (notifyEditorOfChanges) {
try {
editor.setValue(isSelected() ? Boolean.TRUE : Boolean.FALSE);
}
}
}
catch (IllegalArgumentException ex) {
// Quietly ignore.
}
}
}
}

View File

@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -21,10 +20,10 @@ import java.awt.event.ItemListener;
import javax.swing.*;
import docking.widgets.button.GRadioButton;
import docking.wizard.AbstractWizardJPanel;
import docking.wizard.PanelManager;
import ghidra.app.util.*;
import ghidra.app.util.GenericHelpTopics;
import ghidra.util.HelpLocation;
import ghidra.util.layout.VerticalLayout;
@ -47,29 +46,29 @@ class ProjectTypePanel extends AbstractWizardJPanel {
buildPanel();
setBorder(NewProjectPanelManager.EMPTY_BORDER);
}
private void buildPanel() {
JPanel innerPanel = new JPanel(new VerticalLayout(10));
innerPanel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
ItemListener listener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
panelManager.getWizardManager().validityChanged();
}
};
nonSharedRB = new JRadioButton("Non-Shared Project", true);
nonSharedRB = new GRadioButton("Non-Shared Project", true);
nonSharedRB.addItemListener(listener);
nonSharedRB.setToolTipText("Create a project that is not shared with others");
sharedRB = new JRadioButton("Shared Project");
sharedRB = new GRadioButton("Shared Project");
sharedRB.addItemListener(listener);
sharedRB.setToolTipText("Create a project that can be shared with others");
buttonGroup = new ButtonGroup();
buttonGroup.add(nonSharedRB);
buttonGroup.add(sharedRB);
innerPanel.add(nonSharedRB);
innerPanel.add(sharedRB);
JPanel outerPanel = new JPanel();
@ -77,17 +76,19 @@ class ProjectTypePanel extends AbstractWizardJPanel {
outerPanel.add(innerPanel);
add(outerPanel);
}
/* (non-Javadoc)
* @see ghidra.util.bean.wizard.WizardPanel#getTitle()
*/
@Override
public String getTitle() {
return "Select Project Type";
}
/* (non-Javadoc)
* @see ghidra.util.bean.wizard.WizardPanel#initialize()
*/
@Override
public void initialize() {
buttonGroup.remove(sharedRB);
buttonGroup.remove(nonSharedRB);
@ -96,22 +97,23 @@ class ProjectTypePanel extends AbstractWizardJPanel {
buttonGroup.add(nonSharedRB);
buttonGroup.add(sharedRB);
}
/**
* Return true if the user has entered a valid project file
*/
*/
@Override
public boolean isValidInformation() {
return sharedRB.isSelected() || nonSharedRB.isSelected();
}
/* (non-Javadoc)
* @see ghidra.util.bean.wizard.WizardPanel#getHelpLocation()
*/
@Override
public HelpLocation getHelpLocation() {
public HelpLocation getHelpLocation() {
return new HelpLocation(GenericHelpTopics.FRONT_END, "SelectProjectType");
}
boolean isSharedProject() {
return sharedRB.isSelected();
}

View File

@ -27,6 +27,7 @@ import javax.swing.event.*;
import docking.DialogComponentProvider;
import docking.DockingUtils;
import docking.widgets.button.GRadioButton;
import docking.widgets.label.GDLabel;
import docking.widgets.label.GLabel;
import ghidra.framework.client.*;
@ -190,12 +191,12 @@ class RepositoryChooser extends DialogComponentProvider {
}
};
serverInfoChoice = new JRadioButton("Ghidra Server");
serverInfoChoice = new GRadioButton("Ghidra Server");
serverInfoChoice.setSelected(true);
serverInfoChoice.addChangeListener(choiceListener);
radioButtonPanel.add(serverInfoChoice);
urlChoice = new JRadioButton("Ghidra URL");
urlChoice = new GRadioButton("Ghidra URL");
urlChoice.addChangeListener(choiceListener);
radioButtonPanel.add(urlChoice);

View File

@ -23,6 +23,7 @@ import javax.swing.*;
import javax.swing.event.*;
import docking.DockingUtils;
import docking.widgets.button.GRadioButton;
import docking.widgets.label.GDLabel;
import docking.wizard.*;
import ghidra.app.util.GenericHelpTopics;
@ -147,7 +148,7 @@ public class RepositoryPanel extends AbstractWizardJPanel {
private JPanel createListPanel(String[] repositoryNames) {
JPanel panel = new JPanel(new VerticalLayout(5));
panel.setBorder(BorderFactory.createTitledBorder("Choose Existing Repository"));
existingRepButton = new JRadioButton("Existing Repository", (repositoryNames.length > 0));
existingRepButton = new GRadioButton("Existing Repository", (repositoryNames.length > 0));
existingRepButton.setEnabled(repositoryNames.length > 0);
buttonGroup.add(existingRepButton);
@ -177,7 +178,7 @@ public class RepositoryPanel extends AbstractWizardJPanel {
namePanel.setLayout(new VerticalLayout(5));
namePanel.setBorder(BorderFactory.createTitledBorder("Create Repository"));
createRepButton = new JRadioButton("Create Repository", !existingRepButton.isSelected());
createRepButton = new GRadioButton("Create Repository", !existingRepButton.isSelected());
buttonGroup.add(createRepButton);
nameLabel = new GDLabel("Repository Name:", SwingConstants.RIGHT);

View File

@ -25,6 +25,7 @@ import javax.swing.*;
import docking.DialogComponentProvider;
import docking.widgets.OptionDialog;
import docking.widgets.button.GRadioButton;
import docking.widgets.label.GHtmlLabel;
import ghidra.framework.model.Tool;
import ghidra.util.HTMLUtilities;
@ -75,7 +76,7 @@ public class SelectChangedToolDialog extends DialogComponentProvider {
ButtonGroup buttonGroup = new ButtonGroup();
JRadioButton noneButton = new JRadioButton("None");
GRadioButton noneButton = new GRadioButton("None");
ItemListener listener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
@ -87,7 +88,7 @@ public class SelectChangedToolDialog extends DialogComponentProvider {
panel.add(noneButton);
for (final Tool tool : toolList) {
JRadioButton radioButton = new JRadioButton(tool.getName());
GRadioButton radioButton = new GRadioButton(tool.getName());
radioButton.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {

View File

@ -23,6 +23,7 @@ import java.io.IOException;
import javax.swing.*;
import docking.framework.DockingApplicationConfiguration;
import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GCheckBox;
import generic.concurrent.GThreadPool;
import ghidra.GhidraApplicationLayout;
@ -69,10 +70,10 @@ public class TaskSimulator {
JButton addGroupButton = new JButton("Add Group");
JButton addTaskButton = new JButton("Add Task");
JButton showResultsButton = new JButton("Show Results");
lowButton = new JRadioButton("Low");
mediumButton = new JRadioButton("Medium");
highButton = new JRadioButton("High");
urgentButton = new JRadioButton("Urgent");
lowButton = new GRadioButton("Low");
mediumButton = new GRadioButton("Medium");
highButton = new GRadioButton("High");
urgentButton = new GRadioButton("Urgent");
ButtonGroup group = new ButtonGroup();
group.add(lowButton);
group.add(mediumButton);