{
protected void paintComponent(Graphics g)
{
// g.drawImage(ic.getImage(), 0, 0, null);
// Scale image to size of component
Dimension d = getSize();
g.drawImage(ic.getImage(), 0, 0, d.width, d.height, null);
// Fix the image position in the scroll pane
// Point p = scrollPane.getViewport().getViewPosition();
// g.drawImage(icon.getImage(), p.x, p.y, null);
super.paintComponent(g);
}
};
panel.setOpaque( false );
panel.setPreferredSize( new Dimension(400, 400) );
getContentPane().add( panel);
JButton button = new JButton( "Hello" );
panel.add( button );
panel.setBounds(getBounds());
星期一, 10月 08, 2007
利用panel放背景圖
JPanel panel = new JPanel()
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言