Java Code Examples for com.intellij.ui.components.JBList#setTransferHandler()

The following examples show how to use com.intellij.ui.components.JBList#setTransferHandler() . 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: CustomActionSettingsForm.java    From StringManipulation with Apache License 2.0 6 votes vote down vote up
private JBList createJBList(DefaultListModel pluginsModel) {
	JBList jbList = new JBList(pluginsModel);
	jbList.setCellRenderer(new DefaultListCellRenderer() {
		@Override
		public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
													  boolean cellHasFocus) {
			final Component comp = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
			CustomActionModel goal = (CustomActionModel) value;
			setText(goal.getName());
			return comp;
		}
	});
	jbList.setDragEnabled(true);
	jbList.setDropMode(DropMode.INSERT);
	jbList.setTransferHandler(new MyListDropHandler(jbList));

	new MyDragListener(jbList);
	return jbList;
}
 
Example 2
Source File: ApplicationSettingsForm.java    From MavenHelper with Apache License 2.0 6 votes vote down vote up
private JBList createJBList(DefaultListModel pluginsModel) {
	JBList jbList = new JBList(pluginsModel);
	jbList.setCellRenderer(new DefaultListCellRenderer() {
		@Override
		public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
													  boolean cellHasFocus) {
			final Component comp = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
			Goal goal = (Goal) value;

			setText(goal.getPresentableName());
			return comp;
		}
	});
	jbList.setDragEnabled(true);
	jbList.setDropMode(DropMode.INSERT);
	jbList.setTransferHandler(new MyListDropHandler(jbList));

	new MyDragListener(jbList);
	return jbList;
}