java-gnome 4.0.7, released 30 Apr 2008
About
Overview, News
Documentation
Tutorials, API, and Hacking
Download
Binaries and Source
Interact
Mailing Lists, IRC, and Reporting Bugs

EXAMPLES

These files are examples of specific parts of the java-gnome API worked up as complete Java programs.

Source code, especially Java source code, doesn’t always lend itself to being read, certainly not from top to bottom. We have attempted, however, to create some examples which are non-trivial but nonetheless are still readable.

  1. Button in a Window

  2. Handling keystrokes

    • ExampleSnooping.java
      Handling keyboard input is more complicated than it reasonably ought to be. In most cases the existing GTK Widgets already do everything that needs doing (when you type text into an Entry, the text does indeed go into that Entry), focus handling, etc. However, if you need to intercept a keystroke so you can do something special, then you need to work with the Keyval and ModifierType classes in response to the KEY_PRESS_EVENT signal. This is how.
  3. TreeView and TreeModel

    • ExampleTrailHeads.java
      While not a complete tutorial, we have an example of a small application which uses a TreeView backed by a ListStore called ExampleTrailHeads. It is heavily commented and meant to serve as an introduction of the incredibly powerful yet very complex TreeView / TreeModel system. It should be read in conjunction with the API documentation for these types. You’ll also want to read about how to setup a ListStore and the explanation of available column types in DataColumn.
  4. Drawing with Cairo

    • ExampleDrawingInExposeEvent.java
      FIXME this needs a better name.
      Using the Cairo Graphics library to draw within a GTK program means following the idiom shown in this example. This program demonstrates drawing lines, rectangles, and gradients using a drawing Context as obtained within a Widget’s EXPOSE_EVENT signal handler.
Contents copyright © 2006-2008 Operational Dynamics Consulting Pty Ltd, and Others. See AUTHORS file and source code history for the various files comprising this site for full details. This page was generated from a text document! We use John Gruber's Markdown syntax as ported to PHP by Michel Fortin. See MARKUP for details