How to save JTabbedPane to file so it can be restored later

I am trying to build a program that will allow the user to add/remove tabs and buttons in a JTabbedPane and then save this to a file so that it can be restored later. However when I try to restore it from the file I cannot get it to update the panel.
public class LightCommander extends JFrame
     private Container windowContent;
     private JPanel mainPanel;
     // menubar items and actionlistener
     private JMenuBar mainMenu;
     private JMenu f,v,c,c1,h;
     private ButtonGroup view_group;
     private MenuHandler mlistener;
     private static JMenuItem f1,f2,f3,c11,c12,c2,c3,c4,c5,h1,h2,h3;
     private JRadioButtonMenuItem v1;
     // mainWindow items
     private JScrollPane scrollWindow;
     private TabbedView mainWindow;
     // infoBar items and mouselistener
     private JPanel infoBar;
     private JLabel info;
     private InfoHandler ilistener;
     // program variables
     private Color defaultColor;
     private File setupFile;
     private FileInputStream fis;
     private FileOutputStream fos;
     private ObjectInputStream ois;
     private ObjectOutputStream oos;
     public LightCommander()
          super("LightCommander2 - \"The Light Project\"");
          windowContent = getContentPane();
          setupFile = null;
          defaultColor = this.getBackground();
          // create the mainPanel of the program which will
          // contain all the programs gui elements
          mainPanel = new JPanel(new BorderLayout());
          mainPanel.setPreferredSize(new Dimension(800,600));
          mainPanel.setMaximumSize(new Dimension(1400,1050));
               // create the menuBar and it's menus
               mainMenu = new JMenuBar();
               // create the file menu
               f  = new JMenu("File");
               f.setMnemonic(KeyEvent.VK_F);
               f1 = new JMenuItem("New");
               f1.setMnemonic(KeyEvent.VK_N);
               f1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK));     // set shortcut = (Ctrl + n) for power users
               f2 = new JMenuItem("Open");
               f2.setMnemonic(KeyEvent.VK_O);
               f2.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));     // set shortcut = (Ctrl + o) for power users
               f3 = new JMenuItem("Exit");
               f3.setMnemonic(KeyEvent.VK_X);
               f3.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK));     // set shortcut = (Ctrl + x) for power users
               f.add(f1);
               f.add(f2);
               f.addSeparator();
               f.add(f3);
               // create the view menu
               v  = new JMenu("View");
               v.setMnemonic(KeyEvent.VK_V);
               v1 = new JRadioButtonMenuItem("Tabs");
               view_group = new ButtonGroup();
               view_group.add(v1);
               v1.setSelected(true);
               v.add(v1);
               // create the command menu
               c   = new JMenu("Command");
               c.setMnemonic(KeyEvent.VK_C);
               c1  = new JMenu("Add");
               c1.setMnemonic(KeyEvent.VK_A);
               c11 = new JMenuItem("Light");
               c11.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.CTRL_MASK));     // set shortcut = (Ctrl + 1) for power users
               c12 = new JMenuItem("Switch");
               c12.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, ActionEvent.CTRL_MASK));     // set shortcut = (Ctrl + 2) for power users
               c1.add(c11);
               c1.add(c12);
               c2  = new JMenuItem("Remove");
               c2.setMnemonic(KeyEvent.VK_R);
               c2.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_3, ActionEvent.CTRL_MASK));     // set shortcut = (Ctrl + 3) for power users
               c3  = new JMenuItem("Reset");
               c3.setMnemonic(KeyEvent.VK_E);
               c3.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_4, ActionEvent.CTRL_MASK));     // set shortcut = (Ctrl + 4) for power users
               c4  = new JMenuItem("All On");
               c4.setMnemonic(KeyEvent.VK_N);
               c4.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_5, ActionEvent.CTRL_MASK));     // set shortcut = (Ctrl + 5) for power users
               c5  = new JMenuItem("All Off");
               c5.setMnemonic(KeyEvent.VK_F);
               c5.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_6, ActionEvent.CTRL_MASK));     // set shortcut = (Ctrl + 6) for power users
               c.add(c1);
               c.add(c2);
               c.add(c3);
               c.addSeparator();
               c.add(c4);
               c.add(c5);
               // create the help menu
               h  = new JMenu("Help");
               h.setMnemonic(KeyEvent.VK_H);
               h1 = new JMenuItem("Help Topics");
               h1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, ActionEvent.CTRL_MASK));     // set shortcut = (Ctrl + F1) for power users
               h2 = new JMenuItem("Technical Support");
               h3 = new JMenuItem("About LightCommander2...");
               h.add(h1);
               h.add(h2);
               h.addSeparator();
               h.add(h3);
               // add actionlistener and infolistener to the menuitems
               mlistener = new MenuHandler();
               ilistener = new InfoHandler();
               f.addMouseListener(ilistener);
               f1.addActionListener(mlistener);
               f1.addMouseListener(ilistener);
               f2.addActionListener(mlistener);
               f2.addMouseListener(ilistener);
               f3.addActionListener(mlistener);
               f3.addMouseListener(ilistener);
               v.addMouseListener(ilistener);
               v1.addActionListener(mlistener);
               v1.addMouseListener(ilistener);
               c.addMouseListener(ilistener);
               c11.addActionListener(mlistener);
               c11.addMouseListener(ilistener);
               c12.addActionListener(mlistener);
               c12.addMouseListener(ilistener);
               c2.addActionListener(mlistener);
               c2.addMouseListener(ilistener);
               c3.addActionListener(mlistener);
               c3.addMouseListener(ilistener);
               c4.addActionListener(mlistener);
               c4.addMouseListener(ilistener);
               c5.addActionListener(mlistener);
               c5.addMouseListener(ilistener);
               h.addMouseListener(ilistener);
               h1.addActionListener(mlistener);
               h1.addMouseListener(ilistener);
               h2.addActionListener(mlistener);
               h2.addMouseListener(ilistener);
               h3.addActionListener(mlistener);
               h3.addMouseListener(ilistener);
               // disable menu items with no functionality as of yet
//               f1.setEnabled(false);
//               f2.setEnabled(false);
//               v1.setEnabled(false);
               c1.setEnabled(false);
               c11.setEnabled(false);
               c12.setEnabled(false);
               c2.setEnabled(false);
               c3.setEnabled(false);
               c4.setEnabled(false);
               c5.setEnabled(false);
               h1.setEnabled(false);
               h2.setEnabled(false);
               h3.setEnabled(false);
               // add the menus to the menubar
               mainMenu.add(f);
               mainMenu.add(v);
               mainMenu.add(c);
               mainMenu.add(h);
               // create the mainWindow for displaying
               // switch and light elements
               mainWindow = new TabbedView();
               scrollWindow = new JScrollPane(mainWindow);
               // create the infoBar to display
               // the mouseOver information of components
               infoBar = new JPanel(new BorderLayout());
               infoBar.setPreferredSize(new Dimension(800,20));
               info = new JLabel("");
               info.setPreferredSize(new Dimension(400,20));
               info.setBorder(BorderFactory.createMatteBorder(1,1,1,1,Color.GRAY));
               infoBar.add(info,BorderLayout.WEST);
          // add the items to the mainPanel
          mainPanel.add(mainMenu,BorderLayout.NORTH);
          mainPanel.add(scrollWindow,BorderLayout.CENTER);
          mainPanel.add(infoBar,BorderLayout.SOUTH);
          windowContent.add(mainPanel);
          pack();
          show();
     public static void main(String[] args)
          LightCommander GUI = new LightCommander();
          GUI.addWindowListener(
                    new WindowAdapter()
                         public void windowClosing(WindowEvent e)
                         { f3.doClick(); }
     // inner class that handles all Events
     // created by the menu items in the JFrame
     public class MenuHandler implements ActionListener
          public void actionPerformed(ActionEvent e)
               if(e.getSource() == f1)
               //* New File:                                                                                *
               //*      updates any currently open file, creates a fileBrowser for user          *
               //*      input, and then creates the file and enables additional menu items     *
                    //*** check to see if a file is currently open and if so save it
                    if(setupFile != null)
                         try
                              fos = new FileOutputStream(setupFile);
                              oos = new ObjectOutputStream(fos);
                              oos.writeObject(mainWindow);
                              oos.close();
                              fos.close();
                              setupFile = null;
                         catch(Exception f) { JOptionPane.showMessageDialog(mainPanel,"ERROR: " + f); }
                    //*** create popup window to request file name and location (fileBrowser)
                    JFileChooser chooser = new JFileChooser();
                    int result = chooser.showSaveDialog(mainMenu);
                    if(result == JFileChooser.CANCEL_OPTION) return;
                    setupFile = chooser.getSelectedFile();
                    try
                         setupFile.createNewFile();
                         mainWindow = new TabbedView();     // reset the view here
                         mainWindow.repaint();
                         // enable the menu items that should now be functional
                         c1.setEnabled(true);
                         c12.setEnabled(true);
                    catch(Exception f){ JOptionPane.showMessageDialog(mainPanel, "ERROR: " + f); }
               if(e.getSource() == f2)
               //* Open File:                                                                                     *
               //*          updates any currently open file, creates a fileBrowser for user               *
               //*          input, opens the file, builds the view from file, enables menu items     *
                    //*** check to see if a current file is open and if so save it
                    if(setupFile != null)
                         try
                              fos = new FileOutputStream(setupFile);
                              oos = new ObjectOutputStream(fos);
                              oos.writeObject(mainWindow);
                              oos.close();
                              fos.close();
                              setupFile = null;
                         catch(Exception f) { JOptionPane.showMessageDialog(mainPanel,"ERROR: " + f); }
                    //*** create popup window (file browser) to allow user to select the file to be opened
                    JFileChooser chooser = new JFileChooser();
                    int result = chooser.showOpenDialog(mainMenu);
                    if(result == JFileChooser.CANCEL_OPTION) return;
                    try
                         //*** open the selected file and fill the view
                         setupFile = chooser.getSelectedFile();
                         fis = new FileInputStream(setupFile);
                         ois = new ObjectInputStream(fis);
                         mainWindow = (TabbedView) ois.readObject();
                         mainWindow.reset();
                         ois.close();
                         fis.close();
                         // finally, enable the menu items that should now be functional
                         c1.setEnabled(true);
                         c11.setEnabled(true);
                         c12.setEnabled(true);
//                         c2.setEnabled(true);
//                         c3.setEnabled(true);
//                         c4.setEnabled(true);
//                         c5.setEnabled(true);
                    catch(Exception f){ JOptionPane.showMessageDialog(mainPanel,"ERROR: " + f); }
               if(e.getSource() == f3)
               //* Exit Program:                                        *
               //*          update the currently open file and exit     *
                    //*** check to see if a current file is open and if so save it
                    if(setupFile != null)
                         try
                              fos = new FileOutputStream(setupFile);
                              oos = new ObjectOutputStream(fos);
                              oos.writeObject(mainWindow);
                              oos.close();
                              fos.close();
                              setupFile = null;
                         catch(Exception f) { JOptionPane.showMessageDialog(mainPanel,"ERROR: " + f); }
                    System.exit(0);
               if(e.getSource() == c11)
               // add a lightObject to the selected switch
               // and also add the lightObject to each view
                    //*** get the selected switchObject
                         // if the current view is tabbed find the selected tab
                         // if the current view is matrix then find the selected button
                    //*** add a lightObject to the selected switchObject
                    //*** finally add the lightObject as a button to both views
               if(e.getSource() == c12)
               // add a switchObject to the current setup
               // and also add a tab to the mainWindow
                    if(!mainWindow.addSwitch())     JOptionPane.showMessageDialog(mainPanel,"ERROR: MAX number of switches are installed.");
                    // enable menu items that should now be functional
                    c11.setEnabled(true);
//                    c2.setEnabled(true);
//                    c3.setEnabled(true);
//                    c4.setEnabled(true);
//                    c5.setEnabled(true);
               if(e.getSource() == c2){ System.out.println("event - remove"); }
               if(e.getSource() == c3){ System.out.println("event - reset"); }
               if(e.getSource() == c4){ System.out.println("event - all on"); }
               if(e.getSource() == c5){ System.out.println("event - all off"); }
               if(e.getSource() == h1){ System.out.println("event - help topics"); }
               if(e.getSource() == h2){ System.out.println("event - technical support"); }
               if(e.getSource() == h3){ System.out.println("event - about lightcommander2..."); }
     // displays mouseover information in the infoPanel
     public class InfoHandler implements MouseListener
          // the mouse has entered a mouselistener object
          public void mouseEntered(MouseEvent e)
               if(e.getSource() == f ) { info.setText(" file menu");     }
               if(e.getSource() == f1) { info.setText(" create a new setup file"); }
               if(e.getSource() == f2) { info.setText(" open an existing setup file"); }
               if(e.getSource() == f3) { info.setText(" exit the program");     }
               if(e.getSource() == v ) { info.setText(" view menu");     }
               if(e.getSource() == v1) { info.setText(" change the main window layout to tabular layout"); }
               if(e.getSource() == c ) { info.setText(" command menu"); }
               if(e.getSource() == c11){ info.setText(" add a light to the current lighting setup"); }
               if(e.getSource() == c12){ info.setText(" add a switch to the current lighting setup"); }
               if(e.getSource() == c2) { info.setText(" remove the selected item from the lighting setup");     }
               if(e.getSource() == c3) { info.setText(" reset the selected item in the lighting setup"); }
               if(e.getSource() == c4) { info.setText(" turn on all the lights"); }
               if(e.getSource() == c5) { info.setText(" turn off all the lights"); }
               if(e.getSource() == h ) { info.setText(" help menu");     }
               if(e.getSource() == h1) { info.setText(" open a list of common help topics"); }
               if(e.getSource() == h2) { info.setText(" open a window with company contact information"); }
               if(e.getSource() == h3) { info.setText(" open a window displaying program info"); }
          public void mouseExited(MouseEvent e){ info.setText(""); }
          public void mousePressed(MouseEvent e){  }
          public void mouseReleased(MouseEvent e){  }
          public void mouseClicked(MouseEvent e){  }
public class TabbedView extends JTabbedPane implements Serializable
     private SwitchObject[] switches;
     private int numSwitches;
     public TabbedView()
          super();
          switches = new SwitchObject[128];
          numSwitches = 0;
     public boolean addSwitch()
          if(numSwitches < 128)
               for(int i=0; i<128; i++)
                    if(switches[i] == null)
                         SwitchObject x = new SwitchObject("S" + Integer.toString(i), i);
                         switches[i] = x;
                         this.addTab(x.getLabel(), x);
                         break;
               numSwitches++;     // increment the number of switches installed
               return true;     // signal a successful operation
          else return false;     // signal that all available switch addresses are used
public class SwitchObject extends JPanel implements Serializable
     private String s_label;
     private int s_addr;
     private int numLights;
     private LightObject[] lights;
     // SwitchObject Constructor
     public SwitchObject(String label, int addr)
          super();
          s_label = label;
          s_addr = addr;
          numLights = 0;
          lights = new LightObject[128];     // create an empty array of lights
          for(int i=0; i<3; i++) Tx();     // send the switches addr 3 times in order to setup the hardware addr
     public String getLabel(){ return s_label; }
     public int getAddr(){ return s_addr; }
     // add a light to the switch
     public boolean addLight()
          if(numLights < 128)
               for(int i=0; i<128; i++)
                    if(lights[i] == null)
                         lights[i] = new LightObject("L" + Integer.toString(i), i+128);
                         break;
               numLights++;
               return true;
          else return false;
     // transmit the switches addr to the hardware
     public void Tx()
          //*** Add Code Here ***
          System.out.println("Tx: " + Integer.toString(s_addr));     // output for debugging
public class LightObject extends JButton implements Serializable,ActionListener
     private int l_addr;
     private boolean isOn;
     public LightObject(String label, int addr)
          super(label);
          this.addActionListener(this);
          this.setBackground(Color.YELLOW);
          l_addr = addr;
          for(int i=0; i<3; i++) Tx();          // send the light addr 3 times to setup the hardware addr
          isOn = true;
     public int getAddr(){ return l_addr; }
     // Transmit the light's addr to the hardware
     public void Tx()
          //*** Add Code Here ***
          System.out.println("Tx: " + Integer.toString(l_addr));
     public void actionPerformed(ActionEvent e)
          Tx();
          if(isOn)
               isOn = false;
               this.setBackground(Color.GRAY);
          else
               isOn = true;
               this.setBackground(Color.YELLOW);
}

You're welcome for the help I gave you in your last posting on this topic.
Why are you posting 200 lines of code? 90% of the code is not related to saving/restoring a component. Create a simple demo program and then maybe someone will take a look. We are not here to debug you entire application.
How to create a [url http://www.physci.org/codes/sscce.jsp]Short, Self Contained, Correct (Compilable), Example

Similar Messages

  • How to save info in 'File Info.' Can't find a way

    I edit a photo in Photoshop CC. I want to save its information in 'File Info' so that I don't need to retype all of it over and over again. I could do that in my old Photoshop app. Every time I try it now, it doesn't save and I end up retyping. When you have 20 photos edited, that takes a huge amount of unnecessary time. How do I save 'File Info?"

    I'm assuming you mean "file info...", under the file menu item. After adding information, be sure you click "OK" in the bottom right of the info window, and then of course be sure to, in turn, save the entire image to your hard drive. It worked for me every time, so I don't think there is a bug.

  • Please can someone tell me how to save a MP3 file from my email on my iPad so I can put in on Facebook? Thankyou

    Please can someone tell me how to save a MP3 file from my email on my iPad so I can put it on Faceboo? I use hotmail and please tell me step by step as I am not a tech guru lol. Thankyou

    Hi jscher200,
    Thank you for your reply, sorry for the VERY late late response, but I have just figured out how to control this separate 'panel'. I find it really useful for monitoring Google Analytics in as it can just sit there running. It does have its limitations, as it's a limited size (you can't expand it to full screen view), so you can only ever see a vertical section of a website and need to scroll to look to the right or left, but I have the live view of people accessing my website running on there and if the numbers start racking up at any time, I can scroll to look and see what pages they are accessing, where they've been referred from, etc.
    To get it to work, you save a website address in the Bookmarks Toolbar and when you can see it sitting on the toolbar at the top of the screen with its little icon, right click on it then click 'properties', then tick the box 'Load this bookmark in the sidebar'. The next time you click on this bookmark to open the website, it will load in this sidebar, which looks like a separate 'window' but is immovable. You can only have one sidebar application running at a time, but can change it by right clicking on the bookmark you want to load in there and it will then change to that one next time you click on that bookmark.
    I hope this might be useful to others, as I asked for help with this on loads of forums and not one person knew that this existed - even really skilled techies!

  • How to save a numbers file to a pdf file of multiple pages instead of one giant long page?

    How to save a numbers file to a pdf file of multiple pages instead of one giant long page?

    Hi DW,
    Numbers 3.2.2
    Instead of Menu > File > Export To,  use Menu > File > Print...
    That takes you to Print Preview.
    In the Print Setup panel, Click on the Print... button lower right (it won't print yet).
    That opens the Print Dialogue.
    Click on the PDF Pop-Up Menu lower left.
    Choose Open PDF in Preview or Save as PDF.
    That will have page breaks and will be full sized.
    Print from Preview.
    Regards,
    Ian.

  • I want to send a normal pages document as a attachment to someone (non Mac PC). How do I convert the file so they can open it? Silly question but I'm new to Mac.

    I want to send a normal pages document as a attachment to someone (non Mac PC). How do I convert the file so they can open it? Silly question but I'm new to Mac.

    A Pages (.pages) document is only viewable with Apple's Pages application on the Mac, or via Pages for iCloud beta. You should export it to either MS Word (.doc/x) or PDF. The Share menu will let you do this directly into a Mail attachment.

  • How to compress a pdf file so I can e-mail

    how to compress a pdf file so I can e-mail it

    On a Windows you can try a program like WinZip or WinRar.

  • I have ipad3, but all my files where deleted, can I restore them?

    I  have ipad3, but all my files where deleted, can I restore them?

    Without a backup you can download the apps again for free, but only if you have a backup you can get back your settings and other data if you restore from that backup.
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    iOS: How to back up

  • HOW TO SAVE A TEXT FILE ON AL11

    HOW CAN WE SAVE A TEXT FILE ON THE APPLICATION SERVER AL11 WHICH IS ON THE DESKTOP OR ANY DRIVES.
    CAN SOME ONE GIVE ME THE STEP BY STEP PRCEDURE
    REWARDS IF USEFUL

    Hi,
    Use Tcode CG3Z to upload files to application server and use tocde CG3Y to download file to your desktop.
    Reward points if helpful.
    Regards,
    CS.

  • How to save an excel file as CSV with semi-colon as data separator?

    We are creating a flat data file to load the flat file data to our BW system with Excel.  When we save the file, there are three kinds of CSV types for selecting from the "Save as type" list box:
    CSV (Comma delimited)
    CSV (Macintosh)
    CSV (MS-DOS)
    There is no CSV (semi colon delimited) type.  If we pick CSV (Comma delimted) as the type, then when clicking the "Preview ..." picture icon under the "DataSource/Trans. Structure" tab of the InfoSource for this flat file (with the CSV radio button checked the Data separator default is ";"), the File Upload Preview window shows the data is messed up that some columns of the excel flat file are combined into one column.
    Since the save type we picked is "CSV (Comma delimited)", then we try to change the default Data separator from ";" to "," in the preview selection screen, but still not helpful!
    How to resolve the above problem?
    Thanks

    Hi Kevin,
    This "," is defined in your windows setting. If you want to have ";" as separator then go to control Panel, select Regional Options, go to Numbers Tab and define the List separator as ";". After that when you will save your excel file as CSV(MS-DOS) it will have ";" as separator. This will make sure that the amounts are not broken in to two different fields while loading.
    Else if you keep "," as separator then you can also go into the Excel and define all number fields as Number without thousand separator.
    Let me know if you have any doubts in this.
    Regards,
    Rohit

  • How to save a video file which uses the setCodecChain method on its video t

    hi! i really need your help please. i got the Code for RotationEffect and i would like to know how to save it to a file instead of playing it simultaneously in a player:
    Here is the code: Plz Help me!!! am doing my final year project
    import java.awt.*;
    import java.awt.event.*;
    import javax.media.*;
    import javax.media.control.TrackControl;
    import javax.media.Format;
    import javax.media.format.*;
    * Sample program to test the RotationEffect.
    public class TestEffect extends Frame implements ControllerListener {
    Processor p;
    Object waitSync = new Object();
    boolean stateTransitionOK = true;
    public TestEffect() {
         super("Test RotationEffect");
    * Given a media locator, create a processor and use that processor
    * as a player to playback the media.
    * During the processor's Configured state, the RotationEffect is
    * inserted into the video track.
    * Much of the code is just standard code to present media in JMF.
    public boolean open(MediaLocator ml) {
         try {
         p = Manager.createProcessor(ml);
         } catch (Exception e) {
         System.err.println("Failed to create a processor from the given url: " + e);
         return false;
         p.addControllerListener(this);
         // Put the Processor into configured state.
         p.configure();
         if (!waitForState(p.Configured)) {
         System.err.println("Failed to configure the processor.");
         return false;
         // So I can use it as a player.
         p.setContentDescriptor(null);
         // Obtain the track controls.
         TrackControl tc[] = p.getTrackControls();
         if (tc == null) {
         System.err.println("Failed to obtain track controls from the processor.");
         return false;
         // Search for the track control for the video track.
         TrackControl videoTrack = null;
         for (int i = 0; i < tc.length; i++) {
         if (tc.getFormat() instanceof VideoFormat) {
              videoTrack = tc[i];
              break;
         if (videoTrack == null) {
         System.err.println("The input media does not contain a video track.");
         return false;
         System.err.println("Video format: " + videoTrack.getFormat());
         // Instantiate and set the frame access codec to the data flow path.
         try {
         Codec codec[] = { new RotationEffect() };
         videoTrack.setCodecChain(codec);
         } catch (UnsupportedPlugInException e) {
         System.err.println("The processor does not support effects.");
         // Realize the processor.
         p.prefetch();
         if (!waitForState(p.Prefetched)) {
         System.err.println("Failed to realize the processor.");
         return false;
         // Display the visual & control component if there's one.
         setLayout(new BorderLayout());
         Component cc;
         Component vc;
         if ((vc = p.getVisualComponent()) != null) {
         add("Center", vc);
         if ((cc = p.getControlPanelComponent()) != null) {
         add("South", cc);
         // Start the processor.
         p.start();
         setVisible(true);
         addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent we) {
              p.close();
              System.exit(0);
         return true;
    public void addNotify() {
         super.addNotify();
         pack();
    * Block until the processor has transitioned to the given state.
    * Return false if the transition failed.
    boolean waitForState(int state) {
         synchronized (waitSync) {
         try {
              while (p.getState() != state && stateTransitionOK)
              waitSync.wait();
         } catch (Exception e) {}
         return stateTransitionOK;
    * Controller Listener.
    public void controllerUpdate(ControllerEvent evt) {
         if (evt instanceof ConfigureCompleteEvent ||
         evt instanceof RealizeCompleteEvent ||
         evt instanceof PrefetchCompleteEvent) {
         synchronized (waitSync) {
              stateTransitionOK = true;
              waitSync.notifyAll();
         } else if (evt instanceof ResourceUnavailableEvent) {
         synchronized (waitSync) {
              stateTransitionOK = false;
              waitSync.notifyAll();
         } else if (evt instanceof EndOfMediaEvent) {
         p.close();
         System.exit(0);
    * Main program
    public static void main(String [] args) {
         if (args.length == 0) {
         prUsage();
         System.exit(0);
         String url = args[0];
         if (url.indexOf(":") < 0) {
         prUsage();
         System.exit(0);
         MediaLocator ml;
         if ((ml = new MediaLocator(url)) == null) {
         System.err.println("Cannot build media locator from: " + url);
         System.exit(0);
         TestEffect fa = new TestEffect();
         if (!fa.open(ml))
         System.exit(0);
    static void prUsage() {
         System.err.println("Usage: java TestEffect <url>");

    Can you please send me Your codec class and guide me the way you use it .. i am trying to apply some filters on the movie before presenting. Any help would be appreciated.

  • HOW TO SAVE A SCANNED FILE IN PDF FORMAT

    I HAVE A HP LASER JET M1005MFP PRINTER...
    HOW CAN I SAVE A SCANNED FILE IN PDF FORMAT..???
    PLEASE HELP AS SOON AS POSSIBLE AS IT IS URGENT.

    To get your issue more exposure I would suggest posting it in the commercial forums since the LaserJet M1005 is a commercial product. You can do this at Commercial Forums.
    I hope this helps!
    R a i n b o w 7000I work on behalf of HP
    Click the “Kudos Thumbs Up" at the bottom of this post to say
    “Thanks” for helping!
    Click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution!

  • How to save a .csv file to database server

    Hi every body,
    I need to upload a .csv file from the client machine and save it to a directory in a database sever.
    I could do the uploading part. Can anyone tell me how to save the file?
    Another option is save the file as a CLOB in a database column. But I'm not aware of doing that too.
    Please guide me.
    Thanks in advance.
    Surangi.

    See Steve Muench's Not Yet Documented Example #85 at http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html#85. While this is for 10.1.3, this is still relevant for 11g. Steve's example is for uploading to a BLOB - same thing for a CLOB. Once your data is in the database, you can use the DBMS_LOB package to write the file to a directory on the database server, if you like.
    Also the Developers Guide is your friend - Chapter 9.9 in the Fusion Web User Interface Developers Guide for Oracle ADF 11g, or 19.6 in the ADF Developers Guide for Forms/4GL Developers for JDeveloper 10.1.3.

  • How to save the pdf file or word doc into sap table

    Hi Expertu2019s
       I have a pfd file in my presentation server .Now I want to save the pdf file into sap table using module pool program. Whenever i need, I want to open that file from the table and show it in the Screen. Please any one tell me how I can save the file. What is the table name, guide me.
    Regards,
    S.Nehru.

    Hi,
    Try the following code
    FORM gui_upload.
      DATA: lv_filetype(10) TYPE c,
            lv_gui_sep TYPE c,
            lv_file_name TYPE string.
      lv_filetype = 'PDF'.
      lv_file_name = <name of ur file>.
    DATA: tb_file_data TYPE TABLE OF text4096.
    * FM call to upload file
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = lv_file_name
          filetype                = lv_filetype
          has_field_separator     = lv_gui_sep
        TABLES
          data_tab                = tb_file_data
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "gui_upload
    I dont think you can save the data into sap tables in PDF format.
    With the above code you can save data into an internal table.
    Regards,
    Manish

  • How to save an encoded file

    i want to generate a file in run mode and that file contain username and password and i dont want to save as text file
    is there away i can save it in encoded file that cant be opend easily?
    another quistion : how can I make curren value in a string control defualt in run mode?
    many thanx

    mana111;
    Users will always be able to open the file, some way or the other. What you don't want is the ability to understand it - you want to preserve the confidentiality. First, you need to determine what needs to be protected. Usually the username is known and therefore no protection is provided. The password always need protection. Also, you need to determine your recovery procedures. Users WILL forget their passwords. That has an impact on how to protect the password. If you want the ability to tell the user their password, then you may want to encrypt the password so the administrator can decrypt it. If instead you want to give them a new password, then you can hash the password. With that technique you won't be able to recover the lost password. If you encrypt the password, you need to have a key management scheme because you need to manage the key that encrypt the passwords - that is equivalent to a master key.
    I've seen systems where the password does more than just authenticate the user. It is also used as a key to encrypt additional information. If that's your case, you need to encrypt the password. There are other considerations for your systems. The ideal way to understand the best solution is via a security assessment.
    Check Crypto-G: www.visecurity.com. It is a very good library with algorithms for encryption, hashing (message digest) and other cryptographic functions.
    Regards;
    Enrique
    www.vartortech.com

  • How To save a music file from an email

    PLEASE HELP ME I CANT FIGURE OUT HOW TO SAVE SONG FROM MY ITUNES LIBRARY THAT U SENT TO MY EMAIL
    Post relates to: Pixi Plus p8wu0 (AT&T)

    Open email attachments
    You can receive any kind of file sent to you in email, but you can open an
    attachment only if your phone has an application that can open the file type.
    To open a single attachment: Tap the attachment name to download the
    attachment. If the attachment is a supported file type (MP3, PDF, DOC,
    XLS, PPT, GIF, or JPG), it opens automatically.
    To open multiple attachments: Tap the list of attachment names to view
    the attachments, and tap an attachment name to open the file.
    Save attachments;
    When you open attachments of certain file types, you can save them to your
    phone so you can view them later in one of your phone’s applications.
    1. Open the attachment (see Open email attachments).
    2. Do one of the following:
    • For pictures in JPG, GIF, BMP or PNG format, tap Copy To Photos.
    • For other file types, open the application menu and tap Save As. If
    the Save As menu item is not available, you cannot save the
    attachment.
    To open a saved attachment on your phone, open the application that can
    display the attachment. The attachment appears in the list of available files.
    Tap the file to open it.
    You can find this info. on page 74 of the user guide.
    For reference purposes, click on the following link for the support page for your device on the kb.palm.com webpage.
    http://kb.palm.com/wps/portal/kb/na/pixi/pixi/att/home/page_en.html
    There are links on the page to the user guide, troubleshooting, how to's, downloads, etc.

Maybe you are looking for

  • XSL transformations work in OC4J but not in Tomcat

    XSL transformations made with XML taglib (xml.tld) are working fine in OC4J (both standalone in JDev as Oracle 10g AS in Solaris) but I cannot get them working in Tomcat. No significant message appears just only oracle/xml/parser/v2/XSLStylesheet. An

  • I'm setting up my new imac and

    Hi I'm setting up my new imac and have migrated files from my old windows pc okay. the problem is that the migration utility created two different users for my music and my pictures. i want to combine all files under one user. any suggestions? (sorry

  • Itunes/ipod updating HELP!

    whenever i plug my ipod into the computer it updates my ipod, however once that update is done if i change a setting and hit sync or apply nothing happens..itunes say it is updating but my ipod doesn't respond and it says that it is updating for a go

  • Alternative G/L for Consumption account

    Dear SAP Guru, My client requires a new G/L account separately to be maintained for monitoring their consumption to the existing materials. Up to my knowledge the VBR in the Transaction code - OMWN, whether the new G/L can be assigned to this account

  • THE CHARACTER (  '  )

    HELLO EVERYONE, i need to replace ,in a name,  the character ( ' )  by a sapce, i try to use the instruction TRANSLATE but what's the word for ( ' ) because it's will not work if i use the character  . thank you.