Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions? | Software Development
 

To Create a Frame with Preferences

In this section you will learn how to use the preferences in frame. The example will make it easier to understand to use the preferences with frame window.

To Create a Frame with Preferences

                         

In this section you will learn how to use the preferences in frame. The example will make it easier to understand to use the preferences with frame window. the required package to use the preferences with frame window are java.awt, java.awt.event, javax.swing and java.util.prefs. I the given example we make a preferences object and call it in main.

 

 

Here is the Complete Code of the Example :

 import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

 import java.util.prefs.*;
  
    public class PreferenceTestFrame extends JFrame {
  
        // A reference to Preferences object
        private Preferences myPreferences = null;
  
        public PreferenceTestFrame() {
            super("Preferences Test Window");
  
            // Obtain a references to a Preferences object
            myPreferences = Preferences.userNodeForPackage(this.getClass());
        }
     public static void main(String[] args) {
        JFrame window = new PreferenceTestFrame();
        window.setVisible(true);
    }

  }
  

After thoroughly knowing the code you should save the file by "PreferenceTestFrame.java" file name and when after compiling the code you run your program you will get the output given below .  

Here is the Output of the Example :

Download this example.

                         

» View all related tutorials
Related Tags: c reference methods references method user system using id package node create check if preferences for call exists to automatic

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
 
Tell A Friend
Your Friend Name

 

 
Recently Viewed
Software Solutions
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.