本文整理了Java中javax.swing.JSlider.setPaintTicks()
方法的一些代码示例,展示了JSlider.setPaintTicks()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSlider.setPaintTicks()
方法的具体详情如下:
包路径:javax.swing.JSlider
类名称:JSlider
方法名:setPaintTicks
暂无
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
sldVolume = new javax.swing.JSlider();
btnRewind = new javax.swing.JButton();
btnStop = new javax.swing.JButton();
pnlBar = new javax.swing.JPanel();
lblTime = new javax.swing.JLabel();
sldBar = new javax.swing.JSlider();
sldVolume.setMajorTickSpacing(20);
sldVolume.setOrientation(javax.swing.JSlider.VERTICAL);
sldVolume.setPaintTicks(true);
sldVolume.setValue(100);
sldVolume.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
sldVolumeStateChanged(evt);
sldBar.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
sldBarStateChanged(evt);
代码示例来源:origin: stackoverflow.com
// orientation, min, max, initial value
final JSlider slider = new JSlider(SwingConstants.HORIZONTAL, 0, 2, 1);
slider.setSnapToTicks(true); // only allow 0, 1, 2 and not in between
slider.setPaintTicks(true); // paint ticks at tick spacing interval
slider.setMajorTickSpacing(1); // set interval to 1
slider.setPaintLabels(true); // show labels on ticks
代码示例来源:origin: robotframework/SwingLibrary
private JSlider testSlider() {
JSlider slider = new JSlider(0, 5);
slider.setName("testSlider");
slider.setMajorTickSpacing(1);
slider.setPaintTicks(true);
return slider;
}
代码示例来源:origin: stackoverflow.com
public class SliderPane extends JPanel {
private JSlider diameterJSlider;
private Circle1 myPanel;
public SliderPane() {
setLayout(new BorderLayout());
myPanel = new Circle1();
diameterJSlider = new JSlider(SwingConstants.HORIZONTAL, 0, 300, 10);
diameterJSlider.setMajorTickSpacing(10);
diameterJSlider.setPaintTicks(true);
diameterJSlider.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
myPanel.setDiameter(diameterJSlider.getValue());
}
}
);
add(diameterJSlider, BorderLayout.NORTH);
add(myPanel, BorderLayout.CENTER);
}
}
代码示例来源:origin: sc.fiji/TrakEM2_
private JSlider createSlider(JPanel panel, GridBagLayout gb, GridBagConstraints c, String title, Font font, int sliderRange, int start) {
Utils.log2("createSlider range: " + sliderRange + ", start: " + start);
JSlider s = new JSlider(JSlider.HORIZONTAL, 0, sliderRange, start);
s.setPaintLabels(false);
s.setPaintTicks(false);
s.setBackground(Color.white);
c.gridy++;
c.insets = new Insets(2, 10, 0, 10);
gb.setConstraints(s, c);
panel.add(s);
JLabel l = new JLabel(title);
l.setBackground(Color.white);
l.setFont(font);
c.gridy++;
c.insets = new Insets(0, 10, IJ.isMacOSX() ? 4 : 0, 0);
JPanel p = new JPanel();
p.setBackground(Color.white);
p.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
gb.setConstraints(p, c);
p.add(l);
panel.add(p);
return s;
}
代码示例来源:origin: org.geotools/gt-widgets-swing-pending
/**
* opacity component, slider
*/
public OpacityComponent() {
super();
setLayout(new GridLayout(1, 1));
slide.setOpaque(false);
slide.setPaintTicks(true);
slide.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
applyOpacity(slide.getValue() / 100d);
}
});
}
代码示例来源:origin: nroduit/Weasis
/**
*
* @param value
* @param min
* @param max
* @param nbDiv
* @return
* @since 2.5.0
*/
public static JSlider newSlider(int value, int min, int max, int nbDiv) {
JSlider slider = newSlider(value, min, max);
slider.setPaintTicks(true);
slider.setPaintLabels(true);
setSliderLabelValues(slider, nbDiv);
return slider;
}
代码示例来源:origin: marytts/marytts
int max = 13;
int deflt = (int) (Math.log(this.fftSize) / Math.log(2));
JSlider fftSizeSlider = new JSlider(JSlider.VERTICAL, min, max, deflt);
fftSizeSlider.setAlignmentX(CENTER_ALIGNMENT);
fftSizeSlider.setMajorTickSpacing(1);
fftSizeSlider.setPaintTicks(true);
fftSizeSlider.setSnapToTicks(true);
Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();
fftSizeSlider.setPaintLabels(true);
fftSizeSlider.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent ce) {
JSlider source = (JSlider) ce.getSource();
代码示例来源: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: 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: marytts/marytts
int max = 13;
int deflt = (int) (Math.log(this.fftSize) / Math.log(2));
JSlider fftSizeSlider = new JSlider(JSlider.VERTICAL, min, max, deflt);
fftSizeSlider.setAlignmentX(CENTER_ALIGNMENT);
fftSizeSlider.setMajorTickSpacing(1);
fftSizeSlider.setPaintTicks(true);
fftSizeSlider.setSnapToTicks(true);
Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();
fftSizeSlider.setPaintLabels(true);
fftSizeSlider.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent ce) {
JSlider source = (JSlider) ce.getSource();
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {//GEN-BEGIN:initComponents
brightnessSlider = new javax.swing.JSlider();
setLayout(new java.awt.BorderLayout());
brightnessSlider.setMajorTickSpacing(50);
brightnessSlider.setOrientation(javax.swing.JSlider.VERTICAL);
brightnessSlider.setPaintTicks(true);
add(brightnessSlider, java.awt.BorderLayout.EAST);
}//GEN-END:initComponents
代码示例来源: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: marytts/marytts
int max = 13;
int deflt = (int) (Math.log(this.fftSize) / Math.log(2));
JSlider fftSizeSlider = new JSlider(JSlider.VERTICAL, min, max, deflt);
fftSizeSlider.setAlignmentX(CENTER_ALIGNMENT);
fftSizeSlider.setMajorTickSpacing(1);
fftSizeSlider.setPaintTicks(true);
fftSizeSlider.setSnapToTicks(true);
Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();
fftSizeSlider.setPaintLabels(true);
fftSizeSlider.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent ce) {
JSlider source = (JSlider) ce.getSource();
代码示例来源:origin: org.java.net.substance/substance
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {//GEN-BEGIN:initComponents
brightnessSlider = new javax.swing.JSlider();
setLayout(new java.awt.BorderLayout());
brightnessSlider.setMajorTickSpacing(50);
brightnessSlider.setOrientation(javax.swing.JSlider.VERTICAL);
brightnessSlider.setPaintTicks(true);
add(brightnessSlider, java.awt.BorderLayout.EAST);
}//GEN-END:initComponents
代码示例来源:origin: nroduit/Weasis
private void formatSlider(JSlider slider) {
slider.setPaintTicks(true);
slider.setMajorTickSpacing(100);
slider.setMinorTickSpacing(5);
slider.setLabelTable(labels);
slider.setPaintLabels(true);
}
代码示例来源:origin: marytts/marytts
int max = 13;
int deflt = (int) (Math.log(this.fftSize) / Math.log(2));
JSlider fftSizeSlider = new JSlider(JSlider.VERTICAL, min, max, deflt);
fftSizeSlider.setAlignmentX(CENTER_ALIGNMENT);
fftSizeSlider.setMajorTickSpacing(1);
fftSizeSlider.setPaintTicks(true);
fftSizeSlider.setSnapToTicks(true);
Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();
fftSizeSlider.setPaintLabels(true);
fftSizeSlider.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent ce) {
JSlider source = (JSlider) ce.getSource();
代码示例来源:origin: robo-code/robocode
private JSlider createBattlefieldSizeSlider() {
JSlider slider = new JSlider();
slider.setMinimum(MIN_BATTLEFIELD_SIZE);
slider.setMaximum(MAX_BATTLEFIELD_SIZE);
slider.setMajorTickSpacing(BATTLEFIELD_STEP_SIZE);
slider.setSnapToTicks(true);
slider.setPaintTicks(true);
return slider;
}
代码示例来源:origin: net.java.abeille/abeille
public JETABean createBean(String compName, boolean instantiateBean, boolean setDefaults) throws FormException {
JETABean jbean = super.createBean(compName, instantiateBean, setDefaults);
Component comp = jbean.getDelegate();
if (comp instanceof JSlider && setDefaults) {
JSlider slider = (JSlider) comp;
slider.setMajorTickSpacing(20);
slider.setMaximum(100);
slider.setPaintTicks(true);
slider.setPaintLabels(true);
}
return jbean;
}
}
代码示例来源:origin: 4thline/cling
volumeSlider = new JSlider(JSlider.HORIZONTAL, minVolume, maxVolume, maxVolume / 2);
volumeSlider.setBorder(BorderFactory.createTitledBorder("Volume"));
volumeSlider.setMajorTickSpacing(maxVolume / 5);
volumeSlider.setMinorTickSpacing(5);
volumeSlider.setPaintTicks(true);
volumeSlider.setPaintLabels(true);
volumeSlider.addChangeListener(new ChangeListener() {
内容来源于网络,如有侵权,请联系作者删除!