Hello all,
Can anyone tell me why the image I have does not appear on the JButton? I can�t see why, I{ve tried using the absolute path, but to no avail. Here�s the code (I�ve started, and I�m just experimenting at the moment.. )
import java.awt.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import javax.swing.border.*;
public class MainFrame extends JFrame {
JToolBar toolbar = new JToolBar();
XYLayout xYLayout1 = new XYLayout();
JButton button;
JButton button2;
JButton button3;
JButton button4;
TitledBorder titledBorder1;
public MainFrame() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
titledBorder1 = new TitledBorder("Ficha");
toolbar.setForeground(new java.awt.Color(77, 77, 108));
toolbar.setBorder(BorderFactory.createEtchedBorder());
toolbar.setSize(600, 50);
button = new JButton(new ImageIcon("images/save.jpeg"));
button2 = new JButton("blah");
button3 = new JButton("blah");
button4 = new JButton("blah");
toolbar.add(button);
toolbar.add(button2);
toolbar.add(button3);
toolbar.add(button4);
this.getContentPane().setLayout(xYLayout1);
this.getContentPane().add(toolbar, new XYConstraints(0, 0, 600, 30));
this.setSize(600, 450);
this.show();
}
public static void main(
String args[]) {
MainFrame mainf = new MainFrame();
}
}
Thanks very much...
Malc