ecco il problema: ho realizzato una classe estesa a JFrame alla quale aggiungo un JPanel tablePanel inserito in un JScrollPane barrePanel;
-------------
tablePanel = new JPanel();
tablePanel.setLayout(new GridBagLayout());
c1 = new GridBagConstraints();
barrePanel = new JScrollPane(tablePanel);
barrePanel.setVerticalScrollBarPolicy(JScrollPane. VERTICAL_SCROLLBAR_ALWAYS);
barrePanel.setHorizontalScrollBarPolicy(JScrollPan e.HORIZONTAL_SCROLLBAR_NEVER);
barrePanel.setPreferredSize(new Dimension(560, 100));
c.gridx = 5;
c.gridy = 3;
c.anchor = GridBagConstraints.NORTHWEST;
this.add(barrePanel, c); // Il this è riferito al JFrame
-----------------
Quando però il tablePanel comprende componenti che richiedono maggiore spazio, non è il barrePanel a Scrollare, ma sono i componenti a rimpicciolirsi.
Note:
- Aggiungo i componenti al tablePanel e non al barrePanel.
- Utilizzo, nel tablePanel, un GridBagLayout per posizionare gli elementi.
Ringrazio in anticipo per l'attezione