Java programming course: 18.4 Setting the look and feel

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...

Java programming course: 18.3 Creating a toolbar

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...

Java programming course: 18.2 Creating a menu bar

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...

Java programming course: 18.1 Finishing off the User Interface

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 ...

Java programming course: 17.5 Handling the Add button

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...

Java programming course: 17.4 Removing an existing animal

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 ...

Java programming course: 17.3 Modifying AdministratorFrame

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...

Java programming course: 17.2 Defining a selection tree of animals

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...

Java programming course: 17.1 More User Interface Developments

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...

Java programming course: 16.9 Handling the Add button

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...