Java Code Examples for javax.swing.JToggleButton#addMouseListener()

The following examples show how to use javax.swing.JToggleButton#addMouseListener() . 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: PaletteUI.java    From pumpernickel with MIT License 5 votes vote down vote up
private JToggleButton createCell() {
	JToggleButton newCell = new JToggleButton();
	newCell.addMouseListener(mouseListener);
	newCell.addMouseMotionListener(mouseListener);
	newCell.setContentAreaFilled(false);
	newCell.setBorder(null);
	newCell.setRequestFocusEnabled(false);
	newCell.setBorderPainted(false);
	newCell.setOpaque(false);
	newCell.putClientProperty(PROPERTY_CELL, Boolean.TRUE);
	newCell.addActionListener(cellActionListener);
	return newCell;
}
 
Example 2
Source File: ControlsFrame.java    From training with MIT License 5 votes vote down vote up
private JToggleButton makeIDEToggleShowingDemo(String ideLabel, IDE ide, boolean initial, Consumer<Boolean> action) {
	JToggleButton button = makeToggleShowingDemo(ideLabel, initial, action);
	JPopupMenu popup = new JPopupMenu();
	JMenuItem item = new JMenuItem("Listen to shortcuts of this");
	item.addActionListener(e-> {
		GlobalSettings.workingIde = ide;
		ShortcutKeylogger.reloadShortcutsForCurrentIDE();
	});
	popup.add(item);
	button.addMouseListener(new PopClickListener(popup));
	return button;
}