|
From: Don C. <dco...@ch...> - 2007-04-30 17:23:46
|
You can simply raise a Property Veto Exception in your Jython code.
raise PropertyVetoException("Not allowed to detach toolbar", event)
On 4/29/07, ast...@gm... <ast...@gm...> wrote:
> Hello again..
>
> I have a floatable toolbar in my application. However, I just want the
> end-user to just move it from top, left, right, or bottom
> (BorderLayout.NORTH, etc equivalent) within the app. From what I
> understand, I have to add a propertyChangeListener and throw an
> exception to stop the toolbar from floating. I've never achieved this
> in Java and I'm attempting to do this in Jython. My code right now is
> as follows (with comments on the parts that I have problems with):
>
> import java.beans as beans
> class MyToolbarListener(beans.PropertyChangeListener):
> def propertyChange(self, event):
> if event.getNewValue() is None: return
> tbar = event.getSource()
> root = swing.SwingUtilities.getRoot(tbar)
> if root is None: return
> if root.getTitle() == 'Toolbar': # main JFrame has different title
> # (Java) throw new PropertyVetoException("Not allowed to detach
> toolbar", event);
> # (Jython) raise WhatException?
>
> Is there any other way of stopping a toolbar from being detached?
> Because when I think about it, if an error is raised, I don't know
> what to do next :-/
>
> Thanks for reading this confused email :-(
>
> astigmatik
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Jython-users mailing list
> Jyt...@li...
> https://lists.sourceforge.net/lists/listinfo/jython-users
>
|