Hi.
This is not strictly an OpenMap issue, but it took me a wee while to work it
out so here it is if anyone else comes across the same problem.
I wanted to change the button borders on the OpenMap tool bar to bring them
in line with the rest of my application. However in some instances setting
the button border appeared to make no difference. After spending a couple
fo hours walking though my code and the OpenMap ToolPanel, I tried to
recreate the problem with a noddy and found that the problem still exists.
(I have since found a Java bug report on this issue (4523149)).
It seems to be that when using Java 1.4, adding buttons directly to a
JToolBar causes the Border to be reset. This doesn't occur when adding
buttons to a JPanel, or adding other components to a JToolBar.
My workaround for the problem is to add the button to a JPanel, then add the
JPanel to the JToolBar. In my OpenMap code this means rewriting my Tools
getFace() method:
public Container getFace() {
ImageIcon iicon = Icons.getImageIcon(Icons.ICON_GIF);
JButton button = new JButton(iicon);
button.addActionListener(getActionListener());
button.setBorder(this.getDefaultBorder());
JPanel panel = new JPanel();
panel.add(button);
return panel;
}
This may also help if anyone had problems setting insets of Buttons on the
JToolBar, as I believe they are also written over.
Laura
General Dynamics United Kingdom Limited
Registered in England and Wales No. 1911653
Registered Office: 100 New Bridge Street, London, EC4V 6JA
-- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"]Received on Wed Nov 5 09:32:34 2003
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:36 EDT