本文整理了Java中javax.swing.JSlider.setLabelTable()
方法的一些代码示例,展示了JSlider.setLabelTable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSlider.setLabelTable()
方法的具体详情如下:
包路径:javax.swing.JSlider
类名称:JSlider
方法名:setLabelTable
暂无
代码示例来源:origin: marytts/marytts
labelTable.put(new Integer(i), new JLabel(String.valueOf(twoPowI)));
fftSizeSlider.setLabelTable(labelTable);
fftSizeSlider.setPaintLabels(true);
fftSizeSlider.addChangeListener(new ChangeListener() {
代码示例来源:origin: marytts/marytts
labelTable.put(new Integer(i), new JLabel(String.valueOf(twoPowI)));
fftSizeSlider.setLabelTable(labelTable);
fftSizeSlider.setPaintLabels(true);
fftSizeSlider.addChangeListener(new ChangeListener() {
代码示例来源:origin: marytts/marytts
labelTable.put(new Integer(i), new JLabel(String.valueOf(twoPowI)));
fftSizeSlider.setLabelTable(labelTable);
fftSizeSlider.setPaintLabels(true);
fftSizeSlider.addChangeListener(new ChangeListener() {
代码示例来源:origin: marytts/marytts
labelTable.put(new Integer(i), new JLabel(String.valueOf(twoPowI)));
fftSizeSlider.setLabelTable(labelTable);
fftSizeSlider.setPaintLabels(true);
fftSizeSlider.addChangeListener(new ChangeListener() {
代码示例来源:origin: apache/pdfbox
slider.setLabelTable(labelTable);
slider.addChangeListener(this);
代码示例来源:origin: stackoverflow.com
JSlider slider = ...
Dictionary dict = new Hashtable();
for (int i=0; i<=10000; i += 1000) {
dict.put(i, new JLabel(Integer.toString(i / 1000)));
}
slider.setLabelTable(dict);
代码示例来源:origin: stackoverflow.com
//Create the slider
JSlider framesPerSecond = new JSlider(JSlider.VERTICAL,
FPS_MIN, FPS_MAX, FPS_INIT);
...
//Create the label table
Hashtable labelTable = new Hashtable();
labelTable.put( new Integer( 0 ), new JLabel("Stop") );
labelTable.put( new Integer( FPS_MAX/10 ), new JLabel("Slow") );
labelTable.put( new Integer( FPS_MAX ), new JLabel("Fast") );
framesPerSecond.setLabelTable( labelTable );
framesPerSecond.setPaintLabels(true);
代码示例来源:origin: matsim-org/matsim
void replaceLabel(String label, int newEnd) {
for (Integer i : labelTable.keySet() ) {
JLabel value = labelTable.get(i);
if(value.getText().equals(label)) {
labelTable.remove(i);
break;
}
}
labelTable.put(Integer.valueOf(newEnd), new JLabel(label));
timestepSlider.setLabelTable(labelTable);
timestepSlider.repaint();
}
代码示例来源:origin: entertailion/Fling
public void setDuration(int duration) {
this.duration = duration;
if (duration >= 0) {
Hashtable labelTable = new Hashtable();
labelTable.put(new Integer(0), new JLabel("0"));
labelTable.put(new Integer(100), new JLabel(simpleDateFormat.format(new Date(duration * 1000))));
scrubber.setLabelTable(labelTable);
scrubber.setPaintLabels(true);
if (!isTranscoding) {
scrubber.setEnabled(true);
} else {
scrubber.setEnabled(false);
}
}
}
代码示例来源:origin: openpnp/openpnp
private void setUnits(LengthUnit units) {
if (units == LengthUnit.Millimeters) {
Hashtable<Integer, JLabel> incrementsLabels = new Hashtable<>();
incrementsLabels.put(1, new JLabel("0.01")); //$NON-NLS-1$
incrementsLabels.put(2, new JLabel("0.1")); //$NON-NLS-1$
incrementsLabels.put(3, new JLabel("1.0")); //$NON-NLS-1$
incrementsLabels.put(4, new JLabel("10")); //$NON-NLS-1$
incrementsLabels.put(5, new JLabel("100")); //$NON-NLS-1$
sliderIncrements.setLabelTable(incrementsLabels);
}
else if (units == LengthUnit.Inches) {
Hashtable<Integer, JLabel> incrementsLabels = new Hashtable<>();
incrementsLabels.put(1, new JLabel("0.001")); //$NON-NLS-1$
incrementsLabels.put(2, new JLabel("0.01")); //$NON-NLS-1$
incrementsLabels.put(3, new JLabel("0.1")); //$NON-NLS-1$
incrementsLabels.put(4, new JLabel("1.0")); //$NON-NLS-1$
incrementsLabels.put(5, new JLabel("10.0")); //$NON-NLS-1$
sliderIncrements.setLabelTable(incrementsLabels);
}
else {
throw new Error("setUnits() not implemented for " + units); //$NON-NLS-1$
}
machineControlsPanel.updateDros();
}
代码示例来源:origin: senbox-org/snap-desktop
private void configureSilderLabels(JSlider recordSlider) {
Hashtable<Integer, JLabel> labelTable = new Hashtable<>();
JLabel minLabel = new JLabel(String.valueOf(recordSlider.getMinimum()));
labelTable.put(recordSlider.getMinimum(), minLabel);
JLabel maxLabel = new JLabel(String.valueOf(recordSlider.getMaximum()));
labelTable.put(recordSlider.getMaximum(), maxLabel);
recordSlider.setLabelTable(labelTable);
}
代码示例来源:origin: stackoverflow.com
JSlider slider = new JSlider(JSlider.VERTICAL, 0, 100, 0);
slider.setMinorTickSpacing(5);
slider.setMajorTickSpacing(10);
slider.setPaintTicks(true);
Hashtable<Integer, JLabel> labels = new Hashtable<Integer, JLabel>();
labels.put(0, new JLabel("0"));
labels.put(100, new JLabel("100"));
slider.setLabelTable(labels);
slider.setPaintLabels(true);
代码示例来源:origin: stackoverflow.com
JSlider slider = new JSlider(0, 100, 50);
slider.setPaintLabels(true);
slider.setPaintTicks(true);
slider.setMajorTickSpacing(20);
slider.setMinorTickSpacing(2);
Dictionary<Integer, JLabel> labels = new Hashtable<>();
for (int i = 0; i <= 100; i += 20) {
labels.put(i, new JLabel(String.format("%.1f", i / 200.0)));
}
slider.setLabelTable(labels);
代码示例来源:origin: org.ihtsdo/wb-api
/**
*
*/
private void updateFineControlLabelTable() {
Hashtable<Integer, JLabel> fineLabelTable = new Hashtable<Integer, JLabel>();
for (int i = this.fineControl.getMinimum(); i <= this.fineControl.getMaximum(); i++) {
if ((i != 0) && (i != this.coarseControl.getMaximum())) {
if (i == this.fineControl.getMinimum()) {
fineLabelTable.put(new Integer(i), new JLabel("<html><font color='blue'>prev"));
} else if (i == this.fineControl.getMaximum()) {
fineLabelTable.put(new Integer(i), new JLabel("<html><font color='blue'>next"));
} else {
labelDateItem(fineLabelTable, i);
}
} else {
labelDateItem(fineLabelTable, i);
}
}
this.fineControl.setLabelTable(fineLabelTable);
}
代码示例来源:origin: palantir/Cinch
private void initializeInterface() {
JPanel toPanel = new JPanel(new BorderLayout());
toPanel.add(new JLabel("Count"), BorderLayout.WEST);
slider.setPaintLabels(true);
slider.setLabelTable(slider.createStandardLabels(1));
slider.setSnapToTicks(true);
toPanel.add(slider, BorderLayout.CENTER);
panel.setLayout(new BorderLayout());
panel.add(toPanel, BorderLayout.NORTH);
checkboxPanel.setLayout(new BoxLayout(checkboxPanel, BoxLayout.Y_AXIS));
checkboxPanel.setPreferredSize(new Dimension(200, 300));
panel.add(checkboxPanel, BorderLayout.CENTER);
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
}
代码示例来源:origin: nroduit/Weasis
private void formatSlider(JSlider slider) {
slider.setPaintTicks(true);
slider.setMajorTickSpacing(100);
slider.setMinorTickSpacing(5);
slider.setLabelTable(labels);
slider.setPaintLabels(true);
}
代码示例来源:origin: MegaMek/megamek
private JSlider buildSlider(String minMsgProperty, String maxMsgProperty, String toolTip, String title) {
JSlider thisSlider = new JSlider(SwingConstants.HORIZONTAL, 0, 10, 5);
Hashtable<Integer, JLabel> sliderLabels = new Hashtable<Integer, JLabel>(3);
sliderLabels.put(0, buildSliderLabel("0 - " + minMsgProperty));
sliderLabels.put(10, buildSliderLabel("10 - " + maxMsgProperty));
sliderLabels.put(5, buildSliderLabel("5"));
thisSlider.setToolTipText(toolTip);
thisSlider.setLabelTable(sliderLabels);
thisSlider.setPaintLabels(true);
thisSlider.setMinorTickSpacing(1);
thisSlider.setMajorTickSpacing(2);
thisSlider.setSnapToTicks(true);
thisSlider.setBorder(new TitledBorder(new LineBorder(Color.black), title));
thisSlider.setEnabled(true);
return thisSlider;
}
代码示例来源:origin: cytoscape/application
/**
* Method to set the upperBound for this Tunable. This might be used to change a Tunable
* based on changes in the plugin environment.
*
* @param upperBound the new upperBound for the tunable
*/
public void setUpperBound(Object upperBound) {
this.upperBound = upperBound;
if (inputField == null)
return;
// If we're a slider, this might require us to reset things
if (checkFlag(USESLIDER)) {
slider.setMaximum(sliderScale(upperBound));
slider.setLabelTable(createLabels(slider));
}
}
代码示例来源:origin: com.github.insubstantial/substance
/** Creates a new instance. */
@SuppressWarnings("UseOfObsoleteCollectionType")
public ColorSliderUI(JSlider b) {
super(b);
this.thumbModel = new DefaultButtonModel();
this.thumbModel.setArmed(false);
this.thumbModel.setSelected(false);
this.thumbModel.setPressed(false);
this.thumbModel.setRollover(false);
this.thumbModel.setEnabled(b.isEnabled());
this.stateTransitionTracker = new StateTransitionTracker(b,
this.thumbModel);
b.setLabelTable(new java.util.Hashtable());
}
代码示例来源:origin: nroduit/Weasis
public AbstractSliderComponent(AbstractAcquireActionPanel panel, String title) {
super(panel, title);
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
slider = new JSlider(getMin(), getMax(), getDefaultValue());
slider.setMajorTickSpacing(getMax());
slider.setPaintTicks(true);
slider.setLabelTable(getLabels());
slider.setPaintLabels(true);
SliderChangeListener.setFont(slider, FontTools.getFont10());
slider.setBorder(borderTitle);
add(slider);
}
内容来源于网络,如有侵权,请联系作者删除!