GUIUtilities.loadToolBar() change in JEdit 4.2 pre?
Submitted by Tuesday, 30 March, 2004 - 12:35
on
Hi there,
I tried to update a little plugin I wrote to JEdit 4.2. pre 11, but I am stuck updating my plugin toolbar...
in JEdit 4.1. final I am using
JToolBar toolbar = GUIUtilities.loadToolBar("tidedebug.toolbar");
Then I am iterating over the components to get my buttons and that's basically it...
start = (JButton) toolbar.getComponentAtIndex(0);
pause = (JButton) toolbar.getComponentAtIndex(1);
stop = (JButton) toolbar.getComponentAtIndex(2);
stepInto = (JButton) toolbar.getComponentAtIndex(4);
stepOver = (JButton) toolbar.getComponentAtIndex(5);
runToCursor = (JButton) toolbar.getComponentAtIndex(6);
stepOut = (JButton) toolbar.getComponentAtIndex(7);
But, in 4.2., this doesnt work anymore since now I get a Box back from this method:
Box toolbar = GUIUtilities.loadToolBar("tidedebug.toolbar");
I've tried to simply create new Buttons like this:
if(toolbar != null)
{
try
{
start = new JButton();
pause = new JButton();
etc., then setting Icons, ToolTipsTexts, adding ActionHandlers for every button, etc. but while the buttons are being rendered now, I'm still getting weird NullPointerExceptions all over the place and I'm not sure why... is there any other way doing this?
Or what is the recommended way now to add a Toolbar with usable buttons? And why was this changed?
Thanks for any advice!
best regards,
beffy
I tried to update a little plugin I wrote to JEdit 4.2. pre 11, but I am stuck updating my plugin toolbar...
in JEdit 4.1. final I am using
JToolBar toolbar = GUIUtilities.loadToolBar("tidedebug.toolbar");
Then I am iterating over the components to get my buttons and that's basically it...
start = (JButton) toolbar.getComponentAtIndex(0);
pause = (JButton) toolbar.getComponentAtIndex(1);
stop = (JButton) toolbar.getComponentAtIndex(2);
stepInto = (JButton) toolbar.getComponentAtIndex(4);
stepOver = (JButton) toolbar.getComponentAtIndex(5);
runToCursor = (JButton) toolbar.getComponentAtIndex(6);
stepOut = (JButton) toolbar.getComponentAtIndex(7);
But, in 4.2., this doesnt work anymore since now I get a Box back from this method:
Box toolbar = GUIUtilities.loadToolBar("tidedebug.toolbar");
I've tried to simply create new Buttons like this:
if(toolbar != null)
{
try
{
start = new JButton();
pause = new JButton();
etc., then setting Icons, ToolTipsTexts, adding ActionHandlers for every button, etc. but while the buttons are being rendered now, I'm still getting weird NullPointerExceptions all over the place and I'm not sure why... is there any other way doing this?
Or what is the recommended way now to add a Toolbar with usable buttons? And why was this changed?
Thanks for any advice!
best regards,
beffy