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 ...
随机推荐
- 源码分析HotSpot GC过程(三):TenuredGeneration的GC过程
老年代TenuredGeneration所使用的垃圾回收算法是标记-压缩-清理算法.在回收阶段,将标记对象越过堆的空闲区移动到堆的另一端,所有被移动的对象的引用也会被更新指向新的位置.看起来像是把杂陈 ...
- MVC+EF+PagedList+调用通用存储封装+多表联合信息展示分页+存储过程分页
主要的技术点不在这里一一阐述,相关存储也是引用别人的,主要技术点就是通过最优性能方式处理需求,PagedList.包需要在线安装就可以 直接上干货 1.存储代码之第一种: 参数相对多点 /**//* ...
- iOS-通讯录(无界面)
通讯录(无界面) #import "AppDelegate.h" #import <AddressBook/AddressBook.h> @interface AppD ...
- DIOCP开源项目-DIOCP3的ECHO测试<贴图>
星期六开了测试台测试机子.星期天休息,今天早上来接两个图 开了2个客户端,一个qsl的echo client,一个是楠楠的dbiocp回调客户端.建立13240个连接 今天来后,机子很卡,后来发现是楠 ...
- 【Android】Gesture Detector
Gesture detector Android Touch Screen 与传统Click Touch Screen不同,会有一些手势(Gesture),例如Fling,Scroll等等. 这些Ge ...
- 分析jvm线程堆栈
目录 一.java线程状态 二.使用jstack生成进程dump文件 三.统计dump文件中处于不同状态的线程数量 四.举例分析不同状态的线程 1.分析BLOCKED (on object monit ...
- windows下使用mingw编译出ffplay(简化版)
之前编译FFmpeg直接使用dll.lib,默认的mingw也不会编译出ffplay.exe. 近期由于工作需要,需要验证下修改之后的FFmpeg版本是否正常,需要使用ffplay.exe. 比较暴力 ...
- Python获取间隔时间段的时间戳数据
import time import datetime today = datetime.datetime.now() # delta = datetime.timedelta(hours=1) de ...
- scala工程导入报错:scalatest_2.10-1.9.1.jar is cross-compiled with an incompatible version of Scala (2.10).
错误原因: The Scala IDE tries to check if binary incompatible Scala libraries have been inadvertently mi ...
- RedHat 将应用程序添加到 Gnome 菜单中
. . . . . 在RedHat下面安装了Eclipse,是解压缩就能运行的,没有经过脚本安装所以无法自动在菜单中生成链接,但是可以通过手动的方式,步骤如下. 首先在/usr/share/appli ...