- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
[swing] Mouse events not working
Fri, 2009-07-31, 10:31
Scala 2.7.4, Java SE 1.6.0-12b04, Debian Lenny
Mouse events not catching in BoxPanel reactions, but resize event works :
class Document(t:(String)=>String, logger:Logged) extends SplitPane with
IntrospectableAttributes {
orientation = Orientation.Vertical
resizeWeight = 0.2
leftComponent = new BoxPanel(Orientation.Vertical) {
reactions += {
case ComponentResized(s) =>
println("Resized")
case MouseEntered(c,p,AWTEvent.MOUSE_MOTION_EVENT_MASK) =>
println("Entered")
case MouseClicked(s,p,AWTEvent.MOUSE_EVENT_MASK,c,false) =>
println("Clicked")
case _ =>
}
}
rightComponent = new BoxPanel(Orientation.Vertical)
}
What wrong ?
Sat, 2009-08-01, 22:17
#2
Re: [swing] Mouse events not working
Ingo Maier-3 wrote:
>
> 1.) you should listenTo(mouse.clicks, mouse.moves). See
> https://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/src/swing/scala/s...
>
maybe Mouse.clicks, Mouse.moves ? i can't find where mouse.clicks,
mouse.moves, keys located...
Sun, 2009-08-02, 08:47
#3
Re: [swing] Mouse events not working
This is on trunk. The Mouse object has been deprecated in favor of mouse
there.
Ingo
On 8/1/09 11:07 PM, qwerky wrote:
>
>
> Ingo Maier-3 wrote:
>> 1.) you should listenTo(mouse.clicks, mouse.moves). See
>> https://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/src/swing/scala/s...
>>
> maybe Mouse.clicks, Mouse.moves ? i can't find where mouse.clicks,
> mouse.moves, keys located...
>
1.) you should listenTo(mouse.clicks, mouse.moves). See
https://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/src/swing/scala/s...
2.) if you don't care about modifiers, you should do:
case MouseEntered(c,p,_) => ...
3.) that's a pretty old version you are using. Try trunk or a nightly
first to see whether a bug has been fixed in the meanwhile.
Ingo
On 7/31/09 11:31 AM, qwerky wrote:
> Scala 2.7.4, Java SE 1.6.0-12b04, Debian Lenny
>
> Mouse events not catching in BoxPanel reactions, but resize event works :
>
> class Document(t:(String)=>String, logger:Logged) extends SplitPane with
> IntrospectableAttributes {
> orientation = Orientation.Vertical
> resizeWeight = 0.2
>
> leftComponent = new BoxPanel(Orientation.Vertical) {
> reactions += {
> case ComponentResized(s) =>
> println("Resized")
> case MouseEntered(c,p,AWTEvent.MOUSE_MOTION_EVENT_MASK) =>
> println("Entered")
> case MouseClicked(s,p,AWTEvent.MOUSE_EVENT_MASK,c,false) =>
> println("Clicked")
> case _ =>
> }
> }
> rightComponent = new BoxPanel(Orientation.Vertical)
> }
>
> What wrong ?
>