In this newsletter, we describe how we can generate remote screen shots as compressed, scaled JPGs to build a more efficient remote control mechanism. Full Article
Recent versions of Swing do a good job of mimicking the underlying platform, with a few caveats. For example, the JSlider only snaps onto the correct tick once you let go of the mouse. Here I present a fix for this problem with a non-intrusive one-liner that we can add to the application code. Full Article
The Tristate Checkbox is widely used to represent an undetermined state of a check box. In this newsletter, we present a new version of this popular control, retrofitted to Java 5 and 6. Full Article
Google Web Toolkit (GWT) allows ordinary Java Programmers to produce highly responsive web user interfaces, without needing to become experts in JavaScript. Here we demonstrate a little maths game for practicing your arithmetic. Included is an Easter egg. Full Article
Our earlier solution to multi-line cells in JTable did not work in Java 1.4. We show a new version that does. Full Article
Swing is famous for its "refresh bug", where the application stops refreshing the screen. This happens when the Event Dispatch Thread (EDT) is blocked, either temporarily by a long operation or permanently because of a deadlock. In the newsletter we look at a technique for sounding the alarm. Full Article
A follow-up to explain that the previous code was not the "refresh bug", but rather an issue with the static initializer starting a thread and that thread calling a static method. Full Article
Swing uses several locks. When several threads work with the GUI at the same time, it is not always easy to determine the order of the locks. This can result in deadlocks, the famous "refresh bug". Full Article
In Swing, we can make GUIs be oriented either from left to right, as most countries do, or from right to left, as you would find in Arabic and Hebrew. Full Article
We use the java.awt.Robot to control machines remotely with Java, typing keys, moving the mouse and sending back screenshots. This can help instructors assist remote students. Full Article
The ordinary Swing JCheckBox has only two states. We present a new component that is based on the old JCheckBox, but which has three states. Full Article
Instead of programmatically setting the wait cursor, we can also let the java.awt.EventQueue do the heavy lifting for us. Nathan Arthur explains how. Full Article
Instead of using Rapid Application Development (RAD) tools for building GUIs, we can use GoF factory methods to create our user interfaces with code. Full Article
Coding Swing can be tricky. There are a lot of strange edge cases. One of the harder things to get right are the wait cursors, specifically in conjunction with modal dialogs. We will learn how to set the wait cursor on the parent window/frame of a modal dialog. Full Article
In this newsletter we have a look at how we can render a JTextArea in a JTable cell. Full Article
Swing uses the Composite design pattern for components. This means that we can place components on each other, creating new types of widgets. An example would be a JButton that also contains a JCheckBox. Full Article
We learn how to build a simple, yet usable, cross-platform registry editor using standard Java. Full Article
We keep a list of created Frame instances handy, so that we can find them again when we create Dialogs. This prevents ownerless modal Dialogs from causing issues. Full Article
The previous newsletter had a dependency that stopped us serializing the components. The code worked when compiled with JBuilder 2, but not when compiled with the JDK 1.3. Full Article
Thousands of classes implement the Serializable interface, meaning we can write them over an ObjectOutputStream. Amongst these is java.awt.Component, the superclass of all GUI classes in AWT and Swing. We can thus serialize JTable, JLabel, even JFrame. Full Article
In Swing, we sometimes need to set the focus to the second component. This newsletter describes how to do it. Full Article
Layout managers in AWT/Swing can be frustrating to use. After trying various combinations, my colleague gave up and asked me for help. Instead of battling with GridBagLayout, we wrote our own LayoutManager. It was surprisingly simple and very effective. Full Article
In this newsletter, we learn how we can create our own EventQueue and then use that to intercept all the events that arrive in AWT/Swing. Full Article
Get: every new article, exclusive invites to live webinars, our top-10 articles ever, access to expert tutorials & more!
Java Champion, author of the Javaspecialists Newsletter, conference speaking regular... About Heinz
We deliver relevant courses, by top Java developers to produce more resourceful and efficient programmers within their organisations.
We can help make your Java application run faster and trouble-shoot concurrency and performance bugs...
We deliver relevant courses, by top Java developers to produce more resourceful and efficient programmers within their organisations. Find Out More