本文整理了Java中javax.swing.JSlider.<init>()
方法的一些代码示例,展示了JSlider.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSlider.<init>()
方法的具体详情如下:
包路径:javax.swing.JSlider
类名称:JSlider
方法名:<init>
暂无
代码示例来源:origin: stanfordnlp/CoreNLP
private JPanel makeBrowseButtonBox() {
JPanel buttonBox = new JPanel();
buttonBox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
buttonBox.setLayout(new GridBagLayout());
browseButton = new JButton("Browse Trees");
browseButton.addActionListener(this);
JLabel sizeLabel = new JLabel("Tree size:");
JSlider fontSlider = new JSlider(2, 64, 12);
fontSlider.addChangeListener(this);
GridBagConstraints buttonConstraints = new GridBagConstraints();
buttonConstraints.fill = GridBagConstraints.HORIZONTAL;
buttonConstraints.weightx = 0.2;
buttonConstraints.weighty = 0.2;
buttonBox.add(browseButton,buttonConstraints);
buttonConstraints.weightx = 0.6;
buttonBox.add(fontSlider, buttonConstraints);
buttonConstraints.weightx = 0.2;
buttonBox.add(sizeLabel, buttonConstraints);
return buttonBox;
}
代码示例来源: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.setPaintTicks(true);
sldVolume.setValue(100);
sldVolume.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
sldVolumeStateChanged(evt);
pnlButtons.add(btnOpen);
getContentPane().add(pnlButtons, java.awt.BorderLayout.CENTER);
sldBar.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
sldBarStateChanged(evt);
pnlBar.add(sldBar);
getContentPane().add(pnlBar, java.awt.BorderLayout.PAGE_START);
代码示例来源:origin: bonnyfone/vectalign
svgMorphing.setListener(this);
svgMorphing.setPreferredSize(new Dimension(400, 400));
sliderMorphing = new JSlider(JSlider.HORIZONTAL, 0, 1000, 0);
sliderMorphing.setPreferredSize(new Dimension(350, 25));
btnMorphAnimation = new JButton(icnPlay);
getContentPane().add(panelConfig, BorderLayout.WEST);
getContentPane().add(panelMorphing, BorderLayout.EAST);
getContentPane().add(panelOutput, BorderLayout.SOUTH);
setPreferredSize(new Dimension(900, 650));
setBackground(Color.white);
代码示例来源:origin: stackoverflow.com
final JFrame frame = new JFrame();
final JTextField text = new JTextField(20);
final JSlider slider = new JSlider(0, 100, 0);
slider.addChangeListener(new ChangeListener(){
@Override
public void stateChanged(ChangeEvent e) {
text.setText(String.valueOf(slider.getValue()));
frame.add(text, BorderLayout.NORTH);
frame.add(slider, BorderLayout.CENTER);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
frame.pack();
代码示例来源:origin: fossasia/neurolab-desktop
int[] y1 = new int[numChannels];
frame = new JFrame() {
parameterPanel.setBackground(Color.GREEN);
JSlider freqZoomSlider = new JSlider(JSlider.HORIZONTAL, 1, 800, 200);
JLabel freqZoomLabel = new JLabel("freq zoom: 0.5x");
freqZoomSlider.addChangeListener(new ChangeListener() {
parameterPanel.add(freqZoomLabel);
JSlider avgSlider = new JSlider(JSlider.HORIZONTAL, 100, 100000, 100);
avg = Integer.valueOf(config.getPref(Config.server_settings, String.valueOf(Config.server_settings_params.avg) ));
JLabel avgLabel = new JLabel("avg: " + avg);
avgSlider.addChangeListener(new ChangeListener() {
JSlider peakSlider = new JSlider(JSlider.HORIZONTAL, 1, 5000, 200);
JLabel peakLabel = new JLabel("p2p: "+pp+" uV");
peakSlider.addChangeListener(new ChangeListener() {
JSlider trainSlider = new JSlider(JSlider.HORIZONTAL, 1, 100, 10);
JLabel trainLabel = new JLabel("training factor: "+tf+"%");
trainSlider.addChangeListener(new ChangeListener() {
frame.setSize(width - samplesPerSecond-(drawBins?0:600), height);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
代码示例来源:origin: stackoverflow.com
quality = new JSlider(JSlider.VERTICAL, 0, 100, 75);
quality.setSnapToTicks(true);
quality.setPaintTicks(true);
quality.setMajorTickSpacing(10);
quality.setMinorTickSpacing(5);
quality.addChangeListener( new ChangeListener(){
public void stateChanged(ChangeEvent ce) {
updateImages();
gui.add(quality, BorderLayout.WEST);
dithering = new JCheckBox("Dithering", false);
controls.add(antialiasing);
controls.add(fractionalMetrics);
float qualityFloat = (float)quality.getValue()/100f;
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
builder.append(jpgSize);
builder.append(" bytes \tquality: ");
builder.append(quality.getValue());
代码示例来源:origin: stackoverflow.com
public class Test {
public static void main(String[] args) {
try {
SynthLookAndFeel laf = new SynthLookAndFeel();
laf.load(Test.class.getResourceAsStream("demo.xml"), Test.class);
UIManager.setLookAndFeel(laf);
} catch (Exception e) {
e.printStackTrace();
}
JFrame f = new JFrame();
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
f.add(new JSlider() {{
setOrientation(JSlider.VERTICAL);
setMinimum(-24);
setMaximum(12);
setVisible(true);
}});
f.setSize(320, 240);
f.setLocationRelativeTo(null);
f.setVisible(true);
}
}
代码示例来源:origin: eseifert/vectorgraphics2d
@Override
public void draw(Graphics2D g) {
JFrame frame = new JFrame();
frame.getContentPane().add(new JButton("Hello Swing!"), BorderLayout.CENTER);
frame.getContentPane().add(new JSlider(), BorderLayout.NORTH);
frame.setSize(200, 250);
//g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
frame.setVisible(true);
frame.printAll(g);
frame.setVisible(false);
frame.dispose();
}
}
代码示例来源:origin: fossasia/neurolab-desktop
frame = new JFrame();
frame.setSize(70, 600);
frame.setLayout(new BorderLayout());
JSlider slider = new JSlider(1,1000,50);
slider.setOrientation(JSlider.VERTICAL);
slider.addChangeListener(new ChangeListener() {
代码示例来源:origin: magefree/mage
JPanel sliderPanel = new JPanel(new GridBagLayout());
sliderPanel.setOpaque(false);
cardSizeSlider = new JSlider(SwingConstants.HORIZONTAL, 0, 100, 50);
cardSizeSlider.setOpaque(false);
cardSizeSlider.setPreferredSize(new Dimension(100, (int) cardSizeSlider.getPreferredSize().getHeight()));
cardSizeSlider.addChangeListener(e -> {
if (!cardSizeSlider.getValueIsAdjusting()) {
float sliderFrac = ((float) (cardSizeSlider.getValue() - 50)) / 50;
代码示例来源:origin: com.io7m.jcamera/com.io7m.jcamera.examples.jogl
CameraFloatSlider(
final String in_label,
final double in_minimum,
final double in_maximum)
{
this.label = new JLabel(NullCheck.notNull(in_label, "ForwardLabel"));
this.group = new RowGroup();
this.maximum = in_maximum;
this.minimum = in_minimum;
this.field = new JTextField(Double.toString(in_minimum));
this.slider = new JSlider(SwingConstants.HORIZONTAL);
this.slider.setMinimum(0);
this.slider.setMaximum(100);
this.slider.setValue(0);
this.slider.addChangeListener(ev -> {
final int slider_current = CameraFloatSlider.this.slider.getValue();
this.current = convertFromSlider(slider_current, in_minimum, in_maximum);
this.refreshText();
this.callListener();
});
this.field.setEditable(false);
}
代码示例来源:origin: stackoverflow.com
JFrame frame = new JFrame("Testing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new BorderLayout());
frame.add(new FadePane());
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
slider = new JSlider(0, 100);
setLayout(new BorderLayout());
add(slider, BorderLayout.SOUTH);
slider.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
progress = ((float)slider.getValue() / 100f);
repaint();
代码示例来源:origin: stackoverflow.com
public static void main(String[] args) {
JFrame frame = new JFrame("Test");
JSlider slider = new JSlider();
slider.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent ce) {
System.out.println(((JSlider) ce.getSource()).getValue());
}
});
frame.add(slider);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400, 300);
frame.setVisible(true);
}
代码示例来源:origin: stackoverflow.com
FloatControl.Type.MASTER_GAIN);
VolumeSlider vs = new VolumeSlider(volCtrl);
gui.add( new JLabel(volCtrl.toString()) );
gui.add( vs.getVolume() );
System.out.println(
" volCtrl.getValue() = " + volCtrl.getValue());
volume = new JSlider(
(int) volumeControl.getMinimum() * 100,
(int) volumeControl.getMaximum() * 100,
float val = volume.getValue() / 100f;
volumeControl.setValue(val);
System.out.println(
volume.addChangeListener(listener);
代码示例来源:origin: geotools/geotools
panel.add(label, "split 2");
fillOpacitySlider = new JSlider(0, 100, 100);
fillOpacitySlider.setPaintLabels(true);
fillOpacitySlider.setMajorTickSpacing(20);
fillOpacitySlider.addChangeListener(
new ChangeListener() {
panel.add(btn);
getContentPane().add(panel);
pack();
代码示例来源:origin: datacleaner/DataCleaner
public static void main(final String[] args) {
LookAndFeelManager.get().init();
final PopupButton popupButton =
new PopupButton("More", ImageManager.get().getImageIcon("images/menu/more.png"));
final JPanel toolBarPanel = new JPanel();
toolBarPanel.add(popupButton);
final JToolBar toolBar = new JToolBar();
toolBar.add(toolBarPanel);
final JPanel popupPanel = new JPanel();
popupPanel.setLayout(new BorderLayout());
popupPanel.add(new JLabel("This popup has components"), BorderLayout.NORTH);
popupPanel.add(new JTextArea("Some text", 15, 20), BorderLayout.CENTER);
popupPanel.add(new JSlider(), BorderLayout.SOUTH);
popupButton.getMenu().add(popupPanel);
final JFrame frame = new JFrame("test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setPreferredSize(new Dimension(640, 480));
frame.add(toolBar, BorderLayout.PAGE_START);
frame.pack();
frame.setVisible(true);
}
}
代码示例来源:origin: stackoverflow.com
import java.awt.BorderLayout;
import java.awt.GridLayout;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.SwingUtilities;
public class DifferentSizeSlider extends JPanel{
public DifferentSizeSlider() {
JPanel topPanel = new JPanel(new BorderLayout());
topPanel.add(new JSlider());
JPanel bottomPanel = new JPanel(new GridLayout(1, 2));
bottomPanel.add(new JSlider());
bottomPanel.add(new JPanel());
setLayout(new GridLayout(2, 1));
add(topPanel);
add(bottomPanel);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable(){
public void run() {
JOptionPane.showMessageDialog(null, new DifferentSizeSlider());
}
});
}
}
代码示例来源:origin: libgdx/libgdx
public ColorSlider (Color[] paletteColors) {
this.paletteColors = paletteColors;
setLayout(new GridBagLayout());
{
slider = new JSlider(0, 1000, 0);
slider.setPaintTrack(false);
add(slider, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
new Insets(0, 6, 0, 6), 0, 0));
}
{
colorPicker = new ColorPicker();
add(colorPicker, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.HORIZONTAL, new Insets(0, 6, 0, 6), 0, 0));
}
slider.addChangeListener(new ChangeListener() {
public void stateChanged (ChangeEvent event) {
colorPicked();
}
});
}
代码示例来源:origin: fossasia/neurolab-desktop
Font bigFont = new Font(Font.SANS_SERIF, Font.PLAIN, 16);
window = new JFrame()
JFrame controlPanel = new JFrame();
controlPanel.setSize(80, windowHeight);
controlPanel.setLocationRelativeTo(window);
controlPanel.setLayout(new BoxLayout(controlPanel.getContentPane(), BoxLayout.X_AXIS));
JSlider sliderMin = new JSlider(SwingConstants.VERTICAL, -1000, 1000, 0);
JSlider sliderMax = new JSlider(SwingConstants.VERTICAL, -1000, 5000, 30);
sliderMin.addChangeListener(new ChangeListener()
sliderMax.addChangeListener(new ChangeListener()
代码示例来源:origin: nroduit/Weasis
JSlider createSlider(final FloatControl c) {
if (c == null) {
return null;
}
final JSlider s = new JSlider(0, 1000);
final float min = c.getMinimum();
final float max = c.getMaximum();
final float width = max - min;
float fval = c.getValue();
s.setValue((int) ((fval - min) / width * 1000));
java.util.Hashtable<Integer, JLabel> labels = new java.util.Hashtable<>(3);
labels.put(0, new JLabel(c.getMinLabel()));
labels.put(500, new JLabel(c.getMidLabel()));
labels.put(1000, new JLabel(c.getMaxLabel()));
s.setLabelTable(labels);
s.setPaintLabels(true);
s.setBorder(new TitledBorder(c.getType().toString() + " " + c.getUnits())); //$NON-NLS-1$
s.addChangeListener(e -> {
int i = s.getValue();
float f = min + (i * width / 1000.0f);
c.setValue(f);
});
return s;
}
内容来源于网络,如有侵权,请联系作者删除!