javax.swing.event.ChangeListener Java Examples

The following examples show how to use javax.swing.event.ChangeListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SymbolMerger.java    From ghidra with Apache License 2.0 7 votes vote down vote up
protected VerticalChoicesPanel getConflictPanel(int conflictType, ChangeListener listener) {
		// Re-use the same conflict panel
		if (conflictPanel == null) {
			conflictPanel = new VerticalChoicesPanel();
			currentConflictPanel = conflictPanel;
			conflictPanel.setTitle("Symbol");
		}
		switch (conflictType) {
			case REMOVE_CONFLICT:
				return getRemoveConflictPanel(currentSymbol, listener);
			case RENAME_CONFLICT:
				return getRenameConflictPanel(currentSymbol, listener);
//			case COMMENT_CONFLICT:
//				return getCommentConflictPanel(currentSymbol, listener);
//			case ADD_COMMENT_CONFLICT:
//				return getAddCommentConflictPanel(currentSymbol, listener);
			case NAMESPACE_CONFLICT:
				return getNamespaceConflictPanel(currentNamespace, currentSymbolName, listener);
			case ADDRESS_CONFLICT:
				return getAddressConflictPanel(currentAddress, currentSymbolName, listener);
			case PRIMARY_CONFLICT:
				return getPrimaryConflictPanel(currentAddress, listener);
			default:
				return null;
		}
	}
 
Example #2
Source File: CustomClientResizingProfilePanel.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
private JPanel createPositionPanel(int width, int height)
{
	JPanel dimensionPanel = new JPanel();
	dimensionPanel.setLayout(new BorderLayout());

	JSpinner widthSpinner = createSpinner(width);
	JSpinner heightSpinner = createSpinner(height);

	ChangeListener listener = e -> updatePosition((Integer) widthSpinner.getValue(), (Integer) heightSpinner.getValue());

	widthSpinner.addChangeListener(listener);
	heightSpinner.addChangeListener(listener);

	dimensionPanel.add(widthSpinner, BorderLayout.WEST);
	dimensionPanel.add(new JLabel(" x "), BorderLayout.CENTER);
	dimensionPanel.add(heightSpinner, BorderLayout.EAST);

	return dimensionPanel;
}
 
Example #3
Source File: SymbolMerger.java    From ghidra with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the conflict panel for resolving which name to use when
 * Latest and My programs both renamed the symbol.
 * @param symbol the symbol
 * @param listener listener for handling user selecting an option.
 * @return the conflict panel
 */
protected VerticalChoicesPanel getRenameConflictPanel(Symbol symbol, ChangeListener listener) {
	long symbolID = symbol.getID();
	String text = "Symbol: " + ConflictUtility.getEmphasizeString(symbol.getName(true)) +
		ConflictUtility.spaces(4) + "Address: " +
		ConflictUtility.getAddressString(symbol.getAddress());
	conflictPanel.clear();
	conflictPanel.setHeader(text);
	conflictPanel.setRowHeader(getSymbolInfo(null, null));
	String prefix = "Rename as in '";
	String suffix = "' version";
	conflictPanel.addRadioButtonRow(getSymbolInfo(latestPgm, symbolID, prefix, suffix),
		LATEST_BUTTON_NAME, KEEP_LATEST, listener);
	conflictPanel.addRadioButtonRow(getSymbolInfo(myPgm, symbolID, prefix, suffix),
		CHECKED_OUT_BUTTON_NAME, KEEP_MY, listener);
	conflictPanel.addInfoRow(getSymbolInfo(originalPgm, symbolID, "'", suffix));
	return conflictPanel;
}
 
Example #4
Source File: SymbolMerger.java    From ghidra with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the conflict panel for resolving symbols with the same name and namespace at an address.
 * @param address the address
 * @param symbolName the name of the conflicting symbol
 * @param listener listener for handling user selecting an option.
 * @return the conflict panel
 */
protected VerticalChoicesPanel getAddressConflictPanel(Address address, String symbolName,
		ChangeListener listener) {
	Symbol my = currentSymbol;
	Namespace latestNamespace = DiffUtility.getNamespace(currentNamespace, latestPgm);
	Symbol latest = latestSymTab.getSymbol(symbolName, currentAddress, latestNamespace);
	String text = "Symbol Name Conflict @ " + ConflictUtility.getAddressString(currentAddress) +
		"<br>Can't have symbols with same name and different scope at an address.";
	conflictPanel.clear();
	conflictPanel.setHeader(text);
	conflictPanel.setRowHeader(getSymbolInfo(null, my));
	String prefix = "'";
	String suffix = "' version";
	conflictPanel.addInfoRow(getSymbolInfo(latestPgm, latest, prefix, suffix));
	conflictPanel.addInfoRow(getSymbolInfo(myPgm, my, prefix, suffix));
	conflictPanel.addInfoRow(new String[] { "", "", "", "", "", "", "" });
	String removeMsg = "Discard '" + MY_TITLE + "' symbol";
	String renameMsg = "Rename '" + MY_TITLE + "' symbol to '" + uniqueName + "'";
	conflictPanel.addRadioButtonRow(new String[] { removeMsg, "", "", "", "", "", "" },
		REMOVE_CHECKED_OUT_BUTTON_NAME, REMOVE_MY, listener);
	conflictPanel.addRadioButtonRow(new String[] { renameMsg, "", "", "", "", "", "" },
		RENAME_CHECKED_OUT_BUTTON_NAME, RENAME_MY, listener);
	return conflictPanel;
}
 
Example #5
Source File: MultiGradientTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private ControlsPanel() {
    cmbPaint = createCombo(this, paintType);
    cmbPaint.setSelectedIndex(1);
    cmbCycle = createCombo(this, cycleMethod);
    cmbSpace = createCombo(this, colorSpace);
    cmbShape = createCombo(this, shapeType);
    cmbXform = createCombo(this, xformType);

    int max = COLORS.length;
    SpinnerNumberModel model = new SpinnerNumberModel(max, 2, max, 1);
    spinNumColors = new JSpinner(model);
    spinNumColors.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            numColors = ((Integer)spinNumColors.getValue()).intValue();
            gradientPanel.updatePaint();
        }
    });
    add(spinNumColors);

    cbAntialias = createCheck(this, "Antialiasing");
    cbRender = createCheck(this, "Render Quality");
}
 
Example #6
Source File: GUIRepeater.java    From PacketProxy with Apache License 2.0 6 votes vote down vote up
public Repeats(GUIRepeater parent) {
	this.parent = parent;
	repeat_tab = new CloseButtonTabbedPane();
	previousTabIndex = repeat_tab.getSelectedIndex();
	repeat_tab.addChangeListener(new ChangeListener() {
		@Override
		public void stateChanged(ChangeEvent e) {
			int currentTabIndex = repeat_tab.getSelectedIndex();
			if(previousTabIndex<0){
				previousTabIndex = currentTabIndex;
				return;
			}
			previousTabIndex = currentTabIndex;
		}
	});
    main_panel = new JPanel();
	main_panel.setLayout(new BoxLayout(main_panel, BoxLayout.Y_AXIS));
	main_panel.add(repeat_tab);
	list = new ArrayList<Repeat>();
}
 
Example #7
Source File: MultiGradientTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private ControlsPanel() {
    cmbPaint = createCombo(this, paintType);
    cmbPaint.setSelectedIndex(1);
    cmbCycle = createCombo(this, cycleMethod);
    cmbSpace = createCombo(this, colorSpace);
    cmbShape = createCombo(this, shapeType);
    cmbXform = createCombo(this, xformType);

    int max = COLORS.length;
    SpinnerNumberModel model = new SpinnerNumberModel(max, 2, max, 1);
    spinNumColors = new JSpinner(model);
    spinNumColors.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            numColors = ((Integer)spinNumColors.getValue()).intValue();
            gradientPanel.updatePaint();
        }
    });
    add(spinNumColors);

    cbAntialias = createCheck(this, "Antialiasing");
    cbRender = createCheck(this, "Render Quality");
}
 
Example #8
Source File: ArrayElementPropertyEditor.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private IntegerTextField createLocalPrefixTextField(String labelText, String tooltipText,
		Container parent) {

	IntegerTextField textField = new IntegerTextField(10);
	textField.setAllowNegativeValues(false);
	textField.setEnabled(true);

	JPanel textFieldPanel = new JPanel();
	textFieldPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));

	elementsLabel = new GDLabel(labelText);
	textFieldPanel.add(elementsLabel);
	textFieldPanel.add(textField.getComponent());
	textField.addChangeListener(new ChangeListener() {

		@Override
		public void stateChanged(ChangeEvent e) {
			firePropertyChange();
		}
	});

	// add to the main panel
	parent.add(textFieldPanel);

	return textField;
}
 
Example #9
Source File: SymbolMerger.java    From ghidra with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the conflict panel for resolving different symbols with the
 * same name in the same namespace.
 * @param myNamespace the symbol namespace
 * @param symbolName the symbol name
 * @param listener listener for handling user selecting an option.
 * @return the conflict panel
 */
protected VerticalChoicesPanel getNamespaceConflictPanel(Namespace myNamespace,
		String symbolName, ChangeListener listener) {
	Symbol latest =
		latestSymTab.getNamespace(symbolName, DiffUtility.getNamespace(myNamespace, latestPgm))
			.getSymbol();
	Symbol my = mySymTab.getNamespace(symbolName, myNamespace).getSymbol();
	String text = "Namespace Conflict";
	conflictPanel.clear();
	conflictPanel.setHeader(text);
	conflictPanel.setRowHeader(getSymbolInfo(null, my));
	String prefix = "'";
	String suffix = "' version";
	conflictPanel.addInfoRow(getSymbolInfo(latestPgm, latest, prefix, suffix));
	conflictPanel.addInfoRow(getSymbolInfo(myPgm, my, prefix, suffix));
	String removeMsg = "Discard '" + MY_TITLE + "' symbol";
	String renameMsg = "Rename '" + MY_TITLE + "' symbol to '" + uniqueName + "'";
	conflictPanel.addRadioButtonRow(new String[] { removeMsg }, REMOVE_CHECKED_OUT_BUTTON_NAME,
		REMOVE_MY, listener);
	conflictPanel.addRadioButtonRow(new String[] { renameMsg }, RENAME_CHECKED_OUT_BUTTON_NAME,
		RENAME_MY, listener);
	return conflictPanel;
}
 
Example #10
Source File: FunctionMerger.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private VariousChoicesPanel createOverlapConflictPanel(final Address addr,
		final TaskMonitor monitor) {
	final AddressSet resolveSet = overlapConflicts.get(addr);
	VariousChoicesPanel panel = getEmptyVariousPanel();

	runSwing(() -> {
		panel.setTitle("Function Overlap");
		StringBuffer buf = new StringBuffer();
		buf.append("Function @ ");
		ConflictUtility.addAddress(buf, addr);
		buf.append(" overlaps with different function(s) in other program.");
		buf.append("<br>");
		buf.append("The overlap address set is " +
			ConflictUtility.getEmphasizeString(resolveSet.toString()) + ".");
		panel.setHeader(buf.toString());
		ChangeListener changeListener =
			new FunctionOverlapConflictChangeListener(FUNC_OVERLAP, addr, panel, monitor);
		panel.addSingleChoice("Choose the version of functions to keep: ",
			new String[] { LATEST_TITLE, MY_TITLE }, changeListener);
	});
	return panel;
}
 
Example #11
Source File: NumberControl.java    From arcusipcd with Apache License 2.0 5 votes vote down vote up
public NumberControl(JComponent parent, final String title, double floor, double ceiling,
		double number, final CommandQueue commandQueue) {
	
	JLabel label = new JLabel(title);
	parent.add(label);
	
	model = new SpinnerNumberModel(number, floor, ceiling, 1.0);
	spinner = new JSpinner(model);
	spinner.setMaximumSize(new Dimension(200,40));
	spinner.addChangeListener(new ChangeListener() {
		@Override
		public void stateChanged(ChangeEvent e) {
			if (!isUpdating) {
				Number newNumber = model.getNumber();
				Command setCommand = new SetParameterValue();
				setCommand.putAttribute(title, newNumber.toString());
				try {
					commandQueue.insertCommand(setCommand);
				} catch (InterruptedException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}
		}
	});
	
	parent.add(spinner);
	parent.add(Box.createVerticalGlue());
}
 
Example #12
Source File: ReferenceMerger.java    From ghidra with Apache License 2.0 5 votes vote down vote up
protected VerticalChoicesPanel getRemoveConflictPanel(Reference ref, ChangeListener listener) {
	VerticalChoicesPanel panel = getVerticalConflictPanel();
	Reference originalRef = ref;
	Reference latestRef = DiffUtility.getReference(originalPgm, originalRef, latestPgm);
	Reference myRef = DiffUtility.getReference(originalPgm, originalRef, myPgm);
	if (originalRef.getReferenceType().isFallthrough()) {
		Address fromAddr = originalRef.getFromAddress();
		int opIndex = originalRef.getOperandIndex();
		Reference latestFallthrough = getFallThroughReference(latestPgm, fromAddr, opIndex);
		Reference myFallthrough = getFallThroughReference(myPgm, fromAddr, opIndex);
		latestRef = latestFallthrough;
		myRef = myFallthrough;
	}
	panel.setTitle("Reference");
	String fromAddrStr = ConflictUtility.getAddressString(ref.getFromAddress());
	String toAddrStr =
		ConflictUtility.colorString(ConflictUtility.ADDRESS_COLOR,
			DiffUtility.getUserToAddressString(resultPgm, ref.getToAddress()));
	String text =
		getRefGroup(ref) + " Reference from '" + fromAddrStr + "' " +
			getOperandIndexString(ref) + " to '" + toAddrStr +
			"' was removed in one version and changed in other.";
	panel.setHeader(text);
	panel.setRowHeader(getReferenceInfo(null, null, null, null));
	String latestPrefix = (latestRef == null) ? "Remove as in '" : "Change as in '";
	String myPrefix = (myRef == null) ? "Remove as in '" : "Change as in '";
	String suffix = "' version";
	String[] latestRefInfo = getReferenceInfo(latestPgm, latestRef, latestPrefix, suffix);
	String[] myRefInfo = getReferenceInfo(myPgm, myRef, myPrefix, suffix);
	panel.addRadioButtonRow(latestRefInfo, LATEST_BUTTON_NAME, KEEP_LATEST, listener);
	panel.addRadioButtonRow(myRefInfo, CHECKED_OUT_BUTTON_NAME, KEEP_MY, listener);
	panel.addInfoRow(getReferenceInfo(originalPgm, originalRef, "'", suffix));

	return panel;
}
 
Example #13
Source File: MouseGrabberUtil.java    From darklaf with MIT License 5 votes vote down vote up
public static ChangeListener getOldMouseGrabber() {
    MenuSelectionManager menuSelectionManager = MenuSelectionManager.defaultManager();
    for (ChangeListener listener : menuSelectionManager.getChangeListeners()) {
        if (listener == null) continue;
        Class<?> listenerClass = listener.getClass();
        if (listenerClass == null) continue;
        Class<?> enclosingClass = listenerClass.getEnclosingClass();
        if (enclosingClass == null) continue;
        if (listenerClass.getName().endsWith("MouseGrabber")
            && enclosingClass.getName().endsWith("BasicPopupMenuUI")) {
            return listener;
        }
    }
    return null;
}
 
Example #14
Source File: ExternalProgramMerger.java    From ghidra with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the conflict resolution panel to display
 * @param idGroup the symbol ID group for the external program (Library) in conflict.
 * @param listener the listener for the user's choice when resolving the conflict.
 * @return the panel.
 */
VerticalChoicesPanel getConflictPanel(IDGroup idGroup, ChangeListener listener) {
	if (conflictPanel == null) {
		conflictPanel = new VerticalChoicesPanel();
		conflictPanel.setTitle(getConflictType());
	}
	conflictPanel.clear();
	// Initialize the conflict panel.
	conflictPanel.setHeader(getConflictInfo(idGroup, 1, 1));

	conflictPanel.setRowHeader(getExternalNameInfo(null, null, null, null));
	ExternalManager latestMgr = latestPgm.getExternalManager();
	ExternalManager myMgr = myPgm.getExternalManager();
	String latestName = idGroup.getLatestName();
	String myName = idGroup.getMyName();
	String originalName = idGroup.getOriginalName();
	boolean inLatest = (latestName != null) ? latestMgr.contains(latestName) : false;
	boolean inMy = (myName != null) ? myMgr.contains(myName) : false;
	String latestPrefix = (inLatest) ? "Change as in '" : "Remove as in '";
	String myPrefix = (inMy) ? "Change as in '" : "Remove as in '";
	String suffix = "' version";
	conflictPanel.addRadioButtonRow(
		getExternalNameInfo(latestPgm, latestName, latestPrefix, suffix), LATEST_BUTTON_NAME,
		KEEP_LATEST, listener);
	conflictPanel.addRadioButtonRow(getExternalNameInfo(myPgm, myName, myPrefix, suffix),
		CHECKED_OUT_BUTTON_NAME, KEEP_MY, listener);
	conflictPanel.addInfoRow(getExternalNameInfo(originalPgm, originalName, "'", suffix));
	return conflictPanel;
}
 
Example #15
Source File: ColorWheel.java    From nanoleaf-desktop with MIT License 5 votes vote down vote up
protected void fireChangeListeners()
{
    ChangeEvent event = new ChangeEvent(this);
    for (ChangeListener listener : getChangeListeners())
    {
        listener.stateChanged(event);
    }
}
 
Example #16
Source File: JRibbonSpinner.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public JRibbonSpinner(Projection<JRibbonSpinner,
        RibbonSpinnerContentModel, ComponentPresentationModel> projection) {
    super(projection.getContentModel());

    RibbonSpinnerContentModel contentModel = projection.getContentModel();
    if (contentModel.getSelectionChangeListener() != null) {
        Object initialValue = this.getValue();

        this.addChangeListener(new ChangeListener() {
            Object prevValue = initialValue;

            @Override
            public void stateChanged(ChangeEvent e) {
                Object newValue = getValue();
                if (newValue == this.prevValue) {
                    return;
                }
                contentModel.getSelectionChangeListener().onSelectionChanged(this.prevValue, newValue);
                this.prevValue = newValue;
            }
        });

        // Notify the listener on initial selection
        if (initialValue != null) {
            contentModel.getSelectionChangeListener().onSelectionChanged(null, initialValue);
        }
    }
}
 
Example #17
Source File: FileDialogs.java    From FancyBing with GNU General Public License v3.0 5 votes vote down vote up
public SgfPreview()
{
    setLayout(new BorderLayout());
    JPanel previewPanel = new JPanel();
    previewPanel.setBorder(GuiUtil.createEmptyBorder());
    previewPanel.setLayout(new BoxLayout(previewPanel, BoxLayout.Y_AXIS));
    previewPanel.add(Box.createVerticalGlue());
    Dimension dimension = new Dimension(140, 140);
    previewPanel.setPreferredSize(dimension);
    add(previewPanel);
    m_imagePanel = new ImagePanel();
    previewPanel.add(m_imagePanel);
    previewPanel.add(Box.createVerticalGlue());
    JPanel buttonPanel = new JPanel();
    add(buttonPanel, BorderLayout.SOUTH);
    m_auto = new JCheckBox(i18n("LB_AUTOMATIC_PREVIEW"));
    m_auto.setSelected(m_prefs.getBoolean("auto-preview", false));
    m_auto.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
                boolean isSelected = m_auto.isSelected();
                m_prefs.putBoolean("auto-preview", isSelected);
                if (isSelected)
                    preview();
            } });
    buttonPanel.add(m_auto);
    m_preview = new JButton(i18n("LB_PREVIEW"));
    m_preview.setActionCommand("preview");
    m_preview.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                if (event.getActionCommand().equals("preview"))
                    preview();
            } });
    m_preview.setEnabled(false);
    buttonPanel.add(m_preview);
}
 
Example #18
Source File: CommandToggleGroupModel.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Adds the specified command to the group. If the command is selected, and
 * the group has a selected command, the newly added command is marked as
 * unselected.
 *
 * @param command The command to be added.
 */
public void add(final Command command) {
    if (command == null) {
        return;
    }
    commands.addElement(command);

    boolean wasSelectionNull = (this.selection == null);
    if (command.isToggleSelected()) {
        if (wasSelectionNull) {
            selection = command;
        } else {
            command.setToggleSelected(false);
        }
    }
    ChangeListener cl = new ChangeListener() {
        boolean wasSelected = command.isToggleSelected();

        @Override
        public void stateChanged(ChangeEvent e) {
            boolean isSelected = command.isToggleSelected();
            if (wasSelected != isSelected) {
                setSelected(command, isSelected);
            }
            wasSelected = isSelected;
        }
    };

    command.addChangeListener(cl);
    this.modelChangeListeners.put(command, cl);
}
 
Example #19
Source File: EditRegisterValueDialog.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private JComponent buildWorkPanel(Register register, Address start, Address end,
		BigInteger value, AddressFactory factory) {

	JTextField registerField =
		new JTextField(register.getName() + " (" + register.getBitLength() + ")");
	registerField.setEditable(false);

	startAddrField = new AddressInput();
	endAddrField = new AddressInput();
	ChangeListener changeListener = new ChangeListener() {
		@Override
		public void stateChanged(ChangeEvent e) {
			updateOk();
		}
	};
	startAddrField.setAddressFactory(factory);
	endAddrField.setAddressFactory(factory);
	startAddrField.addChangeListener(changeListener);
	endAddrField.addChangeListener(changeListener);

	registerValueField = new FixedBitSizeValueField(register.getBitLength(), true, false);
	startAddrField.setAddress(start);
	endAddrField.setAddress(end);
	registerValueField.setValue(value);

	JPanel panel = new JPanel(new PairLayout(5, 1));

	panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
	panel.add(new GLabel("Register:"));
	panel.add(registerField);
	panel.add(new GLabel("Start Address:"));
	panel.add(startAddrField);
	panel.add(new GLabel("End Address:"));
	panel.add(endAddrField);
	panel.add(new GLabel("Value:"));
	panel.add(registerValueField);

	return panel;
}
 
Example #20
Source File: MemoryMergePanel.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void create() {
	setLayout(new BorderLayout());

	JPanel boxPanel = new JPanel();
	boxPanel.setLayout(new BoxLayout(boxPanel, BoxLayout.Y_AXIS));

	cardLayout = new CardLayout();
	cardPanel = new JPanel(cardLayout);
	cardPanel.setBorder(BorderFactory.createTitledBorder("Resolve Block Conflict"));
	ChangeListener listener = new ChangeListener() {
		@Override
		public void stateChanged(ChangeEvent e) {
			mergeManager.setApplyEnabled(true);
		}
	};
	commentPanel = new CommentsConflictPanel(listener);
	cardPanel.add(commentPanel, COMMENT_PANEL_ID);

	namePanel = new BlockConflictPanel(listener);
	cardPanel.add(namePanel, CONFLICT_PANEL_ID);

	cardLayout.show(cardPanel, CONFLICT_PANEL_ID);

	countPanel = new ConflictCountPanel();
	boxPanel.add(countPanel);
	boxPanel.add(Box.createVerticalStrut(10));
	boxPanel.add(cardPanel);

	add(boxPanel, BorderLayout.CENTER);
	add(createUseForAllCheckBox(), BorderLayout.SOUTH);
}
 
Example #21
Source File: FixedBitSizeValueField.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public void valueChanged() {
	if (listeners.size() == 0) {
		return;
	}
	ChangeEvent ev = new ChangeEvent(this);
	for (ChangeListener listener : listeners) {
		listener.stateChanged(ev);
	}
}
 
Example #22
Source File: ClassSearcher.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private static void fireClassListChanged() {
	for (ChangeListener listener : listenerList) {
		try {
			listener.stateChanged(null);
		}
		catch (Throwable t) {
			Msg.showError(ClassSearcher.class, null, "Exception",
				"Error in listener for class list changed", t);
		}
	}
}
 
Example #23
Source File: MarkerManager.java    From ghidra with Apache License 2.0 4 votes vote down vote up
private void notifyListeners() {
	for (ChangeListener listener : listeners) {
		listener.stateChanged(null);
	}
}
 
Example #24
Source File: StyleSheet.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public ChangeListener[] getChangeListeners() {
    return new ChangeListener[0];
}
 
Example #25
Source File: MappingPanelController.java    From constellation with Apache License 2.0 4 votes vote down vote up
@Override
public void addChangeListener(final ChangeListener l) {
    // Required for implementation of Panel, intentionally left blank
}
 
Example #26
Source File: bug4624207.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    Robot robot = new Robot();
    robot.setAutoDelay(50);

    SwingUtilities.invokeAndWait(new Runnable() {

        public void run() {
            createAndShowGUI();
        }
    });

    toolkit.realSync();

    SwingUtilities.invokeAndWait(new Runnable() {

        public void run() {
            txtField.requestFocus();
        }
    });

    toolkit.realSync();

    if (!focusGained) {
        throw new RuntimeException("Couldn't gain focus for text field");
    }

    SwingUtilities.invokeAndWait(new Runnable() {

        public void run() {
            tab.addChangeListener((ChangeListener) listener);
            txtField.removeFocusListener((FocusListener) listener);
        }
    });

    toolkit.realSync();

    if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
        Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_B);
    } else {
        Util.hitKeys(robot, KeyEvent.VK_ALT, KeyEvent.VK_B);
    }

    toolkit.realSync();

    if (!stateChanged || tab.getSelectedIndex() != 1) {
        throw new RuntimeException("JTabbedPane mnemonics don't work from outside the tabbed pane");
    }
}
 
Example #27
Source File: MarkerManager.java    From ghidra with Apache License 2.0 4 votes vote down vote up
@Override
public void addChangeListener(ChangeListener listener) {
	listeners.remove(listener);
	listeners.add(listener);
}
 
Example #28
Source File: AbstractFunctionMerger.java    From ghidra with Apache License 2.0 4 votes vote down vote up
protected VerticalChoicesPanel createParameterSigConflictPanel(final Function[] functions,
		final TaskMonitor monitor) {

	getEmptyVerticalPanel();
	final ChangeListener changeListener = new ChangeListener() {
		@Override
		public void stateChanged(ChangeEvent e) {
			int chosenConflictOption =
				AbstractFunctionMerger.this.verticalConflictPanel.getSelectedOptions();
			if (chosenConflictOption == ListingMergeConstants.ASK_USER) {
				if (mergeManager != null) {
					mergeManager.setApplyEnabled(false);
				}
				return;
			}
			if (mergeManager != null) {
				mergeManager.clearStatusText();
			}
			try {
				mergeParameters(functions, chosenConflictOption, monitor);
				if (mergeManager != null) {
					mergeManager.setApplyEnabled(true);
				}
			}
			catch (Exception e1) {
				Msg.error(this, "Unexpected Exception: " + e1.getMessage(), e1);
			}
		}
	};

	runSwing(() -> {
		verticalConflictPanel.setTitle("Function Parameters");
		String text = getConflictPrefixString(functions) +
			" has conflicting signature storage changes.<br>Choose the desired function signature.<br>" +
			"Note: If the signatures below look the same, then check for return/parameter storage differences in the Listings above.";
		verticalConflictPanel.setHeader(text);
		verticalConflictPanel.setRowHeader(getSignatureInfo(null, null, null, null));
		verticalConflictPanel.addRadioButtonRow(
			getSignatureInfo(programs[LATEST], functions[LATEST], "Use ", " version"),
			LATEST_BUTTON_NAME, KEEP_LATEST, changeListener);
		verticalConflictPanel.addRadioButtonRow(
			getSignatureInfo(programs[MY], functions[MY], "Use ", " version"),
			CHECKED_OUT_BUTTON_NAME, KEEP_MY, changeListener);
		verticalConflictPanel.addInfoRow(
			getSignatureInfo(programs[ORIGINAL], functions[ORIGINAL], "", " version"));
	});

	return verticalConflictPanel;
}
 
Example #29
Source File: TablesPanelController.java    From constellation with Apache License 2.0 4 votes vote down vote up
@Override
public void removeChangeListener(ChangeListener l) {
    // Required for ExtendedAsynchronousValidatingPanel, intentionally left blank
}
 
Example #30
Source File: MappedColumnConstraintEditor.java    From ghidra with Apache License 2.0 4 votes vote down vote up
@Override
public void addChangeListener(ChangeListener constraintEditorChangeListener) {
	delegateEditor.addChangeListener(constraintEditorChangeListener);
}