Can you save a GUI configuration??

Hi everyone,
I am learning java and have a question.
I have a jdesktop pane and it has multiple internal frames in it. Now I open a bunch of frames and place it the way I want.
Now can I do something like save this configuration in any file say for example an XML file and then when i open the program again I can just load the configuration file and everything comes back the same way it was when i had saved it.
Is this possible if yes then how will I be able to do it???
Here is the code which I using to display my internal frames.
//Import files
public class InternalFrameDemo extends JFrame implements ActionListener {
     JDesktopPane desktop;
    public InternalFrameDemo() {
        super("DashBoard");
        //Make the big window be indented 50 pixels from each edge
        //of the screen.
        int inset =250;
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        setBounds(inset, inset,
                  screenSize.width  - inset*2,
                  screenSize.height - inset*2);
        //Set up the GUI.
        desktop = new JDesktopPane(); //a specialized layered pane
        setContentPane(desktop);
        setJMenuBar(createMenuBar());
        desktop.setBackground(Color.lightGray);
        //Make dragging a little faster but perhaps uglier.
        desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
    protected JMenuBar createMenuBar() {
        JMenuBar menuBar = new JMenuBar();
        //Set up the lone menu.
        JMenu menu = new JMenu("NEW");
        menu.setMnemonic(KeyEvent.VK_D);
        menuBar.add(menu);
        //Set up the first menu item.
        JMenuItem menuItem = new JMenuItem("LED Panel");
        menuItem.setMnemonic(KeyEvent.VK_L);
        menuItem.setAccelerator(KeyStroke.getKeyStroke(
                KeyEvent.VK_L, ActionEvent.ALT_MASK));
        menuItem.setActionCommand("new");
        menuItem.addActionListener(this);
        menu.add(menuItem);
      //Set up the second menu item.
        JMenuItem menuItem2 = new JMenuItem("Digital Clock");
        menuItem2.setMnemonic(KeyEvent.VK_D);
        menuItem2.setAccelerator(KeyStroke.getKeyStroke(
                KeyEvent.VK_D, ActionEvent.ALT_MASK));
        menuItem2.setActionCommand("new2");
        menuItem2.addActionListener(this);
        menu.add(menuItem2);
      //Set up the Third menu item.
        JMenuItem menuItem3 = new JMenuItem("Analog Clock");
        menuItem3.setMnemonic(KeyEvent.VK_A);
        menuItem3.setAccelerator(KeyStroke.getKeyStroke(
                KeyEvent.VK_A, ActionEvent.ALT_MASK));
        menuItem3.setActionCommand("new3");
        menuItem3.addActionListener(this);
        menu.add(menuItem3);
      //Set up the Fourth menu item.
        JMenuItem menuItem4 = new JMenuItem("Signal Levels");
        menuItem4.setMnemonic(KeyEvent.VK_S);
        menuItem4.setAccelerator(KeyStroke.getKeyStroke(
                KeyEvent.VK_S, ActionEvent.ALT_MASK));
        menuItem4.setActionCommand("new4");
        menuItem4.addActionListener(this);
        menu.add(menuItem4);
      //Set up the fifth menu item.
        JMenuItem menuItem5 = new JMenuItem("GPS Status");
        menuItem5.setMnemonic(KeyEvent.VK_G);
        menuItem5.setAccelerator(KeyStroke.getKeyStroke(
                KeyEvent.VK_G, ActionEvent.ALT_MASK));
        menuItem5.setActionCommand("new5");
        menuItem5.addActionListener(this);
        menu.add(menuItem5);
        //Set up the Quit menu item.
        menuItem = new JMenuItem("Quit");
        menuItem.setMnemonic(KeyEvent.VK_Q);
        menuItem.setAccelerator(KeyStroke.getKeyStroke(
                KeyEvent.VK_Q, ActionEvent.ALT_MASK));
        menuItem.setActionCommand("quit");
        menuItem.addActionListener(this);
        menu.add(menuItem);
        return menuBar;
    //React to menu selections.
    public void actionPerformed(ActionEvent e) {
        if ("new".equals(e.getActionCommand())) { //new
            createFrame();
        } else if("new2".equals(e.getActionCommand())) {
            createButtons();
        }else if ("new3".equals(e.getActionCommand())){
             createAnalog();
        }else if ("new4".equals(e.getActionCommand())){
             createBoxes();
        }else if ("new5".equals(e.getActionCommand())){
             createGPS();
        else{
             quit();
    protected void createFrame() {
        MyInternalFrame frame = new MyInternalFrame();
        TestApplet clock = new TestApplet();
        clock.init();
        frame.getContentPane().add(clock);
        frame.setSize(150, 150);
        frame.setVisible(true); //necessary as of 1.3
        desktop.add(frame);
        try {
            frame.setSelected(true);
        } catch (java.beans.PropertyVetoException e) {}
    protected void createAnalog() {
        MyInternalFrame frame = new MyInternalFrame();
        AnalogClock clock = new AnalogClock();
        frame.getContentPane().add(clock);
        frame.setSize(180, 200);
        frame.setVisible(true); //necessary as of 1.3
        desktop.add(frame);
        try {
            frame.setSelected(true);
        } catch (java.beans.PropertyVetoException e) {}
    protected void createBoxes() {
      //Code
    protected void createButtons(){
         MyInternalFrame frame = new MyInternalFrame();
         final DigitalClock dc = new DigitalClock();
          dc.setBackground(Color.black);
          frame.getContentPane().add(dc);
           frame.setSize(290, 120);
        frame.setVisible(true); //necessary as of 1.3
        desktop.add(frame);
        class Task extends TimerTask {
             public void run() {
                  dc.repaint();
          java.util.Timer timer = new java.util.Timer();
         timer.schedule(new Task(),0L,250L);
        try {
            frame.setSelected(true);
        } catch(java.beans.PropertyVetoException e) {}
    protected void createGPS() {
        MyInternalFrame frame = new MyInternalFrame();
        gpsstatus clock = new gpsstatus();
        frame.getContentPane().add(clock);
        frame.setSize(300, 190);
        frame.setVisible(true); //necessary as of 1.3
        desktop.add(frame);
        try {
            frame.setSelected(true);
        } catch (java.beans.PropertyVetoException e) {}
    //Quit the application.
    protected void quit() {
        System.exit(0);
    private static void createAndShowGUI() {
        //Make sure we have nice window decorations.
        JFrame.setDefaultLookAndFeelDecorated(true);
        //Create and set up the window.
        InternalFrameDemo frame = new InternalFrameDemo();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //Display the window.
        frame.setVisible(true);
    public static void main(String[] args) {
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
}

FanJava wrote:
Hi everyone,
I am learning java and have a question.
I have a jdesktop pane and it has multiple internal frames in it. Now I open a bunch of frames and place it the way I want.
Now can I do something like save this configuration in any file say for example an XML file and then when i open the program again I can just load the configuration file and everything comes back the same way it was when i had saved it.yes.
Is this possible if yes then how will I be able to do it???you need to design your GUI using absolute layout--null layout manager, that way you can specify how big and exactly where you want all of your components.

Similar Messages

  • Can you save your own theme and button set up so I can use the same format

    Can you save your own theme and button set up, so I can use this same format for similar content. I want to keep the button content and the theme the same without having to create it everytime? I am trying to streamline the process for multiple dvd's with the same menu and buttons but different content. Does that make sense?

    I am only new to this caper too, but I am pretty sure you can save a theme as a favourite by pressing the "save theme as favourite" button under file. If you have edited an existing theme but don't want to lose it, make sure you untick the replace existing button.

  • How can you save an app's data?

    Hi, how can you save an app's data? For example, if I want to switch some applications on my iPod with those were on my iTunes Apps Library, iTunes will force to remove the apps that was on my device and sync the apps that I want onto my iPod. But once the app is removed from my iPod, its data will be erased too, so, for example months later, I want to put them back onto my iPod, I will lose all the apps data and games progress. So, I just want to know the way that people save their apps data.

    Yo can't. apps are locked to the account thatpurchased them and in-app purchases can only be mad with the account that originally purchased the app.
    You will have to recover use of the first account
    How do I change or recover a forgotten Apple ID Password?
    If you've forgotten your Apple ID Password or want to change it, go to My Apple ID and follow the instructions. SeeChanging your Apple ID password if you'd like more information.
    If necessary:
    Forgotten Security Questions/Answers
    You need to contact Apple by:
    1 - Use the Express lane and start here:
    https://expresslane.apple.com
    then click More Products and Services>Apple ID>Other Apple ID Topics>Forgotten Apple ID security questions.
    or
    Apple - Support -form iTunes Store - Contact Us
    2 - Call Apple in your country by getting the number from here:
    http://support.apple.com/kb/HE57
    or           
    Apple ID: Contacting Apple for help with Apple ID account security
    3 - Use your rescue email address if you set one up
    Rescue email address and how to reset Apple ID security questions
    For general  information see:
    Apple ID: All about Apple ID security questions
    If you have not uses any of the $10 you redeemed to the new account, you can likely get that refunded by contacting iTunes
    Contact iTunes

  • How can you save a draft SMS on X3-02 ?

    How can you save a draft SMS on X3-02 ? 
    Can't seem to find an option to do this  ...  Lost message typed half way  when I got out of the editor to check the calendar.
    Am I missing something or has Nokians obsoleted this function on the latest S40 platform ?
    Solved!
    Go to Solution.

    Hi all,
    Like sudude here pointed out that's one way of leaving text as "draft" to message editor. Or you can also select Options > More > Exit editor to do the same. And, next time when you select Create message that previous text should be there as it was left.
    But there is also another option to start writing SMS's - with Notes application. Select Menu > Apps > Notes. Write a note and save it. Then for that note select Options > Send note > Send as message. Now your note is copied to message editor and you can send it or further edit and then send. Neat thing here is that when you use Notes application, text can be saved for later editing or use.
    -ThreeOs

  • Can you save as an earlier version of FCP?

    I don't know of anyway, but the director I am working with says a few people have told her it can...
    Other than working with am EDL, can you save a copy of your project (edited in 5.0.4) as an FCP 4.5 version.
    I don't see how this could be done, but if you know please let me know.
    thanks
      Mac OS X (10.3.7)  

    New Discussions ResponsesThe new system for discussions asks that you take the time to mark any posts that have aided you with the tag and the post that provided your answer with the tag. This not only gives points to the posters, but points anyone searching for answers to similar problems to the proper posts. When you mark a post with the tag, it will also mark the thread as Answered. If you receive the solution or answer to your question outside of the thread, then, and only then, at the top of the thread, mark the thread as Answered. This will mark the thread as Answered without marking an individual post as .
    If we use the forums properly they will work well...

  • Can you save your itunes and songs onto an external hard drive so that incase your computer crashes you will still have all your music?

    Can you save your itunes and songs onto an external hard drive so that incase your computer crashes you will still have all your music?

    The procedures below are for "moving" your library but as long as you don't delete it from your internal drive you are basically backing up.
    iTunes: How to move your music to a new computer [or another drive] - http://support.apple.com/kb/HT4527
    Simple answer:  Copy your whole iTunes folder to the external drive.  For subsequent backups you might want to learn about cloning and using a tool that only does incremental backups of recently changed items rather than copying all your files each time.

  • When editing a photo in iphoto09 can you save original ?

    when editing a photo in iphoto09 how can you save original too?

    iPhoto always saves the original. You decisions are recorded in a database and applied live to the image when yuo view it. Your master file is intouched.
    Want to see it? Hold the shift key when viewing a photo.
    Note the Photos -> Revert to original command.
    Want to access it? File -> Export and set the Kind to Original

  • Can i put Microsoft word onto the ipad, if so how can you save the documents, can i put Microsoft word onto the ipad, if so how can you save the documents

    can i put Microsoft word onto the ipad, if so how can you save the documents, can i put Microsoft word onto the ipad, if so how can you save the documents

    Welcome to Apple Support Communities
    If you have Office 365, you can install Office in your iPad > https://itunes.apple.com/us/app/suscriptores-office-mobile/id541164041?mt=8
    If you haven't got Office 365, there are other apps that work with Microsoft Word files, like Documents To Go > http://www.dataviz.com/dtg_home.html

  • Can you save an mp3 file that you receive as an attachment to an email?

    Can you save an mp3 file you receive as an attachment to an email?

    Irwinwilliam-
    With other attachments, you can press and hold on the attachment icon.  One of the options that may appear is "Open In".  Choosing that, any App that is capable of reading the attachment should show up as a choice.  When opening the document that way, a copy is transferred to the App.  I have not tried with an MP3 file.
    For MP3, I think the Music App should be a choice.  If so, the file should then appear with your other music.
    If an inappropriate App appears in "Open In", you may be able to use it as a conduit to transfer the attachment to your computer.  Run iTunes on your computer with the iPad connected.  Select the iPad under DEVICES, and click on Apps at the top of the window.  Scroll down to File Sharing and select that App.  If successful, your document will appear to the right in the Documents window, where you can select it and Save As.
    Fred

  • How can you save videos from an iPad to an external memory?

    How can you save videos from an ipad to an external memory?

    There are some wireless external hard drives that can be used with the iPad.
    Best iPad External Hard Drive Storage Options
    http://www.unlocktips.com/2012/11/best-ipad-mini-external-hard-drive-memory-stor age-options/
    iPad Storage Solutions
    http://www.ipadstoragesolutions.com/iPadWirelessStorage.php
    SanDisk Connect Wireless Media Drive http://www.sandisk.com/products/wireless/media-drive/
    Another option:
    Expand your iPad's storage capacity with HyperDrive
    http://www.macworld.com/article/1153935/hyperdrive.html
    On the road with a camera, an iPad, and a Hyperdrive
    http://www.macworld.com/article/1160231/ipadhyperdrive.html
     Cheers, Tom

  • Can you save Audio File from WhatsApp to iPhone music

    can you save an Audio file from WhatsApp to iPhone music?

    Only way to add anything to music is download it from the iTunes Store directly on device or sync it from a computer using iTunes.

  • Can you save Canon RAW files as TIFF in iPhoto 6?

    I was just wondering...
    Can you save imported Canon RAW (.cr2) files as TIFF files in iPhoto 6? I know you can view RAW files in iPhoto, but I need to edit them in Photoshop CS, which I don't think supports Canon RAW.
    Thanks!
    eMac G4   Mac OS X (10.4.9)   Photoshop CS, not CS2 or CS3, etc...

    Robert:
    Yes, you can export them to the desktop and select
    tiff as the format to save as.
    Have you tried opening the cr2 files with CS2? PSCS3
    can open and edit them.
    Do you
    Twango?
    I am stuck with Photoshop CS, and have not chosen to upgrade to CS2 or CS3 at this time. For now, I will use iPhoto to export RAW files as TIFF and open them in Photoshop. Thanks for your help!

  • "Import SIM Contacts" under settings-so how can you save to SIM card?

    Update took several hours and afterwards, contacts as well as internet bookmarks and map bookmarks are gone. However, the pictures under the camera icon remain. How is that? Are they on the SIM card? How come contacts didn't save to the SIM card? How can you save to the SIM card through itunes or the phone?
    Bueller?...Bueller?...Bueller?

    Apps you can re-download for free. SMS's are part of the iPhone backup, they would have to copy that folder to a thumb drive along with your photos, calendar & contact database. Your iPhone backup is located here:
    Mac: ~/Library/Application Support/MobileSync/Backup/
    Windows XP: \Documents and Settings\(username)\Application Data\Apple Computer\MobileSync\Backup\
    Windows Vista and Windows 7: \Users\(username)\AppData\Roaming\Apple Computer\MobileSync\Backup\
    Regarding your contacts & calendar, you'd have to first export them to the thumb drive, then copy to the proper location on the computer you intend to use. Same with your iphone backup & pics.

  • Email attachments: whenever someone sends me a file the Ipad labels it winmail.dat and wont allow me to open it...these are Word, Exce or jpgs.  Does anyone know why this is and how to fix it?  Also, how can you save attachments to a file on the IPad2

    whenever someone sends me a file the Ipad labels it winmail.dat and wont allow me to open it...these are Word, Exce or jpgs.  Does anyone know why this is and how to fix it?  Also, how can you save attachments to a file on the IPad2

    Is this a particular sender, or all of your attchments?  Google winmail.dat and you will see a number of returns that can explain this, but in short, this is the way some e mail providers deal with attachments.  If all of your e mail is coming that way, you need to change a setting on your isp set up.  Perhaps stary here...
    http://www.nytimes.com/2010/11/25/technology/personaltech/25askk.html

  • How can you save from photoshop to pdf with intact formlayers?

    How can you save from photoshop to pdf with intact formlayers?

    No, it is form layers for a cutting machine, when you save to pdf from ill or indesign you can select make acrobat layers but not in photoshop.
    Do anyone have a sullotion?

Maybe you are looking for

  • How can I connect external microphone to MacBook Pro?

    Hello! I need to connect the external microphone to my MacBook Pro? How can I do it?

  • External displays and projectors

    I've been having problems getting my MacbookAir (Mid 2012) running OSX 10.8.2 to use external displays and video projectors via VGA and DVI adapters. The problem is that if I am connected to my external monitor and disconnect the magsafe power adapte

  • 5D MkII - Quicktime Pro - MP4 - Premiere, why 4:3?!??!

    I was trying to find a workflow that would allow me to do my video editing on Premiere.  This has been a very expensive and frustrating road... For some reason, if I export a 5D MkII .mov file using Quicktime Pro using: File Format: MP4 Video Video F

  • How to add an entry in LIBL

    Hi! I want to add a new entry in LIBL of R/3 system, but I already tried to add it on job description and user/system library list on system values (QSYSLIBL and QUSRLIBL) without success. After R/3 up, I verify the LIBL on jobs and the new library w

  • Buying the new Mac Pro

    Hi there, I want to buy the new mac pro, I am a after effect user, need to know which graphic card to select, there is two option: 1-NVIDIA GeForce GT 120 with 512MB four of them, or 2-ATI Radeon HD 4870 with 512MB of GDDR5 memory single one. Thanks