javax.swing.DefaultListSelectionModel#setSelectionMode ( )源码实例Demo

下面列出了javax.swing.DefaultListSelectionModel#setSelectionMode ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: pgptool   文件: KeysTableView.java
private JScrollPane initTableComponent() {
	table = new JTable();

	// Adjust some visual appearence
	table.setRowHeight(22);
	table.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

	// Add listeners
	selectionModel = new DefaultListSelectionModel();
	selectionModel.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION);
	selectionModel.addListSelectionListener(rowSelectionListener);
	table.setSelectionModel(selectionModel);
	table.addMouseListener(listMouseListener);
	initTableKeyListener();

	// Envelope in scrollpane
	scrollPane = new JScrollPane();
	scrollPane.addMouseListener(listMouseListener);
	scrollPane.setViewportView(table);
	return scrollPane;
}
 
源代码2 项目: pgptool   文件: HistoryQuickSearchView.java
private JScrollPane initTableComponent() {
	table = new JTable();

	// Adjust some visual appearance
	table.setRowHeight(22);
	table.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

	// Add listeners
	selectionModel = new DefaultListSelectionModel();
	selectionModel.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION);
	selectionModel.addListSelectionListener((evt) -> pm.setSelected(getSelectedRow()));
	table.setSelectionModel(selectionModel);
	table.addMouseListener(listMouseListener);

	table.getActionMap().put("confirmRow", enterAction);
	table.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "confirmRow");

	// Envelope in scrollpane
	scrollPane = new JScrollPane();
	scrollPane.setViewportView(table);
	return scrollPane;
}
 
源代码3 项目: pgptool   文件: MainFrameView.java
private JScrollPane initTableComponent() {
	table = new JTable();

	// Adjust some visual appearence
	table.setRowHeight(22);

	// Add listeners
	selectionModel = new DefaultListSelectionModel();
	selectionModel.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION);
	selectionModel.addListSelectionListener(rowSelectionListener);
	table.setSelectionModel(selectionModel);
	table.addMouseListener(listMouseListener);
	table.setDefaultRenderer(EncryptBackAction.class, new EncryptBackActionCellRenderer());
	table.addMouseListener(encrBackClickHandler);
	initTableKeyListener();

	// Envelope in scrollpane
	scrollPane = new JScrollPane();
	scrollPane.addMouseListener(listMouseListener);
	scrollPane.setViewportView(table);
	return scrollPane;
}
 
源代码4 项目: spotbugs   文件: SorterTableColumnModel.java
public SorterTableColumnModel(Sortables[] columnHeaders) {

        MainFrame mainFrame = MainFrame.getInstance();
        int x = 0;
        for (Sortables c : columnHeaders) {
            if (!c.isAvailable(mainFrame)) {
                continue;
            }
            shown.add(c);

            TableColumn tc = makeTableColumn(x, c);
            columnList.add(tc);
            x++;
        }
        dlsm = new DefaultListSelectionModel();
        dlsm.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        orderUpdate();
        check();
    }
 
源代码5 项目: snap-desktop   文件: EndmemberFormModel.java
public EndmemberFormModel(AppContext appContext) {
    this.appContext = appContext;
    endmemberListModel = new DefaultListModel<>();
    endmemberListSelectionModel = new DefaultListSelectionModel();
    endmemberListSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    endmemberListModel.addListDataListener(new EndmemberListDataListener());
    endmemberListSelectionModel.addListSelectionListener(new EndmemberListSelectionListener());
    addAction = new AddAction();
    removeAction = new RemoveAction();
    clearAction = new ClearAction();
    exportAction = new ExportAction();
    endmemberDiagram = new Diagram();
    endmemberDiagram.setXAxis(new DiagramAxis("Wavelength", ""));
    endmemberDiagram.setYAxis(new DiagramAxis("Radiation", ""));
    endmemberDiagram.setDrawGrid(false);
    propertyChangeSupport = new PropertyChangeSupport(this);
}
 
源代码6 项目: VideoConference   文件: ClientListPanel.java
void createListModel()
{
    list_model=new javax.swing.DefaultListModel();
    list_online_clients = new javax.swing.JList(list_model);
    list_online_clients.setBorder(javax.swing.BorderFactory.createTitledBorder("Buddy List"));

    dlsm=new DefaultListSelectionModel();
    dlsm.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
 list_online_clients.setSelectionModel(dlsm);
    this.setLayout(new BorderLayout());
    this.add(list_online_clients,BorderLayout.CENTER);
}
 
源代码7 项目: VideoConference   文件: ServerMonitor.java
void createListModel()
   {
       list_model=new javax.swing.DefaultListModel();
       list_online_clients = new javax.swing.JList(list_model);
       list_online_clients.setBorder(javax.swing.BorderFactory.createTitledBorder("ONLINE CLIENTS"));

       dlsm=new DefaultListSelectionModel();
       dlsm.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list_online_clients.setSelectionModel(dlsm);
       list_panel.setLayout(new BorderLayout());
       list_panel.add(list_online_clients);
   }
 
源代码8 项目: ghidra   文件: DropDownSelectionTextField.java
@Override
protected ListSelectionModel createListSelectionModel() {
	DefaultListSelectionModel model = new DefaultListSelectionModel();
	model.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	return model;
}
 
源代码9 项目: netbeans   文件: JTableSelectionModelEditor.java
private static ListSelectionModel createListSelectionModel(int selectionMode) {
    DefaultListSelectionModel model = new DefaultListSelectionModel();
    model.setSelectionMode(selectionMode);
    return model;
}
 
源代码10 项目: mvisc   文件: PhotoList.java
public PhotoList(ZooracleContentPanel zooracleContentPanel)
	{

		this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		this.zooracleContentPanel = zooracleContentPanel;
		// Set the frame characteristics
//		setSize(150, 600);
		setBackground(Color.gray);

		// Create a panel to hold all other components
		topPanel = new JPanel();
		topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.Y_AXIS));

		this.add(topPanel);


		// Create some data
//		String dataValues[][] = { { "12", "234", "67" }, { "-123", "43", "853" }, { "93", "89.2", "109" }, { "279", "9033", "3092" } };

		// Create a new table instance
		table = new JTable(null, columnNames);
//		table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

//		table.setMinimumSize(new Dimension(150, 600));
//		table.setPreferredSize(new Dimension(150, 600));

		// table.setD
		selectionModel = new DefaultListSelectionModel();
		
		model = new DefaultTableModel();
		

		// table.setC
		selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		selectionModel.addListSelectionListener(new ListSelectionListener()
		{

			public void valueChanged(ListSelectionEvent e)
			{
				int selectionIndex = table.getSelectedRow();
				if (lastSelectionIndex != selectionIndex)
				{
					
					lastSelectionIndex = selectionIndex;
					
					if (selectionIndex==-1)
						return;
					System.out.println(table.getValueAt(selectionIndex, 0));
					System.out.println("sele:" + selectionIndex);
					
					if (PhotoList.this.zooracleContentPanel instanceof ImportView)
					{
						((ImportView)(PhotoList.this.zooracleContentPanel)).setCurrentPhoto(selectionIndex);
					}
//					if (selectionIndex > 2)
//						PhotoList.this.maximize(false);
				}
			}
		});
		// table.setDefaultRenderer(Object.class, new EditedCellRenderer(this));
		table.setSelectionModel(selectionModel);
		table.setDefaultRenderer(String.class, new BoardTableCellRenderer());
		table.setDefaultRenderer(Object.class, new BoardTableCellRenderer());
		
		table.setModel(model);
//		table.setMaximumSize(new Dimension(100, 300));
		

		// Add the table to a scrolling pane
		scrollPane = new JScrollPane();
//		scrollPane.add(table.getTableHeader());
//		scrollPane.add(table);
//		topPanel.add(scrollPane);
		
		topPanel.add(table.getTableHeader());
		topPanel.add(new JScrollPane(table));
	}