Why JScrollPane does not react to mouse wheel events?

Walter beat me to analysing the issue 🙂 Adding a bit of detail: It’s correct that a JScrollPane supports mouseWheelHandling. According to the rules of mouseEvent dispatching, the top-most (in z-order) component gets the event, and that’s the scrollPane around the textArea. So if wheeling the textarea is not required, a simple solution might be … Read more

How to use Application.Exit Event in WPF?

It’s quite simple: Add “Exit” property to the application tag <Application x:Class=”WpfApplication4.App” xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” StartupUri=”MainWindow.xaml” Exit=”Application_Exit”> </Application> and handle it in the “code behind” private void Application_Exit(object sender, ExitEventArgs e) { // Perform tasks at application exit } The Exit event is fired when the application is shutting down or the Windows session is ending. … Read more

Replacement for deprecated `keypress` DOM event

Since the event is deprecated, you should avoid using it in new code, and plan on removing it from old code. The W3C specification says this about deprecated features: Features marked as deprecated are included in the specification as reference to older implementations or specifications, but are OPTIONAL and discouraged. Only features which have existing … Read more

GWT Custom Events

Events in general: Events are always sent to inform about something (e.g. a change of state). Let’s take your example with a man and a wall. Here we can imagine that there is a game where a user can walk as a man in a labyrinth. Every time a user hits the wall it should … Read more

Javascript Event Handler for Print

Different Style Sheets You can specify a different stylesheet for printing. <link rel=”stylesheet” type=”text/css” media=”print” href=”https://stackoverflow.com/questions/534977/print.css” /> <link rel=”stylesheet” type=”text/css” media=”screen” href=”main.css” /> One Style Sheet As kodecraft mentioned, you can also put the styles into the same file by using the @media block. @media print { div.box { width:100px; } } @media screen { … Read more

C# Dynamic Event Subscription

You can compile expression trees to use void methods without any arguments as event handlers for events of any type. To accommodate other event handler types, you have to map the event handler’s parameters to the events somehow. using System; using System.Linq; using System.Linq.Expressions; using System.Reflection; class ExampleEventArgs : EventArgs { public int IntArg {get; … Read more