e798. 显示JSlider的标记标签
This example demonstrates how to display labels (numerical values) at the major ticks (see e797 显示JSlider的标记).
// Create a horizontal slider that moves left-to-right
JSlider slider = new JSlider(); // Set major tick marks every 25 units
int tickSpacing = 25;
slider.setMajorTickSpacing(tickSpacing); // Determine if currently painting labels
boolean b = slider.getPaintLabels(); // false // Paint labels at the major ticks - 0, 25, 50, 75, and 100
slider.setPaintLabels(true);
The slider allows you to use an arbitrary label at any particular major tick mark. This example configures a slider that shows an icon at the minimum and maximum positions. The component is only used to render the label and so it can be used at more than one position. Unfortunately, it also means that if the component is interactive (e.g., a button), it will not respond to mouse and keyboard gestures.
// Retrieve current table
java.util.Dictionary table = slider.getLabelTable(); // Create icon
ImageIcon icon = new ImageIcon("icon.gif");
JLabel label = new JLabel(icon); // Set at desired positions
table.put(new Integer(slider.getMinimum()), label);
table.put(new Integer(slider.getMaximum()), label); // Force the slider to use the new labels
slider.setLabelTable(table);
Related Examples |
e798. 显示JSlider的标记标签的更多相关文章
- e797. 显示JSlider的标记
The slider supports two levels of tick marks, major and minor. Typically, the minor tick-mark spacin ...
- HTML学习-2标记标签-2
三.表单元素 ①<form></form>表单标签,代表表单 主要属性:1.action提交到的页面. 2.method数据提交方式(get显示提交,有长度限制.post隐 ...
- java continue break 关键字 详解 区别 用法 标记 标签 使用 示例 联系
本文关键词: java continue break 关键字 详解 区别 用法 标记 标签 使用 示例 联系 跳出循环 带标签的continue和break 嵌套循环 深入continue ...
- /.nav-tabs :是普通标签页 .nav-pills:胶囊式标签页 action ;默认的激活项,给<li>加默认显示的是哪个标签页内容 .nav是标签页的一个基类,给ul加 .nav-stacked: 垂直排列BootStrap
<meta name="viewport" content="with=device-width, initial-scale=1, user-scalabe=no ...
- HTML学习-2标记标签-1
大致可以分为以下6类学习: 1.通用标签. 2.常用标签. 3.表格标签. 4.表单元素. 5.框架. 6.其他. 一.通用标签.及属性 1.<body></body>标签,主 ...
- eclipse不显示Android SDK Manager标签
新版的eclipse配置好android开发环境后没有显示在window菜单里显示Android SDK Manager,也没有在工具栏里出现android的工具图标.但可以通过android sdk ...
- flex学习笔记 使用函数,显示实时更新的标签
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="ht ...
- HTML入门(三)后台系统显示页面_框架标签
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- e799. 限制JSlider的数值在标记以内
By default, the slider can take on any value from the minimum to the maximum. It is possible to conf ...
随机推荐
- 36氪首发 | 「myShape」完成千万级人民币 Pre-A轮融资,推出 AI 智能健身私教
无需任何可穿戴设备. 36氪获悉,myShape(原Shapejoy)已于近期完成千万级人民币的Pre-A轮融资,由天奇阿米巴领投,远洋集团.七熹资本以及老股东跟投.过去 myShape 曾获得元迅资 ...
- zsh与oh-my-zsh
在开始今天的 MacTalk 之前,先问两个问题吧: 1.相对于其他系统,Mac 的主要优势是什么?2.你们平时用哪种 Shell?…… 第一个童靴可以坐下了,Mac 的最大优势是 GUI 和命令行的 ...
- lua脚本之lua语言简介以及lua的安装
本博主不擅于进行文字创作,所以,相当一部分文字皆复制于其他博文.还希望能够得到谅解. 一.Lua语言简介 Lua是一个免费的开源软件,可以免费用于科研及商业.Lua具有一个专家团队在维护和升级,其设 ...
- 理解FlumeNG的batchSize和transactionCapacity参数和传输事务的原理 【转】
基于ThriftSource,MemoryChannel,HdfsSink三个组件,对Flume数据传输的事务进行分析,如果使用的是其他组件,Flume事务具体的处理方式将会不同. Flume的事务处 ...
- vue2.0的contextmenu右键菜单
1.事情对象 <!DOCTYPE html> <html> <head> <title></title> <meta charset= ...
- ssh 地址
structs2http://struts.apache.org/download.cgi spring hibernate http://hibernate.org/orm/downloads/
- java基础篇---I/O技术(三)
接上一篇java基础篇---I/O技术(二) Java对象的序列化和反序列化 什么叫对象的序列化和反序列化 要想完成对象的输入或输出,还必须依靠对象输出流(ObjectOutputStream)和对象 ...
- C# 执行bat批处理文件
private void RunBat(string batPath) { Process pro = new Process(); FileInfo file = new FileInfo(batP ...
- RabbitMQ文档翻译——Work queues
原文链接:https://www.rabbitmq.com/tutorials/tutorial-two-java.html Work Queues (using the Java Client) I ...
- WPF中Name和x:Name
x:Name用来在XAML中表示一个制定对象的名称:可以通过它来访问XAML对应的资源: Name在.net的很多类中都存在,在WPF中可以和x:Name互换. 结果: 1. 在XAML中只存在x:N ...