---
title: "Gantt Chart Editing by Mouse Wheel: Java Gantt Chart Best Practice"
description: "Java Gantt chart best practicse: modify data by mouse wheel; with description about how to achieve using Java Gantt chart control VARCHART JGantt"
---

[Production Scheduling Tips & Tricks for Microsoft Dynamics 365 Business Central ](https://blog.netronic.com)

# [Gantt Chart Editing by Mouse Wheel: Java Gantt Chart Best Practice](https://blog.netronic.com/java-gantt-chart-best-practice-fast-editing-by-mouse-whee)

 Written by [Bernd-Rainer Lauber](https://blog.netronic.com/author/bernd-rainer-lauber) | Oct 20, 2015 9:05:00 AM

Drag and drop is the interaction most frequently used in a Gantt chart: Activities are shifted either horizontally or vertically. In some cases, the **data editing mode **is used for modifications: The according node is selected by mouse, an info box appears and the according data field can be modified via key board.

There is yet another, more comfortable and faster way **of modifying data**: by **mouse wheel. **By clicking the node the field’s content is displayed and can be modified immediately by turning the mouse wheel.

This blogpost shows you how you can accomplish this mouse wheel driven interaction with our Java Gantt chart control [VARCHART JGantt](https://www.netronic.com/products/varchart-jgantt/overview.html). It provides you also with code snippets so that you can turn this feature into action rapidly in your Java Gantt chart application.

## How it may look

This video shows a simple example to demonstrate how you can modify data by using the mouse wheel:

 

 

## How to in VARCHART JGantt

> // Adding the MousewheelHandler
> 
>  jGantt1.addMouseWheelListener(new **MousewheelHandler**(jGantt1));
> 
>  public class MousewheelHandler implements MouseWheelListener
> 
>    {
> 
>    JGantt jGantt1;
> 
>      public MousewheelHandler (JGantt jGantt)
> 
>       {
> 
>       jGantt1 = jGantt;
> 
>       }
> 
>     @Override
> 
>    public void mouseWheelMoved(MouseWheelEvent e)
> 
>       {
> 
>       Iterator iter = jGantt1.selectedEntitiesIterator();
> 
>      // No entity was selected
> 
>       if (!iter.hasNext())
> 
>          return;
> 
>       // Only the first selected Entity is cosidered
> 
>       NeIEntity ent = (NeIEntity) iter.next();
> 
>       String priority =  ent.getValueAsString(DataHandler.PRIORITY);
> 
>       int rot = e.getWheelRotation();
> 
>       
> 
>       if (rot == 1)
> 
>          {
> 
>         // Priority is increased
> 
>          if (priority.equals ("Normal"))
> 
>             priority = "High";
> 
>          else if (priority.equals ("High"))
> 
>             priority = "Highest";
> 
>          else
> 
>             priority = "Normal";
> 
>          }
> 
>       else
> 
>          {
> 
>         // Priority is decreased
> 
>          if (priority.equals ("Normal"))
> 
>             priority = "Highest";
> 
>          else if (priority.equals ("High"))
> 
>             priority = "Normal";
> 
>          else
> 
>             priority = "High";
> 
>          }
> 
>      
> 
>       ent.setValue(DataHandler.PRIORITY, priority);
> 
>       }
> 
>    }  

 

## User-Friendliness

Form this Java Gantt chart best practice your learned how editing data by mouse wheel offers additional planning support to the user, allowing settings like

- Maximum or minimum values
- Individual increments such as 60 min or 30 min
- Limited options for the planner, thus forcing faster decisions, like canceling order status, releasing

 

 

Need more Java Gantt chart best practice tips? Here are further [Java Gantt Control Best Practices](https://blog.netronic.com/topic/java-gantt-control) blog posts awaiting you.

## Your next step

Why not turning this idea into action? Download your free trial version of VARCHART JGantt and get going today.

 

 

[View full post](https://blog.netronic.com/java-gantt-chart-best-practice-fast-editing-by-mouse-whee)

```json
{
  "@context" : "http://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Bernd-Rainer Lauber"
  },
  "dateModified" : "2021-09-16T11:20:59.134Z",
  "datePublished" : "2015-10-20T09:05:00Z",
  "headline" : "Gantt Chart Editing by Mouse Wheel: Java Gantt Chart Best Practice",
  "image" : {
    "@type" : "ImageObject",
    "height" : 1601,
    "url" : "http://cdn2.hubspot.net/hubfs/315990/blog/Mausrad.jpg",
    "width" : 2824
  },
  "mainEntityOfPage" : "https://blog.netronic.com/java-gantt-chart-best-practice-fast-editing-by-mouse-whee",
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "height" : 60,
      "url" : "/hs/hsstatic/content_shared_assets/static-1.4092/img/default-amp-logo.png",
      "width" : 60
    },
    "name" : "SMB Production Scheduling Software Blog"
  }
}
```