Skip to content

Java Swing Tips

Introduce the GUI program of Java Swing using small source code examples.

bunner

Create a split button that can be expanded and collapsed by setting a JLayer on a JButton
New

Create a split button that can be expanded and collapsed by setting a JLayer on a JButton

ExpandableSplitButton / Created at

Create a split button by setting a JLayer on a JButton that controls the start and end of the expand/collapse animation and assigns actions to each clicked area.

Place a JList inside a JPopupMenu to create a dropdown time picker
New

Place a JList inside a JPopupMenu to create a dropdown time picker

DropdownTimepicker / Created at

Three JLists placed within JPopupMenu create a time picker that allows selection of times in the `hh:mm aa` format.

Pseudo-3D Cube Page Transition Effect on JPanel
New

Pseudo-3D Cube Page Transition Effect on JPanel

CubeTransition / Created at

Creates a pseudo-3D cube rotation effect on a JPanel for page transitions.

Display and update the playback position of a MIDI file using JSlider
New

Display and update the playback position of a MIDI file using JSlider

MidiPlayer / Created at

Use JSlider and Timer to display and update the current playback position of a MIDI file.

Apply a shimmer effect to the text in a JLabel
New

Apply a shimmer effect to the text in a JLabel

ShimmerLabel / Created at

Draw the text in a JLabel using a LinearGradientPaint with an animation that creates a moving glow.

About the JFC and Swing (The Java™ Tutorials)

The source code is released under the MIT license.