Java Code Examples for javax.swing.event.ChangeListener

The following examples show how to use javax.swing.event.ChangeListener. These examples are extracted from open source projects. 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
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 2
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 3
Source Project: ghidra   Source File: SymbolMerger.java    License: Apache License 2.0 6 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 4
Source Project: PacketProxy   Source File: GUIRepeater.java    License: 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 5
Source Project: ghidra   Source File: ArrayElementPropertyEditor.java    License: 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 6
Source Project: ghidra   Source File: FunctionMerger.java    License: 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 7
Source Project: ghidra   Source File: SymbolMerger.java    License: 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 8
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 9
Source Project: ghidra   Source File: SymbolMerger.java    License: 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 10
Source Project: ghidra   Source File: SymbolMerger.java    License: 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 11
Source Project: nanoleaf-desktop   Source File: ColorWheel.java    License: MIT License 5 votes vote down vote up
protected void fireChangeListeners()
{
    ChangeEvent event = new ChangeEvent(this);
    for (ChangeListener listener : getChangeListeners())
    {
        listener.stateChanged(event);
    }
}
 
Example 12
Source Project: darklaf   Source File: MouseGrabberUtil.java    License: 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 13
Source Project: ghidra   Source File: ReferenceMerger.java    License: 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 14
Source Project: ghidra   Source File: ExternalProgramMerger.java    License: 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 Project: arcusipcd   Source File: NumberControl.java    License: 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 16
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 Project: FancyBing   Source File: FileDialogs.java    License: 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
/**
 * 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 Project: ghidra   Source File: EditRegisterValueDialog.java    License: 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 Project: ghidra   Source File: MemoryMergePanel.java    License: 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 Project: ghidra   Source File: FixedBitSizeValueField.java    License: 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 Project: ghidra   Source File: ClassSearcher.java    License: 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 Project: jdk8u60   Source File: bug4242228.java    License: GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] argv) throws Exception {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            frame = new JFrame("4242228 Test");

            JScrollPane sourcePane = new JScrollPane();
            final JTextPane htmlEditor = new JTextPane();
            final JTextPane sourceEditor = new JTextPane();
            final JScrollPane editorPane = new JScrollPane();

            tabPane = new JTabbedPane();
            htmlEditor.setText(" ");
            htmlEditor.setEditorKit(new HTMLEditorKit());

            sourceEditor.setText(" ");
            sourceEditor.setEditorKit(new StyledEditorKit());

            frame.setLayout(new BorderLayout());

            editorPane.getViewport().add(htmlEditor);

            tabPane.addTab("Editor", editorPane);
            tabPane.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent e) {
                    if (tabPane.getSelectedComponent() == editorPane) {
                        htmlEditor.setText(sourceEditor.getText());
                    } else {
                        sourceEditor.setText(htmlEditor.getText());
                    }
                }
            });

            sourcePane.getViewport().add(sourceEditor);
            tabPane.addTab("Source", sourcePane);
            tabPane.setTabPlacement(SwingConstants.BOTTOM);
            htmlEditor.setDocument(new HTMLDocument());

            frame.add(tabPane);
            frame.setSize(400, 300);
            frame.setVisible(true);
        }
    });

    ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();

    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            for (int i = 0; i < 50; i++) {
                tabPane.setSelectedIndex(i % 2);
            }

            frame.dispose();
        }
    });
}
 
Example 24
Source Project: ghidra   Source File: NamePanel.java    License: Apache License 2.0 4 votes vote down vote up
NamePanel(ChangeListener listener) {
	super(new BorderLayout());
	setBorder(BorderFactory.createTitledBorder("Resolve Tree Name Conflict"));
	this.listener = listener;
	create();
}
 
Example 25
Source Project: constellation   Source File: TablesPanelController.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void removeChangeListener(ChangeListener l) {
    // Required for ExtendedAsynchronousValidatingPanel, intentionally left blank
}
 
Example 26
Source Project: constellation   Source File: MappingPanelController.java    License: 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 27
Source Project: constellation   Source File: ConnectionPanelController.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void addChangeListener(final ChangeListener l) {
    listeners.add(l);
}
 
Example 28
Source Project: ghidra   Source File: CodeBrowserClipboardProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void removeChangeListener(ChangeListener listener) {
	listeners.remove(listener);
}
 
Example 29
Source Project: ghidra   Source File: MarkerManager.java    License: Apache License 2.0 4 votes vote down vote up
private void notifyListeners() {
	for (ChangeListener listener : listeners) {
		listener.stateChanged(null);
	}
}
 
Example 30
Source Project: ghidra   Source File: MarkerManager.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void addChangeListener(ChangeListener listener) {
	listeners.remove(listener);
	listeners.add(listener);
}