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


Java JList.setVisibleRowCount方法代碼示例

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


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

示例1: initComponents

import javax.swing.JList; //導入方法依賴的package包/類
private void initComponents() {
    setLayout(new BorderLayout());
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    listModel = new DefaultListModel();
    list = new JList(listModel);
    list.getAccessibleContext().setAccessibleName(Bundle.ProfilingPointsDisplayer_ListAccessName());
    list.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    list.setVisibleRowCount(6);
    list.setCellRenderer(org.netbeans.modules.profiler.ppoints.Utils.getPresenterListRenderer());

    JScrollPane listScroll = new JScrollPane(list, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                             JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    listScroll.setPreferredSize(new Dimension(405, listScroll.getPreferredSize().height));

    add(listScroll, BorderLayout.CENTER);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:ProfilingPointsDisplayer.java

示例2: MovePanel

import javax.swing.JList; //導入方法依賴的package包/類
public MovePanel(final ChangeListener parent, String startPackage, String headLine) {
    super(parent, startPackage, headLine, targetFolder != null ? targetFolder : (FileObject) mappingFileObjects[0]);
    
    // Add a list to list the selected mapping files
    if (mappingFileObjects.length > 1) {
        setCombosEnabled(!disable);
        JList list = new JList(getNodes());
        list.setCellRenderer(new NodeRenderer());
        list.setVisibleRowCount(5);
        JScrollPane pane = new JScrollPane(list);
        bottomPanel.setBorder(new EmptyBorder(8, 0, 0, 0));
        bottomPanel.setLayout(new BorderLayout());
        bottomPanel.add(pane, BorderLayout.CENTER);
        JLabel listOf = new JLabel();
        Mnemonics.setLocalizedText(listOf, NbBundle.getMessage(MovePanel.class, "LBL_ListOfMappingFiles"));
        bottomPanel.add(listOf, BorderLayout.NORTH);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:MoveMappingFilesRefactoringUI.java

示例3: makeList

import javax.swing.JList; //導入方法依賴的package包/類
private JList<String> makeList(final String[][] items, int visibleRows, Container parent) {
	JList<String> list = new JList<>(new AbstractListModel<String>()	{
		/**
		 * 
		 */
		private static final long serialVersionUID = 6510576197401709714L;

		public String getElementAt(int i) {
			return items[i][0];				
		}
		
		public int getSize() {
			return items.length;
		}
	});

	list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	list.setVisibleRowCount(visibleRows);
	parent.add(new JScrollPane(list));
	return list;
}
 
開發者ID:guilhebl,項目名稱:routerapp,代碼行數:22,代碼來源:OpenGraphDialog.java

示例4: createFilesList

import javax.swing.JList; //導入方法依賴的package包/類
private JList createFilesList(SaveCookie[] saveCookies) {
    JList filesList = new JList(
                listModel = new ArrayListModel<SaveCookie>(saveCookies));
    filesList.setVisibleRowCount(8);
    filesList.setPrototypeCellValue(PROTOTYPE_LIST_CELL_VALUE);
    filesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    filesList.addListSelectionListener(listener);
    filesList.setCellRenderer(new ListCellRenderer());

    return filesList;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:FilesModifiedConfirmation.java

示例5: ValidationReportDialog

import javax.swing.JList; //導入方法依賴的package包/類
public ValidationReportDialog(ValidationReport report, CallBack cb) {
  super(GameModule.getGameModule().getFrame(), false);
  setTitle("Problems found in module");
  this.callback = cb;
  Box reportBox = Box.createVerticalBox();
  add(reportBox);
  JPanel buttonPanel = new JPanel();
  add(buttonPanel, BorderLayout.SOUTH);

  final List<String> warnings = report.getWarnings();
  switch (warnings.size()) {
  case 0:
    reportBox.add(new JLabel("No problems found"));
    buttonPanel.add(createOkButton());
    break;
  case 1:
    reportBox.add(new JLabel("A problem was found in this module."));
    reportBox.add(new JLabel(warnings.get(0) + "."));
    buttonPanel.add(createOkButton());
    buttonPanel.add(createCancelButton());
    break;
  default:
    reportBox.add(new JLabel("The following problems were found in this module."));
    reportBox.add(new JLabel("If not fixed, they could cause bugs during game play."));
    JList list = new JList(warnings.toArray());
    list.setVisibleRowCount(Math.min(list.getVisibleRowCount(),warnings.size()));
    reportBox.add(new ScrollPane(list));
    buttonPanel.add(createOkButton());
    buttonPanel.add(createCancelButton());
  }

  pack();
  setLocationRelativeTo(null);
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:35,代碼來源:ValidationReportDialog.java

示例6: MultiImagePicker

import javax.swing.JList; //導入方法依賴的package包/類
public MultiImagePicker() {
  setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

  imageList = new JList(imageListElements);
  imageList.addListSelectionListener(new ListSelectionListener() {
    public void valueChanged(javax.swing.event.ListSelectionEvent e) {
      showSelected();
    }
  });
  imageList.addKeyListener(new KeyAdapter() {
    public void keyReleased(KeyEvent evt) {
      if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
        showSelected();
      }
    }
  });
  imageList.setVisibleRowCount(4);
  imageList.setPrototypeCellValue("Image 999");
  imageList.setMinimumSize(imageList.getPreferredSize());

  multiPanel.setLayout(cl);

  add(multiPanel);
  JScrollPane scroll = new ScrollPane(imageList);
  scroll.getViewport().setMinimumSize(imageList.getPreferredSize());
  add(scroll);

  addEntry();
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:30,代碼來源:MultiImagePicker.java

示例7: createRight

import javax.swing.JList; //導入方法依賴的package包/類
private Component createRight() {
	for (int i = 0; i < allUnitStrings.length; i++) {
		selectedUnitsSet.addElement(allUnitStrings[i]);
	}
	allUnits = new JList(selectedUnitsSet);

	allUnits.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	allUnits.setVisibleRowCount(rowCount);
	allUnits.addListSelectionListener(new AllSelector());
	rightListPane = new JScrollPane(allUnits);
	return rightListPane;
}
 
開發者ID:etomica,項目名稱:etomica,代碼行數:13,代碼來源:UnitGraphics.java

示例8: createLeft

import javax.swing.JList; //導入方法依賴的package包/類
private Component createLeft() {
	usedUnits = new JList(usedUnitsModel);
	usedUnits.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	usedUnits.setVisibleRowCount(rowCount);
	usedUnits.addListSelectionListener(new UsedSelector());
	leftListPane = new JScrollPane(usedUnits);
	return leftListPane;
}
 
開發者ID:etomica,項目名稱:etomica,代碼行數:9,代碼來源:UnitGraphics.java

示例9: initUI

import javax.swing.JList; //導入方法依賴的package包/類
private void initUI() {
    categoriesModel = new CategoriesListModel();
    categoriesSelection = new CategoriesSelectionModel();
    
    scrollIncrement = new JCheckBox("XXX").getPreferredSize().height; // NOI18N
    
    JList<ProfilerOptionsPanel> categoriesList = new JList(categoriesModel) {
        public Dimension getPreferredSize() {
            Dimension dim = super.getPreferredSize();
            dim.width = Math.max(dim.width + 20, 140);
            return dim;
        }
    };
    categoriesList.setVisibleRowCount(0);
    categoriesList.setSelectionModel(categoriesSelection);
    categoriesList.setCellRenderer(new DefaultListCellRenderer() {
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            String panelName = " " + ((ProfilerOptionsPanel)value).getDisplayName() + " "; // NOI18N
            return super.getListCellRendererComponent(list, panelName, index, isSelected, cellHasFocus);
        }
    });
    
    JScrollPane categoriesScroll = new JScrollPane(categoriesList);
    
    JLabel categoriesLabel = new JLabel();
    categoriesLabel.setHorizontalAlignment(JLabel.LEADING);
    Mnemonics.setLocalizedText(categoriesLabel, Bundle.ProfilerOptionsContainer_Categories());
    categoriesLabel.setLabelFor(categoriesList);
    int labelOffset = 6;
    
    JPanel categoriesPanel = new JPanel(new BorderLayout(0, labelOffset));
    categoriesPanel.add(categoriesLabel, BorderLayout.NORTH);
    categoriesPanel.add(categoriesScroll, BorderLayout.CENTER);
    
    content = new JPanel(new BorderLayout());
    content.setBorder(BorderFactory.createEmptyBorder(categoriesLabel.getPreferredSize().height + labelOffset, 11, 0, 0));
    content.setMinimumSize(new Dimension(0, 0));
    content.setPreferredSize(new Dimension(0, 0));
    
    setLayout(new BorderLayout());
    add(categoriesPanel, BorderLayout.WEST);
    add(content, BorderLayout.CENTER);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:44,代碼來源:ProfilerOptionsContainer.java


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