I've posted my code.
[code]DisasterSelectPane[/code] is also a JPanel, which holds some buttons and 
text boxes, but this one is correctly displayed at any time.
[code]Grid[/code] is the one I'm having problem with.

Don't know if it helps, but after the resizing of the frame, the 
[code]Grid[/code] disappears and the [code]DisasterSelectPane[/code] appears is 
shifted up in the [code]MainWindow[/code].

[code]
public class MainWindow extends JFrame
{
        
    private static MainWindow mainWindow;
    private Grid grid;
    private DisasterSelectPane disasterSelectPane;

    private void initComponents()
    {           
        //mainWindowScrollPane = new javax.swing.JScrollPane(new Grid(444, 
1134));
        this.grid = UIAgent.grid;
        //mainWindowScrollPane = new JScrollPane(this.grid);
        mainWindowScrollPane = new JPanel();
        mainWindowScrollPane.add(this.grid);
        mainWindowScrollPane.setName("mainWindowScrollPane"); // NOI18N
        
        this.disasterSelectPane = new DisasterSelectPane();
        mainDisasterPane = new JPanel();
        mainDisasterPane.setName("mainDisasterPane");

        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        
        layout.setHorizontalGroup(
            
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(this.grid, GroupLayout.DEFAULT_SIZE, 1134, 
Short.MAX_VALUE)
                    //.addComponent(mainDisasterPane, GroupLayout.DEFAULT_SIZE, 
113, GroupLayout.DEFAULT_SIZE)
                    .addComponent(this.disasterSelectPane, 
GroupLayout.DEFAULT_SIZE, 1134, GroupLayout.DEFAULT_SIZE)
                    )
                .addContainerGap())
        );
        
        layout.setVerticalGroup(
            
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGap(18, 18, 18)
                
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(this.grid, GroupLayout.PREFERRED_SIZE, 444, 
GroupLayout.PREFERRED_SIZE)
                //.addComponent(mainDisasterPane, GroupLayout.PREFERRED_SIZE, 
20, GroupLayout.PREFERRED_SIZE)
                .addComponent(this.disasterSelectPane, 
GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
                .addContainerGap(69, Short.MAX_VALUE))
        );
        
         
        pack();
    }// </editor-fold>
}

public class Grid extends JPanel
{
        public static final int GRID_CELL_DIM = 20;
        
        private int lines;
        private int columns;
        //private Map map;
        
        public Grid(int lines, int columns)
        {
                this.setBorder(BorderFactory.createLineBorder(Color.BLACK));
                this.lines = lines;
                this.columns = columns;
                //this.map = new Map(this.lines, this.columns);
        }
        
        public void paintComponent(Graphics g)
        {
                super.paintComponent(g);
        }

}
[/code]
[Message sent by forum member 'mikh' (mikh)]

http://forums.java.net/jive/thread.jspa?messageID=348115

===========================================================================
To unsubscribe, send email to lists...@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
lists...@java.sun.com and include in the body of the message "help".

Reply via email to