📄 ScrollPaneTemplate.java .java dosyası
⬇️ İndir
import javax.swing.*;
import java.awt.*;
public class ScrollPaneTemplate {
public static void main(String[] args) {
Color frameBG = new Color(175, 191, 115);
JFrame frame = new JFrame("ScrollPane Şablon ve Renk | Java Blackboard [125]");
frame.setLayout(null);
frame.add(scrollPaneEkle());
frame.setSize(800,450);
frame.getContentPane().setBackground(frameBG);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(false);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
public static JScrollPane scrollPaneEkle() {
Color panelBG = new Color (242, 184, 75);
Color scrollPaneBG = new Color (0, 0, 0);
JPanel panel = new JPanel();
panel.setBackground(panelBG);
panel.setPreferredSize(new Dimension(730, 600)); // Panel boyutu
JScrollPane scrollPane = new JScrollPane(panel);
scrollPane.setBackground(scrollPaneBG);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
scrollPane.setBounds(20, 20, 760, 390);
return scrollPane;
}
}