JPanel « JSlider « Java Swing Q&A





1. JSlider fitting the width of a JPanel    stackoverflow.com

Is there any way to make a JSlider to fit the width of a JPanel when it resizes? I'm now using. JFrame's pack() method and when I resize the panel in ...

2. JSlider change JPanel[][] rows and columns    java-forums.org

private void maakPnlCenter() { waardeKolommen = slAantalKolommen.getValue(); waardeRijen = slAantalRijen.getValue(); JPanel pnlCenter = new JPanel(); pnlCenter.setLayout(new GridLayout(waardeRijen, waardeKolommen)); JPanel vakken[][] = new JPanel[waardeRijen][waardeKolommen]; for (int i = 0; i < waardeRijen; i++) { for (int j = 0; j < waardeKolommen; j++) { vakken[i][j] = new JPanel(); vakken[i][j].setBorder(new LineBorder(Color.black)); vakken[i][j].setPreferredSize(new Dimension(80, 80)); pnlCenter.add(vakken[i][j]); } } this.add(pnlCenter, BorderLayout.CENTER); }