Do you want your ad here?

Contact us to get your ad seen by thousands of users every day!

[email protected]

Dissection of Joeffice: Open Source Office Suite in Java

  • July 11, 2023
  • 26904 Unique Views
  • 3 min read
Table of Contents
The NetBeans PlatformApache POISwingOther librariesConclusion

10 years ago, I challenged myself to write an office suite in Java in 30 days. This is how the first version of Joeffice was born. This created quite some buzz, including articles on Slashdot, Ars Technica and PC World.

Last month I released a second update. Let's explore how I did this. By levering Java libraries, I was able to create such a complex piece of software very quickly.

The NetBeans Platform

The NetBeans Platform is a desktop application framework. You can see it as shopping for the parts (modules) that you'd like to have from the NetBeans IDE.

In the case of Joeffice, I shopped for many things: the core API and UI, the start-up screen, the look and feels including the dark themes, the file system, the search and progress API, the settings, print and more.

One of the most visible benefits of the platform is the windows management system. It allows you to have multiple documents opened in the same application, either with a tab system or docked next to each others.

I remember when tabs were introduced in Quattro Pro 5 spreadsheet software or Opera browser, quickly the competition followed up and now you can't have a browser or spreadsheet software without tabs.

With the NetBeans Platform, I had this feature directly out of the box for free, so people can have 20, 50 documents opened and still be able to manage the windows.

4 documents opened and visible at the same time

Another part where the NetBeans Platform will save you a lot of time is for creating installers for the different platforms Windows, Mac OS and Linux.

There is online documentation and several books to learn how to use it.

Apache POI

Apache POI is an Apache library to read Microsoft Office documents. It has more than 1,500 stars on GitHub and has an active community.

Depending of the kind of document you want to open, Apache POI has a more or less complete API to get the details. The most complete is to read Excel files. It also includes an interface API with 2 implementations, one for xls files, the old Excel format and one for xlsx format, the current Excel format. In Joeffice, I also implemented the interface to be able to parse CSV documents.

A big part of Joeffice is to translate the information from the document to its visual representation. If you use Apache POI at your company, you could use Joeffice as a playground to understand and play with the Apache POI library.

Swing

Swing is a Java graphical user interface included in Java. Instead of relying on native components, like the AWT API is, each component is drawn in Java using the Java 2D API. The main advantages are consistency between the platforms, the possibility to make the component skinnable, also called look and feel, and it's quite easy to define or override new components.

Joeffice makes heavy use of 2 Swing components:

  • JTextPane: This component is used to represent rich text and is the base to show word and powerpoint documents.
  • JTable: This component is used to represent a table and is the base to show spreadsheets and database data.

As previously mentioned, it's easy to override or create swing components, for example Joeffice is using the SwingX library that contains extra components and the ETable component from the NetBeans Platform.

In the latest release of Joeffice, I've made it easier to reuse the Excel table component without relying on the NetBeans Platform. From it, I've created an Excel viewer applet and the Sheet Viewer application.

The Excel viewer applet running in IntelliJ IDEA within the Applet Runner plugin

Other libraries

Here is a quick overview of some other libraries used in Joeffice:

  • H2 Database: An open source pure Java database. It also includes a CSV parser.
  • Apache Batik SVG: An API to draw .svg files. It is also part of Apache POI dependencies.
  • JUniversalCharDet: Help to detect character encoding of text files. Used to parse CSV text file.

Conclusion

In this article, we've seen on how by combining several API's we can create a new software.

Joeffice is under the Apache license, so if you're interested to learn any of the previously named libraries, you can download the code from GitHub and play with the libraries.

Monitor site demo running in NetBeans Applet Runner plugin
Write Once, Run Embedded in any IDE

Having written many Java GUI applications, I thought it would be cool to run them embedded in IntelliJ IDEA, Eclipse and NetBeans. I didn’t want to write 3 plugins per application so I came up with this solution.

7 Reasons Why, After 26 Years, Java Still Makes Sense!

After many discussions with Java developers, combined with my personal experiences with the Java community and platform, here are the key reasons why Java developers love Java after all these years!

7 Ways to Contribute to OpenJDK

A great many developers today are employed working with OpenJDK. If OpenJDK is the background source for your livelihood, you might want to contribute to future development of the OpenJDK.

There are many ways you can do this. In this article I outline 7 possibilities, ranging from minimal work (because you’re too busy to do much, but you’d like to do something) to intensive work (participating on OpenJDK development is everything you want to do, it’s more than a hobby, you want to contribute to the maximum extent possible).

7 Functional Programming Techniques in Java: A Primer

There is a lot of hype around functional programming (FP) and a lot of cool kids are doing it but it is not a silver bullet.

Like other programming paradigms/styles, functional programming also has its pros and cons and one may prefer one paradigm over the other.

If you are a Java developer and wants to venture into functional programming, do not worry, you don’t have to learn functional programming oriented languages like Haskell or Clojure(or even Scala or JavaScript though they are not pure functional programming languages) since Java has you covered and this post is for you.

5 Tips to Create Secure Docker Images for Java Applications

Docker is the most widely used way to containerize your application. With Docker Hub, it is easy to create and pull pre-created images.

Do you want your ad here?

Contact us to get your ad seen by thousands of users every day!

[email protected]

Comments (0)

Highlight your code snippets using [code lang="language name"] shortcode. Just insert your code between opening and closing tag: [code lang="java"] code [/code]. Or specify another language.

No comments yet. Be the first.

Subscribe to foojay updates:

https://foojay.io/feed/
Copied to the clipboard