Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ve-dev] Stretch


Hi Ezequias,

Try painting the image onto a JPanel and then stretching it in the paint(Graphics g) method.  For the following code I subclassed JFrame and then changed the content pane as follows.

private JPanel getJContentPane() {
                if (jContentPane == null) {
                        image = Toolkit.getDefaultToolkit().getImage(getClass().getResource("/foo/views/sample.gif"));                        
                        jContentPane = new JPanel(){
                                public void paint(Graphics g) {                                        
                                        super.paint(g);
                                        g.drawImage(image,0,0,jContentPane.getSize().width,jContentPane.getSize().height,this);
                                }
                        };
                        jContentPane.setLayout(new BorderLayout());
                }
                return jContentPane;
        }

Best regards,

Joe

Please respond to Discussions people developing code for the Visual Editor project <ve-dev@xxxxxxxxxxx>

Sent by:        ve-dev-bounces@xxxxxxxxxxx

To:        Discussions people developing code for the Visual Editor project <ve-dev@xxxxxxxxxxx>
cc:        
Subject:        [ve-dev] Stretch


    Hi list,

Could anybody tell me how to stretch an ImageIcon on a JFrame ?

I add a Jlabel to a GridLayout but it does not stretch correctly.

Best regards
Ezequias
_______________________________________________
ve-dev mailing list
ve-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ve-dev


Back to the top