Previous lesson: 18.3 Creating a toolbarCourse contents Setting the look and feel AdministratorFrame constructor, immediately after the call to super(): // Set to native look & feeltry { UIManager.setLookAndFeel (UIManager.getSystemLookAndFeelClassName());} catch (Exception e) { e.printStackTrace(); // If unable just carry on with d...
Previous lesson: 18.2 Creating a menu barCourse contents Creating a toolbar Whereas the menu bar provides selectable options for all an application's functions, a toolbar provides a strip consisting typically of icons for the most frequently used facilities. Oracle provides a downloadable set of toolbar icons that you can use in applicat...
Previous lesson: 18.1 Finishing off the User InterfaceCourse contents Creating a menu bar A menu bar is constructed separately from the rest of the graphical layouts and components and once defined is attached to the frame. There are three classes used in combination in building a menu-bar: JMenuBar: an object of this class defines the menu-b...
Previous lesson: 17.5 Handling the Add buttonCourse contents Finishing off the User Interface This section puts the finishing touches to the graphical part of the application by creating a read-only table for the zoo's visitors, defining a menu-bar and toolbar, and by making the application adopt the running system's look-and-feel. In this section ...
Previous lesson: 17.4 Removing an existing animalCourse contents Handling the Add button All that remains now is to write some code for the Add button to enable the user to switch from "change" mode back into "add" mode. Go to the Design view of AnimalPanel and double-click the Add button to generate its addButtonActionPerformed() method. All...
Previous lesson: 17.3 Modifying AdministratorFrameCourse contents Removing an existing animal When you built the form for AnimalPanel you included a Remove button. Before writing the code so that it removes the selected animal (after asking for confirmation) you will change the status of the button so that it is only enabled (i.e., available ...
Previous lesson: 17.2 Defining a selection tree of animalsCourse contents Modifying AdministratorFrame The frame now needs to show AnimalPanel inside a new tab of the JTabbedPane: package virtualzoo.ui;import virtualzoo.core.*;import java.awt.*;import javax.swing.*;public class AdministratorFrame extends JFrame { private ZooKeeperEditor zooKe...
Previous lesson: 17.1 More User Interface DevelopmentsCourse contents Defining a selection tree of animals The left-hand section of the screen shows a scrollable tree of all of the animals in the zoo, categorised by the animal's type. The natural component to use for this is a JTree nested inside a JScrollPane. The AnimalTree class Creat...
Previous lesson: 6.9 Handling the Add buttonCourse contents More User Interface Developments This section continues the previous one to develop some additional interacting graphical components and panels. In this section you will learn: How to develop some additional types of interacting components and panelsHow to prepare the core system for...
Previous lesson: 16.8 Removing an existing zookeeperCourse contents Handling the Add button All that remains now is to write some code for the Add button to enable the user to switch from "change" mode back into "add" mode. Go to the Design view of ZooKeeperPanel and double-click the Add button to generate its addButtonActionPerformed() method. All...