Java Technology Home Page
A-Z Index

Java Developer Connection(SM)
Books

Downloads, APIs, Documentation
Java Developer Connection
Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide
Print Button
 
Book Excerpts

Java Studio by Example

by Lynn Weaver and Leslie Robertson

(June 1998)

This is an excerpt from Java Studio by Example, published by Sun Microsystems Press in June 1998. Java Studio is a visual programming environment not only for end users who do not want to write code, but also for programmers who want to rapidly create prototypes, JavaBeans, or working applications. By saving their Java Studio designs as Beans, programmers can combine designs into larger programs with any development environment that supports JavaBeans.

Some of the advantages of using Java Studio for programming include:

  • Java Studio's easy wiring metaphor supports creating real applications within minutes.
  • You can create significant parts of your Java program without writing code or laying out and defining the attributes of GUI elements in a full development environment.
  • The Design Window in Java Studio is "live." You create and test applications in real time.
  • The same design can be generated as an applet, application, Bean, or packaged design (for re-use within Java Studio).
  • Java Studio lets you generate Beans, and Beans are understood by a variety of development tools, including Sun's Java WorkShop. For example, once you have imported the Bean into Java WorkShop, you can use it as you would the other components that are available in that environment.
  • You can combine the virtues of a full development environment with the rapid visual assembly that you get in Java Studio.

The chapter excerpted here describes the user model and the basic parts of Java Studio. This information introduces you to the wiring paradigm in Java Studio, whereby you assemble components and "wire" them together, as well as the range of components that are available with the tool. You'll see the kinds of programs that you can create, as well as how easy it is to bring Beans from other sources into Java Studio.


Chapter 2 Java Studio Basics

Java Studio consists of a set of tools and building blocks for designing Java applets and applications. In Part II, you can try ten examples to see how to use Java Studio to create an applet or application. You can even take some of the examples and with some modifications use them immediately in your own work. Some readers will want to dive right into Part II. But if you'd like to know more about the parts of Java Studio and how to use them before you look at the examples, this chapter is for you.

Among the features Java Studio provides are:

  • Java building blocks, known as components
  • Dialogs for modifying the building blocks to suit the needs of your applet or application problem
  • Windows for designing applets and applications
  • Support for Java standards
  • Generation of Java programs that can run anywhere, on most computer systems or in most browsers
  • A Help browser with online tutorial exercises, task assistance, and context-specific help

Java Studio Windows

Java Studio, when started, opens three windows and a startup screen. The startup screen, shown in See Startup Screen , offers some ways of beginning work with Java Studio. You can click on links that will take you to a tutorial, examples, a road map to the product, or a frequently asked questions (FAQ) document. You can dismiss this screen and ask that it not be displayed when you start Java Studio. You can open the screen again anytime by clicking the Duke icon ("Where do I start?") in the Main window.

To become familiar with the parts of Java Studio, begin with the Road Map. It consists of pictures of Java Studio windows and question mark icons that you can click to get more information about each part of Java Studio.

Startup Screen
In addition to the startup screen, three Java Studio windows are opened when you launch the product:
  • The Main window --Contains the menus, a toolbar with buttons for the commands that you will use frequently, and the component palette. The Main window title bar shows the name of the current design. See See Java Studio Main Window.
  • The Design window --Titled "The Inner Workings" because it is where you specify the logic of your design by placing components and connecting them together. You can customize some features of this window.
  • The GUI window --Where you specify what the design looks like to the end user. This window is "live," which means that you can test your design here while you are working on it. You can customize some features of this window.

The Design and GUI windows open with introductory text that tells you more about the role of each window. The text disappears when you begin a design by placing the first component in either window. Together, the Design and GUI windows represent the two parts of any program--the way that it appears on the screen and the way that it works. Every component and connection in the design appears in the Design window. Only the user-visible elements appear in the GUI window.

Java Studio Main Window

The Toolbar and Main Menu

The Main window is the control center of Java Studio. In addition to the component palette, it includes the main menu and the toolbar. The toolbar provides easy access to commands that you will use frequently (See Toolbar).

Toolbar
In the order of their appearance on the toolbar, here are the icons and their actions:
  • New --Opens the Design and GUI windows for a new design. A text description of the window appears. As soon as you put a component in either window, the description disappears.
  • Open --Opens an existing design in the GUI window and the Design window. Opens a file chooser for you to browse to or enter the location and name of the design.
  • Save --Saves the current design. The first time that you save a design, Java Studio opens a file browser for you to choose a folder and a name for the design. When you save a named design, Java Studio just writes the changes to the file.
  • Cut --Cuts the current selection and places it on the clipboard.
  • Copy --Copies the current selection and places it on the clipboard.
  • Paste --Pastes the contents of the clipboard.
  • Customize Component --Opens the Customizer dialog box for the selected component.
  • Generate --Generates Java code for the design. You have the choice of generating an applet, an application, a JavaBeans component, or a packaged design.
  • Help --Opens the Help browser.

Tool Tips

If you forget the purpose of an icon, move the mouse cursor over it. Java Studio displays the name of the command associated with the icon. Use the same method to see the name of the component icons. As long as an icon on the toolbar is active (that means available), you can read a description of it. When icons or menus appear fuzzy, or what used to be called "grayed out" when monochrome monitors were the rule, that tool or command is not available.

Moving the mouse cursor over an icon also causes Java Studio to display a brief description of what the icon does. Look for this description in the footer of the Main window.

Java Studio Components

Java Studio comes with over forty JavaBeans components that serve as the building blocks for designs. These components are organized in folders within the component palette on the Main window (See Java Studio Main Window). Components fall into the categories GUI (graphical user interface), Data Flow, Computation, Multimedia, Internet, Database, Debug, and User (the kind that you add yourself). The examples in Part II show these components at work in useful designs.

There are additional components that were created for Java Studio but that are not part of the product. These are available for free from the Java Studio Web site:

http://www.sun.com/studio/index.html
A few of these are used in the examples in Part II. See Importing Components offers a general description of how to import components.

Each component is like a small precoded program in itself. For example, you don't have to write the Java programming language statements to create a Button; the Button is already available as a component that you can manipulate with the mouse. You can do a lot with the components right out of the box, so to speak. But chances are you will want to or need to make some changes to these building blocks so that they suit the needs of your design. The process of modifying a component is called customizing.

Customizers

Almost all of the components in Java Studio have a Customizer dialog.1 (Programmers will recognize customizers as interactive views of bean properties.) When you place a component in one of the windows, a Customizer dialog box opens automatically. If you want to change some aspect of the component as you use it, this arrangement may work well for you. You can change this setting so that you must open the customizer yourself. You might prefer the latter method if you tend to lay out most of your design first before you modify the components in it. To change the default behavior of the Customizer dialog:

  • Choose View Customizer on Add from the main menu.

This command toggles on or off. Click on it again to turn it on.

For the rest of this book, expect menu-command sequences to appear like this: File Open. The first item is the menu name, followed by the command from that menu, and finally the submenu, if any, for that command.

There are several ways to open the Customizer dialog for a selected component:

  • Double-click on the component.
  • Select a component in either the Design or GUI window and click the right mouse button to get a pulldown menu with a Customize command on it.
  • Choose Customize Selected Component from the main menu.

Importing Components

In addition to the components delivered with Java Studio, you can use JavaBeans components from the many vendors and individuals who make them. A set of free JavaBeans components is available to Java Studio users at Sun's Java Studio Web page: http://www.sun.com/studio/index.html.

You can import:

  • Java Studio packaged designs--A packaged design is simply any other design that you or someone else created in Java Studio and generated as a component. Think of generating a packaged design as packaging a component that itself consists of other components connected together. The typical purpose of a packaged design is to combine simpler functions into a single design that will be reused. You can then use that design in a bigger design. Besides reusability, an additional benefit of packaged designs is that using them results in simpler design diagrams because smaller pieces have been encapsulated into one bigger piece.

  • Component catalogs--Component catalogs are groupings of components. Java Studio comes with a catalog to which you can add components or from which you can delete components. If you delete items from the component catalog and want to restore it to its original state, you could import the product's component catalog. Component catalogs are a convenient way to group packaged designs. If you store the designs in a catalog, you can import the entire catalog instead of one packaged design at a time. See See Component Catalogs for more information.

  • JavaBeans components--A JavaBeans component is one that has been created by means of that part of the JDK that supports and standardizes Java component development, or by a software development tool that supports Java Beans components.

If a bean was created in Java Studio or has been used in Java Studio at some time, you import it as described below. The free beans that are available from the Java Studio Web page fall into this category.

To import a bean:

Choose Import JavaBeans.
  1. Enter the location of the JAR file containing the JavaBeans components and click Next. (JAR files have the extension .jar.)
  2. Java Studio displays a list of the beans in the .jar file. Select the beans that you want to import and click Add to move them to the Import column. Click Next.
  3. Decide whether you want the bean to be visible in the palette and choose a palette folder for it. The default is the User folder.
  4. Click Finish.

If a bean fits the JavaBeans standard but has never been imported or used in Java Studio, you follow the same basic steps, but you might see additional steps in the Import wizard that enable the bean to work with other Java Studio components.

Importing a packaged design is very similar to importing a bean. Packaged designs are really just packages of beans and are generated in JAR files, too. To import a packaged design:

Choose Import Packaged Design.
  1. Enter the location of the JAR file and click Next.
  2. Select the item to import and click the Add button. Click Next.
  3. Decide whether you want the packaged design to be visible in the palette and choose a palette folder for it. The default is the User folder.
  4. Click Finish.

Some Notes on Java Studio Components and Web Browsers

The components that come with Java Studio are based on either the Java development kit ( JDK) version 1.0.2 or JDK 1.1.n.

If you use an imported component created with JDK 1.1, Java Studio displays a message ( See JDK 1.1. Warning Message) so that you will know that applets and applications generated from that design will be based on JDK 1.1. Why is this information important? Web browsers that are based on JDK 1.0.2 will display only JDK 1.0.2 applets. Not all Web browsers have caught up with JDK 1.1.n, so applets that include JDK1.1.n components might not display in all browsers.

The best way to be sure that your applets will work in any given browser is to test the applet in the browsers where you think it might be used. The appletviewer will display both JDK 1.0.2 and JDK 1.1.n applets.

JDK 1.1. Warning Message

Sun's JavaSoft division has created a tool called Java Activator that enables applets to run on Internet Explorer 3.02 or 4 (Windows 95 and Windows NT 4.0), and on Netscape Navigator 3 or 4 (Windows 95, Windows NT 4.0, and Solaris 2.4, 2.5 and 2.6). Java Activator is a plug-in that delivers full JDK 1.1 support to those browsers. It's available for free download from the JavaSoft Web site:

http://www.javasoft.com/products/
activator/ea2/plugin-install.html

Component Catalogs

Component catalogs are groupings of components. Java Studio includes a catalog by default, but you can import other catalogs. Component catalogs are useful for grouping packaged designs so that you can import them all at once.

If you make changes to the Java Studio catalog, say, by removing components in the Customize Palette dialog, or adding them by using the Import menu, you can restore it to its original state by importing it again. The catalog of core components (those that are included with Java Studio) is in: installation_directory/JS/lib/vj/VJSysPalette.cfg (on Solaris)

installation_directory\JS\lib\vj\JSysPalette.cfg (on Windows 95 and Windows NT)

Creating a Component Catalog

There is no interactive tool in Java Studio for creating a component catalog. You can create a catalog by writing a catalog file and listing all of the components. The system catalog provides an example of how to do this.

Creating a component catalog file is not supported in Java Studio. If you decide to try to write and use one, be aware that you might get unexpected results.

The Java Studio core component catalog file illustrates the format for .cfg files:

  ::::::::::::::  
  VJSysPalette.cfg  
  ::::::::::::::
  
VERSION 1.0.1
CATALOG Visual Java Core Components
  CATEGORY GUI
    COMPONENT com.sun.jpro.vj.components.label.VJLabel
      DESCRIPTION Customizable label
      JAR com/sun/jpro/vj/components/label/label.jar
    END
    COMPONENT com.sun.jpro.vj.components.button.VJButton
      DESCRIPTION Customizable button 
      JAR com/sun/jpro/vj/components/button/button.jar
    END
  .
  .
  .
  END
END

Importing a Component Catalog

To import a catalog:

Choose Import Component Catalog.
  1. Enter the pathname of the catalog file or click Browse to open a file chooser.
  2. Click Next.
  3. Check each item in the catalog that you want to add to the palette and specify a category for it.

By default, every component is checked. This makes it easier to import the entire catalog.

  1. Click Finish.

Finding Components in Catalogs

To find a component:

Choose Customize Palette to open the Customize Palette dialog box.
  1. Click the Find Component icon (the magnifying glass).

Java Studio opens a Find Components dialog box.

Enter all or part of a component name, or enter a part of the description, or both.

  1. Click Find.

The Find Components dialog lists all matching components.

  1. Click Close.

Connectors

You make designs from component building blocks by wiring the components together. Connectors provide a way to exchange information between components. Information comes into a component through an input connectors and is sent out through an output connector. A bidirectional connector can move information in two directions, in and out, through the same connector.

Connectors often have names other than "input" or "output" associated with them, for example, "Result of the expression." The name describes the information. "Result of the expression," for example, is the data that results from a calculation. "Result of the expression" is an output connector. To see the name of a connector, move the mouse cursor over a connector to display its name.

Triggers are specialized input connectors. Triggers do not move data, they just give the component a signal to perform its operations. You will see the option to add a trigger connector in many of the component customizers.

The Java Studio online help says that "components communicate by sending and receiving messages through connectors." You don't need to understand what a message is, or how one is expressed in Java, to use connectors. Think of a message as data sent from one component to another to carry out some action. In some cases, the data is a value (input, output, and bidirectional connectors); in other cases, the data is just a trigger message to start some action (trigger connectors).

The simple design illustrated in See An Illustration: Codeless Programming with Java Studio shows a slider controlling the speed of an animation. In that case, a message is simply information from the slider--"I've been activated and here's the setting for the speed"--sent to the animation. The sending of this message is "triggered" by a user moving the slider with a mouse. User actions are typical kinds of events that send a message.

Table 2-1 describes the five kinds of connectors. When a component has an icon, the location of the connectors can tell you what kind of connector it is.

Connectors Table 2-1
Connector Type Description Location
Input Receives messages. Usually on left side of icon
Output Sends messages. On right side of icon
Input/Output Can send and/or receive messages. Varies
Trigger Activates output connector. A trigger is a specialized input connector. Usually on the top or left side of icon
Hide/Show Makes a component visible or invisible. Used most often on GUI components but can be added to the Animator component because it will appear to the user, even though it is not, strictly speaking, a GUI component. A Hide/Show connector is a specialized input connector. Upper left, when connector is present
Enable/Disable Enables a component to perform its actions or prevents it from performing its actions. An Enable/Disable connector is a specialized input connector. Upper right, when connector is present

Each component can have one or more connectors. The Label component doesn't start out with any connectors because you typically use it to label some part of the user interface. It is not always involved in some action in a design. However, you can add connectors to the Label component, and to other components as well, if you need to enable or disable, hide or show, set the label text, or make it respond to an action (like a trigger to send its label to another component).

See Placement of Connectors shows the placement of connectors. The illustration uses the Choice component, which is a GUI component that gives the user a drop-down list of items from which to choose. The items in the list are text, or "strings" in programming lingo. In the Choice component the input connector is added when you customize the component to add the ability to enter or select a string (an item in the list). We'll use the Customizer dialog for the Choice component as an illustration in See Adding Connectors below.

Placement of Connectors

You'll see how connectors work on a variety of components when you look at the examples in Part II. To see how much you can do with just one of them (an input connector on the Choice component), seeSee An Illustration: Codeless Programming with Java Studio.

Adding Connectors

By default, the Choice component comes with an output connector. The output connector is for sending to another component the information about what item in the list was selected. The additional connectors are added automatically when you make choices in the Connectors tab of the Choice component Customizer dialog. See Adding Connectors to a Component shows the checkboxes in the Connectors tab. Checking the boxes shown resulted in the additional connectors seen in See Placement of Connectors above. The item not checked is for the input connector that enables the user to select an item from the list: "Select a string value." To give you an idea of how much programming you can do in Java Studio without writing any Java code, we took the customized Choice component in See Placement of Connectors and See Adding Connectors to a Component, added items to the list of choices, and wired it to a text field. See An Illustration: Codeless Programming with Java Studio shows you what we did.

Adding Connectors to a Component

Connecting Components

By themselves, the components and their connectors are not useful. To make them into a working design, you connect them together by clicking on the appropriate connector and dragging a "wire" to a connector on another component.

Deleting Connections

To delete a connection, use any one of several procedures:

  • Click on either end and drag it away from one of the connectors to which it is attached.
  • Click on the round handle in the "wire" and click the right mouse button. Choose Disconnect from the pulldown menu.
  • Delete the component itself. The connections are deleted with it. This step is only useful if you want to delete both the component and the connection.

See Deleting a Connection shows the pulldown menu with the Disconnect command.

Deleting a Connection

Illegal Connections

Sometimes Java Studio will not allow you to wire components together. For example, if you try to wire an output connector from one component to an output connector of another, Java Studio displays a "Connection failed" message. If you import a component and try to wire it to another component that accepts a different kind of data, the connection will fail.

An Illustration: Codeless Programming with Java Studio

If you took the Choice component as is, added data items to it, and connected the modified component to a Text Field, you'd have a program. This section shows you how it can be done. (The section See An Example: Customizing and Wiring Components provides a hands-on example for you to try yourself.)

In about ten minutes, without writing any code, we created a simple design that:

  • Uses the Choice component to present a drop-down list of choices.
  • Includes a connector that can send the selected item from the list.
  • Includes a Text Field to display the selected item.

The result is named ChoiceDesign; you can find it on the companion CD-ROM. The working design in the GUI window is shown in See The Choice Design in the GUI Window.

The Choice Design in the GUI Window

With this design, the user can select the name of a city from a list. The selected city is displayed in a Text Field. You'd probably want to add a label to the text field so the user understood what was being displayed there. We show you how to do that, too.

To create the design:

  1. We started by putting a Choice component in the Design window. (We could have put it in either window.)

  2. We added the items in the list, filling in the Item fields in the Choice tab of the Customizer dialog for the Choice component.

  3. Next, we added a Text Field component to the design and connected the output from the Choice component to the input of the Text Field.

  4. Then, we added labels for the components and provided a description for the labels.

  5. Finally, we rearranged the components for a more pleasing appearance.

Each step is described and illustrated next.

The Choice Component in the GUI Folder

The component appears in both windows, and the customizer opens automatically. See The Choice Component As It Appears in Both Windows shows how the component looks in the Design and GUI windows. See The Choice Component As It Appears in Both Windows shows the Customizer dialog for this component.

The Choice Component As It Appears in Both Windows

The Customizer Dialog for the Choice Component
  • In the Customizer dialog, we added the data items that we wanted in our list.

The Choice tab contains two fields for entering the items, one for entering the data and the other for entering the form in which to pass its value to another component. (We chose to connect the Choice component to a Text Field for display, and we chose to pass the value exactly as it was entered in the Item field. You are given the two Item fields because there might be times when you want your application to have the selected item send a value other than the name as output. For example, you might want the population of Pittsburgh sent as output when the user selects that city's name from the list.)

After each entry, we clicked the Add button. Two additional buttons are available to delete or modify the item. The Delete button removes the selected item from the list. The Modify button reloads the selected item in the Item field, where you can edit it.

As we made the entries, the GUI window showed the updated design. The "live" nature of the Java Studio windows means that you can see what you are doing to your design as it happens.

  • The next step was to add a field to display the selected item from the list of cities in the Choice menu. We selected the Text Field component from the GUI folder and put it in the Design window.
  • To make the Choice component communicate with the Text Field, we wired them together (See Wiring the Choice Component to the Text Field). By default, there is only one connector on the Choice component, unless you add more in the Customizer. We made the connection by using the default output connector. The output connector is designed to send the selected item to another component.

Wiring the Choice Component to the Text Field

On the Text Field, we simply used the input connector because we wanted the output from the Choice component to input a text value in the Text Field.

  • After wiring the two components together and testing them in the GUI window, we decided to make the design a little more useful to a user by labelling the two components. We selected the Label component and added it to the design in two places: over the Choice menu itself and over the Text Field. See See Completed Design.

    When you want to use a component more than once, hold down the Control key when you click the mouse on the component. This procedure allows you to repeatedly drop the component in the Design window


Completed Design

The Labels do not interact with any of the other components in the design, so there is no need to connect them to anything. This is why they have no connectors by default. In other instances, you might want to hide the label under some circumstances or to change its text. In those cases, you could add connectors by using the customizer.

  • Using the customizer, we provided each Label with descriptive text.

We chose to label the Choice menu itself with the descriptive information "Choose a City:". We labelled the Text Field "Selected City:". If you look at See Customizing the Label, you can see that you enter text for the label without quotation marks. We did include a colon to make it clear that the label applied to what was below it.

Customizing the Label
  • The last step to making this design useful was to rearrange the layout of the components. You can only do this layout in the GUI window. We selected the labels, moved them where we wanted them, and resized them so that they would show all of the text that we entered. (The hands-on exercise in See An Example: Customizing and Wiring Components includes a step on changing the layout and resizing components.)

See Completed User Interface shows the user interface for the completed design.

Completed User Interface

An Example: Customizing and Wiring Components

If you'd like to try placing different kinds of components in the Design window and wiring them together, here's a simple example that shows selecting components, using their Customizer dialogs, and wiring them together. (This example is called BasicExample and it is on the Java Studio by Example CD-ROM.)

Select the Slider component by clicking on the Slider icon in the GUI folder of the component palette.
  1. Move the mouse cursor to the Design window and click in it.

The Slider appears in both the Design window and the GUI window, and Java Studio opens a Customizer dialog for it.

  1. Customize the Slider to make it more colorful and to change its size.
In the Standard tab, change the height to 40 and the width to 120.
  1. Change the foreground color. (Hint: Click the color chooser to the right of the Foreground field to get a list of colors.) We chose red to make the slider values more visible.
  2. Change the background color if you'd like something other than the gray. We chose a darker gray.
  3. Click Apply.

Notice how the Slider changes as you apply the new values. The GUI window updates as you customize the component.

  1. Now add the Animator component from the Multimedia folder.

The Animator component provides a flashy way of showing you how components already contain all of the Java code necessary to make something happen. Without doing anything but pointing and clicking, you have a simple animation program underway.

  1. Customize the Animator to use a different set of images. In the Animator tab of the customizer, choose Runner from the pulldown menu of Preset Animations.
  2. Wire the two components together. The Slider has only one connector, an output connector. This makes sense because the user will move the slider to change the animation. If the slider were to respond to another kind of external event, you would add an input connector.

Connect the output from the Slider to the bottom input connector (Animation Speed) of the Animator. If you want to know what each connector does, pass the mouse cursor over it to get a brief tip. See Getting Information About a Connector shows what the bottom input connector of the Animator does.

Getting Information About a Connector

You can try your program at any time in the GUI window. Move the Slider to change the animation speed.

  1. Save the design by selecting File Save.

At this point, you might want to make changes in how the completed design looks to a user. You can make some changes to the appearance of an individual component in the Customizer, including the component's size. Changing the size with the mouse is easier and more direct than using the customizer. To change a component's size, click on it to select it and grab one of the blue handles and resize it. To change the overall layout, click on a component in the GUI window and move it to where you want it. The handles on the outside of a component are for resizing. The handle at the center of a component is for dragging the component. You can also drag a component by clicking anywhere in its outside border. See See Handles for Moving or Resizing a Component.

Handles for Moving or Resizing a Component

You can create a grid in the GUI window by choosing Layout Show Grid. The Layout menu also contains Set Grid Size and Snap to Grid commands. There are three grid sizes: small, medium, and large. When the Snap to Grid command is on, placing or moving components causes them to line up with the grid. This makes it easier to align components with one another.

You'd probably like to add some pieces to start and stop the animation. Move the mouse cursor over the remaining two input connectors on the Animator to see what each does. As you might have guessed, you can add a couple of buttons to your design to start and stop the animation. Except for the brief sidetracks we took to customize the components, you can see how few steps it takes to create a working program. To distribute your work for use outside of Java Studio, you just save the design and generate the Java program.

Java Studio Designs Versus Programs

A Java Studio design is a running program within the context of Java Studio. It's not a program that you can distribute to others until you generate it. When you generate a design, you are generating working Java code that is stored in Java class files and other files that enable you to distribute the program you have created from your design.

Getting Help

Help is available from the Help control (the question mark) on the Java Studio toolbar, from within tools (use the F1 key or click the Help button in the tool's window), and from the Java Studio menu. Context-specific help is available in most windows and dialog boxes. The Help button within a window summons help on that part of Java Studio.

From the Help menu, you can open the following types of Help:

  • Help on Java Studio --This command opens the main body of Help to a table of contents and links to other types of user information. From here, or any other Help page, you can search all of Help for a particular topic. Most of the help is procedural, showing you how to complete Java Studio tasks, but there is abundant reference material on components and the menu commands, too. The Table of Contents is also available from the book icon in the Help browser toolbar. When you click on a book icon, the "book" opens to reveal another level of contents.
  • Release Notes --Look here for late-breaking information about using Java Studio and for current limitations and workarounds.
  • The Java Studio Startup Assistant --The Startup Assistant provides entry points for users who are new to Java Studio. This window is opened automatically when you start Java Studio. You can turn it off by clicking the button at the bottom of the window. Once you've disabled the window, you can always open it again from the Help menu.
  • Serial Number/License --This option provides information about your product serial number and license.
  • Registration --This command opens the registration form for the product.
  • Send Comments --This option provides a way of making your suggestions, criticisms, ideas, or positive feedback known to the entire Java Studio team. The team reads the comments, even if it can't respond to every one. (Your ability to use this option depends on how proxies are configured for your browser environment. If you have a direct connection to the Internet, you do not need to configure proxies. If you use a browser where you work, your access to the Internet might be through a firewall. In that case, you'll have to check with your Web administrator to see about proxy configuration.)
  • The About Java Studio page --You'll find the product version number, your serial number, and the version number (1.0) here.

The online documentation includes a search capability, too. From anywhere in Help, enter a word or phrase in the Search field and press Return. Java Studio returns a list of the links to pages where that keyword appears. When you follow the link to the page where the search string is located, you'll see the word or phrase highlighted on that page.

Finally, there is help on Help. When you are using the Help browser, you'll see that it also has a help menu. This menu offers help on using the Help browser.

Help contains links to additional useful resources for programmers using Java Studio. Navigate from the Table of Contents to Developer Resources, or enter these URLs in the Help browser:

  • jdoc:/lib/html/help/js/vj/developer/developer.html

The URL for the "JavaBeans Components for Java Studio Cookbook." A guide, with examples, for creating JavaBeans components for Java Studio.

  • jdoc:/lib/html/help/js/vj/developer/VJ_API.html

The URL for the APIs for the classes used by Java Studio.


Some Help Tips

Java Studio Help Table of Contents is a good page to bookmark in the Help browser. From here you can easily see and use the whole structure of Java Studio online assistance. The URL is jdoc:/lib/html/help/toc.html.

When you are customizing components, you'll notice that the Customizer dialog box contains a Help button. Clicking the Help button in the dialog takes you directly to the reference page for the component. This is a useful way to see what aspects of a component you can customize, and how.


Examples

The Help Table of Contents includes an entry for Tutorials and Examples. The tutorials and examples are also available from the Startup Assistant. There is actually just one tutorial: It walks you through the basics of using Java Studio. The step-by-step example shows you how to create an example that creates a currency converter. Finally, the additional examples link takes you to a page that describes the types of examples that are included in an examples directory that is installed with Java Studio and tells you where to find them. If you accepted the default installation directory, the examples are installed in:

    C:\Java-Studio1.0\JS\examples

The additional examples page breaks down the examples by what type of design they illustrate, for instance, playing sounds, sending data, handling simple and complex logic, opening and displaying a database, creating applet parameters.

Printing Help

You can print help pages by choosing File Print from the Help browser menu.

Java Studio Preferences

There are a number of things that you can set to reflect your preferences for how you want Java Studio to look or behave. The commands for customizing these parts of Java Studio are found in the View and the Customize menus. Note that the changes you make to the windows are only in effect for the current session. The changes that you make when you customize the palette are in effect even after you quit Java Studio and start it again.

Some of the commands on the Customize menu are for customizing components and their connections, not for customizing the working environment of Java Studio itself. However, some of the commands are for setting up your environment.

The Customize menu contains these commands for setting preferences:

  • GUI Window --Opens a dialog for you to change the appearance of the GUI window, including its color and default size.
  • Design Window --Opens a dialog for you to change the appearance of the Design window, including its color and default size.
  • Palette --Displays all of the icons for the components that come with Java Studio and that you yourself add (unless you choose otherwise). Java Studio stores components in a component catalog. You can remove the icons for rarely used components from the palette if you want to simplify its appearance. Removing the icon for a component from the palette does not delete it from the catalog. That is, you can add that component's icon back to the palette if you need it later.

The View menu contains commands for these settings:

  • Components As --Lets you choose whether to show components as icons, names, or both.
  • Tool Tips --Toggles the tool tips on and off.
  • Tool Bar --Toggles between showing or hiding the toolbar in the Main window.
  • Status Bar --Toggles between showing or hiding the status bar.
  • Customize on Add --Toggles the behavior of the Customizer dialog box. If the command is on, there is a check mark next to it and the Customizer dialog will open automatically for every component as you add it to a design. Choose this command again to turn off the dialog. (See See Customizers for different ways to open the Customizer dialog.)
  • "Where Do I Start?" Button --Opens the Startup Assistant. The Startup Assistant includes tutorials, examples, a road map of the Java Studio interface, and the Java Studio frequently asked questions (FAQ) page. If you do not use this feature very much and you'd like to save room on the toolbar, use this command to turn off the button. You can always restore it by choosing this command again.

Within the Help browser, there are a few additional preferences that you can set to define whether the Help browser shows or hides:

  • The URL field
  • The Help toolbar
  • Labels on the Help toolbar

You can also set the font size used in Help browser pages. All of these settings are available from the View menu in the Help browser.

Java Studio Files and Directories

The default installation locations for Java Studio, the installed sub directories, and files created and used by Java Studio are described here.

Installation Directories

For Windows 95 and Windows NT, the installation program creates these directories:

    C:\Java-Studio1.0\....
    C:\Java-Studio1.0\Java Studio Group
    C:\Java-Studio1.0\JDK
    C:\Java-Studio1.0\JS

The installation program also adds Java Studio to the Windows Start menu.

You are prompted at installation time to specify a directory other than the default installation directory.

Solaris users load a Java Studio tar file and uncompress and untar it in whatever directory they choose. If the installation directory is the home directory, the installed directory structure includes:

    $HOME/Java-Studio1.0
    $HOME/Java-Studio1.0/JDK
    $HOME/Java-Studio1.0/JS

The installation process also creates a directory to store files that Java Studio uses as you work. If the HOME system variable is undefined, the Windows 95 and Windows NT installation uses this directory:

    C:\Windows\js10

Assuming that the home directory is where you install the product, the Solaris directory is:

    $HOME/.js1.0

The js10 (Windows 95 and NT) and .js1.0 (Solaris) directories hold properties files for Java Studio.

Design and Program Directories

As you work with Java Studio, you will create, or Java Studio will generate, the following types of files:

  • DesignName.vj --This file holds all of the information necessary to open your design in Java Studio. When you save the design, Java Studio gives it the name that you specify in the Save dialog and automatically gives it the .vj extension.

You cannot edit this file, except as a design in Java Studio. You also cannot print it.

  • DesignName .html --This HTML file holds an applet. Java Studio creates this file when you choose to generate your design as an applet. Java Studio automatically gives the file an .html extension. You can edit this file. If you want to print it, you can do so by using your system's print utilities or from a text or HTML editor. You can also print the file from the Java Studio browser when you run it there.
  • classes --When you generate an applet or an application from your design, Java Studio creates this directory or folder to contain the working code that turns your design into a program that you can distribute for other people to run. When you publish an applet, makes this folder available at the Web site along with the HTML page that contains the applet.

For applets, Java Studio generates an HTML file for you. The file contains an <applet> tag that refers to the classes directory. The usual rules about the location of the applet and the location of its class files apply. That is, if you put the applet in a different directory, you'll have to change the pathnames in the <applet> tag.

The classes directory contains two subfolders or subdirectories (com and sunw) that contain the Java packages that enable your programs to run.

  • DesignName .zip --When you generate an applet, Java Studio creates a zip file. The zip file holds your working code in a compressed and easily distributed format. Zip files can be downloaded faster than files that have not been compressed. You can choose to use the zip file as the means to distribute your applet on a web. Most browsers include plug-ins for unzipping compressed files.
  • .class --The program file for an applet or application. Java Studio creates a unique name for this file each time you generate an applet or application.
  • DesignName .bat --For applications, Java Studio creates this file to run the program on Windows 95 or Windows NT.
  • DesignName .sh --For applications, Java Studio creates this file to run the program on Solaris.
  • DesignName .jar --When you generate packaged designs or JavaBeans, Java Studio creates this archive file. This is a compressed file. It can be opened by Java Studio or any tool that supports JavaBeans components.

You might need to modify the .sh and .bat files to make the pathnames work if the operating system where you want the program to run is not the same as the one where you generated the program.

Printing Files

You can print designs and GUI layouts. To print the design as it appears in the Design window, choose File Print Design. To print the GUI layout of the design, choose File Print GUI.

You can also print online help from the Help browser and the page that holds your applet from the Java Studio browser. Choose File Print from the browser menu.

Summary

In this chapter you learned how to use these parts of Java Studio in your work:

  • The Main window
  • The Design window
  • The GUI window
  • Components and the component palette
  • Component customizers
  • Connectors
  • Online help
  • Java Studio files and directories
  • Settings for the look and behavior of windows, the palette, and the customizer

As you start using the examples in Part II, keep in mind these tips from this chapter:

  • You can wire components together either by using the mouse to create a "wire" from one component to another or by using the Connection Editor.
  • You can resize a component by entering values in its Customizer dialog or by selecting it and moving the resize handles.
  • After you have customized a component, you can use the customized version again by clicking on it to select it and then using Copy and Paste. This method saves you having to repeat the customizing process.
  • To disconnect components, just click the right mouse button on the "wire" connecting them and choose Disconnect from the popup menu.
  • Some of the components that are available from the Java Studio contrib directory don't have customizers. In other cases, the customizers vary from the standard Java Studio presentation of the Customizer dialog.

1. The exceptions are the 2-Way Splitter and the If component. These components have no customizeable features.

Lynn Weaver is a senior technical writer for a human interface and information design group at Sun Microsystems. She has written user information about multimedia products, Java development tools, relational database products, client-server technologies, and object-oriented programming. She is also the author of the Inside Java WorkShop books.

Leslie Robertson is an STC (Society for Technical Communication) award-winning freelance writer who has written technical user information about Java development tools, relational database tools, OLAP technologies, query languages, and object-oriented programming for Oracle, Taligent, Sun Microsystems, and other Silicon Valley companies.


Reader Feedback

Tell us what you think of this Book excerpt.

[Duke]

 Very worth reading  Worth reading  Not worth reading

If you have other comments or ideas for future articles, please type them here:


Print Button
[ This page was updated: 27-Sep-2000 ]
Products & APIs | Developer Connection | Docs & Training | Online Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary | Feedback | A-Z Index
For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright © 1995-2000 Sun Microsystems, Inc.
All Rights Reserved. Terms of Use. Privacy Policy.