Converting application to applet.... please Help

This program shown works fine in appletveiwer however will not work with I.E. nor Netscape. I do have the java plugins for both and using a netscape version over 6.0. I made the program usint jdk1.3. Can anyone please help me out?
java code
// TabbedPaneFlags.java: Use tabbed pane to select figures
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class TabbedPaneFlags extends javax.swing.JApplet
// Create a tabbed pane to hold figure panels
private JTabbedPane jtpFigures = new JTabbedPane();
// Load Images
private JLabel lblUSA = new JLabel(new ImageIcon("USA.gif"));
private JLabel lblUK = new JLabel(new ImageIcon("uk.gif"));
private JLabel lblGER = new JLabel(new ImageIcon("germany.gif"));
private JLabel lblCAN = new JLabel(new ImageIcon("canada.gif"));
private JLabel lblCHI = new JLabel(new ImageIcon("china.gif"));
private JLabel lblIND = new JLabel(new ImageIcon("india.gif"));
// Main method
//public static void main(String[] args)
// TabbedPaneFlags frame = new TabbedPaneFlags();
// frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// frame.setSize(450, 350);
// frame.setVisible(true);
// Constructor
// public TabbedPaneFlags()
public void init()
// setTitle("Tabbed Pane Demo");
jtpFigures.add(lblUSA,"USA");
jtpFigures.add(lblUK,"UK");
jtpFigures.add(lblGER,"Germany");
jtpFigures.add(lblCAN,"Canada");
jtpFigures.add(lblCHI,"China");
jtpFigures.add(lblIND,"India");
// Place tabbed pane
this.getContentPane().add(jtpFigures, BorderLayout.CENTER);
html code
<html>
<head>
<title>AppletMenuDemo</title>
</head>
<body>
<applet
code = "TabbedPaneFlags.class"
width = 450
height = 350
alt="You must have a JDK 1.2-enabled browser to view the applet">
</applet>
</body>
</html>

You should try the html converter so that the browsers are forced to invoke their plugin... or prompt the user to download one.
To turn an applet into an application is easy. You act like the browser. You make a frame, construct the applet, and put the applet in the frame, (They are components) ... Then just call the init() method. Then add a window listener to call the stop() method when the frame gets closed.
Application to an applet is a bit harder. You need to figure out what needs to be in the init method. Depending on what the application does you can also run into security issues.

Similar Messages

  • I had my ipod this week, so I do not know which applications to install. please help me

    I had my ipod this week, so I do not know which applications to install please help me    thank you in advance

    You can buy any apps that you want.

  • I can not access the calendar, reports that calendar application unexpectedly ended. please help

    I can not access the calendar, reports that calendar application unexpectedly ended. please help
    Os Mountain Lion

    Which install type did you choose? If you chose Custom, you may not have installed OHS at all...

  • Cannot convert Word to PDF - please help?

    Hi I am running Windows XP, Office 2003 and Acrobat Writer 5.
    I've had the same setup for five years and have always been able to covert Word documents to PDF like this:
    File/print - then I select Acrobat PDF writer from the list of printers, and click "print to file" and it's done.
    I've created thousands of PDFs in this way. I've also reformatted my hard drive and re-installed all the same programs again, and always been able to print to PDF.
    Last week I again reformatted my hard drive, and re-installed all the same programs that I have always had. I have changed nothing, absolutely nothing about the setup of the computer.
    However, NOW when I click file/print from Word, there is no longer Acrobat PDF writer listed!
    And so I cannot convert to PDF.
    Can anyone please tell me how to get Acrobat back into my list of "printers"?
    Thanks

    As I recall, Acrobat Distiller and Acrobat Writer are 2 different print drivers available with AA5. The Writer is not installed by default and is not recommended. It was almost not included with AA5 as I recall. It is no longer included with any distribution. The Acrobat Distiller printer (now renamed as the Adobe PDF printer) is the preferred method of printing with AA5. This latter process creates a PS file and then (using AcroTray running in the background) calls Distiller to complete the conversion from the PS file to the final PDF file. There are several options available under the list of settings. These can be set in the Acrobat Distiller printer properties and generally override the settings in Distiller. You can further make changes for the current printing in the printer properties menu of your current application.
    Hope that helps explain what you have found. I still have AA5 running on XP. I also have a newer reader installed because of the limitations of reading some of the newer PDF files with AA5. I try to be careful with how I use Reader and AA5 as they can cause conflicts in what is used to open a PDF, and that is why this configuration is not recommended.

  • Converting applications to applets

    please,can someone help run this code of mine and convert it to applet for me.couldn't change the file access.thanks in advance.
    //package personalData;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    public class Parent extends JPanel
         //private JLabel ;
         private JSeparator labelseparator,personalseparator;
         private JLabel picLabel;
         private JPanel picP;
         private JButton browseB;
         private Image image;
         private ImageIcon passport;
         private JTextField surnameF,othernameF,rankF,sexF,bloodgroupF,maritalF,
         maidenF,children1F,children2F,dateofbirth1F,placeofbirth1F,stateoforiginF,
         lgaF,nationalityF,homeaddressF,contactF,telF,emailF,nextofkinF,nextofkinaddressF,
         qualificationF,daybox,additionalqualificationF,dateofappointmentF,typeofappointmentF,
         ageofentryF,dateofpresappointmentF,dateofconfirmationF,dateoflastpromotionF,presentcommandF,
         previouscommandF,dateoflastpostingF,postingtypeF,presentdesignationF,basictrainingF,
         venueF,approvedcourseF,institutionF,dateenrolledF,durationF,completiondateF,appointedF,
         salaryF,stepsF,basicsalaryF;
         String fileName,fileS;
         private JFileChooser fc;
         private File file;
         /*public void init()
         {     try{
                   ParentGUI();
              catch(Exception e)     {System.err.println(e);}
         public Parent()
              setLayout(null);
              JLabel logo=new JLabel(new ImageIcon("flower.gif"));
              logo.setBounds(10,10,200,120);
              add(logo);
              JLabel label1=new JLabel("FEDERAL REPUBLIC OF NIGERIA");
              JLabel label2=new JLabel("FEDERAL ROAD SAFETY COMMISSION");
              JLabel label3=new JLabel("NATIONAL HEADQUARTERS,WUSE,ABUJA");
              JLabel label4=new JLabel("COMPUTER DATA FORM");
            label1.setBounds(220,15,300,20);
            label1.setFont(new Font("SanSerif", Font.BOLD, 12));
            label1.setForeground(Color.blue);
            label2.setBounds(210,35,300,20);
            label2.setFont(new Font("SanSerif", Font.BOLD, 12));
            label2.setForeground(Color.blue);
            label3.setBounds(200,55,300,20);
            label3.setFont(new Font("SanSerif", Font.BOLD, 12));
            label3.setForeground(Color.blue);
            label4.setBounds(230,70,300,20);
            label4.setFont(new Font("SanSerif", Font.BOLD, 12));
            label4.setForeground(Color.blue);
              add(label1);
              add(label2);
              add(label3);
              add(label4);
              labelseparator=new JSeparator();
              labelseparator.setBounds(10,140,570,20);
              add(labelseparator);
              fc=new JFileChooser();
              File f1=new File("My Pictures");
              fc.setCurrentDirectory(f1);
              /*passLab=new JLabel("Passport");
              passLab.setBounds(430,10,60,20);
              add(passLab);
              picP=new JPanel();
              picP.setLayout(new BorderLayout());
              picP.setBounds(450,10,140,120);
              picLabel=new JLabel();
              picP.add(picLabel);
              browseB=new JButton("Browse");
              browseB.setOpaque(false);
              browseB.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent e)
                        int returnVal=fc.showOpenDialog(Parent.this);
                        if(returnVal==JFileChooser.APPROVE_OPTION)
                             file=fc.getSelectedFile();
                             fileName=""+file+"";
                             passport=new ImageIcon(fileName);
                             picLabel.setIcon(passport);
                        else{}
              browseB.setBounds(600,100,80,25);
              add(browseB);
              picP.setBorder(new BevelBorder(BevelBorder.LOWERED));
              add(picP);
              JLabel personaldata=new JLabel("PERSONAL DATA:");
              personaldata.setFont(new Font("SanSerif",Font.BOLD,12));
              personaldata.setForeground(Color.darkGray);
              personaldata.setBounds(10,150,200,20);
              add(personaldata);
              personalseparator=new JSeparator();
              personalseparator.setBounds(10,170,100,20);
              add(personalseparator);
              JLabel surname=new JLabel("Surname:");
              surname.setBounds(10,190,100,20);
              add(surname);
              surnameF=new JTextField(20);
              surnameF.setBounds(70,190,150,20);
              add(surnameF);
              JLabel othername=new JLabel("Other Names:");
              othername.setBounds(260,190,150,20);
              add(othername);
              othernameF=new JTextField(20);
              othernameF.setBounds(350,190,300,20);
              add(othernameF);
              JLabel rank=new JLabel("Rank:");
              rank.setBounds(10,210,50,20);
              add(rank);
              rankF=new JTextField(20);
              rankF.setBounds(70,210,150,20);
              add(rankF);
              JLabel sex=new JLabel("Sex:");
              sex.setBounds(310,210,90,20);
              add(sex);
              sexF=new JTextField(10);
              sexF.setBounds(350,210,90,20);
              add(sexF);
              JLabel bloodgroup=new JLabel("Blood Group:");
              bloodgroup.setBounds(450,210,150,20);
              add(bloodgroup);
              bloodgroupF=new JTextField(10);
              bloodgroupF.setBounds(530,210,120,20);
              add(bloodgroupF);
              JLabel marital=new JLabel("Marital Status:");
              marital.setBounds(10,230,150,20);
              add(marital);
              maritalF=new JTextField(20);
              maritalF.setBounds(100,230,100,20);
              add(maritalF);
              JLabel maiden=new JLabel("Maiden Name:");
              maiden.setBounds(260,230,100,20);
              add(maiden);
              maidenF=new JTextField(20);
              maidenF.setBounds(350,230,300,20);
              add(maidenF);
              JLabel m=new JLabel("M");
              m.setBounds(115,250,40,20);
              add(m);
              JLabel f=new JLabel("F");
              f.setBounds(145,250,40,20);
              add(f);
              JLabel children=new JLabel("No. of Children:");
              children.setBounds(10,270,100,20);
              add(children);
              children1F=new JTextField(5);
              children1F.setBounds(100,270,40,20);
              add(children1F);
              children2F=new JTextField(5);
              children2F.setBounds(135,270,40,20);
              add(children2F);
              JLabel dateofbirth=new JLabel("Date of Birth:");
              dateofbirth.setBounds(210,270,150,20);
              add(dateofbirth);
              dateofbirth1F=new JTextField(10);
              dateofbirth1F.setBounds(290,270,80,20);
              add(dateofbirth1F);
              JLabel placeofbirth=new JLabel("Place of Birth:");
              placeofbirth.setBounds(410,270,150,20);
              add(placeofbirth);
              placeofbirth1F=new JTextField(30);
              placeofbirth1F.setBounds(500,270,150,20);
              add(placeofbirth1F);
              JLabel stateoforigin=new JLabel("State of Origin:");
              stateoforigin.setBounds(10,290,100,20);
              add(stateoforigin);
              stateoforiginF=new JTextField(20);
              stateoforiginF.setBounds(100,290,150,20);
              add(stateoforiginF);
              JLabel lga=new JLabel("LGA:");
              lga.setBounds(257,290,150,20);
              add(lga);
              lgaF=new JTextField(10);
              lgaF.setBounds(290,290,100,20);
              add(lgaF);
              JLabel nationality=new JLabel("Nationality:");
              nationality.setBounds(425,290,100,20);
              add(nationality);
              nationalityF=new JTextField(10);
              nationalityF.setBounds(500,290,150,20);
              add(nationalityF);
              JLabel homeaddress=new JLabel("Permanent Home Address:");
              homeaddress.setBounds(10,310,250,20);
              add(homeaddress);
              homeaddressF=new JTextField(200);
              homeaddressF.setBounds(170,310,480,20);
              add(homeaddressF);
              JLabel contact=new JLabel("Contact Address:");
              contact.setBounds(60,330,150,20);
              add(contact);
              contactF=new JTextField(200);
              contactF.setBounds(170,330,480,20);
              add(contactF);
              JLabel tel=new JLabel("Tel. No:");
              tel.setBounds(118,350,100,20);
              add(tel);
              telF=new JTextField(15);
              telF.setBounds(170,350,100,20);
              add(telF);
              JLabel email=new JLabel("E-mail:");
              email.setBounds(290,350,150,20);
              add(email);
              emailF=new JTextField(20);
              emailF.setBounds(330,350,320,20);
              add(emailF);
              JLabel nextofkin=new JLabel("Next of Kin Name:");
              nextofkin.setBounds(60,370,250,20);
              add(nextofkin);
              nextofkinF=new JTextField(200);
              nextofkinF.setBounds(170,370,480,20);
              add(nextofkinF);
              JLabel nextofkinaddress=new JLabel("Next of Kin Address:");
              nextofkinaddress.setBounds(47,390,250,20);
              add(nextofkinaddress);
              nextofkinaddressF=new JTextField(200);
              nextofkinaddressF.setBounds(170,390,480,20);
              add(nextofkinaddressF);
              JLabel qualification=new JLabel("Qualification at Entry:");
              qualification.setBounds(40,410,250,20);
              add(qualification);
              qualificationF=new JTextField(200);
              qualificationF.setBounds(170,410,250,20);
              add(qualificationF);
              JLabel date=new JLabel("Date");
              date.setBounds(430,410,40,20);
              add(date);
              daybox=new JTextField(10);
              daybox.setBounds(460,410,190,20);
              add(daybox);
              JLabel additionalqualification=new JLabel("Additional Qualifications Acquired:");
              additionalqualification.setBounds(10,430,250,20);
              add(additionalqualification);
              additionalqualificationF=new JTextField(100);
              additionalqualificationF.setBounds(214,430,437,20);
              add(additionalqualificationF);
              JLabel info=new JLabel("RECORD OF SERVICE:");
              info.setFont(new Font("SanSerif",Font.BOLD,12));
              info.setForeground(Color.darkGray);
              info.setBounds(10,450,200,20);
              add(info);
              JSeparator infos=new JSeparator();
              infos.setBounds(10,470,120,20);
              add(infos);
              JLabel dateofappointment=new JLabel("Date of First Appointment:");
              dateofappointment.setBounds(10,490,200,20);
              add(dateofappointment);
              dateofappointmentF=new JTextField(10);
              dateofappointmentF.setBounds(170,490,80,20);
              add(dateofappointmentF);
              JLabel typeofappointment=new JLabel("Type of Appointment:");
              typeofappointment.setBounds(260,490,200,20);
              add(typeofappointment);
              typeofappointmentF=new JTextField(50);
              typeofappointmentF.setBounds(400,490,160,20);
              add(typeofappointmentF);
              JLabel ageofentry=new JLabel("Age of Entry:");
              ageofentry.setBounds(600,490,100,20);
              add(ageofentry);
              ageofentryF=new JTextField(10);
              ageofentryF.setBounds(680,490,80,20);
              add(ageofentryF);
              JLabel dateofpresappointment=new JLabel("Date Pres. of Appointment:");
              dateofpresappointment.setBounds(10,510,200,20);
              add(dateofpresappointment);
              dateofpresappointmentF=new JTextField(10);
              dateofpresappointmentF.setBounds(170,510,80,20);
              add(dateofpresappointmentF);
              JLabel dateofconfirmation=new JLabel("Date of Confirmation:");
              dateofconfirmation.setBounds(260,510,200,20);
              add(dateofconfirmation);
              dateofconfirmationF=new JTextField(10);
              dateofconfirmationF.setBounds(400,510,80,20);
              add(dateofconfirmationF);
              JLabel dateoflastpromotion=new JLabel("Date of Last Promotion:");
              dateoflastpromotion.setBounds(530,510,200,20);
              add(dateoflastpromotion);
              dateoflastpromotionF=new JTextField(20);
              dateoflastpromotionF.setBounds(680,510,80,20);
              add(dateoflastpromotionF);
              JLabel presentcommand=new JLabel("Present Command/Dept:");
              presentcommand.setBounds(10,530,200,20);
              add(presentcommand);
              presentcommandF=new JTextField(20);
              presentcommandF.setBounds(170,530,190,20);
              add(presentcommandF);
              JLabel previouscommand=new JLabel("Immediate Previous Command/Dept:");
              previouscommand.setBounds(400,530,250,20);
              add(previouscommand);
              previouscommandF=new JTextField(20);
              previouscommandF.setBounds(610,530,150,20);
              add(previouscommandF);
              JLabel dateoflastposting=new JLabel("Date of Last Posting:");
              dateoflastposting.setBounds(10,550,200,20);
              add(dateoflastposting);
              dateoflastpostingF=new JTextField(20);
              dateoflastpostingF.setBounds(170,550,100,20);
              add(dateoflastpostingF);
              JLabel postingtype=new JLabel("Posting Type:");
              postingtype.setBounds(300,550,100,20);
              add(postingtype);
              postingtypeF=new JTextField(20);
              postingtypeF.setBounds(400,550,100,20);
              add(postingtypeF);
              JLabel presentdesignation=new JLabel("Present Designation:");
              presentdesignation.setBounds(530,550,200,20);
              add(presentdesignation);
              presentdesignationF=new JTextField(20);
              presentdesignationF.setBounds(660,550,100,20);
              add(presentdesignationF);
              JLabel basictraining=new JLabel("Year of FRSC Basic Training:");
              basictraining.setBounds(10,570,570,20);
              add(basictraining);
              basictrainingF=new JTextField(20);
              basictrainingF.setBounds(180,570,120,20);
              add(basictrainingF);
              JLabel venue=new JLabel("Venue:");
              venue.setBounds(450,570,80,20);
              add(venue);
              venueF=new JTextField(20);
              venueF.setBounds(510,570,250,20);
              add(venueF);
              JLabel approvedcourse=new JLabel("Approved Course of Study (if on course):");
              approvedcourse.setBounds(50,590,300,20);
              add(approvedcourse);
              approvedcourseF=new JTextField(20);
              approvedcourseF.setBounds(290,590,350,20);
              add(approvedcourseF);
              JLabel institution=new JLabel("Institution:");
              institution.setBounds(50,610,80,20);
              add(institution);
              institutionF=new JTextField(20);
              institutionF.setBounds(120,610,150,20);
              add(institutionF);
              JLabel dateenrolled=new JLabel("Date Enrolled:");
              dateenrolled.setBounds(320,610,80,20);
              add(dateenrolled);
              dateenrolledF=new JTextField(20);
              dateenrolledF.setBounds(430,610,150,20);
              add(dateenrolledF);
              JLabel duration=new JLabel("duration of Study:");
              duration.setBounds(50,630,100,20);
              add(duration);
              durationF=new JTextField(20);
              durationF.setBounds(160,630,150,20);
              add(durationF);
              JLabel completiondate=new JLabel("Completion Date:");
              completiondate.setBounds(320,630,100,20);
              add(completiondate);
              completiondateF=new JTextField(20);
              completiondateF.setBounds(430,630,150,20);
              add(completiondateF);
              JLabel profession=new JLabel("PROFESSION:");
              profession.setFont(new Font("SanSerif",Font.BOLD,12));
              profession.setForeground(Color.darkGray);
              profession.setBounds(10,650,200,20);
              add(profession);
              JSeparator infos1=new JSeparator();
              infos1.setBounds(10,670,80,20);
              add(infos1);
              JLabel appointed=new JLabel("Appointed As:");
              appointed.setBounds(10,690,100,20);
              add(appointed);
              appointedF=new JTextField(20);
              appointedF.setBounds(120,690,150,20);
              add(appointedF);
              JLabel remuneration=new JLabel("REMUNERATION:");
              remuneration.setFont(new Font("SanSerif",Font.BOLD,12));
              remuneration.setForeground(Color.darkGray);
              remuneration.setBounds(10,710,100,20);
              add(remuneration);
              JSeparator ren=new JSeparator();
              ren.setBounds(10,710,100,20);
              add(ren);
              JLabel salary=new JLabel("Salary Happss:");
              salary.setBounds(10,730,100,20);
              add(salary);
              salaryF=new JTextField(20);
              salaryF.setBounds(110,730,50,20);
              add(salaryF);
              JLabel steps=new JLabel("Steps:");
              steps.setBounds(170,730,50,20);
              add(steps);
              stepsF=new JTextField(20);
              stepsF.setBounds(220,730,50,20);
              add(stepsF);
              JLabel basicsalary=new JLabel("Basic Salary:");
              basicsalary.setBounds(270,730,100,20);
              add(basicsalary);
              basicsalaryF=new JTextField(20);
              basicsalaryF.setBounds(370,730,50,20);
              add(basicsalaryF);
         public static void main(String k[])
              Parent p=new Parent();
         //Container c=f.getContentPane();
              JFrame f=new JFrame();
              Container c=f.getContentPane();
              f.setSize(700,700);
              c.add(p);
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              f.setVisible(true);
              //f.setTitle("")
    }

    i did it my self and it didn't display components and
    gave me a complain of java.io i used.please, someone
    help me.thanks in advance.That didnt make any sense. If youre getting an error, post the complete error message, along with the relevant code.

  • Errors running converted application (from applet)

    I've converted some codes (applet) into an application. When I run the application, I can see the GUI, but the application reports error as follows:
    Exception occurred during event dispatching:
    java.lang.NullPointerException
         at swarmCanvas.paint(Swarm.java:192)
         at sun.awt.RepaintArea.paint(RepaintArea.java:298)
         at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:196)
         at java.awt.Component.dispatchEventImpl(Component.java:2663)
         at java.awt.Component.dispatchEvent(Component.java:2497)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
    What I see is only the GUI less the animation that occurs when it was an applet. Could anyone offer me any suggestions or help? Thanks a lot.

    Here's my codes, many thanks:
    * Swarm.class
    * This is the major class of the swarm animation. The Swarm class is
    * responsible for initialising and coordinating the Flock, swarmCanvas,
    * and swarmPanel classes.
    * @see Flock.class
    * @see Bird.class
    * @see Barrier.class
    * @author Duncan Crombie
    * @version 2.02, 20 September 1997
    import java.awt.*;
    public class Swarm extends java.applet.Applet implements Runnable {
    Thread animator; // animation thread
    swarmCanvas arena; // display canvas
    swarmPanel controls; // control panel
    static int NUMBLUE = 15, NUMRED = 5, MAXPOP = 20;
    static double SPEED = 5.0;
    static int TURN = 15, MINDIST = 30, MAXDIST = 60;
    boolean paused = false;
    public void init() { // initialise applet components
    arena = new swarmCanvas();
    controls = new swarmPanel(NUMBLUE, NUMRED, MAXPOP);
    setLayout(new BorderLayout());
    add("Center", arena); // add canvas to applet at 'Center'
    add("South", controls); // add panel to applet at 'South'
    arena.requestFocus();
    public void start() { // start thread when applet starts
    if (animator == null) {
    animator = new Thread(this);
    animator.start();
    public void stop() { // stop thread when applet stops
    if (animator != null) {
    animator.stop();
    animator = null;
    public void run() {
    boolean flocking = false;
    while (true) {
    if (!flocking && arena.unpacked) { // once canvas component is unpacked
    Bird.setBoundaries(arena.w, arena.h); // set swarm boundaries
    arena.flock = new Flock(NUMBLUE, NUMRED, SPEED, TURN, MINDIST, MAXDIST);
    flocking = true;
    } else if (flocking) {
    Bird.setBoundaries(arena.w, arena.h);
    if (!paused)
    arena.flock.move(); // animate the flock
    arena.repaint(); // update display
    try {
    Thread.sleep(20); // interval between steps
    } catch (InterruptedException e) {}
    public boolean handleEvent(Event ev) { // check for control panel actions
    if (ev.id == Event.ACTION_EVENT && ev.target == controls.reset) {
    resetApplet(); // reset button pressed in controls
    return true;
    if (ev.id == Event.ACTION_EVENT && ev.target == controls.pause) {
    paused = !paused; // toggle paused status
    controls.pause.setLabel((paused) ? "Continue" : "Pause");
    return true;
    if (ev.target == controls.sbRed) {
    if (ev.id == Event.SCROLL_LINE_UP)
    arena.flock.removeBird(Color.red); // remove a red Bird from flock
    else if (ev.id == Event.SCROLL_LINE_DOWN)
    arena.flock.addBird(new Bird(Color.red)); // add a red Bird
    return true;
    if (ev.target == controls.sbBlue) {
    if (ev.id == Event.SCROLL_LINE_UP)
    arena.flock.removeBird(Color.blue); // remove a blue Bird from flock
    else if (ev.id == Event.SCROLL_LINE_DOWN)
    arena.flock.addBird(new Bird(Color.blue)); // add a blue Bird
    return true;
    return super.handleEvent(ev); // pass on unprocessed events
    public boolean keyDown(Event e, int x) { // check for key press
    boolean shiftKeyDown = ((e.modifiers & Event.SHIFT_MASK) != 0);
    if (shiftKeyDown) {
    if (x == Event.DOWN) Flock.minDISTANCE -= 5; // less separation
    if (x == Event.UP) Flock.minDISTANCE += 5; // more separation
    if (x == Event.LEFT) Flock.maxDISTANCE -= 5; // lower detection
    if (x == Event.RIGHT) Flock.maxDISTANCE += 5; // higher detection
    Barrier.minRANGE = Flock.minDISTANCE;
    Barrier.maxRANGE = Flock.maxDISTANCE;
    } else {
    if (x == Event.DOWN) Bird.maxSPEED -= 1.0; // slower
    if (x == Event.UP) Bird.maxSPEED += 1.0; // faster
    if (x == Event.LEFT) Bird.maxTURN -= 5; // less turning
    if (x == Event.RIGHT) Bird.maxTURN += 5; // more turning
    return true; // all key events handled
    public void resetApplet() {
    arena.flock = new Flock(NUMBLUE, NUMRED, SPEED, TURN, MINDIST, MAXDIST);
    controls.sbBlue.setValue(NUMBLUE); // initialise scrollbars
    controls.sbRed.setValue(NUMRED);
    * swarmPanel.class
    * A Panel holding two scrollbars and two buttons for controlling the
    * Swarm applet.
    * @see Swarm.class
    * @author Duncan Crombie
    * @version 2.01, 20 September 1997
    class swarmPanel extends Panel { // class defines applet control panel
    Button reset, pause;
    Scrollbar sbBlue = new Scrollbar(Scrollbar.HORIZONTAL);
    Scrollbar sbRed = new Scrollbar(Scrollbar.HORIZONTAL);
    Label label1, label2;
    * The construction method creates and adds control panel components
    swarmPanel(int numRed, int numBlue, int maxBoid) {
    setLayout(new GridLayout(2, 3)); // define 2 x 3 grid layout for controls
    label1 = new Label("Blue #");
    label1.setFont(new Font("Dialog", Font.PLAIN, 12)); add(label1);
    label2 = new Label("Red #");
    label2.setFont(new Font("Dialog", Font.PLAIN, 12)); add(label2);
    reset = new Button("Reset"); add(reset);
    sbBlue.setValues(numRed, 1, 0, maxBoid);
    add(sbBlue);
    sbRed.setValues(numBlue, 1, 0, maxBoid);
    add(sbRed);
    pause = new Button("Pause");
    add(pause);
    * swarmCanvas.class
    * A Canvas for displaying the Flock and Swarm parameters.
    * @see Swarm.class
    * @author Duncan Crombie
    * @version 2.01, 20 September 1997
    class swarmCanvas extends Canvas {
    Flock flock;
    Image offScrImg;
    boolean unpacked = false;
    int w, h;
    /* Double buffered graphics */
    public void update(Graphics g) {
    if (offScrImg == null || offScrImg.getWidth(this) != w || offScrImg.getHeight(this) != h)
    offScrImg = createImage(w, h);
    Graphics og = offScrImg.getGraphics();
    paint(og);
    g.drawImage(offScrImg, 0, 0, this);
    og.dispose();
    public void paint(Graphics g) {
    Dimension d = this.preferredSize();
    if (!unpacked) {
    this.w = d.width;
    this.h = d.height;
    unpacked = true;
    g.setColor(Color.white);
    g.fillRect(0, 0, w, h); // draw white background
    g.setColor(Color.black); // set font and write applet parameters
    g.setFont(new Font("Dialog", Font.PLAIN, 10));
    g.drawString("Bird Speed: " + Bird.maxSPEED, 10, 15);
    g.drawString("Bird Turning: " + Bird.maxTURN, 10, 30);
    g.drawString("Minimum Distance: " + Flock.minDISTANCE, 10, 45);
    g.drawString("Maximum Distance: " + Flock.maxDISTANCE, 10, 60);
    flock.display(g); // draw Flock members
    if (this.w != d.width || this.h != d.height)
    unpacked = false;
    public boolean mouseDown(Event ev, int x, int y) {
    int radius = Barrier.maxRANGE;
    boolean top, bottom;
    flock.addBird(new Barrier(x, y)); // place Barrier at click coordinates
    top = (y < radius);
    bottom = (y > h-radius);
    if (x < radius) { // if left
    flock.addBird(new Barrier(w + x, y));
    if (top) flock.addBird(new Barrier(w + x, h + y));
    else if (bottom) flock.addBird(new Barrier(w + x, y - h));
    } else if (x > w-radius) { // if right
    flock.addBird(new Barrier(x - w, y));
    if (top) flock.addBird(new Barrier(x - w, h + y));
    else if (bottom) flock.addBird(new Barrier(x - w, y - h));
    if (top) flock.addBird(new Barrier(x, h + y));
    else if (bottom) flock.addBird(new Barrier(x, y - h));
    return true;
    ===================================================================
    * Bird.class
    * This class defines the appearance and behaviour of a Bird object.
    * @see Swarm.class
    * @see Flock.class
    * @see Barrier.class
    * @author Duncan Crombie
    * @version 2.02, 21 September 1997
    import java.awt.*;
    class Bird {
    int iX, iY, iTheta;
    Color cFeathers;
    static int arenaWIDTH, arenaHEIGHT; // canvas dimensions
    static double maxSPEED; // speed of Bird
    static int maxTURN; // maximum turn in degrees
    Bird(int x, int y, int theta, Color feath) {
    iX = x;
    iY = y;
    iTheta = theta;
    cFeathers = feath;
    Bird(Color feath) {
    this((int)(Math.random() * arenaWIDTH),
    (int)(Math.random() * arenaHEIGHT),
    (int)(Math.random() * 360),
    feath);
    public void move(int iHeading) {
    int iChange = 0;
    int left = (iHeading - iTheta + 360) % 360;
    int right = (iTheta - iHeading + 360) % 360;
    if (left < right)
    iChange = Math.min(maxTURN, left);
    else
    iChange = -Math.min(maxTURN, right);
    iTheta = (iTheta + iChange + 360) % 360;
    iX += (int)(maxSPEED * Math.cos(iTheta * Math.PI/180)) + arenaWIDTH;
    iX %= arenaWIDTH;
    iY -= (int)(maxSPEED * Math.sin(iTheta * Math.PI/180)) - arenaHEIGHT;
    iY %= arenaHEIGHT;
    public void display(Graphics g) { // draw Bird as a filled arc
    g.setColor(this.cFeathers);
    g.fillArc(iX - 12, iY - 12, 24, 24, iTheta + 180 - 15, 30);
    public int getDistance(Bird bOther) {
    int dX = bOther.getPosition().x-iX;
    int dY = bOther.getPosition().y-iY;
    return (int)Math.sqrt(Math.pow(dX, 2) + Math.pow(dY, 2));
    static void setBoundaries(int w, int h) {
    arenaWIDTH = w;
    arenaHEIGHT = h;
    public int getTheta() {
    return iTheta;
    public Point getPosition() {
    return new Point(iX, iY);
    public Color getFeathers() {
    return cFeathers;
    =================================================================
    * Flock.class
    * This class creates and coordinates the movement of a flock of Birds.
    * @see Swarm.class
    * @see Bird.class
    * @see Barrier.class
    * @author Duncan Crombie
    * @version 2.02, 21 September 1997
    import java.util.Vector;
    import java.awt.*;
    class Flock { // implement swarming algorithm on flock of birds
    private Vector vBirds;
    static int minDISTANCE, maxDISTANCE;
    Flock(int nBlue, int nRed, double speed, int turn, int minDist, int maxDist) {
    vBirds = new Vector(5, 5);
    for (int i=0; i < nBlue + nRed; i++)
    addBird(new Bird((i < nBlue) ? Color.blue : Color.red));
    Bird.maxSPEED = speed;
    Bird.maxTURN = turn;
    Barrier.minRANGE = minDISTANCE = minDist;
    Barrier.maxRANGE = maxDISTANCE = maxDist;
    public void addBird(Bird bird) { // add Bird to vector
    vBirds.addElement(bird);
    synchronized void removeBird(Color col) { // remove Bird from vector
    for (int i=0; i < vBirds.size(); i++) { // loop through vector of Birds
    Bird bTemp = (Bird)vBirds.elementAt(i);
    if (bTemp.getFeathers() == col) { // search for Bird of given colour
    vBirds.removeElementAt(i); // if found, remove Bird..
    break; // ..and stop searching
    * The move function simply tells each Bird in the Vector vBirds to move
    * according to the resultant Point of generalHeading.
    synchronized public void move() {
    for (int i=0; i < vBirds.size(); i++) {
    Bird bTemp = (Bird)vBirds.elementAt(i);
    bTemp.move(generalHeading(bTemp));
    * The display function simply draws each Bird in the Vector vBirds at its
    * current position.
    public void display(Graphics g) { // display each Bird in flock
    for (int i=0; i < vBirds.size(); i++) {
    Bird bTemp = (Bird)vBirds.elementAt(i);
    bTemp.display(g);
    public Point sumPoints(Point p1, double w1, Point p2, double w2) {
    return new Point((int)(w1*p1.x + w2*p2.x), (int)(w1*p1.y + w2*p2.y));
    public double sizeOfPoint(Point p) {
    return Math.sqrt(Math.pow(p.x, 2) + Math.pow(p.y, 2));
    public Point normalisePoint(Point p, double n) {
    if (sizeOfPoint(p) == 0.0) return p;
    else {
    double weight = n / sizeOfPoint(p);
    return new Point((int)(p.x * weight), (int)(p.y * weight));
    * The generalHeading function determines the point a Bird will turn towards
    * in the next timestep. The Bird b checks for all Birds (other than self)
    * that fall within the detection range. If the Bird is of a different colour
    * or closer than the separation distance then they are repulsed else the
    * Birds are attracted according to the flocking algorithm.
    private int generalHeading(Bird b) {
    if (b instanceof Barrier) return 0;
    Point pTarget = new Point(0, 0);
    int numBirds = 0; // total of Birds to average
    for (int i=0; i < vBirds.size(); i++) { // for each Bird in array
    Bird bTemp = (Bird)vBirds.elementAt(i); // retrieve element i
    int distance = b.getDistance(bTemp); // get distance to Bird
    if (!b.equals(bTemp) && distance > 0 && distance <= maxDISTANCE) {
    * If the neighbour is a sibling the algorithm tells the boid to align its
    * direction with the other Bird. If the distance between them differs from
    * minDISTANCE then a weighted forces is applied to move it towards that
    * distance. This force is stronger when the boids are very close or towards
    * the limit of detection.
    if (b.getFeathers().equals(bTemp.getFeathers())) { // if same colour
    Point pAlign = new Point((int)(100 * Math.cos(bTemp.getTheta() * Math.PI/180)), (int)(-100 * Math.sin(bTemp.getTheta() * Math.PI/180)));
    pAlign = normalisePoint(pAlign, 100); // alignment weight is 100
    boolean tooClose = (distance < minDISTANCE);
    double weight = 200.0;
    if (tooClose) weight *= Math.pow(1 - (double)distance/minDISTANCE, 2);
    else weight *= - Math.pow((double)(distance-minDISTANCE) / (maxDISTANCE-minDISTANCE), 2);
    Point pAttract = sumPoints(bTemp.getPosition(), -1.0, b.getPosition(), 1.0);
    pAttract = normalisePoint(pAttract, weight); // weight is variable
    Point pDist = sumPoints(pAlign, 1.0, pAttract, 1.0);
    pDist = normalisePoint(pDist, 100); // final weight is 100
    pTarget = sumPoints(pTarget, 1.0, pDist, 1.0);
    * In repulsion the target point moves away from the other Bird with a force
    * that is weighted according to a distance squared rule.
    else { // repulsion
    Point pDist = sumPoints(b.getPosition(), 1.0, bTemp.getPosition(), -1.0);
    pDist = normalisePoint(pDist, 1000);
    double weight = Math.pow((1 - (double)distance/maxDISTANCE), 2);
    pTarget = sumPoints(pTarget, 1.0, pDist, weight); // weight is variable
    numBirds++;
    if (numBirds == 0) return b.getTheta();
    else // average target points and add to position
    pTarget = sumPoints(b.getPosition(), 1.0, pTarget, 1/(double)numBirds);
    int targetTheta = (int)(180/Math.PI * Math.atan2(b.getPosition().y - pTarget.y, pTarget.x - b.getPosition().x));
    return (targetTheta + 360) % 360; // angle for Bird to steer towards
    ======================================================================
    * Barrier.class
    * This class creates and coordinates the movement of a flock of Birds.
    * @see Swarm.class
    * @see Flock.class
    * @see Bird.class
    * @author Duncan Crombie
    * @version 2.01, 21 September 1997
    import java.awt.*;
    class Barrier extends Bird {
    static int minRANGE, maxRANGE;
    Barrier(int x, int y) {
    super(x, y, 0, Color.black); // position Barrier and define color as black
    public void move(int dummy) {
    // do nothing
    public void display(Graphics g) { // paint Barrier
    g.setColor(Color.black);
    g.fillOval(this.iX-5, this.iY-5, 10, 10);
    g.setColor(Color.gray); // paint separation circle
    g.drawOval(this.iX-minRANGE, this.iY-minRANGE, 2*minRANGE, 2*minRANGE);
    g.setColor(Color.lightGray); // paint detection circle
    g.drawOval(this.iX-maxRANGE, this.iY-maxRANGE, 2*maxRANGE, 2*maxRANGE);
    =====================================================================
    import java.awt.*;
    import java.awt.event.*;
    public class SwarmFrame extends Frame implements ActionListener {
    public SwarmFrame() {
    super("Flocking Bird");
    MenuBar mb = new MenuBar();
    setMenuBar(mb);
    Menu fileMenu = new Menu("File");
    mb.add(fileMenu);
    MenuItem exitMenuItem = new MenuItem("Exit");
    fileMenu.add(exitMenuItem);
    exitMenuItem.addActionListener(this);
    Swarm swarmApplet = new Swarm();
    add(swarmApplet, BorderLayout.CENTER);
    swarmApplet.init();
    public void actionPerformed(ActionEvent evt) {
    if(evt.getSource() instanceof MenuItem) {
    String menuLabel = ((MenuItem) evt.getSource()).getLabel();
    if(menuLabel.equals("Exit")) {
    dispose();
    System.exit(0);
    =====================================================================
    import java.awt.*;
    public class SwarmApplication {
    public static void main(String[] args) {
    Frame frame = new SwarmFrame();
    frame.setBounds(10, 10, 600, 400);
    frame.setVisible(true);

  • Unable to deploy example 'banking' application on weblogic, please help...

    Hi,
    I have downloaded the example 'banking.zip' and have installed it.
    I have followed all given steps in the tutorial, but I am unable to
    see the login page.
    I am also not able to see the ejb and web application descriptor file
    from the admin console.
    I have copied the banking directory to
    '$WEBLOGIC\config\mydomain\applications'.
    There are 3 directories under it
    (1) ejb (containing meta-inf and examples directory. Meta-info
    contains the descriptor .xml files)
    (2) web (containing web-inf and html,jsp and image files. Web-inf
    contains weblogic.xml and web.xml)
    (3) Meta-Inf (containing the application.xml)
    I get the 'Error 404--Not Found' error when I go to
    http://localhost:8001/banking/login.html. (my server is running on
    8001 port, i hope this doesn't matter)
    When I try to edit the web application descriptor I get the following
    error
    java.lang.NullPointerException
         at weblogic.management.console.utils.MBeans.getMBeanClassFor(MBeans.java:860)
         at weblogic.management.console.actions.internal.ActionUtils.getAreaFor(ActionUtils.java:142)
         at weblogic.management.console.actions.mbean.MBeanDescriptorFramesetAction.perform(MBeanDescriptorFramesetAction.java:133)
         at weblogic.management.console.actions.internal.ActionServlet.doAction(ActionServlet.java:167)
         at weblogic.management.console.actions.internal.ActionServlet.doGet(ActionServlet.java:91)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2456)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2039)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    Could someone please help me ? I am trying to deploy this in the
    exploded form. My server is running in the development mode.
    - Thanks in advance,
    Sonali

    Hi,
    I was able to successfully deploy after installing
    weblogic 6.1 SP2 (earlier I had SP1). Also, I had to make
    changes in the BankAppServlet code since it tries to find the
    bean with a different name than one specified in jndi-name.
    - Thanks,
    Sonali
    [email protected] (Sonali Kale) wrote in message news:<[email protected]>...
    Hi,
    I have downloaded the example 'banking.zip' and have installed it.
    I have followed all given steps in the tutorial, but I am unable to
    see the login page.
    I am also not able to see the ejb and web application descriptor file
    from the admin console.
    I have copied the banking directory to
    '$WEBLOGIC\config\mydomain\applications'.
    There are 3 directories under it
    (1) ejb (containing meta-inf and examples directory. Meta-info
    contains the descriptor .xml files)
    (2) web (containing web-inf and html,jsp and image files. Web-inf
    contains weblogic.xml and web.xml)
    (3) Meta-Inf (containing the application.xml)
    I get the 'Error 404--Not Found' error when I go to
    http://localhost:8001/banking/login.html. (my server is running on
    8001 port, i hope this doesn't matter)
    When I try to edit the web application descriptor I get the following
    error
    java.lang.NullPointerException
         at weblogic.management.console.utils.MBeans.getMBeanClassFor(MBeans.java:860)
         at weblogic.management.console.actions.internal.ActionUtils.getAreaFor(ActionUtils.java:142)
         at weblogic.management.console.actions.mbean.MBeanDescriptorFramesetAction.perform(MBeanDescriptorFramesetAction.java:133)
         at weblogic.management.console.actions.internal.ActionServlet.doAction(ActionServlet.java:167)
         at weblogic.management.console.actions.internal.ActionServlet.doGet(ActionServlet.java:91)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2456)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2039)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    Could someone please help me ? I am trying to deploy this in the
    exploded form. My server is running in the development mode.
    - Thanks in advance,
    Sonali

  • Ipod says that files are being used by another application...please help!

    My ipod lost all of my music but tells me that there is apparently still the same amount of memory used, i just can't access my music. To fix this, i'm trying to restore my ipod and just resync the music. However, every time i click restore i get the message "Itunes can not restore Ipod because it contains files in use by another application" even though there are no other applications running. I've ever tried restarting the computer to be sure that no applications are running. Please help!

    I had the same issue with my new iPod 4gb nano. To be perfectly honest, I fixed it and I'm not exactly sure what part of the process actually did the job, so I'm going to attempt to explain it as best I can.
    Basically I bought the nano to replace my 160gb classic aka paperweight. I'm currently deployed and the thought of traveling back to the US without a portable music player made me shudder. Within 4 days new nano click wheel decided to do the whole dying thing where I could click the buttons but not scroll through my music/change volume. I took the defunct iPod back to the BX and they exchanged it. I got home and discovered the "new" one they gave me was actually one that had been returned..because it popped up as "josh's ipod" when I plugged it in. So I'm on my third device and you can imagine when my computer informed me said device was corrupt and couldn't be read by my computer..I was pretty peeved. It took 7 or 8 tries to get the new nano update to install on my slow connection and when it finally did..I got the message that the files were in use by another application and couldn't be restored. I restarted the computer, made sure all other applications were shut down, checked my virus software. No dice. I ejected the ipod from my computer, plugged it back in and went into itunes preferences and clicked on "reset sync history". I think at this point it then treated the iPod as if it had never been plugged into my computer before. I then attempted the restore again, it did its thing and I now have a nice, new functioning iPod.

  • Problem to debug applet, please help...

    i use windows.
    there are 3 files under "c:\current" directory, they are
    file 1. mem_appletviewer.bat - with content:
    "e:\install\java\jdk1.3.1_05\bin\appletviewer" -J-Xdebug -J-Xrunjdwp:transport=dt_shmem,address=conn001122,server=y,suspend=y test.htm
    file 2. mem_jdb.bat - with content:
    "e:\install\java\jdk1.3.1_05\bin\jdb" -attach conn001122
    file 3. test.htm - with applet tag:
    <applet
    code="Let0.class"
    codebase="G:\Victor\Vc5060\Develop\JCity\files\RecentFile"
    width=400 height=250 ></applet>
    (Let0.class is a simplest class extends Applet)
    please note, codebase is not "c:\current" directory
    problems happend when i debug: (run mem_appletviewer.bat first then mem_jdb.bat)
    a) if move Let0.class to "c:\current" directory, debug is fine but test.htm can not load Let0.class itself because of codebase tag.
    b) if move Let0.class to codebase directory (G:\Victor\Vc5060\Develop\JCity\files\RecentFile), test.htm can load the class but appletviewer can not load the class (can not find Let0.class).
    ===========================================================
    in my application, i need to put Let0.class in codebase directory.
    Question:
    1) how to set -classpath for appletviewer (as debug application class in java.exe )? is it possible?
    2) codebase TAG in test.htm doesn't work for appletviewer, what is problem? how to fix it?
    totally:
    how to debug Let0.class if it is in codebase directory (not in "c:\current")?
    thx

    i fix it.

  • "Application Not Responding" please help!

    Okay this problem has been occurring for about a month and I cannot handle life without iTunes:
    Originally, my iTunes randomly stopped working and I would try to open the application, but it showed me a blank library with the spinning wheel.
    I then tried to solve the problem by deleting unnecessary programs, restarting my computer, and uninstalling and reinstalling iTunes because the dock said that the application was not responding, so I would have to force quit.
    Now, I get as far as the "iTunes Setup Assistant" by the time the color wheel starts spinning and the application stalls again.
    I tried creating a new account and opening iTunes and that seemed to work fine, except a third of my library wasn't appearing and it's frustrating to have to keep logging in and out of accounts.
    Also, whenever I plug my iPod into the computer and load Senuti, I can listen to songs off of that, but I can't add or modify songs on my iPod.
    Please help me solve this problem!
    iMac G5   Mac OS X (10.4.8)  

    You have a UAD-1e and you're getting a kernel panic from a conflict with the UA driver.
    You should send this to Universal Audio tech support. This used to be an issue with sleep, but I believe they fixed that fairly recently, so I'm not sure why it's happening to you.
    In the interim, also make sure for the moment that sleep mode on your computer is OFF, and that you are using the latest UA software.

  • Help with Illustrator Script! Batch convert files including subfolders - please help! :)

    Hello,
    I honestly have tried reading the other answers and researching to try to solve this problem.  I'm sorry for my ignorance in this area.  Please help!!!
    I'm trying to make a script (for Illustrator CS2) that will batch convert several files to PNG files.  The source folder has several subfolders and I need the script to go into the subfolders and convert those files as well.  The destination directory should be an entirely separate folder but with the same hierarchy as the original source folder.
    The script I have been using (that converts just as I need) is below.  The only problem is it doesn't do the subfolders.
    Any help would be so amazingly appreciated!
    ADOBE SYSTEMS INCORPORATED
    Copyright 2005 Adobe Systems Incorporated
    All Rights Reserved
    NOTICE:  Adobe permits you to use, modify, and
    distribute this file in accordance with the terms
    of the Adobe license agreement accompanying it. 
    If you have received this file from a source
    other than Adobe, then your use, modification,
    or distribution of it requires the prior
    written permission of Adobe.
    ExportDocsAsPNG24.jsx
    DESCRIPTION
    This sample gets files specified by the user from the
    selected folder and batch processes them and saves them
    as PNGs in the user desired destination with the same
    file name.
    // Main Code [Execution of script begins here]
    // uncomment to suppress Illustrator warning dialogs
    // app.userInteractionLevel =
    UserInteractionLevel.DONTDISPLAYALERTS;
    var destFolder, sourceFolder, files, fileType,
    sourceDoc, targetFile, pngExportOpts;
    // Select the source folder.
    sourceFolder = Folder.selectDialog( 'Select the folder
    with Illustrator files you want to convert to PNG', '~'
    // If a valid folder is selected
    if ( sourceFolder != null )
        files = new Array();
        fileType = prompt( 'Select type of Illustrator files
    to you want to process. Eg: *.ai', ' ' );
        // Get all files matching the pattern
        files = sourceFolder.getFiles( fileType );
        if ( files.length > 0 )
            // Get the destination to save the files
            destFolder = Folder.selectDialog( 'Select the
    folder where you want to save the converted PNG files.',
    '~' );
            for ( i = 0; i < files.length; i++ )
                sourceDoc = app.open(files[i]); // returns
    the document object
                // Call function getNewName to get the name
    and file to save the pdf
                targetFile = getNewName();
                // Call function getPNGOptions get the
    PNGExportOptions for the files
                pngExportOpts = getPNGOptions();
                // Export as PNG
                sourceDoc.exportFile( targetFile,
    ExportType.PNG24, pngExportOpts );
                sourceDoc.close
    (SaveOptions.DONOTSAVECHANGES);
            alert( 'Files are saved as PNG in ' + destFolder
        else
            alert( 'No matching files found' );
    getNewName: Function to get the new file name. The
    primary
    name is the same as the source file.
    function getNewName()
        var ext, docName, newName, saveInFile, docName;
        docName = sourceDoc.name;
        ext = '.png'; // new extension for png file
        newName = "";
        for ( var i = 0 ; docName[i] != "." ; i++ )
            newName += docName[i];
        newName += ext; // full png name of the file
        // Create a file object to save the png
        saveInFile = new File( destFolder + '/' + newName );
        return saveInFile;
    getPNGOptions: Function to set the PNG saving options of
    the
    files using the PDFSaveOptions object.
    function getPNGOptions()
        // Create the PDFSaveOptions object to set the PDF
    options
        var pngExportOpts = new ExportOptionsPNG24();
        // Setting PNGExportOptions properties. Please see
    the JavaScript Reference
        // for a description of these properties.
        // Add more properties here if you like
        pngExportOpts.antiAliasing = true;
        pngExportOpts.artBoardClipping = true;
        pngExportOpts.horizontalScale = 300.0;
        //pngExportOpts.matte = true;
        //pngExportOpts.matteColor = 0, 0, 0;
        pngExportOpts.saveAsHTML = false;
        pngExportOpts.transparency = true;
        pngExportOpts.verticalScale = 300.0;
        return pngExportOpts;

    You can turn off some of the dialogs with: app.displayDialogs = DialogModes.NO;
    #target photoshop
    if (app.documents.length > 0) {
    //Turn display dialogs off
    app.displayDialogs = DialogModes.NO;
    //=============Find Current Documents path================//
    var CurrentPath = activeDocument.path;
    //=============Establish current documents destination===============//
    var folder1 = Folder(CurrentPath + '/' + 'Flats');
    //=============Check if it exist, if not create it.============//
    if(!folder1.exists) folder1.create();
    //=============Establish current documents file name=========//
    //Current filename without the extension
    var CurrentFileName = app.activeDocument.name.replace(/\.[^\.]+$/, '');
    //=============Modify current file name================//
    var modifiedFileName = CurrentFileName +"Flat.psd";
    //=============Establish save path====================//
    var saveFileCurrentPath = new File(folder1 + '/' + modifiedFileName);
    //=============Flatten document ====================//
    activeDocument.flatten();
    //=============Rotate  document if in 'Landscape'====================//
    var myDocument = app.activeDocument;
    if (myDocument.width > myDocument.height) myDocument.rotateCanvas(90);
    //============Save File=======================//
    psdSaveOptions = new PhotoshopSaveOptions();
    activeDocument.saveAs(saveFileCurrentPath, psdSaveOptions, true, Extension.LOWERCASE);
    //Close Document
    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

  • My iphoto icon has disappeared from my dock and applications folder. Please HELP

    I tried clicking on the iphoto icon in the dock and nothing happened. I went looking for it in the applications folder and it wasn't there. I then moved the icon from the dock on to the desktop and it poof'd into thin air! GONE. What can I do? Please help! VERY upset.

    reinstall iPhoto from the restore disks that came with your computer -
    reinstall iPhoto - go to your receipts folder ("Your hard drive" ==> library ==> receipts) and remove any iPhoto receipts and reinstall from the restore disks that came with your computer - do a custom install of bundled software only
    For more information  <a href="http://www.macworld.com/article/132243/2008/02/pacifist.html"> click here for the MacWorld article on reinstalling OS X applications.</a>
    LN

  • How to convert flv into mp3 -- please help!

    hi,
    i'm very new to using videos in flash. i uploaded a video into flash in order to add texts to it to upload later to web. my problem is converting the fla file to mp3. i tried the video encoder but i'm stuck. please help if you can..it'll be very much appreciated. thanks!

    i think i see where the problem lies. the file i worked on in flash (i inserted some texts into the video) are saving as .fla. how do i get it to change to flv in order to use the service you suggested? thanks a bunch!

  • Hey i have pruchased my iphone 4s from singapore and right i m in india. i can't download any application. can you please help me to know to download application.

    hi sir
    please help me to download my application that is charable and free so that i can enjoy my iphone 4s 16GB.
    thanking you

    You need an iPhone forum not an iPhoto one.

  • Swing applet- please help

    Hi,
    I am still trying to make sense of the java code...
    I thought it should be easy to create an applet, but I don't know what is wrong.
    Could anyone help me debugging it?
    Here is the code and the error msg:
    package BrImage;
    /* Example 16-3 An Image Previewer Accessory implements BrImagFile*/
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.beans.*;
    import java.io.*;
    import java.applet.Applet;
    public class BrImage extends JApplet {
    public void init() {
    getContentPane().add(new JLabel("JAppletSwing!"));
    public class BrImagFile extends javax.swing.JFrame {
    JFileChooser chooser = new JFileChooser();
    ImagePreviewer previewer = new ImagePreviewer();
    PreviewPanel previewPanel = new PreviewPanel();
    class PreviewPanel extends javax.swing.JPanel {
    public PreviewPanel() {
    JLabel label = new JLabel("Image Previewer",SwingConstants.CENTER);
    setPreferredSize(new Dimension(150,0));
    setBorder(BorderFactory.createEtchedBorder());
    setLayout(new BorderLayout());
    label.setBorder(BorderFactory.createEtchedBorder());
    add(label, BorderLayout.NORTH);
    add(previewer, BorderLayout.CENTER);
    public BrImagFile() {
    super("Image Previewer");
    Container contentPane = getContentPane();
    JButton button = new JButton("Select A File");
    contentPane.setLayout(new FlowLayout());
    contentPane.add(button);
    chooser.setAccessory(previewPanel);
    button.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    int state = chooser.showOpenDialog(null);
    File file = chooser.getSelectedFile();
    String s = "CANCELED";
    if(file != null && state == JFileChooser.APPROVE_OPTION) {
    s = "File Selected: " + file.getPath();
    /* needs to open file on the right html */
    JOptionPane.showMessageDialog(null, s);
    chooser.setFileFilter(new ImageFilter()); /*test filter */
    chooser.addPropertyChangeListener(
    new PropertyChangeListener() {
    public void propertyChange(PropertyChangeEvent e) {
    if(e.getPropertyName().equals(
    JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) {
    File f = (File)e.getNewValue();
    String s = f.getPath(), suffix = null;
    int i = s.lastIndexOf('.');
    if(i > 0 && i < s.length() - 1)
    suffix = s.substring(i+1).toLowerCase();
    if(suffix.equals("gif") ||
    suffix.equals("jpg") ||
    suffix.equals("bmp"))
    previewer.configure(f);
    class ImagePreviewer extends javax.swing.JLabel {
    public void configure(File f) {
    Dimension size = getSize();
    Insets insets = getInsets();
    ImageIcon icon = new ImageIcon(f.getPath());
    setIcon(new ImageIcon(icon.getImage().getScaledInstance(
    size.width - insets.left - insets.right,
    size.height - insets.top - insets.bottom,
    Image.SCALE_SMOOTH)));
    class ImageFilter extends javax.swing.filechooser.FileFilter {
    public boolean accept(File f) {
    boolean accept = f.isDirectory();
    if( ! accept) {
    String suffix = getSuffix(f);
    if(suffix != null)
    accept = suffix.equals("jpg") ||
    suffix.equals("gif") ||
    suffix.equals("bmp");
    return accept;
    public String getDescription() {
    return "Image Files(*.gif *.jpg *.bmp)";
    private String getSuffix(File f) {
    String s = f.getPath(), suffix = null;
    int i = s.lastIndexOf('.');
    if(i > 0 && i < s.length() - 1)
    suffix = s.substring(i+1).toLowerCase();
    return suffix;
    public static void main(String a[]) {
    JApplet applet = new BrImage();
    JFrame f = new BrImagFile();
    f.setBounds(300, 300, 300, 75);
    applet.init();
    applet.start();
    f.setVisible(true);
    /* f.setDefaultCloseOperation(
    WindowConstants.DISPOSE_ON_CLOSE); */
    f.addWindowListener(new WindowAdapter() {
    public void windowClosed(WindowEvent e) {
    System.exit(0);
    BrImage/BrImage.java [109:1] non-static variable this cannot be referenced from a static context
    JFrame f = new BrImagFile();
    ^
    1 error
    Errors compiling BrImage.

    Hi again,
    Please help.
    JL

Maybe you are looking for

  • Opening Garageband Project In Logic Express

    I have successfully opened / saved a garageband project in Logic Express and everything seems to have come over fine. In the arrange window, the 'Input' button is highlighted on many tracks (the button next to mute, solo, etc.). Should the 'Input' be

  • When opening a jpg in illustrator it automatically rotates 90 degrees

    I'm only new to illustrator so please excuse my ignorance. I'm trying to open a jpg and edit it but when I initally open it the picture is on a 90 degree angle. How do I fix this.   Thanks

  • DIV and p (Gaps between them).

    I'm sure that I'm missing something really obvious here: I've attached the CSS that I'm using (external). Using the WYSIWYG view, it's really hard to get it to do what I want; I seem to have to ensure that I have a space below where I want to put any

  • Beans graph drill down problem.

    Hi, I am currently using 10.1.2 version of BI Beans and developed a front end application for my OLAP cubes. The nice feature of 10g BIB is that we are now able to drill a graph, which was not possible in earlier 9i versions. The problem I am facing

  • IDVD '04 will not burn disk

    I've done a second install of iDVD on my 2nd HD. When I tried to burn a DVD-R disc from imovie, it went through all the motions then gave me this error: The recording device reported the media error: Power calibration area error (0x73, 0x0.3) I've go