当前位置: 首页>>代码示例>>Java>>正文


Java ListSelectionModel.setSelectionMode方法代码示例

本文整理汇总了Java中javax.swing.ListSelectionModel.setSelectionMode方法的典型用法代码示例。如果您正苦于以下问题:Java ListSelectionModel.setSelectionMode方法的具体用法?Java ListSelectionModel.setSelectionMode怎么用?Java ListSelectionModel.setSelectionMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.ListSelectionModel的用法示例。


在下文中一共展示了ListSelectionModel.setSelectionMode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setTo

import javax.swing.ListSelectionModel; //导入方法依赖的package包/类
public void setTo(ListSelectionModel sm) {
    sm.clearSelection();
    sm.setSelectionMode(selectionMode);
    for (int[] itv : intervals) {
        sm.addSelectionInterval(itv[0], itv[1]);
    }
    sm.setAnchorSelectionIndex(anchor);
    sm.setLeadSelectionIndex(lead);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:OutlineView.java

示例2: setup

import javax.swing.ListSelectionModel; //导入方法依赖的package包/类
private void setup(Class<U> protoScript, String entityDisplayName)
{
	JButton add = new JButton(addAction);
	JButton remove = new JButton(removeAction);

	model = new MyTableModel<T, U>(cache, protoScript, entityDisplayName);

	table = new JTable(model);
	table.addMouseListener(new TablePopupListener(table, addAction, removeAction));

	ListSelectionModel selModel = table.getSelectionModel();
	selModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
	selModel.addListSelectionListener(new ListSelectionListener()
	{
		@Override
		public void valueChanged(ListSelectionEvent e)
		{
			removeAction.update();
		}
	});

	TableColumn c1 = table.getColumnModel().getColumn(1);
	c1.setCellRenderer(new ScriptingTableCellRenderer(model));
	c1.setCellEditor(new ScriptingCellEditor(this, clientService, model));

	final int height1 = add.getPreferredSize().height;
	final int width1 = remove.getPreferredSize().width;

	final int[] rows = {TableLayout.FILL, height1,};
	final int[] cols = {TableLayout.FILL, width1, width1,};

	setLayout(new TableLayout(rows, cols));

	add(new JScrollPane(table), new Rectangle(0, 0, 3, 1));

	add(add, new Rectangle(1, 1, 1, 1));
	add(remove, new Rectangle(2, 1, 1, 1));

	changeDetector = new ChangeDetector();
	changeDetector.watch(model);
}
 
开发者ID:equella,项目名称:Equella,代码行数:42,代码来源:EntityWhereEditor.java

示例3: setupGUI

import javax.swing.ListSelectionModel; //导入方法依赖的package包/类
@SuppressWarnings("nls")
private void setupGUI(Node privNode, PrivilegeList accessModel)
{
	JButton add = new JButton(addAction);
	JButton remove = new JButton(removeAction);
	JButton up = new JTextlessButton(upAction);
	JButton down = new JTextlessButton(downAction);

	privilegeModel = new MyTableModel(privNode, accessModel);
	privilegeTable = new JTable(privilegeModel);
	privilegeTable.addMouseListener(new TablePopupListener(privilegeTable, actions));

	ListSelectionModel selectionModel = privilegeTable.getSelectionModel();
	selectionModel.addListSelectionListener(this);
	selectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

	TableColumn actionColumn = privilegeTable.getColumnModel().getColumn(0);
	actionColumn.setCellRenderer(new ActionTableCellRenderer());
	actionColumn.setCellEditor(new ActionTableCellEditor());

	TableColumn whoColumn = privilegeTable.getColumnModel().getColumn(1);
	whoColumn.setCellRenderer(new ExpressionTableCellRenderer(userService));
	whoColumn.setCellEditor(new WhoTableCellEditor(userService, this));

	JScrollPane scroller = new JScrollPane(privilegeTable);

	final int height1 = add.getPreferredSize().height;
	final int width1 = remove.getPreferredSize().width;
	final int[] rows = {height1, height1, height1, height1, TableLayout.FILL,};
	final int[] cols = {TableLayout.FILL, width1,};

	JPanel all = new JPanel(new TableLayout(rows, cols));
	all.add(scroller, new Rectangle(0, 0, 1, 5));
	all.add(add, new Rectangle(1, 0, 1, 1));
	all.add(remove, new Rectangle(1, 1, 1, 1));
	all.add(up, new Rectangle(1, 2, 1, 1));
	all.add(down, new Rectangle(1, 3, 1, 1));

	showOverrides = new JCheckBox(
		CurrentLocale.get("com.tle.admin.security.editors.advancededitorpanel.overriding"));
	showDefaults = new JCheckBox(CurrentLocale.get("com.tle.admin.security.editors.advancededitorpanel.default"));

	showOverrides.addActionListener(this);
	showDefaults.addActionListener(this);

	final int mainHeight1 = showOverrides.getPreferredSize().height;
	final int[] mainRows = {TableLayout.INVISIBLE, TableLayout.FILL, TableLayout.INVISIBLE, mainHeight1,};
	final int[] mainCols = {TableLayout.FILL, TableLayout.FILL, width1,};
	layout = new TableLayout(mainRows, mainCols);
	setLayout(layout);

	add(new JLabel(CurrentLocale.get("com.tle.admin.security.editors.advancededitorpanel.overrides")),
		new Rectangle(2, 0, 1, 1));
	add(all, new Rectangle(0, 1, 3, 1));
	add(new JLabel(CurrentLocale.get("com.tle.admin.security.editors.advancededitorpanel.defaults")),
		new Rectangle(2, 2, 1, 1));
	add(showOverrides, new Rectangle(0, 3, 1, 1));
	add(showDefaults, new Rectangle(1, 3, 1, 1));

	updateButtons();
}
 
开发者ID:equella,项目名称:Equella,代码行数:62,代码来源:AdvancedEditorPanel.java


注:本文中的javax.swing.ListSelectionModel.setSelectionMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。