Another circle applet question

I am wondering, how do I keep track of user clicks so that I can have the program set the location of the circle for the first click and then draw the radius with the second click?
Here is what I got so far.
import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;
   This program draws a user-specified triangle by clicking
      on three points
public class ExP10_6 extends Applet
   public ExP10_6()
      clicks = 0;
      points = new Point2D.Double[MAX_CLICKS];
      MouseClickListener listener = new MouseClickListener();
      addMouseListener(listener);
   public void paint(Graphics g)
      Graphics2D g2 = (Graphics2D)g;
      circle c = new circle(clicks, points);
      c.draw(g2);
   // implement the mouse press handler
   class MouseClickListener extends MouseAdapter
      public void mousePressed(MouseEvent event)
         if (clicks >= MAX_CLICKS) return;
         int mouseX = event.getX();
         int mouseY = event.getY();
         points[clicks] = new Point2D.Double(mouseX, mouseY);
         clicks++;
         repaint();
   private int clicks;
   private Point2D.Double[] points;
   private final int MAX_CLICKS = 2;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Point2D;
public class Circle
   public Circle(int aClick, Point2D.Double[] aPoint)
      clicks = aClick;
      points = aPoint;    
   public void draw(Graphics2D g2)
      // draw circle around first point
      if (clicks == 1)
         double x = points[0].getX();
         double y = points[0].getY();
         circle.setLocation(x, y);
      else if (clicks == 2)
         double x = points[1].getX();
         double y = points[1].getY();
   private int clicks;
   private Point2D.Double[] points;  
}

/*  <applet code="CircleApplet" width="400" height="400"></applet>
*  use: >appletviewer CircleApplet.java
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.util.*;
import java.util.List;
public class CircleApplet extends Applet
    CirclePanel circlePanel;
    CircleSelector selector;
    public void init()
        circlePanel = new CirclePanel();
        selector = new CircleSelector(circlePanel);
        circlePanel.addMouseListener(selector);
        setLayout(new BorderLayout());
        add(getUIPanel(), "North");
        add(circlePanel);
    private Panel getUIPanel()
        Button add = new Button("add circle");
        add.addActionListener(new ActionListener()
            public void actionPerformed(ActionEvent e)
                selector.addCircle();
        Panel panel = new Panel();
        panel.add(add);
        return panel;
    public static void main(String[] args)
        Applet applet = new CircleApplet();
        Frame f = new Frame();
        f.addWindowListener(new WindowAdapter()
            public void windowClosing(WindowEvent e)
                System.exit(0);
        f.add(applet);
        f.setSize(400,400);
        f.setLocation(200,200);
        applet.init();
        f.setVisible(true);
class CirclePanel extends Panel
    //List<Circle> circles;                            // j2se 1.5
    List circles;                                      // j2se 1.4
    public CirclePanel()
        //circles = new ArrayList<Circle>();           // j2se 1.5
        circles = new ArrayList();                     // j2se 1.4
    public void paint(Graphics g)
        super.paint(g);
        Graphics2D g2 = (Graphics2D)g;
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                            RenderingHints.VALUE_ANTIALIAS_ON);
        for(int j = 0; j < circles.size(); j++)
            //g2.draw(circles.get(j).circle);          // j2se 1.5
            g2.draw(((Circle)circles.get(j)).circle);  // j2se 1.4
    public void addCircle(Circle c)
        circles.add(c);
        repaint();
class CircleSelector extends MouseAdapter
    CirclePanel circlePanel;
    boolean readyToSetLocation, locationIsSet;
    Point center;
    public CircleSelector(CirclePanel cp)
        circlePanel = cp;
        readyToSetLocation = false;
        locationIsSet = false;
    public void mousePressed(MouseEvent e)
        Point p = e.getPoint();
        if(readyToSetLocation)
            center = p;
            readyToSetLocation = false;
            locationIsSet = true;
        else if(locationIsSet)
            int radius = (int)center.distance(p);
            circlePanel.addCircle(new Circle(center, radius));
            locationIsSet = false;
    public void addCircle()
        readyToSetLocation = true;
class Circle
    Ellipse2D circle;
    public Circle(Point p, int radius)
        circle = new Ellipse2D.Double(p.x - radius, p.y - radius, 2*radius, 2*radius);
}

Similar Messages

  • Another color management question

    Hi folks,
    Apologies for yet another color management question, but Im getting very confused and could do with some help. I use a Canon 10D and Canon 30D. Ive come to LightRoom from Pixmantec Raw Shooter.
    As Ive gotten more serious about producing high quality images for both the web and as prints, I thought Id invest in the Colorvision Spyder2 calibration product. So my monitor is now calibrated (quite a difference from what I was seeing!) and I have a calibration profile applied.
    My needs are pretty obvious I want my images to look the same wherever theyre viewed including exported files (such as JPEGs) whether this be on my monitor (in LightRoom, a web browser, Paint Shop Pro, whatever) and on a printer.
    Perhaps Im getting confused because Im trying to compare what LightRoom does with what RawShooter does.
    In RawShooter, when exporting from RAW to JPEG, I can specify the RGB Working Space Im using and then select my monitor profile. I think that what happens is that the export mechanism takes this profile into account and, low and behold, the JPEG looks fine when viewed in any web browser - the colours are exactly the same as in RawShooter. In Paint Shop Pro they look fine too unless I enable Color Management in which case (Im guessing) the monitor profile is, essentially, applied twice! But the upshot is I seem to get the results I want.
    What I cant figure out is how I do this in LightRoom. I can make the same adjustments to the RAW image as I did in RawShooter, but there doesnt seem an option for me to select my profile on export to JPEG only the standard 3 color spaces. Anyway the result is a JPEG that looks somewhat different when viewed in a web browser, or Paint Shop Pro with Color Management turned off. However, if I turn Color Management on in Paint Shop Pro, then it looks fine. So Im assuming that my profile isnt accounted for when exporting JPEGs from LightRoom.
    So any pointers or explanations would be really appreciated. I also acknowledge that this is my first foray into color management, and feel free to tell me to go and read some introductory article (link please!) and then come back with a sensible question if thats whats needed!
    Thanks in advance.
    - Pete

    Lightroom color management.
    a.) Monitor profile used: The profile set as the default in your operating system (e.g. Windows xp). (your monitor profile software usually does this when you calibrate/profile your monitor).
    b.) Working space: ProPhotoRGB
    c.) Export color space: You can choose one of the following sRGB; Adobe RGB or Pro Photo RGB.
    There is no option (afaik) to change a.) or b.) the option you choose in c.) will affect how the exported image will be displayed in color managed applications or non-color managed applications.
    Non-color managed applications are not able to display Adobe RGB or Pro Photo RGB correctly. I guess if you wish a consistent display of your images in color managed and non-color managed applications then the only common factor is sRGB and you should export your images in sRGB color space.
    The benefits of the other expanded color spaces are in printing and you also would have to get this end of your color management correct. Printing profiles to match your printer and each paper being used etc.
    Until you can get this all sorted out you will get better results from sRGB, this is also applicable when using most commercial printing services.

  • Cannot run circle applet

    1.0     I am learning Java, working my way through Seefeld?s book, JAVA PROGRAMMING FUNDAMENTALS.
    2.0     Cannot get the circle applet to work.
    3.0     Source code is:
    import javax.swing.*;
    import java.awt.Graphics;
    public class circle extends JApplet{
         //class variables can be accessed by all methods
         //use to set values of variables
         public void init ()
         }//end init
         //draws shapes on screen
         public void paint (Graphics g)
              g.drawOval(100,100,75,75);
              g.drawOval(75,75,125,125);
              g.drawOval(50,50,175,175);
              g.drawOval(25,25,225,225);
         }//end paint
    }//end class
    4.0     HTML is:
    <HTML>
         <applet code=?circle.class? width=300
         >height=300></applet>
    <HTML>
    5.0     At the command: appletviewer circle.html
    5.1     Get: Warning: <applet> tag requires height attribute.
    6.0 My mistake is???

    Thanks lethalwire. Yes indeed, your suggestion allowed the Applet Viewer window to appear, but along with it... this:
    C:\Program Files\Java\jdk1.6.0\bin>appletviewer circle.html
    load: class ?circle.class? not found.
    java.lang.ClassNotFoundException: ?circle.class?
    at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:183)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:127)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:626)
    at sun.applet.AppletPanel.createApplet(AppletPanel.java:778)
    at sun.applet.AppletPanel.runLoader(AppletPanel.java:707)
    at sun.applet.AppletPanel.run(AppletPanel.java:361)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.6.0\bin\?ci
    rcle\class?.class (The system cannot find the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:106)
    at java.io.FileInputStream.<init>(FileInputStream.java:66)
    at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection
    .java:70)
    at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLCon
    nection.java:161)
    at sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:295)
    at sun.applet.AppletClassLoader.access$100(AppletClassLoader.java:44)
    at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:173)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:170)
    ... 8 more
    I am new, too new, to know if this applies to the original source code for the circle applet. And if so how do I go about deciphering this message?
    Help me, lethal wire, help me.

  • PDA is under the environment of Jeode, carry out applet question with swing

    Purpose : Under the environment of Jeode in PDA, links APPLET webpage on websites, and APPLET is " import javax.swing. *".
    Question: Not knowing the problem of how to go to solve swing bug of applet , it is unable to read webpages to cause pda.

    Right. Make "number" a field, and take it out of the
    method signature for paint.
    Because you didn't use the same signature, you didn't
    override the existing paint(Graphics) method, you
    just overloaded it. That means that when the GUI
    thread tries to make your applet paint itself, it
    calls the original paint(Graphics) method, and not
    your paint(Graphics, int) method -- and so your
    method never gets called.
    Hi Paul,
    Not to sure whether is this what you mean by above statement, i just understand the statement in bold, anyway i ammend the program , this time i declare another variable outside the init() and paint() call int num
    import java.awt.*;
    import javax.swing.*;
    public class Draw extends JApplet
        int num;
        public void init()
        \\ask user for input (1, 2 or 3) = String numberStr
        num = Integer.parseInt(numberStr)
        public void paint(Graphics page)
            for (int index = 0; index < 100; index++)
            switch (num)
            \\ my statement code
    }Anyway it works, thanks..:)
    my last assigment before my exam.

  • Help - Applet Question ???

    Hi, I thought I post it yesterday, but I could not find it.
    I write a simple applet as follow:
    public class demoapplet extends Applet {
    private StringBuffer buf = new StringBuffer(1000);
    public void init() { }
    public void start() {
    //display start info
    disp("start");
    buff = processXML();
    sendHTTP(buff);
    //display start info
    disp("end");
    public void disp(string st) {
    Graphics g;
    g.drawString(st,10,60);
    public stringbuffer processXML() { ...}
    public void sendHTTP(stringbuffer buf) {... }
    My question:
    1. How to init Graphics object?
    If I use paint method, I can not pass string variable.
    2. How to send stringbuffer to another application
    via HTTP?
    3. Any problem I put my processXML and sendHTTP in start method? It only be called once when user load html page.
    Many thanks

    Hey Hi! david...
    first of all make your questions a bit more clear,
    about getting the graphics object you can get it by
    Graphics g=getGraphics();
    in the Applet.
    Also about getting the string in the paint method of the Applet. you can declare a string variable in the class and it would be accessible in the paint method.
    I first of all suggest you to get your basics right ..
    regards
    vikram

  • Another Simple Code Question... Please Help!

    Hi!
    I've stumbled across another problem with my coding, and I'm hoping that someone could help me out again. I've now got two classes, one with the code to draw a button, and the other which invokes the button and does a number of other things.
    I'd like it so each button is assigned to a different sound, but I get these errors when I compile...
    D:\java\Phone.java:8: cannot resolve symbol
    symbol : class AudioClip
    location: class Phone
    private AudioClip sound1;
    D:\java\Phone.java:64: cannot resolve symbol
    symbol : variable myButton1
    location: class Phone
    if (event.getSource() == myButton1)
    Could anyone suggest as to why this is?? Here is the source code (I've trimmed it down for the sake of these pages...)
    >>>>>>>
    import java.awt.*;
    import java.applet.Applet;
    import java.awt.event.*;
    public class Phone extends Applet implements ActionListener {
    private Image image;
    private AudioClip sound1;
    public void init() {
    setLayout(null);
    image = getImage(getDocumentBase(), "phone.jpg");
    sound1 = getAudioClip(getDocumentBase(), "sound.wav");
    PhoneButton myButton1;
    myButton1 = new PhoneButton(322,180, 1);
    add(myButton1);
    myButton1.addActionListener(this);
    public void paint (Graphics g) {
    g.drawImage(image, 0, 0, 700, 530, this);
    super.paint(g);
    public void actionPerformed(ActionEvent event)
    if (event.getSource() == myButton1)
    sound1.play();
    >>>>>>>
    Again, I'm sorry about the indentation.
    Cheers in advance!

    To answer your post...instance variables mean you should put your variable declarations
    just below the class declaration like u have done with this...
    public class Phone extends Applet implements ActionListener {
    private Image image;
    private AudioClip sound1;Just add here...
    PhoneButton myButton1;
    this.
    That would make myButton1 an instance variable.
    sorry, i don't understand. And now, since you've put up dukes for answering your question...you have to reward them
    else they go waste. But only if you thought my reply was helpful to you. The choice is yours.
    cheers.

  • Applet Questions

    I need some help writing some applets for school.
    My CircleDrawer Class
    import java.awt.*;
    import java.util.*;
    import java.applet.Applet;
    public class CircleDrawer
         private static Random random = new Random();
         private int x;
         private int y;
         private int width;
         private int height;
         private Color cirColor;
         public CircleDrawer()
              x = random.nextInt(300);
              y = random.nextInt(300);
              width = random.nextInt(300);
              height = random.nextInt(300);
              cirColor = new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255));
         public void drawCircle(Graphics g)
              g.setColor(cirColor);
              g.drawOval(x, y, width, height);
    }My RandomCircles Class which uses CircleDrawer
    import java.awt.*;
    import java.util.*;
    import java.applet.Applet;
    public class RandomCircles extends Applet
              CircleDrawer c = new CircleDrawer();
         public void init()
              setSize(500,500);
         public void paint (Graphics page)
              for (int d=0; d<=10; d++)
                   c.drawCircle(page);
    }It's supposed to draw 10 circles, but it only draws one. I've tried lots of things to fix it, but all my ideas have failed me.
    Another thing...
    My CBoxBuilder Class
    import java.awt.*;
    public class CBoxBuilder
         private final int MAX_WIDTH = 25;
         private int width;
         private int height;
         private Color color;
         public CBoxBuilder(int h, Color shade)
              width = MAX_WIDTH;
              height = h;
              color = shade;
         public void makeCrayon(Graphics g, int x, int y)
              //Sets the Crayon's Color
              g.setColor(color);
              //In theory this should draw the Crayons...let's hope
              g.fillRect(x,y,width,height);
    }I know there's some code I need to put in the makeCrayon method to reverse the height. I need to make x and y the starting point at the lower left hand of a crayon and the height needs to make it go up, not down.
    Here's the Crayon class that uses CBoxBuilder
    import java.awt.*;
    import java.applet.Applet;
    public class Crayon extends Applet
         private CBoxBuilder c1, c2, c3, c4, c5, c6;
         public void init()
              c1 = new CBoxBuilder(100, Color.red);
              c2 = new CBoxBuilder(200, Color.blue);
              setBackground(Color.black);
              setSize(600, 600);
         public void paint(Graphics page)
              //The Crayon Box
              page.setColor(Color.yellow);
              page.fillRect(10,10,250,400);
    }I'd appreciate any help. My school network account was frozen so my instructor can't really help me.
    -John

    It's supposed to draw 10 circles, but it only draws
    one. Actually it does draw 10 circles, they are just on top of each other. Your x, y, width and height never change.

  • Multiple-jar applet question

    Here's a basic question that none of the examples seem to address. If my applet is comprised of multiple jars (some dynamically loaded based on system configuration), do they all have to be signed, or does just the jar file containing the applet entry point need to be signed?
    Conversely, could it be that only the jar files that contain code that wants to write files to the local file system need to be signed, or does everything need to be signed?

    Conversely, could it be that only the jar files that contain code that wants to write files to
    the local file system need to be signedThe Stack needs to be "trusted" code. If an unsigned applet "not trusted" calls a method
    of the signed applet it should not be allowed to do "trusted" things.
    One example is when you call a public method of the applet from javascript. There is a
    sollution other that signing all.
    http://forum.java.sun.com/thread.jsp?forum=63&thread=524815
    second post

  • Another external drive question

    As I mentioned in an earlier post, I've partitioned my WD 500 GB firewire 800 external drive into three partitions. My intention was to obtain a bootable backup in the first partition (100 GB) and have the other two as supplemental strorage for future use (200 GB and the remaining approx. 165 GB). After performing an immediate backup of the Macintosh HD into the first partition, I read that a "duplicate", not "backup" was required for boot purposes.
    I'd really appreciate some suggestions here from those with more experience in these matters. My internal 500 GB HD has approximately 28 GB of used capacity currently (this will grow, of course, over time). Should I have created a partition for a bootable start up and "duplicated" the internal HD? Then, should I use a second partition for normal backups? What size should these partitions be configured to allow for maximum future storage, without pushing the limits on the backup/startup partitions? And finally, what are the steps to re-configure the external to achieve my desired intentions?
    This is a lot of question, but I certainly appreciate the guidance provided me thus far in my early days of Mac enjoyment. Thanks.
    iMac 24 2.33/3G Ram/500G HD/7600GT/BT K/M /WD 500GB FWHD   Mac OS X (10.4.9)  

    Hello! Sounds like you have thought it out well. All you need now is to clone your main drive so it will be bootable. You can do that using CarbonCopyCloner, SuperDuper, or you can use the Apple Disk Utility you already have. A lot of people use SuperDuper and others swear by some of the others. Below are listed Kappy's steps to do it using the disk utility. I use several bootable backups just for peace of mind. I generally clone to one and then the other so if something happens during the cloning (such as a power outage) I'll still have a drive that works. I usually make a clone about once a month and then backup any important documents every day to a flash drive, cd/dvd, or another hard drive volume. Once you make a clone you should always boot from it to make sure it's booting ok. Sometimes a clone will fail to boot. I also HIGHLY recommend obtaining and using DISKWARRIOR. Diskwarrior is the "gold standard" for disk drive directory maintenance which is the leading cause of hard drive problems. Using DW about once a month or after any force shutdown, forced re-start, or power outage will head off most disk problems. Tom
    Kappy's Steps to Produce a bootable clone
    Prep external FW drive:
    1. Open Disk Utility from the Utilities folder.
    2. Select the backup or destination volume from the left side list.
    3. Click on the Erase tab in the DU main window. Set the format type to Mac OS Extended (journaled, if available) and click on the Erase button. This step can be skipped if the destination has already been freshly erased.
    4. Click on the Restore tab in the DU main window.
    5. Select the backup or destination volume from the left side list and drag it to the Destination entry field.
    6. Select the startup or source volume from the left side list and drag it to the Source entry field.
    7. Double-check you got it right, then click on the Restore button.
    8. Select the destination drive on the Desktop and press COMMAND-I to open the Get Info window. At the bottom in the Ownership and Permissions section be sure the box labeled "Ignore Permissions on this Volume" is unchecked. Verify the settings for Ownership and Permissions as follows: Owner=system with read/write; Group=admin with read/write; Other with read-only. If they are not correct then reset them.
    For added precaution you can boot into safe mode before doing the clone.

  • Another check box question

    For some reason all my songs have become unchecked. I don't know why. Is there an easy way to recheck them all. Rather than having to click in every box? It seems that because the aren't checked Genius will not recognize them. They were all working until today.
    Thanks in advance

    Flushkie wrote:
    I copied 250 gig of music from my old pc hard drive to my desktop. I just imported them to iTunes by adding them to my library. Now that the music is all in iTunes, I can delete the large music file on my desktop?
    This is another topic that should have it's own thread.
    To answer your question. It depends on if you had <iTunes/Preferences/Advanced/Copy files to iTunes Media folder when adding to library> checked. If the files were copied then you have duplicates and the files on the desktop can be deleted. If the files were not copied then the files on the desktop ARE your music files.
    Tracy

  • Applet question!!!

    Hello there!!! I have an applet that sends text messages to a remote pc (chat application). I want to send a text message once the user closed the browser or another page is displayed or in general when the applet is no longer running. I tried to use the stop() method by it seems that it dont work even destroy()method for final clean-up. Do you know any other ways???
    Thanks mate!!!

    thanks arcosh!!!
    yeah... I know what you mean but is there any other ways than this...??? I'm sort of saving this as my last card, hehehe!!!
    Thanks anyways!!!

  • Two applet questions

    Hi there,
    I don't know if it's good to post two questions in one post, but I think it's okay since they are just small questions.
    First one: When an applet is dragged out of a browser, I have to close the browser if I want Java to ask me if I want to create a desktop shortcut. Is it possible to change this behaviour, or will it be changed in the next release?
    Second question: How can I re-integrate a JavaFX-Applet into the webpage? There seems to be no other possibility than to use that default small close button provided by Java, but I'd like to call it from the code. That must be possible?

    Yes, I tried this, but it leads to "java.lang.IllegalStateException: Can not call FX.exit() twice".
    Is there some way to do it like it is in standard java? Because there's the possibility to implement a function for the closeListener (or something like that), and then it's possible to directly call the listener to put the applet back into the page. And it hides the standard close button. Maybe we get this functionality in JFX 1.3?
    I'm currently using stage.close(), but that leads to the problems I already described.

  • Yet another Try Catch question. Iterating through a ForEach loop

    Confused on error handling in a Powershell ForEach loop. I’m looping through a list of registry keys, attempting
     to open each one. If it succeeds, I do a bunch of stuff. If it fails, I want to skip to the next iteration.
    If I was doing It in VBScript I’d do this:
    For Each Thing In colThings
    Open Thing
    If Err.Number <> 0 Then
    “oops”
    Else
    Do stuff
    Do stuff
    Do stuff
    End If
    Next
    This is what I came up with in PowerShell. It seems to work, but just doesn’t seem powershell-ish. There must be a better way to use the catch output than just creating a $return variable and assigning it success or fail?
    ForEach ($subKeyName in $subKeyNames)
    try{$subKey = $baseKey.OpenSubKey("$subKeyName")}
    catch{$return = "error" }
    If($return -eq "error" )
    “Oops”
    Else
    Do stuff
    Do stuff
    Do Stuff

     
    I totally get what you're saying about formatting. I don't' have any habits yet, since I've only been working in Powershell since... well, what time is it now?
    Unfortunately, It Has Been Decreed that we are no longer to use VBScript for any engineering solutions at work, so my 15 years experience in it now needs to be transitioned over asap. I don't have the luxury of crawling before I run. I'm trying not to be
    frustrated, but it's like an English major waking up one day and being told "You must now speak French exclusively. Here's a book."
    The Do Stuff example of my ForEach loop is about 50 lines of code involving matching values in subkeys of this registry key with another and collecting output. I tried wrapping the whole thing in a try section based on some examples, but it seemed odd, that's
    why I'm asking. I'm used to tightly focused error handling at the point where an error may occur.
    In this example I'm only interested in whether or not I can open the subkey (it exists, but I may not have permission). If I can't, there's no point in continuing with this iteration of the loop, I want to skip to the next one. So why include all the "Do
    Stuff" in the the try section? From a readability viewpoint, it doesn't seem helpful.
    Also, there may be more error handling deeper in the code. If I then put that in a try/catch, and then something else inside that, now I have nested try/catches mixed in with nested if/elses, all wrapped in a For loop.
    Again, I can see how it works logically, but for readability not so much, and having all these braces 50 lines apart to match up is giving me eye strain :).
    It sounds like David is agreeing with jrv, that putting the entire ForEach loop code into a try/catch is the conventional way to do it. I guess it makes as much sense as putting it all in an If-else-Endif, and I just need to adjust my paradigm.
    But if not, my specific question was more along the lines of, is there a built in way to tell that the catch section has been executed, rather than me using it to populate an arbitrary variable and then read it? In VBScript, you execute something, and the
    next line, you check the Err.number. I wasn't sure if you could do that with a try/catch.

  • Another canvas related question

    Here is my scenario:
    I have content canvas (say CC), a stacked canvas (SC) and a tab canvas (TC). On the CC, I have the TC always showing in the bottom half. In the upper half of the CC, I have some text items, list items etc always showing.
    When the user selects certain options of the drop down lists in the CC and/or TC, I want to display the stacked canvas(SC) while still displaying the TC in the bottom half of the CC. SC has only a text item and an ok button on it. This text field is to capture the comments of the user. What I am trying to accomplish is to capture the user comments from the SC, assign it to a data block item when the user clicks on the 'ok' button on the SC and then hide the SC. Since there are multiple drop down list items in the SC and TC, I plan to re-use the same SC to capture the comments. Don't know if this is a good way to do it and if it can be accomplised or not. Any suggestions/ideas are appreciated.
    The issue that I am facing is when I display the SC upon changing a list item in the CC, then the TC
    disappears.Neither does the SC appear with the text box and the ok button on it.
    1. I am using the show_view to display the SC.
    2. For the SC properties itself, I set the
    Raise on entry =NO, '
    visible = 'YES'
    3. All the canvases share the same WINDOW
    4. My canvases are ordered in the following order
    SC
    CC
    TC
    5. Using forms 6i.
    Pardon my ignorance about the workings of the canvases (I always struggled to understand how the various canvases work). Also, these questions were probably asked many times before....but figured might re-ask. Pls. excuse my laziness in this regard.
    Questions:
    1. Can I have all the 3 canvases showing at a same point in time? (does reports allow that?)
    2. Has any one implemented what I am trying to accomplish? If yes, how did you do it?
    Edited by: Megastar_Chiru on Jul 13, 2010 11:30 AM
    Edited by: Megastar_Chiru on Jul 13, 2010 11:33 AM

    If the "TC" disappears, maybe the SC overlaps it.
    If the SC isn't displayed, try using a GO_ITEM('THE_TEXT_ITEM'); instead of using SHOW_VIEW.
    Another option might be:
    Create a second form and put the "comment-field" on a canvas in that form. In the WHEN-LIST-CHANGED-trigger where you actually show the SC, do a CALL_FORM to that new form to capture the users comment and proceed when the called form is ended.

  • Another .avi file question

    Hi there,
    I opened a quicktime movie in Mpeg Streamclip and exported to avi file.
    I then burned it off onto iDVD for a customer. However, she could not open it as an .avi file from her PC (to put into power point) is there any way I can burn off a DVD in iDVD that allows another to extract the .avi file as an .avi file?
    Thanks for any help!

    .. thanks, what do you mean by PC compatible disc? ...
    typical Mac-user question.. ;)) a Mac 'eats' all formats, a PC not.
    depending on how or with what your burning a dataDisk, you are allowed to select a disk's 'format' ... if you're using the Finder (insert dvd-r, drag content on it, burn..) it will care to choose a format, a PC is able to read it ...

Maybe you are looking for