Ciao a tutti!
Volevo chiedervi una cosa, sicuramente voi ne sapete più di me al riguardo. Sto creando un JINternalFrame nel quale ho un JTabbedPane. In questo jTabbedPane inserisco dinamicamente un JPanel, nel quale ho inserito un JScrollPane nel quale ho diversi piccoli JPanel che contengono elementi grafici(textField...etc.)
Il problema è che non viene visualizzata la scroll all'occorrenza? Qualcuno mi sa dire a cosa può essere dovuto?
Ecco parte del mio codice..grazie (Spero che qualcuno mi aiuti..)!
codice:
scroll=new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
panelScroll=new JPanel(new FlowLayout(FlowLayout.LEADING));
panelScroll.setPreferredSize(new Dimension(380, 300));
for(int j=0;j<label.size();j++) {
Vector labelEtichetta=(Vector)label.get(j);
String etichetta=(String)labelEtichetta.get(1);
if(etichetta.equalsIgnoreCase((String)((Vector)labelArchivio.get(indice)).get(0))){
tempLabel = (JLabel) labelEtichetta.get(0);
tempPanel = new JPanel();
tempPanel.add(tempLabel);
o = text.get(j);
if (o instanceof JTextField) {
tempText = (JTextField) o;
tempPanel.add(tempText);
panelScroll.add(tempPanel);
}
else if (o instanceof JComboBox) {
tempCombo = (JComboBox) o;
tempPanel.add(tempCombo);
panelScroll.add(tempPanel);
}
else if (o instanceof JFormattedTextField) {
tempForm = (JFormattedTextField) o;
tempPanel.add(tempForm);
panelScroll.add(tempPanel);
}
}
}
scroll.getViewport().removeAll();
scroll.getViewport().add(panelScroll, null);
( (JPanel) jTabbedPanePermessi.getComponent(
indice)).removeAll();
( (JPanel) jTabbedPanePermessi.getComponent(
indice)).add(scroll, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0
, GridBagConstraints.CENTER,
GridBagConstraints.BOTH,
new Insets(0, 0, 0, 0), 0, 0));
indice++;
}