Copy Link
Add to Bookmark
Report

Java Coffee Break Newsletter Volume 1 Issue 01

eZine's profile picture
Published in 
Java Coffee Break Newsletter
 · 10 months ago

                Java Coffee Break Newsletter Vol 1, Issue 1 
ISSN 1442-3790

Welcome to the first Java Coffee Break Newsletter! This is the first in a series of monthly newsletters that bring you the latest updated to JCB, as well as information and news for the Java Developer.

- - - - - - - - - - - - - - - - - - - - - - - -
Java Coffee Break Updates

* We've moved!
* New Java Servlet Archive
* Java Development Software

1. We've moved!

The new location for the Java Coffee Break is http://www.davidreilly.com/jcb/

Please update your bookmarks, and if you are a PointCast Connections subscriber, you'll need to remove your current channel, and re-subscribe.

2. New Java Servlet Archive

Java developers can now access free servlet source-code, from JCB's Servlet Archive. You can access the servlet archive from the following URL : http://www.davidreilly.com/jcb/servlets/

If you've written a servlet, and would like to post your source-code so that others can learn from your example, let us know.

3. Java Development Software

JCB now features useful Java development tools, on its software page. If you've used a cool development tool, that you think other Java programmers should know about, drop us a line.

- - - - - - - - - - - - - - - - - - - - - - - -
Java Q & A

Question : How can I create a modal dialog box?

Modal dialog boxes are extremely useful for display alert messages, and for capturing the user's attention. You can create a simple modal dialog box, and then it will remain visible and will maintain focus until it is hidden (usually when the user clicks on a button). Here's a simple example.

import java.awt.*;
import java.awt.event.*;

public class DialogExample {
private static Dialog d;

public static void main(String args[])
{
Frame window = new Frame();

// Create a modal dialog
d = new Dialog(window, "Alert", true);

// Use a flow layout
d.setLayout( new FlowLayout() );

// Create an OK button
Button ok = new Button ("OK");
ok.addActionListener ( new ActionListener()
{
public void actionPerformed( ActionEvent e )
{
// Hide dialog
DialogExample.d.setVisible(false);
}
});

d.add( new Label ("Click OK to continue"));
d.add( ok );

// Show dialog
d.pack();
d.setVisible(true);
System.exit(0);
}
}

The most important part of the program is the line that initializes the dialog. Notice the parameters we pass to it. The first parameter is a parameter for a window, and the second the title for the dialog. The final parameter controls whether the dialog is modal or not (true modal, false non-modal).

d = new Dialog(window, "Alert", true);

Using dialogs is easy, and can communicate information to users effectively. For those wishing to use the example, remember that it requires JDK1.1 or higher, as it uses an inner class for the button.

- - - - - - - - - - - - - - - - - - - - - - - -

The Java Coffee Break Newsletter is only sent out to email subscribers who have requested it. If you no longer wish to receive the JCB Newsletter, please unsubscribe using the WWW form located at http://www.davidreilly.com/jcb/newsletter/unsubscribe.html

next →
loading
sending ...
New to Neperos ? Sign Up for free
download Neperos App from Google Play
install Neperos as PWA

Let's discover also

Recent Articles

Recent Comments

Neperos cookies
This website uses cookies to store your preferences and improve the service. Cookies authorization will allow me and / or my partners to process personal data such as browsing behaviour.

By pressing OK you agree to the Terms of Service and acknowledge the Privacy Policy

By pressing REJECT you will be able to continue to use Neperos (like read articles or write comments) but some important cookies will not be set. This may affect certain features and functions of the platform.
OK
REJECT