[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] timeline/schedule

If you want complete control over the look and feel of your timeline, you 
probably want to draw it all yourself on a Canvas.
You'll need to add events for painting & resize, events for handling 
traversal and other key events, drag & drop handling, etc.

There are a couple of SWT graphics examples that you might find useful.
One is called PaintExample (which shows how to do rubber-band line drawing 
- might be useful), and one is called GraphicsExample (lots of animations 
and moving lines <grin>).
You can see how to download and run both of these examples here: 

Also, depending on how you want the date line to look when it is being 
dragged, you might find Tracker interesting:

Or maybe you prefer to have your users drag around a borderless shell 
containing their selected date range, something like this:

import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;

public class ShellNoTrimDrag {
public static void main(String[] args) {
        final Display display = new Display();
        final Shell shell = new Shell(display, SWT.NO_TRIM | SWT.ON_TOP);
        shell.setSize(200, 100);
        Listener listener = new Listener() {
                Point origin;
                public void handleEvent(Event e) {
                        switch (e.type) {
                                case SWT.MouseDown:
                                        origin = new Point(e.x, e.y);
                                case SWT.MouseUp:
                                        origin = null;
                                case SWT.MouseMove:
                                        if (origin != null) {
                                                Point p = 
display.map(shell, null, e.x, e.y);
                                                shell.setLocation(p.x - 
origin.x, p.y - origin.y);
        shell.addListener(SWT.MouseDown, listener);
        shell.addListener(SWT.MouseUp, listener);
        shell.addListener(SWT.MouseMove, listener);
        while (!shell.isDisposed()) {
                if (!display.readAndDispatch())

Hope this helps,

[platform-swt-dev] timeline/schedule

Javier Godinez 
04/09/2008 09:38 PM

Sent by:
Please respond to "Eclipse Platform SWT component developers list." 

Hey guys/gals,

I am trying to build a timeline/schedule application where one can
choose a start and end date and populate the timeline with events of
different types. The events should be draggable as to extend the time
interval as well as to shift the dates (move both start and end
dates). I am just wondering which widget/widgets would be the best to
use. I am thinking I can use some sort of canvas? Does anyone know
anything that has similar functionality? Here is an image of what I'm
talking about: http://www.flickr.com/photos/25490294@N02/2401496683/

Javier Godinez
platform-swt-dev mailing list