Cross-platform development using JRuby and swing

Source: Internet
Author: User
Tags gtk ruby on rails

Rapid development of desktop applications using the Monkeybars JRuby Swing Library

With Ruby, in addition to building WEB and console applications, you can write complex GUI desktop applications that can run on a variety of platforms without modification. Thanks to Jruby,ruby's traditional C-implementation robust alternatives, the Ruby GUI Toolkit can use UI tools for the Java platform. This article describes a library monkeybars that uses JRuby and Swing to build an application, and explains a sample application.

Ruby is now known as a programming language for building WEB applications, mainly through the Ruby on Rails framework. However, this language can also be used to develop graphical desktop applications. In this article, you'll learn more about using Ruby for desktop application development, and complete a detailed example that uses monkeybars-, a Swing and JRuby Open Source Library, to create a GUI desktop application.

Desktop-facing Ruby

Standard Ruby distributions include code for TK binding, a set of Open-source, Cross-platform part sets for creating graphical desktop applications. This can bring a lot of convenience. However, when you install Ruby from the source code, you should confirm that there are also TK dependencies and that the compilation settings include TK. If you install Ruby with the handy one-click (one-click) installer package on Windows®, you still need to take additional steps to make the Tk work because it no longer supports automatic installation.

Even though Tk is set for Ruby, it is still a bit dull. On some target platforms, they look pretty ugly. Moreover, creating complex interfaces is daunting. Tk is best suited for smaller GUI requirements.

Available Tool Packs

These weaknesses of Tk have led to the development of other GUI Toolkit options for Ruby (see Resources for related links). Some notable choices are:

Fxruby:fxruby is a Ruby binding for Fox, a GUI toolkit written in C. It can be used for installations that use RubyGems. For Windows, there is a binary gem; Gems for other platforms need to compile local code.

Wxruby:wxruby is a binding for Cross-platform wxWidgets C + + GUI Toolkit, which enables you to create desktop applications that have a local look. It can be used to install with a gem.

Qtruby:qtruby provides Ruby bindings for the QT Toolkit (the toolkit used in the KDE desktop system). For Windows installations, there is a gem, but for other platforms there is only source code.

GTK-RUBY:GTK is the UI toolkit used in GNOME. To make it run, you need to compile the local code.

Shoes:shoes is a recently occurring toolkit for Ruby GUI parts. Unlike the other toolkits mentioned in this list, it is designed specifically for Ruby. You can install it by using a platform-specific setup program.

Swing:swing? Yes, it is this GUI library that is bundled with each Java runtime environment. If you run JRuby, you can use Swing.

Except for one, all of these are GUI or part libraries written in C or C + +, all of which are bound to allow them to be invoked in other languages, such as Ruby, Python, and Perl. In almost all cases, you have to face a variety of considerations, such as installation and distribution.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.