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 ...
随机推荐
- u3d中的坐标系
任何子级游戏对象 (Child GameObject) 的检视器 (Inspector) 中的变换 (Transform) 值都会相对于父级 (Parent) 的变换 (Transform) 值而显示 ...
- 【delphi】多线程同步之Semaphore
另外两种多线程的同步方法 CriticalSection(临界区) 和 Mutex(互斥), 这两种同步方法差不多, 只是作用域不同; CriticalSection(临界区) 类似于只有一个蹲位的公 ...
- ElasticSearch5.3安装head插件及连接ElasticSearch
1. 安装插件head # 去github上下载head git clone git://github.com/mobz/elasticsearch-head.git # 由于head基于nodejs ...
- 实现基于最近邻内插和双线性内插的图像缩放C++实现
平时我们写图像处理的代码时,如果需要缩放图片,我们都是直接调用图像库的resize函数来完成图像的缩放.作为一个机器视觉或者图像处理算法的工作者,图像缩放代码的实现应该是必须掌握的.在众多图像缩放算法 ...
- easyui扩展
datagrid行内编辑时为datetimebox $.extend($.fn.datagrid.defaults.editors, { datetimebox: {// datetimebox就是你 ...
- django源码解析之 BooleanField (二)
class BooleanField(Field): empty_strings_allowed = False default_error_messages = { 'invalid': _(u&q ...
- 审计一波appcms-持续更新。
废话 看到土司大牛都在审计,作为彩笔也要审计下去.该文章置顶持续更新.大家有啥可以评论区交流. 先对其目录进行分析 -admin/ #后台文件 - - -cache/ #缓存目录 -core/ #核心 ...
- FileNet P8 工作流生命周期管理和 Process Engine API 应用介绍
摘录:https://www.ibm.com/developerworks/cn/data/library/techarticles/dm-0902wangzheng/ FileNet P8 工作流生 ...
- DataTable的一些特殊用法:Select
当你从数据库里取出一些数据,然后要对数据进行整合,你很容易就会想到: 1DataTable dt = new DataTable();//假设dt是由"SELECT C1,C2,C3 FRO ...
- TextBox只能输入数字
Asp.net TextBox只能输入数字 <asp:textbox id="TextBox1" onkeyup="if(isNaN(value))execComm ...