Results 1 to 2 of 2
Thread: JScrollPane refresh problem
- 01-23-2012, 11:15 AM #1
Member
- Join Date
- Jan 2012
- Posts
- 1
- Rep Power
- 0
JScrollPane refresh problem
Hi to all,
i've some problem with the refresh while use scrollbar in scrollpane.
The graphics object in my pane, seems to be cancelled or overwrited when scroll the page, the object that are not visible, when i use the scrollbar don't be paint. When i resize the page, all seems to be ok.
Sorry for my english.gif)
thanks for any helpJava Code:package Forms; import javax.swing.ButtonGroup; public class ClientsForm extends JScrollPane { // private ButtonGroup group; private JTextField RagSocField; private JTextField cognomeField; private JTextField nomeField; private JTextField pIvaField; private JTextField codFiscField; private JTextField indirizzoField; private JTextField civicoField; private JTextField cittaField; private JTextField provinciaField; private JTextField statoField; private JPanel insertClientPanel; /** * Create the panel. */ public ClientsForm() { setPreferredSize(new Dimension(450, 520)); // addMouseWheelListener(new MouseWheelListener() { // public void mouseWheelMoved(MouseWheelEvent arg0) { // insertClientPanel.doLayout(); // } // }); setIgnoreRepaint(false); insertClientPanel = new JPanel(); insertClientPanel.setPreferredSize(new Dimension(450, 520)); setViewportView(insertClientPanel); getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); insertClientPanel.setLayout(new MigLayout("", "[][grow,center][grow,center][grow][grow][grow][grow][grow]", "[][][][][][][][][][][][][][][][][][]")); JLabel label = new JLabel("Inserimento Cliente"); label.setHorizontalTextPosition(SwingConstants.CENTER); label.setHorizontalAlignment(SwingConstants.CENTER); label.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 24)); label.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); label.setAutoscrolls(true); label.setAlignmentX(0.5f); insertClientPanel.add(label, "cell 0 0 7 1,grow"); Label lblSeparator1 = new Label(""); insertClientPanel.add(lblSeparator1, "cell 1 1,alignx left,aligny bottom"); Label lblSeparator2 = new Label(""); insertClientPanel.add(lblSeparator2, "cell 1 2"); Label titleIntestazione = new Label("Intestazione"); titleIntestazione.setFont(new Font("Comic Sans MS", Font.BOLD, 15)); titleIntestazione.setBackground(new Color(238, 232, 170)); insertClientPanel.add(titleIntestazione, "cell 1 3,grow"); JLabel lblRagioneSociale = new JLabel("Ragione Sociale: "); insertClientPanel.add(lblRagioneSociale, "cell 1 4,alignx trailing"); RagSocField = new JTextField(); RagSocField.setColumns(25); insertClientPanel.add(RagSocField, "cell 2 4 5 1,growx"); JLabel lblCognome = new JLabel("Cognome: "); insertClientPanel.add(lblCognome, "cell 1 5,alignx trailing"); cognomeField = new JTextField(); cognomeField.setColumns(25); insertClientPanel.add(cognomeField, "cell 2 5 5 1,growx"); JLabel lblNome = new JLabel("Nome: "); insertClientPanel.add(lblNome, "cell 1 6,alignx trailing"); nomeField = new JTextField(); nomeField.setColumns(25); insertClientPanel.add(nomeField, "cell 2 6 5 1,growx"); JLabel lblPIva = new JLabel("Partita Iva: "); insertClientPanel.add(lblPIva, "cell 1 7,alignx trailing"); pIvaField = new JTextField(); pIvaField.setColumns(25); insertClientPanel.add(pIvaField, "cell 2 7 5 1,growx"); JLabel lblCodFisc = new JLabel("Codice Fiscale: "); insertClientPanel.add(lblCodFisc, "cell 1 8,alignx trailing"); codFiscField = new JTextField(); codFiscField.setColumns(25); insertClientPanel.add(codFiscField, "cell 2 8 5 1,growx"); Label lblSeparator3 = new Label(""); insertClientPanel.add(lblSeparator3, "cell 1 9"); Label titleIndirizzo = new Label("Indirizzo"); titleIndirizzo.setFont(new Font("Comic Sans MS", Font.BOLD, 15)); titleIndirizzo.setBackground(new Color(238, 232, 170)); insertClientPanel.add(titleIndirizzo, "cell 1 10,grow"); JLabel lblIndirizzo = new JLabel("Indirizzo: "); insertClientPanel.add(lblIndirizzo, "cell 1 11,alignx trailing"); indirizzoField = new JTextField(); indirizzoField.setColumns(25); insertClientPanel.add(indirizzoField, "cell 2 11 5 1,growx"); JLabel lblCivico = new JLabel("n\u00B0 Civico: "); insertClientPanel.add(lblCivico, "cell 1 12,alignx trailing"); civicoField = new JTextField(); civicoField.setColumns(25); insertClientPanel.add(civicoField, "cell 2 12 5 1,growx"); JLabel lblCitta = new JLabel("Citt\u00E0: "); insertClientPanel.add(lblCitta, "cell 1 13,alignx trailing"); cittaField = new JTextField(); cittaField.setColumns(10); insertClientPanel.add(cittaField, "cell 2 13 5 1,growx"); JLabel lblProvincia = new JLabel("Provincia: "); insertClientPanel.add(lblProvincia, "cell 1 14,alignx trailing"); provinciaField = new JTextField(); provinciaField.setColumns(10); insertClientPanel.add(provinciaField, "cell 2 14 5 1,growx"); JLabel lblStato = new JLabel("Stato:"); insertClientPanel.add(lblStato, "cell 1 15,alignx trailing"); statoField = new JTextField(); statoField.setColumns(10); insertClientPanel.add(statoField, "cell 2 15 5 1,growx"); Label lblSeparator4 = new Label(""); insertClientPanel.add(lblSeparator4, "cell 1 16"); Label titleRecapiti = new Label("Recapiti"); titleRecapiti.setFont(new Font("Comic Sans MS", Font.BOLD, 15)); titleRecapiti.setBackground(new Color(238, 232, 170)); insertClientPanel.add(titleRecapiti, "cell 1 17,grow"); insertClientPanel.revalidate();
Luca
- 01-23-2012, 02:49 PM #2
Re: JScrollPane refresh problem
If you want help, we're going to have to see an SSCCE (that's NOT your whole program) that demonstrates how you're calling this code, etc.
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
Similar Threads
-
Problem with JScrollPane
By loony in forum AWT / SwingReplies: 4Last Post: 03-30-2011, 01:48 AM -
JScrollPane problem
By KArelVH in forum AWT / SwingReplies: 6Last Post: 04-27-2009, 09:40 PM -
problem with Jscrollpane
By ravrajesh.ap in forum AWT / SwingReplies: 5Last Post: 01-03-2009, 10:38 PM -
JScrollPane updation Problem
By goodwillwins in forum AWT / SwingReplies: 22Last Post: 09-28-2008, 09:11 AM -
jscrollpane problem
By monkey04 in forum AWT / SwingReplies: 2Last Post: 01-19-2008, 05:23 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks