本文整理了Java中javax.swing.JSlider.getLabelTable()
方法的一些代码示例,展示了JSlider.getLabelTable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSlider.getLabelTable()
方法的具体详情如下:
包路径:javax.swing.JSlider
类名称:JSlider
方法名:getLabelTable
暂无
代码示例来源:origin: com.synaptix/SynaptixSwing
protected int getWidthOfWidestLabel() {
Dictionary dictionary = slider.getLabelTable();
int widest = 0;
if (dictionary != null) {
Enumeration keys = dictionary.keys();
while (keys.hasMoreElements()) {
Component label = (Component) dictionary
.get(keys.nextElement());
widest = Math.max(label.getPreferredSize().width, widest);
}
}
return widest;
}
代码示例来源:origin: com.synaptix/SynaptixSwing
protected int getHeightOfTallestLabel() {
Dictionary dictionary = slider.getLabelTable();
int tallest = 0;
if (dictionary != null) {
Enumeration keys = dictionary.keys();
while (keys.hasMoreElements()) {
Component label = (Component) dictionary
.get(keys.nextElement());
tallest = Math.max(label.getPreferredSize().height, tallest);
}
}
return tallest;
}
代码示例来源:origin: com.synaptix/SynaptixSwing
protected int getHeightOfTallestLabel() {
Dictionary dictionary = slider.getLabelTable();
int tallest = 0;
if (dictionary != null) {
Enumeration keys = dictionary.keys();
while (keys.hasMoreElements()) {
Component label = (Component) dictionary
.get(keys.nextElement());
tallest = Math.max(label.getPreferredSize().height, tallest);
}
}
return tallest;
}
代码示例来源:origin: com.synaptix/SynaptixSwing
protected int getWidthOfWidestLabel() {
Dictionary dictionary = slider.getLabelTable();
int widest = 0;
if (dictionary != null) {
Enumeration keys = dictionary.keys();
while (keys.hasMoreElements()) {
Component label = (Component) dictionary
.get(keys.nextElement());
widest = Math.max(label.getPreferredSize().width, widest);
}
}
return widest;
}
代码示例来源:origin: nroduit/Weasis
public static void setFont(JSlider jslider, Font font) {
Enumeration<?> enumVal = jslider.getLabelTable().elements();
while (enumVal.hasMoreElements()) {
Object el = enumVal.nextElement();
if (el instanceof JLabel) {
((JLabel) el).setFont(font);
}
}
}
代码示例来源:origin: UISpec4J/UISpec4J
private TreeMap<Integer, String> getSortedTree() {
Dictionary dictionary = jSlider.getLabelTable();
TreeMap<Integer, String> treeMap = new TreeMap<Integer, String>();
for (Enumeration indices = dictionary.keys(); indices.hasMoreElements();) {
Integer index = (Integer)indices.nextElement();
JComponent component = (JComponent)dictionary.get(index);
treeMap.put(index, ComponentUtils.getDisplayedName(component));
}
return treeMap;
}
}
代码示例来源:origin: UISpec4J/UISpec4J
private int getIndexForLabel(String label) {
Dictionary dictionary = jSlider.getLabelTable();
for (Enumeration indices = dictionary.keys(); indices.hasMoreElements();) {
Integer index = (Integer)indices.nextElement();
JComponent component = (JComponent)dictionary.get(index);
if (label.equals(ComponentUtils.getDisplayedName(component))) {
return index;
}
}
return -1;
}
代码示例来源:origin: lbalazscs/Pixelitor
public void showTicksAsFloat() {
// TODO throws NullPointerException
slider.createStandardLabels(10);
@SuppressWarnings("unchecked")
Dictionary<Integer, JLabel> labelsDict = slider.getLabelTable();
Enumeration<Integer> keys = labelsDict.keys();
while (keys.hasMoreElements()) {
Integer i = keys.nextElement();
labelsDict.get(i).setText(String.valueOf(i / 100.0f));
}
}
代码示例来源:origin: com.synaptix/SynaptixSwing
/**
* Returns the label that corresponds to the lowest slider value in the
* label table.
*
* @see JSlider#setLabelTable
*/
protected Component getHighestValueLabel() {
Integer max = getHighestValue();
if (max != null) {
return (Component) slider.getLabelTable().get(max);
}
return null;
}
代码示例来源:origin: com.synaptix/SynaptixSwing
/**
* Returns the label that corresponds to the highest slider value in the
* label table.
*
* @see JSlider#setLabelTable
*/
protected Component getLowestValueLabel() {
Integer min = getLowestValue();
if (min != null) {
return (Component) slider.getLabelTable().get(min);
}
return null;
}
代码示例来源:origin: com.synaptix/SynaptixSwing
/**
* Returns the label that corresponds to the lowest slider value in the
* label table.
*
* @see JSlider#setLabelTable
*/
protected Component getHighestValueLabel() {
Integer max = getHighestValue();
if (max != null) {
return (Component) slider.getLabelTable().get(max);
}
return null;
}
代码示例来源:origin: com.synaptix/SynaptixSwing
/**
* Returns the label that corresponds to the highest slider value in the
* label table.
*
* @see JSlider#setLabelTable
*/
protected Component getLowestValueLabel() {
Integer min = getLowestValue();
if (min != null) {
return (Component) slider.getLabelTable().get(min);
}
return null;
}
代码示例来源:origin: UISpec4J/UISpec4J
private String getCurrentLabel() {
int value = jSlider.getValue();
Dictionary dictionary = jSlider.getLabelTable();
for (Enumeration indices = dictionary.keys(); indices.hasMoreElements();) {
Integer index = (Integer)indices.nextElement();
JComponent component = (JComponent)dictionary.get(index);
if (Utils.equals(index, value)) {
return ComponentUtils.getDisplayedName(component);
}
}
return null;
}
代码示例来源:origin: net.java.dev.swing-layout/swing-layout
private Integer getMinSliderValue(JSlider slider) {
Dictionary dictionary = slider.getLabelTable();
if (dictionary != null) {
Enumeration keys = dictionary.keys();
int min = slider.getMaximum() + 1;
while (keys.hasMoreElements()) {
min = Math.min(min, ((Integer)keys.nextElement()).intValue());
}
if (min == slider.getMaximum() + 1) {
return null;
}
return new Integer(min);
}
return null;
}
代码示例来源:origin: net.java.dev.swing-layout/swing-layout
private Integer getMaxSliderValue(JSlider slider) {
Dictionary dictionary = slider.getLabelTable();
if (dictionary != null) {
Enumeration keys = dictionary.keys();
int max = slider.getMinimum() - 1;
while (keys.hasMoreElements()) {
max = Math.max(max, ((Integer)keys.nextElement()).intValue());
}
if (max == slider.getMinimum() - 1) {
return null;
}
return new Integer(max);
}
return null;
}
代码示例来源:origin: net.java.dev.swing-layout/swing-layout
private static Integer getMaxSliderValue(JSlider slider) {
Dictionary dictionary = slider.getLabelTable();
if (dictionary != null) {
Enumeration keys = dictionary.keys();
int max = slider.getMinimum() - 1;
while (keys.hasMoreElements()) {
max = Math.max(max, ((Integer)keys.nextElement()).intValue());
}
if (max == slider.getMinimum() - 1) {
return null;
}
return new Integer(max);
}
return null;
}
代码示例来源:origin: net.java.dev.swing-layout/swing-layout
private static Integer getMinSliderValue(JSlider slider) {
Dictionary dictionary = slider.getLabelTable();
if (dictionary != null) {
Enumeration keys = dictionary.keys();
int min = slider.getMaximum() + 1;
while (keys.hasMoreElements()) {
min = Math.min(min, ((Integer)keys.nextElement()).intValue());
}
if (min == slider.getMaximum() + 1) {
return null;
}
return new Integer(min);
}
return null;
}
代码示例来源:origin: com.synaptix/SynaptixSwing
/**
* Returns the biggest value that has an entry in the label table.
*
* @return biggest value that has an entry in the label table, or null.
* @since 1.6
*/
protected Integer getHighestValue() {
Dictionary dictionary = slider.getLabelTable();
if (dictionary != null) {
Enumeration keys = dictionary.keys();
int max = slider.getMinimum() - 1;
while (keys.hasMoreElements()) {
max = Math.max(max, ((Integer) keys.nextElement()).intValue());
}
if (max == slider.getMinimum() - 1) {
return null;
}
return max;
}
return null;
}
代码示例来源:origin: com.synaptix/SynaptixSwing
/**
* Returns the smallest value that has an entry in the label table.
*
* @return smallest value that has an entry in the label table, or null.
* @since 1.6
*/
protected Integer getLowestValue() {
Dictionary dictionary = slider.getLabelTable();
if (dictionary != null) {
Enumeration keys = dictionary.keys();
int min = slider.getMaximum() + 1;
while (keys.hasMoreElements()) {
min = Math.min(min, ((Integer) keys.nextElement()).intValue());
}
if (min == slider.getMaximum() + 1) {
return null;
}
return min;
}
return null;
}
代码示例来源:origin: com.synaptix/SynaptixSwing
protected void calculateTrackBuffer() {
if (slider.getPaintLabels() && slider.getLabelTable() != null) {
Component highLabel = getHighestValueLabel();
Component lowLabel = getLowestValueLabel();
if (slider.getOrientation() == JSlider.HORIZONTAL) {
trackBuffer = Math.max(highLabel.getBounds().width, lowLabel
.getBounds().width) / 2;
trackBuffer = Math.max(trackBuffer, thumbRect.width / 2);
} else {
trackBuffer = Math.max(highLabel.getBounds().height, lowLabel
.getBounds().height) / 2;
trackBuffer = Math.max(trackBuffer, thumbRect.height / 2);
}
} else {
if (slider.getOrientation() == JSlider.HORIZONTAL) {
trackBuffer = thumbRect.width / 2;
} else {
trackBuffer = thumbRect.height / 2;
}
}
}
内容来源于网络,如有侵权,请联系作者删除!