O'Reilly logo

Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython by Richard Hightower

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

JToolBar and Actions

We've improved the address book application with the addition of JTabbedPane, JTable, and (if you did the exercises) JTree. Still, something's missing.

In the early days of Java there was no Swing, and AWT didn't have a toolbar. This meant that most developers used panels, which is what I did in the address book application. I had two reasons for this: to show how JPanel and the BorderLayout layout manager work and to avoid introducing actions.

Actions

We can avoid actions no longer. Any introduction to JToolBar has to include them. I held off until now because actions are a higher abstraction than components, and I thought you should have a good grip on components first.

Think of an action as a command. An item on a menu ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required