当前位置: 首页>>代码示例>>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;未经允许,请勿转载。