By default, the width of the list is determined by the longest item and the height is determined by the number of visible lines multiplied by the tallest item. This example demonstrates how to override these values.

    // Create a list
String[] items = {"A", "B", "C", "D"};
JList list = new JList(items); // Set the item width
int cellWidth = 200;
list.setFixedCellWidth(cellWidth); // Set the item height
int cellHeight = 18;
list.setFixedCellHeight(cellHeight);

It is also possible to set the item dimensions using a sample value:

    String protoCellValue = "My Sample Item Value";
list.setPrototypeCellValue(protoCellValue);
Related Examples

e775. 设置JList组件项的维数的更多相关文章

  1. e776. 设置JList组件项的提示语

    // Create a list, overriding the getToolTipText() method String[] items = {"A", "B&qu ...

  2. BIOS设置第一启动项

    在电脑的Bois中怎样去设置第一启动项.. 对于很多新手朋友来说,BIOS满屏英文,生涩难懂,话说我原来也很排斥BIOS,界面太丑,光看界面就没什么兴趣,更谈不上深入研究,大多数人在电脑城装机的时候都 ...

  3. <from>;<input>;readonly:只读;disabled:不可用;checked:用来做选中;selected:用在下拉列表中,设置那一项被选中

    表单元素: ①②③④⑤⑥⑦★ 一.<from> 1. 代表表单 2 . action:提交为哪个页面 method:①  get :显示提交,由长度限制 ②  post: 隐藏提交 二.文 ...

  4. PCA样本数量少于矩阵维数

    %test pcaA=[3,7,1,4,1;5,5,2,1,3;4,2,4,5,3];S=cov(A);T=cov(A');[ds,vs]=eig(S)[dt,vt]=eig(T) 样本数量少于矩阵维 ...

  5. HOG参数简介及Hog特征维数的计算(转)

    HOG构造函数 CV_WRAP HOGDescriptor() :winSize(64,128), blockSize(16,16), blockStride(8,8),      cellSize( ...

  6. C# 设置程序启动项

    托盘图标设置 新建一个NotifyIcon,会在托盘处显示一个图标. NotifyIcon.Icon可以直接设置一个ico图片,也可以延用原有程序的图标. notifyIcon.Icon = Syst ...

  7. Tensorflow描述张量的维度:阶,形状以及维数

    张量 TensorFlow用张量这种数据结构来表示所有的数据.你可以把一个张量想象成一个n维的数组或列表.一个张量有一个静态类型和动态类型的维数.张量可以在图中的节点之间流通. 阶 在TensorFl ...

  8. LR特征维数特别大实时计算问题

    美团 https://tech.meituan.com/machinelearning-data-feature-process.html 维数灾难 待续...

  9. /编写一个函数,要求从给定的向量A中删除元素值在x到y之间的所有元素(向量要求各个元素之间不能有间断), 函数原型为int del(int A ,int n , int x , int y),其中n为输入向量的维数,返回值为删除元素后的维数

    /** * @author:(LiberHome) * @date:Created in 2019/2/28 19:39 * @description: * @version:$ */ /* 编写一个 ...

随机推荐

  1. python virtualenv使用

    1.什么是virtualenv virtualenv用来做环境隔离,比如项目A使用了python2,项目B使用了python3 使用virtualenv可以分别生成项目A和项目B的环境包 2.virt ...

  2. java 多线程 24 : 线程组

    线程组 可以把线程归属到某一个线程组中,线程组中可以有线程对象,也可以有线程组,组中还可以有线程,这样的组织结构有点类似于树的形式,如图所示: 线程组的作用是:可以批量管理线程或线程组对象,有效地对线 ...

  3. Python3求m以内的素数、求m个数中最小的n个数

    [本文出自天外归云的博客园] 题1:求m以内的素数(m>2) def find_all_primes_in(m): def prime(num): for i in range(2, num): ...

  4. in linux system of ftp command

    一口流利的english title 常用命令: ftp baidu.com ftp>ls ftp>cd directory ftp>get filename 下载 ftp>p ...

  5. PHP重载以及Laravel门面Facade

    目录 重载的概念 魔术方法中的重载 属性重载 方法重载 Laravel中的Facade 扩展 谈谈__invoke Laravel提供了许多易用的Facade,让我们用起来特步顺手,那么这些Facad ...

  6. 'Project Name' was compiled with optimization

    'Project Name' was compiled with optimizationhtml, body {overflow-x: initial !important;}html { font ...

  7. # Writing your first Django app, part 2

    创建admin用户 D:\desktop\todoList\Django\mDjango\demoSite>python manage.py createsuperuser 然后输入密码 进入a ...

  8. WPF自定义行为Behavior,实现双击控件复制文本

    WPF引用xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity& ...

  9. Mongo分片集群脚本

    bash大法好啊,一键玩mongo. 我的mongo版本是:MongoDB shell version v4.0.2 这里准备为大家献上Mongo创建分片和可复制集的脚本,以及在部署的时候踩的坑. 分 ...

  10. WinDbg F9时“code not found breakpoint not set”

    当使用Windbg 6.2.9200.16384 进行源码调试时,无法在代码文件中F9设置断点,会出现“code not found breakpoint not set”,我们只有启动下我们自己的驱 ...