javax.swing.JSlider.setPreferredSize()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中javax.swing.JSlider.setPreferredSize()方法的一些代码示例,展示了JSlider.setPreferredSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSlider.setPreferredSize()方法的具体详情如下:
包路径:javax.swing.JSlider
类名称:JSlider
方法名:setPreferredSize

JSlider.setPreferredSize介绍

暂无

代码示例

代码示例来源:origin: 4thline/cling

public ProgressPanel() {
  super();
  setBorder(BorderFactory.createTitledBorder("Position"));
  setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
  positionLabel.setText("00:00:00/00:00:00");
  positionLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
  positionSlider.setEnabled(false);
  positionSlider.setPreferredSize(new Dimension(200, 24));
  add(positionSlider);
  add(positionLabel);
}

代码示例来源:origin: bonnyfone/vectalign

svgMorphing.setPreferredSize(new Dimension(400, 400));
sliderMorphing = new JSlider(JSlider.HORIZONTAL, 0, 1000, 0);
sliderMorphing.setPreferredSize(new Dimension(350, 25));
btnMorphAnimation = new JButton(icnPlay);
btnMorphAnimation.setPreferredSize(new Dimension(35, 35));

代码示例来源:origin: magefree/mage

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()) {

代码示例来源:origin: fossasia/neurolab-desktop

softeningSlider.setPreferredSize(new Dimension(200, 30));
sliderPanel.add(sliderMax);
sliderPanel.setPreferredSize(new Dimension(60, 600));
sliderMin.setPreferredSize(new Dimension(30, 600));
sliderMax.setPreferredSize(new Dimension(30, 600));

代码示例来源:origin: de.sciss/prefuse-core

/**
 * @see javax.swing.JComponent#setPreferredSize(java.awt.Dimension)
 */
public void setPreferredSize(Dimension d) {
  int fw = Math.min(40, d.width/5);
  int lw = Math.min(100, (d.width-fw)/2);
  int sw = d.width-fw-lw;
  super.setPreferredSize(d);
  Dimension dd = new Dimension(lw, d.height);
  m_label.setPreferredSize(dd);
  dd = new Dimension(sw, d.height);
  m_slider.setPreferredSize(dd);
  dd = new Dimension(fw, d.height);
  m_field.setPreferredSize(dd);
}

代码示例来源:origin: Exslims/MercuryTrade

public JPanel getSliderSettingsPanel(JLabel titleLabel, JLabel countLabel, JSlider slider) {
  Dimension elementsSize = convertSize(new Dimension(160, 30));
  Dimension countSize = convertSize(new Dimension(40, 30));
  titleLabel.setPreferredSize(elementsSize);
  slider.setPreferredSize(elementsSize);
  countLabel.setPreferredSize(countSize);
  JPanel panel = getTransparentPanel(new GridBagLayout());
  panel.setBackground(AppThemeColor.ADR_BG);
  GridBagConstraints titleGc = new GridBagConstraints();
  GridBagConstraints countGc = new GridBagConstraints();
  GridBagConstraints sliderGc = new GridBagConstraints();
  titleGc.weightx = 0.5f;
  countGc.weightx = 0.1f;
  sliderGc.weightx = 0.4f;
  titleGc.fill = GridBagConstraints.HORIZONTAL;
  countGc.fill = GridBagConstraints.HORIZONTAL;
  sliderGc.fill = GridBagConstraints.HORIZONTAL;
  titleGc.anchor = GridBagConstraints.NORTHWEST;
  countGc.anchor = GridBagConstraints.NORTHWEST;
  sliderGc.anchor = GridBagConstraints.NORTHWEST;
  titleGc.gridx = 0;
  countGc.gridx = 1;
  sliderGc.gridx = 2;
  panel.add(titleLabel, titleGc);
  panel.add(countLabel, countGc);
  panel.add(slider, sliderGc);
  return panel;
}

代码示例来源:origin: lbalazscs/Pixelitor

private ZoomControl() {
  super(new FlowLayout(FlowLayout.LEFT, 0, 0));
  zoomSlider = new JSlider(0, zoomLevels.length - 1);
  // Make sure that the status bar height does not increase because of this control.
  // Normally the JSlider vertical size in Nimbus would be 21.
  zoomSlider.setPreferredSize(new Dimension(200, PREFERRED_HEIGHT));
  zoomDisplay = new JLabel("100%");
  double preferredHeight = zoomDisplay.getPreferredSize().getHeight();
  Dimension preferredSize = new Dimension(70, (int) preferredHeight);
  zoomDisplay.setPreferredSize(preferredSize);
  zoomSlider.addChangeListener(e ->
    OpenComps.onActiveView(
          this::zoomAccordingToTheSlider));
  zoomLabel = new JLabel("  Zoom: ");
  add(zoomLabel);
  add(zoomSlider);
  add(zoomDisplay);
  Dimension buttonSize = new Dimension(60, PREFERRED_HEIGHT);
  fitButton = addZoomButton(buttonSize, "Fit",
      FIT_SPACE_ACTION, FIT_SPACE_TOOLTIP);
  actualPixelsButton = addZoomButton(buttonSize, "100%",
      ACTUAL_PIXELS_ACTION, ACTUAL_PIXELS_TOOLTIP);
  setLookIfNoImage();
  OpenComps.addActivationListener(this);
}

代码示例来源:origin: sdedit/sdedit

scaleSlider.setPreferredSize(new Dimension(100, 0));
scaleSlider.setMaximumSize(new Dimension(100, 0));
scaleSlider.addMouseListener(new MouseAdapter() {

代码示例来源:origin: bcdev/beam

private JSlider createSpeedSlider() {
  final JSlider speedSlider = new JSlider(1, 10);
  speedSlider.setToolTipText("Choose the playing speed");
  speedSlider.setSnapToTicks(true);
  speedSlider.setPaintTrack(true);
  speedSlider.setPaintTicks(true);
  speedSlider.setPaintLabels(true);
  speedSlider.setValue(6);
  speedSlider.setPreferredSize(new Dimension(80, speedSlider.getPreferredSize().height));
  speedSlider.addChangeListener(new ChangeListener() {
    @Override
    public void stateChanged(ChangeEvent e) {
      timerDelay = calculateTimerDelay();
      timer.setDelay(timerDelay);
      updateSpeedUnit();
    }
  });
  return speedSlider;
}

代码示例来源:origin: bcdev/beam

private JSlider createTimeSlider() {
  final JSlider timeSlider = new JSlider(JSlider.HORIZONTAL, 0, 0, 0);
  timeSlider.setMajorTickSpacing(stepsPerTimespan);
  timeSlider.setMinorTickSpacing(1);
  timeSlider.setPaintTrack(true);
  timeSlider.setSnapToTicks(true);
  timeSlider.setPaintTicks(true);
  timeSlider.addChangeListener(new ChangeListener() {
    @Override
    public void stateChanged(ChangeEvent e) {
      final int index = timeSlider.getValue() / stepsPerTimespan;
      final List<Band> bandList = getBandList(currentView.getRaster().getName());
      final String labelText = createSliderLabelText(bandList, index);
      dateLabel.setText("Date: " + labelText);
    }
  });
  timeSlider.setPreferredSize(new Dimension(320, 60));
  return timeSlider;
}

代码示例来源:origin: cytoscape.coreplugins/manual-layout

jSlider.setMinorTickSpacing(15);
jSlider.setValue(0);
jSlider.setPreferredSize(new Dimension(120, 50));
jSlider.addChangeListener(this);

代码示例来源:origin: org.cytoscape/manual-layout-impl

jSlider.setMinorTickSpacing(15);
jSlider.setValue(0);
jSlider.setPreferredSize(new Dimension(120, 50));
jSlider.addChangeListener(this);

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

quality.setPreferredSize(new Dimension(350, dim.height));

代码示例来源:origin: biojava/biojava

slider.setPreferredSize(new Dimension(100,slider.getPreferredSize().height));

代码示例来源:origin: apache/batik

quality.setPreferredSize(new Dimension(350, dim.height));

代码示例来源:origin: it.unibo.alchemist/alchemist-swingui

/**
 * 
 */
public ReactivityPanel() {
  super(UI_REACTIVITY);
  slider.setPreferredSize(new Dimension(SLIDE_SIZE, slider.getHeight()));
  // setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
  // button = new JButton(max);
  btnMax = new JToggleButton(MAX_REACTIVITY, max, true);
  btnReal = new JToggleButton(REALTIME, real, false);
  btnUser = new JToggleButton(USER_SELECTED, user, false);
  /*
   * add(button); add(slider); button.addActionListener(this);
   */
  btnMax.addItemListener(this);
  btnReal.addItemListener(this);
  btnUser.addItemListener(this);
  slider.setEnabled(false);
  stack1.registerFeature(btnMax);
  stack1.registerFeature(btnReal);
  buttMF.registerFeature(btnUser);
  sliderMF.registerFeature(slider);
  registerSection(stack1);
  registerSection(buttMF);
  registerSection(sliderMF);
}

代码示例来源:origin: eu.mihosoft.vrl/vrl

this.input.setPreferredSize(new Dimension(100, height));
this.input.setMinimumSize(new Dimension(100, height));

代码示例来源:origin: eu.mihosoft.vrl/vrl

this.improvedSlider.setPreferredSize(new Dimension(100, height));
this.improvedSlider.setMinimumSize(new Dimension(100, height));

代码示例来源:origin: uk.co.caprica/vlcj

contrastSlider.setMinimum(Math.round(LibVlcConst.MIN_CONTRAST * 100.0f));
contrastSlider.setMaximum(Math.round(LibVlcConst.MAX_CONTRAST * 100.0f));
contrastSlider.setPreferredSize(new Dimension(100, 40));
contrastSlider.setToolTipText("Change Contrast");
contrastSlider.setEnabled(false);
brightnessSlider.setMinimum(Math.round(LibVlcConst.MIN_BRIGHTNESS * 100.0f));
brightnessSlider.setMaximum(Math.round(LibVlcConst.MAX_BRIGHTNESS * 100.0f));
brightnessSlider.setPreferredSize(new Dimension(100, 40));
brightnessSlider.setToolTipText("Change Brightness");
brightnessSlider.setEnabled(false);
hueSlider.setMinimum(Math.round(LibVlcConst.MIN_HUE * 100.0f));
hueSlider.setMaximum(Math.round(LibVlcConst.MAX_HUE * 100.0f));
hueSlider.setPreferredSize(new Dimension(100, 40));
hueSlider.setToolTipText("Change ");
hueSlider.setEnabled(false);
saturationSlider.setMinimum(Math.round(LibVlcConst.MIN_SATURATION * 100.0f));
saturationSlider.setMaximum(Math.round(LibVlcConst.MAX_SATURATION * 100.0f));
saturationSlider.setPreferredSize(new Dimension(100, 40));
saturationSlider.setToolTipText("Change ");
saturationSlider.setEnabled(false);
gammaSlider.setMinimum(Math.round(LibVlcConst.MIN_GAMMA * 100.0f));
gammaSlider.setMaximum(Math.round(LibVlcConst.MAX_GAMMA * 100.0f));
gammaSlider.setPreferredSize(new Dimension(100, 40));
gammaSlider.setToolTipText("Change ");
gammaSlider.setEnabled(false);

代码示例来源:origin: uk.co.caprica/vlcj

add(disableButton);
opacitySlider.setPreferredSize(new Dimension(100, 16));

相关文章

JSlider类方法