本文整理了Java中javax.swing.JSlider.setMinorTickSpacing()
方法的一些代码示例,展示了JSlider.setMinorTickSpacing()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSlider.setMinorTickSpacing()
方法的具体详情如下:
包路径:javax.swing.JSlider
类名称:JSlider
方法名:setMinorTickSpacing
暂无
代码示例来源:origin: MovingBlocks/Terasology
public PropertySlider() {
titledBorder = new TitledBorder("");
setBorder(titledBorder);
borderLayout = new BorderLayout();
setLayout(borderLayout);
label = new JLabel("");
slider = new JSlider();
slider.setMinimum(0);
slider.setMaximum(100);
slider.setMinorTickSpacing(1);
slider.setMajorTickSpacing(10);
slider.addChangeListener(this);
add(slider, BorderLayout.CENTER);
add(label, BorderLayout.EAST);
}
代码示例来源:origin: osmdroid/osmdroid
sliMinZoom.setMinimum(0);
sliMinZoom.setMaximum(22);
sliMinZoom.setMajorTickSpacing(1);
sliMinZoom.setMinorTickSpacing(1);
sliMinZoom.setValue(0);
gbcpanel0.gridx = 1;
sliMaxZoom.setMinimum(0);
sliMaxZoom.setValue(10);
sliMaxZoom.setMajorTickSpacing(1);
sliMaxZoom.setMinorTickSpacing(1);
gbcpanel0.gridx = 1;
gbcpanel0.gridy = 4;
代码示例来源:origin: 4thline/cling
volumeSlider.setMajorTickSpacing(maxVolume / 5);
volumeSlider.setMinorTickSpacing(5);
volumeSlider.setPaintTicks(true);
volumeSlider.setPaintLabels(true);
代码示例来源:origin: stackoverflow.com
quality.setPaintTicks(true);
quality.setPaintLabels(true);
quality.setMajorTickSpacing(10);
quality.setMinorTickSpacing(5);
quality.addChangeListener( new ChangeListener(){
public void stateChanged(ChangeEvent ce) {
代码示例来源:origin: stackoverflow.com
framesPerWavelength.setMajorTickSpacing(10);
framesPerWavelength.setMinorTickSpacing(5);
framesPerWavelength.setToolTipText("Frames per Wavelength");
framesPerWavelength.addChangeListener( new ChangeListener(){
代码示例来源:origin: magefree/mage
tooltipDelay.setMajorTickSpacing(1000);
tooltipDelay.setMaximum(5000);
tooltipDelay.setMinorTickSpacing(100);
tooltipDelay.setPaintLabels(true);
tooltipDelay.setPaintTicks(true);
sliderFontSize.setMajorTickSpacing(5);
sliderFontSize.setMaximum(50);
sliderFontSize.setMinimum(10);
sliderFontSize.setMinorTickSpacing(1);
sliderFontSize.setPaintLabels(true);
sliderFontSize.setPaintTicks(true);
sliderChatFontSize.setMajorTickSpacing(5);
sliderChatFontSize.setMaximum(50);
sliderChatFontSize.setMinimum(10);
sliderChatFontSize.setMinorTickSpacing(1);
sliderChatFontSize.setPaintLabels(true);
sliderChatFontSize.setPaintTicks(true);
sliderDialogFont.setMaximum(50);
sliderDialogFont.setMinimum(10);
sliderDialogFont.setMinorTickSpacing(1);
sliderDialogFont.setPaintLabels(true);
sliderDialogFont.setPaintTicks(true);
sliderEditorCardSize.setMaximum(50);
sliderEditorCardSize.setMinimum(10);
sliderEditorCardSize.setMinorTickSpacing(1);
代码示例来源: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: 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: BranislavLazic/SwingTutorials
public JSliderTutorial() {
label.setOpaque(true);
slider.setMajorTickSpacing(10);
slider.setMinorTickSpacing(1);
slider.setPaintLabels(true);
slider.setPaintTicks(true);
slider.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
JSlider source = (JSlider) e.getSource();
label.setBackground(new Color(0,0,source.getValue()));
}
});
frame.add(label, BorderLayout.CENTER);
frame.add(slider,BorderLayout.SOUTH);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
代码示例来源:origin: lbalazscs/Pixelitor
public void setupTicks(int majorSpacing, int minorSpacing) {
if (majorSpacing > 0) {
slider.setMajorTickSpacing(majorSpacing);
}
if (minorSpacing > 0) {
slider.setMinorTickSpacing(minorSpacing);
}
slider.setPaintTicks(true);
slider.setPaintLabels(true);
}
代码示例来源:origin: stackoverflow.com
import java.awt.*;
import javax.swing.*;
class SliderTicks {
public static void main(String[] args) {
Runnable r = new Runnable() {
@Override
public void run() {
JSlider sliderInterior = new JSlider(JSlider.HORIZONTAL, -100, 100, 0);
sliderInterior.setMinorTickSpacing(5);
sliderInterior.setMajorTickSpacing(10);
sliderInterior.setPaintTicks(true);
JOptionPane.showMessageDialog(null, sliderInterior);
}
};
// Swing GUIs should be created and updated on the EDT
// http://docs.oracle.com/javase/tutorial/uiswing/concurrency
SwingUtilities.invokeLater(r);
}
}
代码示例来源:origin: stackoverflow.com
JSlider slider = new JSlider();
slider.setMinimum(0);
slider.setMaximum(100);
slider.setMajorTickSpacing(10);
slider.setMinorTickSpacing(2);
slider.setPaintTicks(true);
代码示例来源:origin: JavaOpenCVBook/code
minimum, maximum, initial);
upperSlider.setMajorTickSpacing(25);
upperSlider.setMinorTickSpacing(5);
upperSlider.setPaintTicks(true);
upperSlider.setPaintLabels(true);
代码示例来源:origin: JavaOpenCVBook/code
minimum, maximum, initial);
upperSlider.setMajorTickSpacing(25);
upperSlider.setMinorTickSpacing(5);
upperSlider.setPaintTicks(true);
upperSlider.setPaintLabels(true);
代码示例来源:origin: JavaOpenCVBook/code
minimum, maximum, initial);
lowerSlider.setMajorTickSpacing(25);
lowerSlider.setMinorTickSpacing(5);
lowerSlider.setPaintTicks(true);
lowerSlider.setPaintLabels(true);
代码示例来源:origin: sing-group/GC4S
private void initializeSliders() {
minValueSlider.setPaintTicks(true);
minValueSlider.setPaintLabels(true);
minValueSlider.setMajorTickSpacing(1);
minValueSlider.setMinorTickSpacing(1);
minValueSlider.addChangeListener((e) -> {
if(minValueSlider.getValue() > maxValueSlider.getValue()) {
maxValueSlider.setValue(minValueSlider.getValue());
}
rangeChanged();
});
maxValueSlider.setPaintTicks(true);
maxValueSlider.setPaintLabels(true);
maxValueSlider.setMajorTickSpacing(1);
maxValueSlider.setMinorTickSpacing(1);
maxValueSlider.addChangeListener((e) -> {
if(maxValueSlider.getValue() < minValueSlider.getValue()) {
minValueSlider.setValue(maxValueSlider.getValue());
}
rangeChanged();
});
}
代码示例来源:origin: JavaOpenCVBook/code
private void setupSlider(JFrame frame) {
JLabel sliderLabel = new JLabel("Depth filter", JLabel.CENTER);
sliderLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
int minimum = 0;
int maximum = 100;
int initial =0;
JSlider levelSlider = new JSlider(JSlider.HORIZONTAL,
minimum, maximum, initial);
levelSlider.setMajorTickSpacing(10);
levelSlider.setMinorTickSpacing(1);
levelSlider.setPaintTicks(true);
levelSlider.setPaintLabels(true);
levelSlider.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
JSlider source = (JSlider)e.getSource();
level = (int)source.getValue();
//Mat output = imageProcessor.blur(image, level);
//updateView(output);
}
});
frame.add(sliderLabel);
frame.add(levelSlider);
}
代码示例来源:origin: nroduit/Weasis
private void formatSlider(JSlider slider) {
slider.setPaintTicks(true);
slider.setMajorTickSpacing(100);
slider.setMinorTickSpacing(5);
slider.setLabelTable(labels);
slider.setPaintLabels(true);
}
代码示例来源:origin: JavaOpenCVBook/code
private void setupSlider(JFrame frame) {
JLabel sliderLabel = new JLabel("Blur level", JLabel.CENTER);
sliderLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
int minimum = 0;
int maximum = 10;
int initial =0;
JSlider levelSlider = new JSlider(JSlider.HORIZONTAL,
minimum, maximum, initial);
levelSlider.setMajorTickSpacing(2);
levelSlider.setMinorTickSpacing(1);
levelSlider.setPaintTicks(true);
levelSlider.setPaintLabels(true);
levelSlider.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
JSlider source = (JSlider)e.getSource();
int level = (int)source.getValue();
Mat output = imageProcessor.blur(image, level);
updateView(output);
}
});
frame.add(sliderLabel);
frame.add(levelSlider);
}
代码示例来源:origin: stackoverflow.com
public static void main(String[] args) throws Exception {
UIManager.getLookAndFeelDefaults().put("Slider.horizontalThumbIcon",new Icon(){
@Override
public int getIconHeight() {
return 0;
}
@Override
public int getIconWidth() {
return 0;
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
//do nothing
}
});
JFrame f = new JFrame();
JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 30, 15);
slider.setMajorTickSpacing(10);
slider.setMinorTickSpacing(1);
slider.setPaintTicks(true);
slider.setPaintLabels(true);
f.add(slider);
f.setSize(200,200);
f.setVisible(true);
}
内容来源于网络,如有侵权,请联系作者删除!