Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #2688
| From | "Chanchal" <chanchal@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Image on a button |
| Message-ID | <1193233929.557412.111310@q3g2000prf.googlegroups.com> (permalink) |
| Newsgroups | comp.lang.java.gui |
| Date | 2011-04-27 15:40 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui
Hello All,
I have a JSplitPane on a JFrame. Left side of the JSplitPane contains
a button with an image on it.
i want the image to get resized along with the button when the divider
of the JSplitPane is dragged. Kindly advice how this can be achieved.
This is my code
import javax.swing.*;
public class NewJFrame extends JFrame {
JButton jButton1;
JButton jButton2;
JSplitPane jSplitPane1;
public NewJFrame() {
jSplitPane1 = new JSplitPane();
jButton1 = new JButton();
jButton2 = new JButton();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
jButton1.setIcon(new ImageIcon(getClass().getResource("/
background1.png")));
jSplitPane1.setLeftComponent(jButton1);
jSplitPane1.setRightComponent(jButton2);
getContentPane().add(jSplitPane1,
java.awt.BorderLayout.CENTER);
pack();
}
public static void main(String args[]) {
new NewJFrame().setVisible(true);
}
}
Thanks in advance
Chanchal
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next | Find similar | Unroll thread
Image on a button "Chanchal" <chanchal@THRWHITE.remove-dii-this> - 2011-04-27 15:40 +0000
csiph-web