Commit 0505c25e authored by 9831111's avatar 9831111 🙂

Add sliderAndIcon method.

parent 965139f9
import javax.swing.*;
import javax.swing.border.LineBorder;
import java.awt.*;
public class CreateNewGameFrame extends JFrame {
......@@ -48,4 +49,24 @@ public class CreateNewGameFrame extends JFrame {
settingPanel.add(gameDetailsPanel, BorderLayout.CENTER);
}
public void sliderAndIcon(JSlider slider, String iconName) {
slider.setMajorTickSpacing(10);
slider.setBackground(Color.white);
slider.setBorder(new LineBorder(Color.GRAY, 2));
slider.setForeground(Color.darkGray);
slider.setOpaque(true);
slider.setMinorTickSpacing(5);
slider.setPaintTicks(true);
slider.setPaintLabels(true);
ImageIcon icon = new ImageIcon(iconName);
JLabel label = new JLabel(icon);
gameDetailsPanel.add(label);
gameDetailsPanel.add(slider);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment