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

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

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

JSlider.setBackground介绍

暂无

代码示例

代码示例来源:origin: pvto/konte-art

@Override
public void setBackground(Color bg)
{
  super.setBackground(bg);
  if (jSlider1 != null)
    jSlider1.setBackground(bg);
}

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

public JSlider getSlider(int min, int max, int value, Color background) {
  JSlider slider = this.getSlider(min, max, value);
  slider.setBackground(background);
  return slider;
}

代码示例来源:origin: sc.fiji/TrakEM2_

public final void setColor(final Color color) {
  this.color = color;
  setBackground(color);
  slider.setBackground(color);
  if (Color.white == color) {
    title.setForeground(Color.black);
  } else {
    title.setForeground(Color.white);
  }
  repaint();
}

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

/**
 * @see java.awt.Component#setBackground(java.awt.Color)
 */
public void setBackground(Color c) {
  m_field.setBackground(c);
  m_label.setBackground(c);
  m_slider.setBackground(c);
  super.setBackground(c);
}

代码示例来源: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: sc.fiji/TrakEM2_

public final void paint(final Graphics g) {
  title.setText(makeTitle());
  if (display.getLayer() == layer) {
    setBackground(Color.green);
    slider.setBackground(Color.green);
  } else {
    setBackground(color);
    slider.setBackground(color);
  }
  super.paint(g);
}

代码示例来源:origin: atarw/material-ui-swing

@Override
public void installUI (JComponent c) {
  super.installUI (c);
  JSlider slider = (JSlider) c;
  slider.setFont (UIManager.getFont ("Slider.font"));
  slider.setBackground (UIManager.getColor ("Slider.background"));
  slider.setForeground (UIManager.getColor ("Slider.foreground"));
  slider.setBorder (UIManager.getBorder ("Slider.border"));
}

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

public JSlider getOpacitySlider(AdrComponentDescriptor descriptor) {
  JSlider opacitySlider = this.componentsFactory.getSlider(20, 100, (int) (descriptor.getOpacity() * 100));
  opacitySlider.setBackground(AppThemeColor.SLIDE_BG);
  opacitySlider.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseReleased(MouseEvent e) {
      descriptor.setOpacity(opacitySlider.getValue() / 100f);
      MercuryStoreUI.adrReloadSubject.onNext(descriptor);
    }
  });
  return opacitySlider;
}

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

public JPanel getFpsSliderPanel(AdrCaptureDescriptor descriptor) {
  JPanel fpsPanel = this.componentsFactory.getJPanel(new BorderLayout(), AppThemeColor.ADR_BG);
  JLabel fpsCountLabel = this.componentsFactory.getTextLabel(String.valueOf(descriptor.getFps()));
  fpsCountLabel.setPreferredSize(new Dimension(30, 26));
  JSlider fpsSlider = this.componentsFactory.getSlider(1, 60, descriptor.getFps());
  fpsSlider.setBackground(AppThemeColor.SLIDE_BG);
  fpsSlider.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseReleased(MouseEvent e) {
      descriptor.setFps(fpsSlider.getValue());
      fpsCountLabel.setText(String.valueOf(fpsSlider.getValue()));
      MercuryStoreUI.adrReloadSubject.onNext(descriptor);
    }
  });
  fpsPanel.add(fpsCountLabel, BorderLayout.LINE_START);
  fpsPanel.add(fpsSlider, BorderLayout.CENTER);
  return fpsPanel;
}

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2-experimental

yMinSlider.addChangeListener(this);
yMaxSlider.addChangeListener(this);
xMinSlider.setBackground(Color.WHITE);
xMaxSlider.setBackground(Color.WHITE);
yMinSlider.setBackground(Color.WHITE);
yMaxSlider.setBackground(Color.WHITE);
xMaxSlider.setEnabled(false);
xMinSlider.setEnabled(false);

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

public JSlider getSlider(int min, int max, int value) {
    JSlider slider = new JSlider(JSlider.HORIZONTAL, min, max, value);
    slider.setMajorTickSpacing(10);
    slider.setMinorTickSpacing(1);
//        slider.setPaintLabels(true);
//        slider.setUI(new WindowsSliderUI(slider));
    slider.setForeground(AppThemeColor.TEXT_DEFAULT);
    slider.setFont(REGULAR_FONT.deriveFont(15f));
    slider.setRequestFocusEnabled(false);
    slider.addMouseMotionListener(new MouseMotionAdapter() {
      @Override
      public void mouseDragged(MouseEvent e) {
        slider.getParent().repaint();
      }
    });
    slider.setBackground(AppThemeColor.FRAME);
    return slider;
  }

代码示例来源:origin: MrCrayfish/ModelCreator

sliderPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(ModelCreator.BACKGROUND, 5), "<html><b>Rotation</b></html>"));
rotation = new JSlider(JSlider.HORIZONTAL, ROTATION_MIN, ROTATION_MAX, ROTATION_INIT);
rotation.setBackground(ModelCreator.BACKGROUND);
rotation.setMajorTickSpacing(4);
rotation.setPaintTicks(true);

代码示例来源:origin: MrCrayfish/ModelCreator

rotation.setBackground(ModelCreator.BACKGROUND);
rotation.setMajorTickSpacing(1);
rotation.setPaintTicks(true);

代码示例来源:origin: com.caffeineowl/bezier-utils

ctrlsSupport.setBackground(Color.white);
this.precSlider.setBackground(new Color(231, 231, 255));

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

JPanel paddingPanel = this.adrComponentsFactory.getGapPanel(this.payload);
JSlider opacitySlider = this.componentsFactory.getSlider(20, 100, (int) (this.payload.getOpacity() * 100));
opacitySlider.setBackground(AppThemeColor.SLIDE_BG);
opacitySlider.addMouseListener(new MouseAdapter() {
  @Override

代码示例来源:origin: net.sf.jung/jung-samples

edgeBetweennessSlider.setBackground(Color.WHITE);
edgeBetweennessSlider.setPreferredSize(new Dimension(210, 50));
edgeBetweennessSlider.setPaintTicks(true);

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

frameSlider.setBackground(VSwingUtil.TRANSPARENT_COLOR);
frameSlider.setEnabled(false);
frameSlider.setValue(0);

代码示例来源:origin: jrtom/jung

edgeBetweennessSlider.setBackground(Color.WHITE);
edgeBetweennessSlider.setPreferredSize(new Dimension(210, 50));
edgeBetweennessSlider.setPaintTicks(true);

代码示例来源:origin: sc.fiji/TrakEM2_

this.transp_slider.setBackground(Color.white);
this.transp_slider.setMinimumSize(new Dimension(250, 20));
this.transp_slider.setMaximumSize(new Dimension(250, 20));

相关文章

JSlider类方法