當前位置: 首頁>>代碼示例>>Java>>正文


Java DefaultListSelectionModel.setSelectionMode方法代碼示例

本文整理匯總了Java中javax.swing.DefaultListSelectionModel.setSelectionMode方法的典型用法代碼示例。如果您正苦於以下問題:Java DefaultListSelectionModel.setSelectionMode方法的具體用法?Java DefaultListSelectionModel.setSelectionMode怎麽用?Java DefaultListSelectionModel.setSelectionMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.DefaultListSelectionModel的用法示例。


在下文中一共展示了DefaultListSelectionModel.setSelectionMode方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: SorterTableColumnModel

import javax.swing.DefaultListSelectionModel; //導入方法依賴的package包/類
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();
    }
 
開發者ID:ytus,項目名稱:findbugs-all-the-bugs,代碼行數:19,代碼來源:SorterTableColumnModel.java

示例2: CameraPosDialog

import javax.swing.DefaultListSelectionModel; //導入方法依賴的package包/類
/**
 * Creates new form CameraPosDialog
 *
 * @param parent The parent object for this form
 * @param modal Indicates whether this is a modal dialog
 */
public CameraPosDialog(AbstractTerrainViewerFrame parent, boolean modal)
{
    super(parent, modal);
    initComponents();

    final DefaultListSelectionModel dlsm =
        (DefaultListSelectionModel) cameraTable.getSelectionModel();

    dlsm.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dlsm.addListSelectionListener(new MySelectionListener());
    cameraTable.addMouseListener(new MyMouseListener());

    ((DefaultCellEditor) cameraTable.getDefaultEditor(String.class)).setClickCountToStart(
        1);
}
 
開發者ID:madebyjeffrey,項目名稱:TerraJ,代碼行數:22,代碼來源:CameraPosDialog.java

示例3: PhotoList

import javax.swing.DefaultListSelectionModel; //導入方法依賴的package包/類
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));
	}
 
開發者ID:fossasia,項目名稱:zooracle,代碼行數:78,代碼來源:PhotoList.java

示例4: SelectValueDialog

import javax.swing.DefaultListSelectionModel; //導入方法依賴的package包/類
public SelectValueDialog(final java.awt.Frame frame, final String title, final HexFieldLayer layer, final boolean multiple) {
  super(frame, true);
  initComponents();
  this.setTitle(title);
  this.layerIconList.setLayerField(layer);
  this.layerIconList.addLayerIconListListener(this);
  if (multiple) {
    final DefaultListSelectionModel model = new DefaultListSelectionModel();
    model.setSelectionMode(DefaultListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    this.layerIconList.setSelectionModel(model);
  }
  this.setLocationRelativeTo(frame);
}
 
開發者ID:raydac,項目名稱:jhexed,代碼行數:14,代碼來源:SelectValueDialog.java

示例5: EndmemberFormModel

import javax.swing.DefaultListSelectionModel; //導入方法依賴的package包/類
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());
    endmemberDiagram = new Diagram();
    endmemberDiagram.setXAxis(new DiagramAxis("Wavelength", ""));
    endmemberDiagram.setYAxis(new DiagramAxis("Radiation", ""));
    endmemberDiagram.setDrawGrid(false);
    propertyChangeSupport = new PropertyChangeSupport(this);
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:14,代碼來源:EndmemberFormModel.java

示例6: createListModel

import javax.swing.DefaultListSelectionModel; //導入方法依賴的package包/類
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);
}
 
開發者ID:robelsharma,項目名稱:VideoConference,代碼行數:13,代碼來源:ClientListPanel.java

示例7: createListModel

import javax.swing.DefaultListSelectionModel; //導入方法依賴的package包/類
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);
   }
 
開發者ID:robelsharma,項目名稱:VideoConference,代碼行數:13,代碼來源:ServerMonitor.java

示例8: createListSelectionModel

import javax.swing.DefaultListSelectionModel; //導入方法依賴的package包/類
private static ListSelectionModel createListSelectionModel(int selectionMode) {
    DefaultListSelectionModel model = new DefaultListSelectionModel();
    model.setSelectionMode(selectionMode);
    return model;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:JTableSelectionModelEditor.java

示例9: PlayList

import javax.swing.DefaultListSelectionModel; //導入方法依賴的package包/類
void PlayList() {
	List = new Vector<File>();
	Model = new DefaultListModel();
	PlayList = new JList(Model);
	PlayList.setSize(71, 83);
	PlayList.setLocation(338, 25);
	PlayList.setDragEnabled(false);
	PlayList.setFocusable(true);

	PlayList.setTransferHandler(new FileListTransferHandler(PlayList, Model, List));

	pane.setViewportView(PlayList);
	pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
	pane.setOpaque(true);
	pane.setSize(130, 217);
	pane.setLocation(405, 0);

	DefaultListSelectionModel m = new DefaultListSelectionModel();
	m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

	PlayList.setSelectionModel(m);
	PlayList.addListSelectionListener(new ListSelectionListener() {
		public void valueChanged(ListSelectionEvent e) {
			Song = List.get(PlayList.getSelectedIndex());
			index_of_the_song = PlayList.getSelectedIndex();
			newChoice = true;
			if (Song != null) {
				Deleted = false;
				Play();
			} else {
				mediaPlayer.stop();
				btnPlay.setText("►");
				songIsPlaying = false;
			}
		}
	});

	contentPane.add(pane);

	panel_1 = new JPanel();
	panel_1.setBounds(0, 0, 535, 50);
	panel_1.setBackground(new Color(0, 0, 0, 100));
	contentPane.add(panel_1);
	panel_1.setLayout(null);
	{
		lblNewLabel = new JLabel("Echo Player");
		lblNewLabel.setForeground(Color.WHITE);
		lblNewLabel.setHorizontalAlignment(SwingConstants.LEFT);
		lblNewLabel.setVerticalAlignment(SwingConstants.TOP);
		lblNewLabel.setFont(new Font("Times New Roman", Font.BOLD, 20));
		lblNewLabel.setBounds(10, 0, 480, 23);

		panel_1.add(lblNewLabel);
	}
	{
		lblNewLabel_2 = new JLabel("");
		lblNewLabel_2.setForeground(Color.WHITE);
		lblNewLabel_2.setVerticalAlignment(SwingConstants.TOP);
		lblNewLabel_2.setFont(new Font("Times New Roman", Font.ITALIC, 16));
		lblNewLabel_2.setBounds(10, 23, 480, 27);
		panel_1.add(lblNewLabel_2);
	}
}
 
開發者ID:mis94,項目名稱:Java-MP3-player,代碼行數:65,代碼來源:PlayerTest.java


注:本文中的javax.swing.DefaultListSelectionModel.setSelectionMode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。