You are receiving this e-mail {e-mail address} because you elected to receive e-mail from Sun Microsystems, Inc. To update your communications preferences, please see the link at the bottom of this message. We respect your privacy and post our privacy policy prominently on our Web site http://sun.com/privacy/ Please do not reply to the mailed version of the newsletter, this alias is not monitored. Feedback options are listed in the footer for both content and delivery issues. |
![]() | ||||||
| ||||||
![]() |
This monthly newsletter provides a way for you to learn the basics of the Java programming language, discover new resources, and keep up-to-date on the latest additions to Sun Developer Network's New to Java Center. You can receive future issues of this newsletter in HTML or text: http://developer.java.sun.com/subscription/ Note: For the code in this issue of Fundamentals to compile, you need to use the JDK 5.0 software. http://java.sun.com/j2se/1.5.0/download.jsp | ||
![]() | Contents | ![]() |
![]() | Java Programming Language Basics | ![]() |
Getting to Know JColorChooser The At the top are three selectable color chooser panels, the tabs; at the bottom is a preview panel, the part labeled Preview. The "I Love Swing" bit is not part of the chooser, but instead of the application that contains the chooser. Notice there are no buttons, they are not part of the chooser. In addition to appearing within your application windows, the If you want to create a
Once you've created a import java.awt.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.colorchooser.*; public class ColorSample { public static void main(String args[]) { Runnable runner = new Runnable() { public void run() { JFrame frame = new JFrame("JColorChooser Popup"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JLabel label = new JLabel("I Love Swing", JLabel.CENTER); label.setFont(new Font("Serif", Font.BOLD | Font.ITALIC, 48)); frame.add(label, BorderLayout.SOUTH); final JColorChooser colorChooser = new JColorChooser(label.getBackground()); colorChooser.setBorder( BorderFactory.createTitledBorder("Pick Foreground Color")); // More source to come frame.add(colorChooser, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); } }; EventQueue.invokeLater(runner); } } Although this source code creates the GUI, selecting a different color within the The public interface ColorSelectionModel { // Listeners public void addChangeListener(ChangeListener listener); public void removeChangeListener(ChangeListener listener); // Properties public Color getSelectedColor(); public void setSelectedColor(Color newValue); } When a user changes the color within the Therefore, to complete the earlier ColorSelectionModel model = colorChooser.getSelectionModel(); ChangeListener changeListener = new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { Color newForegroundColor = colorChooser.getColor(); label.setForeground(newForegroundColor); } }; model.addChangeListener(changeListener); Once this source is added, the example is complete. Running the program brings the first screen shot, and selecting a new color alters the foreground of the label. Although the previous example is sufficient, if you want to include a public static Color showDialog(Component parentComponent, String title, Color initialColor) When called, What normally happens with the Color initialBackground = button.getBackground(); Color background = JColorChooser.showDialog( null, "Change Button Background", initialBackground); if (background != null) { button.setBackground(background); } To place this code in the context of a complete example, the following source code offers a button that when selected displays a import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ColorSamplePopup { public static void main(String args[]) { Runnable runner = new Runnable() { public void run() { JFrame frame = new JFrame("JColorChooser Sample Popup"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JButton button = new JButton("Pick to Change Background"); ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { Color initialBackground = button.getBackground(); Color background = JColorChooser.showDialog( null, "Change Button Background", initialBackground); if (background != null) { button.setBackground(background); } } }; button.addActionListener(actionListener); frame.add(button, BorderLayout.CENTER); frame.setSize(300, 100); frame.setVisible(true); } }; EventQueue.invokeLater(runner); } } There is much much more you can do with a colorChooser.setPreviewPanel(new JPanel()); | ||
Making Sense of the Java Classes & Tools | ||
Using Java DB in Desktop Applications by John O'Conner Sun Microsystems recently announced that it is distributing and supporting Java DB based on the 100 percent Java technology, open-source Apache Derby database. Derby was previously available under its earlier name, Cloudscape, from its former owners: Cloudscape, Informix, and IBM. IBM donated the Derby product source code to the Apache Foundation as an open-source project. Sun, IBM, other companies, and individuals have been actively involved in development of the relational database as part of the Apache Derby community. Sun distributes Java DB in many of its products, including the Sun Java Enterprise System and the Sun Java System Application Server. The NetBeans integrated development environment (IDE) 5.0 also supports Java DB. Java DB is lightweight at two megabytes, and embeddable within desktop Java technology applications. Desktop applications can now access powerful database storage with triggers, stored procedures, and support for SQL, Java DataBase Connectivity (JDBC) software, and Java Platform, Enterprise Edition (Java EE, formerly referred to as J2EE), all embedded within the same Java virtual machine (JVM).* This article describes how to download, install, integrate, and deploy Java DB within desktop Java technology applications. A demo application called Address Book demonstrates how to work with Java DB as an embedded database. Read the article. | ||
Java Bits | ||
J2SE FAQ This collection provides brief answers to a few common questions about the Java Platform, Standard Edition (Java SE). It also links to more detailed information available from the java.sun.com web site. Read the rest of this article. | ||
What's New on Java Studio Creator | ||
Using the File Upload Component The File Upload component enables users of your web application to locate a file on their system and upload that file to the server. This component is useful for collecting text files, image files, and other data. The contents of the uploaded file are stored together with some information about the file, including the file name, size, and MIME type (such as text/plain or image/jpeg). The server holds the uploaded file in memory unless it exceeds 4096 bytes, in which case the server holds the file contents in a temporary file. You can change this threshold by modifying the sizeThreshold parameter for the UploadFilter filter entry in the web application's web.xml file. For more information on modifying the web.xml file, see the last section in this tutorial, Doing More: Modifying the Maximum File Upload Size. In cases where you want to retain the uploaded file, you have three choices:
Read the rest of this article. | ||
Tutorials and Tips on NetBeans.org | ||
NetBeans IDE 5.0 HTML Editor Tutorial This tutorial demonstrates how to build an HTML editor, without any Java coding whatsoever. The HTML editor that you create is a rich-client application built "on top of the NetBeans Platform". What this means is that the core of the IDE, which is what the NetBeans Platform is, will be the base of your application. On top of the NetBeans Platform, you add the plug-in modules that you need and exclude the ones that the IDE needs but that your application doesn't. Here you see some of the IDE's plug-in modules, added to the NetBeans Platform, which is its base: ![]() You will see for yourself how simple and easy it is to build, or to be more precise, to assemble, a full-featured application on top of the NetBeans Platform. At the end, you are shown how to make the final product easily downloadable and launchable using WebStart. Read the rest of the tutorial. | ||
Applet Deployment Guide for Microsoft Internet Explorer by Stanley Ho A recent update to Microsoft Internet Explorer 6 included a change that alters the way users interact with applets in the browser. Microsoft Internet Explorer 6 running on the following platforms are affected by this change:
Impact on Applets Interactive applets loaded directly from the web page in Internet Explorer are affected. However, if the applets are loaded from external script files, they can respond to user interaction immediately and are not affected by this change. ![]() When the applet is inactive, it does not respond to user's input. However, it performs operations that do not involve interaction. For example, when users open a web page which contains an applet, the applet loads and runs as usual. To activate the applet for interaction, users need to manually click on the applet, or use the Tab key to set focus on the applet and then press the Spacebar or the Enter key. Workaround To create web pages that load interactive applets that respond immediately to user input, developers can use JavaScript programming language to load the applets from external script files. Developers should not write script elements inline (for example, using the writeln function) with the main HTML page to load a control externally, because the loaded applet will behave as if it was loaded by the HTML document itself and will require activation. To ensure an applet is interactive when it is loaded, use one of the following techniques. Read the rest of this article. | ||
Sun's Technology Courses | ||
Object-Oriented Analysis and Design Using UML (OO-226) The Object-Oriented Analysis and Design Using UML course effectively combines instruction on the software development processes, object-oriented technologies, and the Unified Modeling Language (UML). This instructor-led course uses lecture, group discussion, and facilitator-led activities (such as analyzing stakeholder interviews) to present one practical, complete, object-oriented analysis and design (OOAD) roadmap from requirements gathering to system deployment. Students are provided a pragmatic approach to object-oriented (OO) software development using a widely adapoted methodology (the Unified Process), the latest UML specification (version 1.4), and OO technologies, such as the Java programming language. Learn more. | ||
Free Developer Tools | ||
Sun is offering the award-winning Sun Java Studio Enterprise and Sun Java Studio Creator IDEs at no cost to all developers worldwide who join Sun Developer Network (SDN). Get your free tools. | ||
For More Information | ||
| ||
Downloading the Java Platform, Standard Edition (Java SE, formerly known as J2SE) | ||
For most Java technology development, you need the class libraries, compiler, tools, and runtime environment provided with the Java SE development kit. | ||
Comments? Send your feedback on the Java Technology Fundamentals Newsletter to: fundamentals_newsletter@sun.com Find archived issues of the following Java technology developer newsletters or manage your current newsletter subscriptions: https://softwarereg.sun.com/registration/developer/en_US/subscriptions Subscribe to the following newsletters for the latest information about technologies and products in other Java platforms:
PRIVACY STATEMENT Sun respects your online time and privacy. You have received this based on your email preferences. If you would prefer not to receive this information, please follow the steps at the bottom of this message to unsubscribe. IMPORTANT: Please read our Terms of Use, Privacy, and Licensing policies: http://www.sun.com/share/text/termsofuse.html http://www.sun.com/privacy/ http://developer.java.sun.com/berkeley_license.html © 2006 Sun Microsystems, Inc. All Rights Reserved. For information on Sun's trademarks see: http://sun.com/suntrademarks Java, J2EE, J2SE, J2ME, and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. To update your Sun subscription preferences or unsubscribe to Sun news services, click here or use this link https://softwarereg.sun.com/registration/developer/en_US/subscriptions FEEDBACK Comments? Send your feedback on the Java Technology Fundamentals Newsletter to dana.nourie@sun.com Sun Microsystems, Inc. 10 Network Circle, MPK10-209 Menlo Park, CA 94025 US |
Please unsubscribe me from this newsletter. |
Born on shraavana shudha chauthi of dundubhi naama samvaswara, Im kiran alias kini alias kiri bought up by loving parents. Being from agricultural family I have learnt plowing, carting but never learnt climbing trees. Now away from home I have lost touch with the agricultural skills.