Applet Menus

I'm trying to put together an Applet Swing menu, but have got my wires a bit crossed. I've written a basic menu system using JMenuBar, JMenu, JMenuItem etc. However all the examples of Applet menus I've found on the web, have used awt components. From what I understand, awt is being phased out and that I should use JMenu... Is that correct, or does that only apply to Java applications? Does anyone know of a basic example using JMenu items for creating an applet?
Thanks

only apply to Java applications? Does anyone know of
a basic example using JMenu items for creating an
applet?
Thanks
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.lang.*;
import java.util.*;
<Applet code="myApp.class" width=500 height=600>
</Applet>
public class  myApp extends JApplet implements ActionListener
JFrame frame;
JMenu mnuMain;
JMenuItem mnuItem;
JMenuBar mb;
public myApp()
public void init()
mnuMain=new JMenu("Menu") ;
mnuItem=new JMenuItem("Open new Window") ;
mb=new JMenuBar();
mb.add(mnuMain);
mnuMain.add(mnuItem);
setJMenuBar(mb);
mnuItem.addActionListener(this);
     public void actionPerformed(ActionEvent src)
JFrame frame=new JFrame("New Frame");
frame.setSize(300,150);
frame.setVisible(true);
}

Similar Messages

  • JMenuItem with icon

    I'm working on a project that has so emulate a 16 bit RISC microprocessor. And I decided to build an Applet and I created a menu for the applet. The problem is that I can't add icons to the menu items. I tried to add icons for a menu in a frame (stand-alone) application and it worked. But I can't in the applet.
    I tried using the following code:
    ImageIcon icon= new ImageIcon("icon.gif");
    menuitem.setIcon(icon);
    And it doesn't work!! :-(
    Why? Or you can't use icons in applet menus?

    Let's assume you have the icon in the same directory
    as the html file the applet's in on the server:
    new ImageIcon(new URL(getDocumentBase(), "icon.gif"));
    I think just the string argument has to be a file.Thanks a lot! I should have tried that... but I forgot that I had to work with images in an applet. That works..

  • Javascript or applet dropdown menus won't work in IE6, How can I solve this

    I've made some dropdownmenu's of javascript and one of java applets. But they don't work in IE6. If IE6 is installed they won't work either. My friend has IE5.5 and he has no problems with the menus. How can you make them work.
    And how can you change the z-index of a javascipt/applet? How do you make a dropdownmenu that's put in the topframe slide over the mainframe?

    Perhaps someone could help me with the following question:
    I have a menu that cascades out of the Applet box. My question is:
    How do I close the menu without clicking on the Applet box? - i.e. if the user clicks on the HTML area of the WEB-PAGE, or simply waits a second or 2, the menu should collapse?
    I notice that this is actually the default behavior for the AWT classes - but then you can't set background colors etc. I need the same kind of behavior, but using Swing classes.
    Would appreciate any assistance or advice...

  • Menus in applets

    Hi!
    I have a question. Is it not possible to have menus (Menu, Menubar, MenuItem) in applets? How do you write that?
    Thanks a lot!
    Christel

    In AWT applets, no.
    In Swing applets, yes.
    In Swing applets, use the method setJMenuBar()
    /Michael

  • Create menus in an applet

    I'm just starting to use applets. I'd like to create an applet menu for my web page. I'd like to use the MenuBar object but I guess you need to add that to a Frame. Of course, applets are panels so how I can accomplish this?
    Do I need to add a frame to me applet?
    Thanks for the help!

    in the init section of your code try:
    JMenu Section = new JMenu("Section");
    JMenuBar mb = new JMenuBar();
    mb.add(Section);
    setJMenuBar(mb);
    This should give you a bar with Section as an option

  • 10.4.7: broken safari menus over flash applets

    It seems after the 10.4.7 safari update: 2.0.4 (419.3), javascript menu dropdowns that hover over flash do not work properly. This can be viewed at http://www.bestbuy.com. Try to use the menu(s) above the main flash applet and you'll see what I mean. I also use the Nightly WebKit and this issue is not present (build 15091).
    Power Mac G5 Dual 2Ghz/iBook G4 1.42Ghz   Mac OS X (10.4.6)   2.5 Gig, Rad 9800 Pro 256M

    Hello,
    Thanks very much for the look,
    You're quite welcome. Always glad to help out.
    I upgraded my G5 and
    the iBook so I had no way of checking the site after
    the fact. The latest webkit seems to have this fixed
    so maybe in a futre release when the webkit merges
    with safari, it will be fixed.
    Which webkit is that? Are you talking about some of the developer software through Apple's Developer Connection?
    Or, are you talking about some 3rd-party updates, or nightly builds of the Flash program?
    I wasn't aware that Safari had a nightly build update like some of the other Open Source projects.
    Perhaps I am just misunderstanding your statement.

  • How do I convert this Applet to launch from a JFrame instead??

       A simple program where the user can sketch curves and shapes in a
       variety of colors on a variety of background colors.  The user selects
       a drawing color form a pop-up menu at the top of the
       applet.  If the user clicks "Set Background", the background
       color is set to the current drawing color and the drawing
       area is filled with that color.  If the user clicks "Clear",
       the drawing area is just filled with the current background color.
       The user selects the shape to draw from another pop-up menu at the
       top of the applet.  The user can draw free-hand curves, straight
       lines, and one of six different types of shapes.
       The user's drawing is saved in an off-screen image, which is
       used to refresh the screen when repainting.  The picture is
       lost if the applet changes size, however.
       This file defines two classes, SimplePaint3,class, and
       class, SimplePaint3$Display.class.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class SimplePaint3 extends JApplet {
            // The main applet class simply sets up the applet.  Most of the
            // work is done in the Display class.
       JComboBox colorChoice, figureChoice;  // Pop-up menus, defined as instance
                                             // variables so that the Display
                                             // class can see them.
       public void init() {
          setBackground(Color.gray);
          getContentPane().setBackground(Color.gray);
          Display canvas = new Display();  // The drawing area.
          getContentPane().add(canvas,BorderLayout.CENTER);
          JPanel buttonBar = new JPanel();       // A panel to hold the buttons.
          buttonBar.setBackground(Color.gray);
          getContentPane().add(buttonBar, BorderLayout.SOUTH);
          JPanel choiceBar = new JPanel();       // A panel to hole the pop-up menus
          choiceBar.setBackground(Color.gray);
          getContentPane().add(choiceBar, BorderLayout.NORTH);
          JButton fill = new JButton("Set Background");  // The first button.
          fill.addActionListener(canvas);
          buttonBar.add(fill);
          JButton clear = new JButton("Clear");   // The second button.
          clear.addActionListener(canvas);
          buttonBar.add(clear);
          colorChoice = new JComboBox();  // The pop-up menu of colors.
          colorChoice.addItem("Black");
          colorChoice.addItem("Red");
          colorChoice.addItem("Green");
          colorChoice.addItem("Blue");
          colorChoice.addItem("Cyan");
          colorChoice.addItem("Magenta");
          colorChoice.addItem("Yellow");
          colorChoice.addItem("White");
          colorChoice.setBackground(Color.white);
          choiceBar.add(colorChoice);
          figureChoice = new JComboBox();  // The pop-up menu of shapes.
          figureChoice.addItem("Curve");
          figureChoice.addItem("Straight Line");
          figureChoice.addItem("Rectangle");
          figureChoice.addItem("Oval");
          figureChoice.addItem("RoundRect");
          figureChoice.addItem("Filled Rectangle");
          figureChoice.addItem("Filled Oval");
          figureChoice.addItem("Filled RoundRect");
          figureChoice.setBackground(Color.white);
          choiceBar.add(figureChoice);
       }  // end init()
       public Insets getInsets() {
              // Specify how wide a border to leave around the edges of the applet.
          return new Insets(3,3,3,3);
       private class Display extends JPanel
                  implements MouseListener, MouseMotionListener, ActionListener {
               // Nested class Display represents the drawing surface of the
               // applet.  It lets the user use the mouse to draw colored curves
               // and shapes.  The current color is specified by the pop-up menu
               // colorChoice.  The current shape is specified by another pop-up menu,
               // figureChoice.  (These are instance variables in the main class.)
               // The panel also listens for action events from buttons
               // named "Clear" and "Set Background".  The "Clear" button fills
               // the panel with the current background color.  The "Set Background"
               // button sets the background color to the current drawing color and
               // then clears.  These buttons are set up in the main class.
          private final static int
                      BLACK = 0,
                      RED = 1,            // Some constants to make
                      GREEN = 2,          // the code more readable.
                      BLUE = 3,           // These numbers code for
                      CYAN = 4,           // the different drawing colors.
                      MAGENTA = 5,
                      YELLOW = 6,
                      WHITE = 7;
          private final static int
                     CURVE = 0,
                     LINE = 1,
                     RECT = 2,               // Some constants that code
                     OVAL = 3,               // for the different types of
                     ROUNDRECT = 4,          // figure the program can draw.
                     FILLED_RECT = 5,
                     FILLED_OVAL = 6,
                     FILLED_ROUNDRECT = 7;
          /* Some variables used for backing up the contents of the panel. */
          Image OSI;  // The off-screen image (created in checkOSI()).
          int widthOfOSI, heightOfOSI;  // Current width and height of OSI.  These
                                        // are checked against the size of the applet,
                                        // to detect any change in the panel's size.
                                        // If the size has changed, a new OSI is created.
                                        // The picture in the off-screen image is lost
                                        // when that happens.
          /* The following variables are used when the user is sketching a
             curve while dragging a mouse. */
          private int mouseX, mouseY;   // The location of the mouse.
          private int prevX, prevY;     // The previous location of the mouse.
          private int startX, startY;   // The starting position of the mouse.
                                        // (Not used for drawing curves.)
          private boolean dragging;     // This is set to true when the user is drawing.
          private int figure;    // What type of figure is being drawn.  This is
                                 //    specified by the figureChoice menu.
          private Graphics dragGraphics;  // A graphics context for the off-screen image,
                                          // to be used while a drag is in progress.
          private Color dragColor;  // The color that is used for the figure that is
                                    // being drawn.
          Display() {
                 // Constructor.  When this component is first created, it is set to
                 // listen for mouse events and mouse motion events from
                 // itself.  The initial background color is white.
             addMouseListener(this);
             addMouseMotionListener(this);
             setBackground(Color.white);
          private void drawFigure(Graphics g, int shape, int x1, int y1, int x2, int y2) {
                // This method is called to do ALL drawing in this applet!
                // Draws a shape in the graphics context g.
                // The shape paramter tells what kind of shape to draw.  This
                // can be LINE, RECT, OVAL, ROUNTRECT, FILLED_RECT,
                // FILLED_OVAL, or FILLED_ROUNDRECT.  (Note that a CURVE is
                // drawn by drawing multiple LINES, so the shape parameter is
                // never equal to CURVE.)  For a LINE, a line is drawn from
                // the point (x1,y1) to (x2,y2).  For other shapes,  the
                // points (x1,y1) and (x2,y2) give two corners of the shape
                // (or of a rectangle that contains the shape).
             if (shape == LINE) {
                   // For a line, just draw the line between the two points.
                g.drawLine(x1,y1,x2,y2);
                return;
             int x, y;  // Top left corner of rectangle that contains the figure.
             int w, h;  // Width and height of rectangle that contains the figure.
             if (x1 >= x2) {  // x2 is left edge
                x = x2;
                w = x1 - x2;
             else {          // x1 is left edge
                x = x1;
                w = x2 - x1;
             if (y1 >= y2) {  // y2 is top edge
                y = y2;
                h = y1 - y2;
             else {          // y1 is top edge.
                y = y1;
                h = y2 - y1;
             switch (shape) {   // Draw the appropriate figure.
                case RECT:
                   g.drawRect(x, y, w, h);
                   break;
                case OVAL:
                   g.drawOval(x, y, w, h);
                   break;
                case ROUNDRECT:
                   g.drawRoundRect(x, y, w, h, 20, 20);
                   break;
                case FILLED_RECT:
                   g.fillRect(x, y, w, h);
                   break;
                case FILLED_OVAL:
                   g.fillOval(x, y, w, h);
                   break;
                case FILLED_ROUNDRECT:
                   g.fillRoundRect(x, y, w, h, 20, 20);
                   break;
          private void repaintRect(int x1, int y1, int x2, int y2) {
                // Call repaint on a rectangle that contains the points (x1,y1)
                // and (x2,y2).  (Add a 1-pixel border along right and bottom
                // edges to allow for the pen overhang when drawing a line.)
             int x, y;  // top left corner of rectangle that contains the figure
             int w, h;  // width and height of rectangle that contains the figure
             if (x2 >= x1) {  // x1 is left edge
                x = x1;
                w = x2 - x1;
             else {          // x2 is left edge
                x = x2;
                w = x1 - x2;
             if (y2 >= y1) {  // y1 is top edge
                y = y1;
                h = y2 - y1;
             else {          // y2 is top edge.
                y = y2;
                h = y1 - y2;
             repaint(x,y,w+1,h+1);
          private void checkOSI() {
               // This method is responsible for creating the off-screen image.
               // It should be called before using the OSI.  It will make a new OSI if
               // the size of the panel changes.
             if (OSI == null || widthOfOSI != getSize().width || heightOfOSI != getSize().height) {
                    // Create the OSI, or make a new one if panel size has changed.
                OSI = null;  // (If OSI already exists, this frees up the memory.)
                OSI = createImage(getSize().width, getSize().height);
                widthOfOSI = getSize().width;
                heightOfOSI = getSize().height;
                Graphics OSG = OSI.getGraphics();  // Graphics context for drawing to OSI.
                OSG.setColor(getBackground());
                OSG.fillRect(0, 0, widthOfOSI, heightOfOSI);
                OSG.dispose();
          public void paintComponent(Graphics g) {
               // Copy the off-screen image to the screen,
               // after checking to make sure it exists.  Then,
               // if a shape other than CURVE is being drawn,
               // draw it on top of the image from the OSI.
             checkOSI();
             g.drawImage(OSI, 0, 0, this);
             if (dragging && figure != CURVE) {
                g.setColor(dragColor);
                drawFigure(g,figure,startX,startY,mouseX,mouseY);
          public void actionPerformed(ActionEvent evt) {
                  // Respond when the user clicks on a button.  The
                  // command must be either "Clear" or "Set Background".
             String command = evt.getActionCommand();
             checkOSI();
             if (command.equals("Set Background")) {
                    // Set background color before clearing.
                    // Change the selected color so it is different
                    // from the background color.
                setBackground(getCurrentColor());
                if (colorChoice.getSelectedIndex() == BLACK)
                   colorChoice.setSelectedIndex(WHITE);
                else
                   colorChoice.setSelectedIndex(BLACK);
             Graphics g = OSI.getGraphics();
             g.setColor(getBackground());
             g.fillRect(0,0,getSize().width,getSize().height);
             g.dispose();
             repaint();
          private Color getCurrentColor() {
                   // Check the colorChoice menu to find the currently
                   // selected color, and return the appropriate color
                   // object.
             int currentColor = colorChoice.getSelectedIndex();
             switch (currentColor) {
                case BLACK:
                   return Color.black;
                case RED:
                   return Color.red;
                case GREEN:
                   return Color.green;
                case BLUE:
                   return Color.blue;
                case CYAN:
                   return Color.cyan;
                case MAGENTA:
                   return Color.magenta;
                case YELLOW:
                   return Color.yellow;
                default:
                   return Color.white;
          public void mousePressed(MouseEvent evt) {
                  // This is called when the user presses the mouse on the
                  // panel.  This begins a draw operation in which the user
                  // sketches a curve or draws a shape.  (Note that curves
                  // are handled differently from other shapes.  For CURVE,
                  // a new segment of the curve is drawn each time the user
                  // moves the mouse.  For the other shapes, a "rubber band
                  // cursor" is used.  That is, the figure is drawn between
                  // the starting point and the current mouse location.)
             if (dragging == true)  // Ignore mouse presses that occur
                 return;            //    when user is already drawing a curve.
                                    //    (This can happen if the user presses
                                    //    two mouse buttons at the same time.)
             prevX = startX = evt.getX();  // Save mouse coordinates.
             prevY = startY = evt.getY();
             figure = figureChoice.getSelectedIndex();
             dragColor = getCurrentColor();        
             dragGraphics = OSI.getGraphics();
             dragGraphics.setColor(dragColor);
             dragging = true;  // Start drawing.
          } // end mousePressed()
          public void mouseReleased(MouseEvent evt) {
                  // Called whenever the user releases the mouse button.
                  // If the user was drawing a shape, we make the shape
                  // permanent by drawing it to the off-screen image.
              if (dragging == false)
                 return;  // Nothing to do because the user isn't drawing.
              dragging = false;
              mouseX = evt.getX();
              mouseY = evt.getY();
              if (figure == CURVE) {
                     // A CURVE is drawn as a series of LINEs
                  drawFigure(dragGraphics,LINE,prevX,prevY,mouseX,mouseY);
                  repaintRect(prevX,prevY,mouseX,mouseY);
              else if (figure == LINE) {
                 repaintRect(startX,startY,prevX,prevY);
                 if (mouseX != startX || mouseY != startY) {
                       // Draw the line only if it has non-zero length.
                    drawFigure(dragGraphics,figure,startX,startY,mouseX,mouseY);
                    repaintRect(startX,startY,mouseX,mouseY);
              else {
                 repaintRect(startX,startY,prevX,prevY);
                 if (mouseX != startX && mouseY != startY) {
                       // Draw the shape only if both its height
                       // and width are both non-zero.
                    drawFigure(dragGraphics,figure,startX,startY,mouseX,mouseY);
                    repaintRect(startX,startY,mouseX,mouseY);
              dragGraphics.dispose();
              dragGraphics = null;
          public void mouseDragged(MouseEvent evt) {
                   // Called whenever the user moves the mouse while a mouse button
                   // is down.  If the user is drawing a curve, draw a segment of
                   // the curve on the off-screen image, and repaint the part
                   // of the panel that contains the new line segment.  Otherwise,
                   // just call repaint and let paintComponent() draw the shape on
                   // top of the picture in the off-screen image.
              if (dragging == false)
                 return;  // Nothing to do because the user isn't drawing.
              mouseX = evt.getX();   // x-coordinate of mouse.
              mouseY = evt.getY();   // y=coordinate of mouse.
              if (figure == CURVE) {
                     // A CURVE is drawn as a series of LINEs.
                 drawFigure(dragGraphics,LINE,prevX,prevY,mouseX,mouseY);
                 repaintRect(prevX,prevY,mouseX,mouseY);
              else {
                    // Repaint two rectangles:  The one that contains the previous
                    // version of the figure, and the one that will contain the
                    // new version.  The first repaint is necessary to restore
                    // the picture from the off-screen image in that rectangle.
                 repaintRect(startX,startY,prevX,prevY);
                 repaintRect(startX,startY,mouseX,mouseY);
              prevX = mouseX;  // Save coords for the next call to mouseDragged or mouseReleased.
              prevY = mouseY;
          } // end mouseDragged.
          public void mouseEntered(MouseEvent evt) { }   // Some empty routines.
          public void mouseExited(MouseEvent evt) { }    //    (Required by the MouseListener
          public void mouseClicked(MouseEvent evt) { }   //    and MouseMotionListener
          public void mouseMoved(MouseEvent evt) { }     //    interfaces).
       } // end nested class Display
    } // end class SimplePaint3

    Im quite the novice, how exactly do I go about doing that. What I did was to put both in diff files but I got errors saying that they cant find colorChoice, figureChoice in the Display class.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Simple extends JFrame implements Display{
            // The main applet class simply sets up the applet.  Most of the
            // work is done in the Display class.
       JComboBox colorChoice, figureChoice;  // Pop-up menus, defined as instance
                                             // variables so that the Display
                                             // class can see them.
       public void init() {
          setBackground(Color.gray);
          getContentPane().setBackground(Color.gray);
          Display canvas = new Display();  // The drawing area.
          getContentPane().add(canvas,BorderLayout.CENTER);
          JPanel buttonBar = new JPanel();       // A panel to hold the buttons.
          buttonBar.setBackground(Color.gray);
          getContentPane().add(buttonBar, BorderLayout.SOUTH);
          JPanel choiceBar = new JPanel();       // A panel to hole the pop-up menus
          choiceBar.setBackground(Color.gray);
          getContentPane().add(choiceBar, BorderLayout.NORTH);
          JButton fill = new JButton("Set Background");  // The first button.
          fill.addActionListener(canvas);
          buttonBar.add(fill);
          JButton clear = new JButton("Clear");   // The second button.
          clear.addActionListener(canvas);
          buttonBar.add(clear);
          colorChoice = new JComboBox();  // The pop-up menu of colors.
          colorChoice.addItem("Black");
          colorChoice.addItem("Red");
          colorChoice.addItem("Green");
          colorChoice.addItem("Blue");
          colorChoice.addItem("Cyan");
          colorChoice.addItem("Magenta");
          colorChoice.addItem("Yellow");
          colorChoice.addItem("White");
          colorChoice.setBackground(Color.white);
          choiceBar.add(colorChoice);
          figureChoice = new JComboBox();  // The pop-up menu of shapes.
          figureChoice.addItem("Curve");
          figureChoice.addItem("Straight Line");
          figureChoice.addItem("Rectangle");
          figureChoice.addItem("Oval");
          figureChoice.addItem("RoundRect");
          figureChoice.addItem("Filled Rectangle");
          figureChoice.addItem("Filled Oval");
          figureChoice.addItem("Filled RoundRect");
          figureChoice.setBackground(Color.white);
          choiceBar.add(figureChoice);
       }  // end init()
    } // end class SimplePaint3
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    class Display extends JPanel
                  implements MouseListener, MouseMotionListener, ActionListener {
               // Nested class Display represents the drawing surface of the
               // applet.  It lets the user use the mouse to draw colored curves
               // and shapes.  The current color is specified by the pop-up menu
               // colorChoice.  The current shape is specified by another pop-up menu,
               // figureChoice.  (These are instance variables in the main class.)
               // The panel also listens for action events from buttons
               // named "Clear" and "Set Background".  The "Clear" button fills
               // the panel with the current background color.  The "Set Background"
               // button sets the background color to the current drawing color and
               // then clears.  These buttons are set up in the main class.
          private final static int
                      BLACK = 0,
                      RED = 1,            // Some constants to make
                      GREEN = 2,          // the code more readable.
                      BLUE = 3,           // These numbers code for
                      CYAN = 4,           // the different drawing colors.
                      MAGENTA = 5,
                      YELLOW = 6,
                      WHITE = 7;
          private final static int
                     CURVE = 0,
                     LINE = 1,
                     RECT = 2,               // Some constants that code
                     OVAL = 3,               // for the different types of
                     ROUNDRECT = 4,          // figure the program can draw.
                     FILLED_RECT = 5,
                     FILLED_OVAL = 6,
                     FILLED_ROUNDRECT = 7;
          /* Some variables used for backing up the contents of the panel. */
          Image OSI;  // The off-screen image (created in checkOSI()).
          int widthOfOSI, heightOfOSI;  // Current width and height of OSI.  These
                                        // are checked against the size of the applet,
                                        // to detect any change in the panel's size.
                                        // If the size has changed, a new OSI is created.
                                        // The picture in the off-screen image is lost
                                        // when that happens.
          /* The following variables are used when the user is sketching a
             curve while dragging a mouse. */
          private int mouseX, mouseY;   // The location of the mouse.
          private int prevX, prevY;     // The previous location of the mouse.
          private int startX, startY;   // The starting position of the mouse.
                                        // (Not used for drawing curves.)
          private boolean dragging;     // This is set to true when the user is drawing.
          private int figure;    // What type of figure is being drawn.  This is
                                 //    specified by the figureChoice menu.
          private Graphics dragGraphics;  // A graphics context for the off-screen image,
                                          // to be used while a drag is in progress.
          private Color dragColor;  // The color that is used for the figure that is
                                    // being drawn.
          Display() {
                 // Constructor.  When this component is first created, it is set to
                 // listen for mouse events and mouse motion events from
                 // itself.  The initial background color is white.
             addMouseListener(this);
             addMouseMotionListener(this);
             setBackground(Color.white);
          private void drawFigure(Graphics g, int shape, int x1, int y1, int x2, int y2) {
                // This method is called to do ALL drawing in this applet!
                // Draws a shape in the graphics context g.
                // The shape paramter tells what kind of shape to draw.  This
                // can be LINE, RECT, OVAL, ROUNTRECT, FILLED_RECT,
                // FILLED_OVAL, or FILLED_ROUNDRECT.  (Note that a CURVE is
                // drawn by drawing multiple LINES, so the shape parameter is
                // never equal to CURVE.)  For a LINE, a line is drawn from
                // the point (x1,y1) to (x2,y2).  For other shapes,  the
                // points (x1,y1) and (x2,y2) give two corners of the shape
                // (or of a rectangle that contains the shape).
             if (shape == LINE) {
                   // For a line, just draw the line between the two points.
                g.drawLine(x1,y1,x2,y2);
                return;
             int x, y;  // Top left corner of rectangle that contains the figure.
             int w, h;  // Width and height of rectangle that contains the figure.
             if (x1 >= x2) {  // x2 is left edge
                x = x2;
                w = x1 - x2;
             else {          // x1 is left edge
                x = x1;
                w = x2 - x1;
             if (y1 >= y2) {  // y2 is top edge
                y = y2;
                h = y1 - y2;
             else {          // y1 is top edge.
                y = y1;
                h = y2 - y1;
             switch (shape) {   // Draw the appropriate figure.
                case RECT:
                   g.drawRect(x, y, w, h);
                   break;
                case OVAL:
                   g.drawOval(x, y, w, h);
                   break;
                case ROUNDRECT:
                   g.drawRoundRect(x, y, w, h, 20, 20);
                   break;
                case FILLED_RECT:
                   g.fillRect(x, y, w, h);
                   break;
                case FILLED_OVAL:
                   g.fillOval(x, y, w, h);
                   break;
                case FILLED_ROUNDRECT:
                   g.fillRoundRect(x, y, w, h, 20, 20);
                   break;
          private void repaintRect(int x1, int y1, int x2, int y2) {
                // Call repaint on a rectangle that contains the points (x1,y1)
                // and (x2,y2).  (Add a 1-pixel border along right and bottom
                // edges to allow for the pen overhang when drawing a line.)
             int x, y;  // top left corner of rectangle that contains the figure
             int w, h;  // width and height of rectangle that contains the figure
             if (x2 >= x1) {  // x1 is left edge
                x = x1;
                w = x2 - x1;
             else {          // x2 is left edge
                x = x2;
                w = x1 - x2;
             if (y2 >= y1) {  // y1 is top edge
                y = y1;
                h = y2 - y1;
             else {          // y2 is top edge.
                y = y2;
                h = y1 - y2;
             repaint(x,y,w+1,h+1);
          private void checkOSI() {
               // This method is responsible for creating the off-screen image.
               // It should be called before using the OSI.  It will make a new OSI if
               // the size of the panel changes.
             if (OSI == null || widthOfOSI != getSize().width || heightOfOSI != getSize().height) {
                    // Create the OSI, or make a new one if panel size has changed.
                OSI = null;  // (If OSI already exists, this frees up the memory.)
                OSI = createImage(getSize().width, getSize().height);
                widthOfOSI = getSize().width;
                heightOfOSI = getSize().height;
                Graphics OSG = OSI.getGraphics();  // Graphics context for drawing to OSI.
                OSG.setColor(getBackground());
                OSG.fillRect(0, 0, widthOfOSI, heightOfOSI);
                OSG.dispose();
          public void paintComponent(Graphics g) {
               // Copy the off-screen image to the screen,
               // after checking to make sure it exists.  Then,
               // if a shape other than CURVE is being drawn,
               // draw it on top of the image from the OSI.
             checkOSI();
             g.drawImage(OSI, 0, 0, this);
             if (dragging && figure != CURVE) {
                g.setColor(dragColor);
                drawFigure(g,figure,startX,startY,mouseX,mouseY);
          public void actionPerformed(ActionEvent evt) {
                  // Respond when the user clicks on a button.  The
                  // command must be either "Clear" or "Set Background".
             String command = evt.getActionCommand();
             checkOSI();
             if (command.equals("Set Background")) {
                    // Set background color before clearing.
                    // Change the selected color so it is different
                    // from the background color.
                setBackground(getCurrentColor());
                if (colorChoice.getSelectedIndex() == BLACK)
                   colorChoice.setSelectedIndex(WHITE);
                else
                   colorChoice.setSelectedIndex(BLACK);
             Graphics g = OSI.getGraphics();
             g.setColor(getBackground());
             g.fillRect(0,0,getSize().width,getSize().height);
             g.dispose();
             repaint();
          private Color getCurrentColor() {
                   // Check the colorChoice menu to find the currently
                   // selected color, and return the appropriate color
                   // object.
             int currentColor = colorChoice.getSelectedIndex();
             switch (currentColor) {
                case BLACK:
                   return Color.black;
                case RED:
                   return Color.red;
                case GREEN:
                   return Color.green;
                case BLUE:
                   return Color.blue;
                case CYAN:
                   return Color.cyan;
                case MAGENTA:
                   return Color.magenta;
                case YELLOW:
                   return Color.yellow;
                default:
                   return Color.white;
          public void mousePressed(MouseEvent evt) {
                  // This is called when the user presses the mouse on the
                  // panel.  This begins a draw operation in which the user
                  // sketches a curve or draws a shape.  (Note that curves
                  // are handled differently from other shapes.  For CURVE,
                  // a new segment of the curve is drawn each time the user
                  // moves the mouse.  For the other shapes, a "rubber band
                  // cursor" is used.  That is, the figure is drawn between
                  // the starting point and the current mouse location.)
             if (dragging == true)  // Ignore mouse presses that occur
                 return;            //    when user is already drawing a curve.
                                    //    (This can happen if the user presses
                                    //    two mouse buttons at the same time.)
             prevX = startX = evt.getX();  // Save mouse coordinates.
             prevY = startY = evt.getY();
             figure = figureChoice.getSelectedIndex();
             dragColor = getCurrentColor();        
             dragGraphics = OSI.getGraphics();
             dragGraphics.setColor(dragColor);
             dragging = true;  // Start drawing.
          } // end mousePressed()
          public void mouseReleased(MouseEvent evt) {
                  // Called whenever the user releases the mouse button.
                  // If the user was drawing a shape, we make the shape
                  // permanent by drawing it to the off-screen image.
              if (dragging == false)
                 return;  // Nothing to do because the user isn't drawing.
              dragging = false;
              mouseX = evt.getX();
              mouseY = evt.getY();
              if (figure == CURVE) {
                     // A CURVE is drawn as a series of LINEs
                  drawFigure(dragGraphics,LINE,prevX,prevY,mouseX,mouseY);
                  repaintRect(prevX,prevY,mouseX,mouseY);
              else if (figure == LINE) {
                 repaintRect(startX,startY,prevX,prevY);
                 if (mouseX != startX || mouseY != startY) {
                       // Draw the line only if it has non-zero length.
                    drawFigure(dragGraphics,figure,startX,startY,mouseX,mouseY);
                    repaintRect(startX,startY,mouseX,mouseY);
              else {
                 repaintRect(startX,startY,prevX,prevY);
                 if (mouseX != startX && mouseY != startY) {
                       // Draw the shape only if both its height
                       // and width are both non-zero.
                    drawFigure(dragGraphics,figure,startX,startY,mouseX,mouseY);
                    repaintRect(startX,startY,mouseX,mouseY);
              dragGraphics.dispose();
              dragGraphics = null;
          public void mouseDragged(MouseEvent evt) {
                   // Called whenever the user moves the mouse while a mouse button
                   // is down.  If the user is drawing a curve, draw a segment of
                   // the curve on the off-screen image, and repaint the part
                   // of the panel that contains the new line segment.  Otherwise,
                   // just call repaint and let paintComponent() draw the shape on
                   // top of the picture in the off-screen image.
              if (dragging == false)
                 return;  // Nothing to do because the user isn't drawing.
              mouseX = evt.getX();   // x-coordinate of mouse.
              mouseY = evt.getY();   // y=coordinate of mouse.
              if (figure == CURVE) {
                     // A CURVE is drawn as a series of LINEs.
                 drawFigure(dragGraphics,LINE,prevX,prevY,mouseX,mouseY);
                 repaintRect(prevX,prevY,mouseX,mouseY);
              else {
                    // Repaint two rectangles:  The one that contains the previous
                    // version of the figure, and the one that will contain the
                    // new version.  The first repaint is necessary to restore
                    // the picture from the off-screen image in that rectangle.
                 repaintRect(startX,startY,prevX,prevY);
                 repaintRect(startX,startY,mouseX,mouseY);
              prevX = mouseX;  // Save coords for the next call to mouseDragged or mouseReleased.
              prevY = mouseY;
          } // end mouseDragged.
          public void mouseEntered(MouseEvent evt) { }   // Some empty routines.
          public void mouseExited(MouseEvent evt) { }    //    (Required by the MouseListener
          public void mouseClicked(MouseEvent evt) { }   //    and MouseMotionListener
          public void mouseMoved(MouseEvent evt) { }     //    interfaces).
       } // end nested class Display

  • JavaScript Menus Appear Behind Flash

    I am creating a page with a flash file embedded below a
    navigation bar with drop-down menus. The nav bar was created in
    Fireworks and imported. The problem is that the drop downs are
    appearing BEHIND the embedded Flash file so you can't see them. I
    have been looking all over for a solution to this without much
    success. If anyone has any ideas I would be appreciative if you
    share them.
    Regards,
    Andy

    All Active content on a page will always rise to the top, so
    to speak,
    including Flash, certain form elements, Java applets, and
    Active X controls.
    This means that each of these will poke through layers. There
    is not a good
    cross-browser/platform reliable way to solve this issue, but
    if you can be
    confident in your visitors using IE 5+ or NN6+, then you can
    use the Flash
    wmode parameter (however, Safari does not support this
    properly!).
    PVII article:
    http://www.projectseven.com/support/answers.asp?id=127
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "andrewmcgibbon" <[email protected]> wrote
    in message
    news:gqr9fs$ad0$[email protected]..
    >I am creating a page with a flash file embedded below a
    navigation bar with
    > drop-down menus. The nav bar was created in Fireworks
    and imported. The
    > problem is that the drop downs are appearing BEHIND the
    embedded Flash
    > file so
    > you can't see them. I have been looking all over for a
    solution to this
    > without much success. If anyone has any ideas I would be
    appreciative if
    > you
    > share them.
    >
    > Regards,
    > Andy
    >

  • How do I convert an applet to a standalone application.

    Hi Everyone,
    I am currently working on this Applet, I have tried putting the main in and building a frame to hold the applet but everytime I try something I just get new errors, What I conclusively want to do is put the applet in a frame and add menus to the frame. I have listed the code below, its quite a lot, I hope someone can help though, am pulling hair out.
    Many Thanks. Chris
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
      public class SciCalc extends Applet implements ActionListener
      // Entered a UID due to String conversion
        private static final long serialVersionUID = 1;
           int Counter;           //Counts the number of digits entered
           double Result;           //The answer displayed, as well as the second
                                 //operator taken for an operation
           double Operand;          //The first number entered for an operation
           double Mem;            //The variable which holds whatever value the user
                                 //wants kept in "memory"
           boolean DecimalFlag;       //The 'flag' that will signify whether or not the
                                 //decimal button has been pressed
           boolean SignFlag;        //The 'flag' that will signify whether or not the
                                 //plus/minus button has been pressed
           boolean OperatorKey;       //The 'flag' that will signify whether or not any
                                 //operator button has been pressed
           boolean FunctionKey;       //The 'flag' that will signify whether or not any
                        //function button has been pressed
           boolean Rad,Grad,Deg;     //The 'flags' that will signify that Rad, Grad or
                        //deg has been pressed
           int Operator;          //an integer value to indicate which operator
                                 //button was pressed
         char currchar;           //a character to hold the value of the key most
                                 //recently pressed
           String GrStatus;         //String to hold the status of various graphic
                                 //operations of the program
           String Status;           //String to hold the status of various parts
                                 //of the program
    //     LABEL DECLARATIONS 
         //This label will display all error messages
           Label DisplError = new Label(" ",Label.CENTER);
           //This label is just to the left of the Display Label lcdDisplay, and will
           //indicate whether or not a value is being held in the calculator's "memory"
           Label LabelMem = new Label(" ",Label.LEFT);
           Label LabelRad = new Label(" ",Label.CENTER);
           Label LabelDeg = new Label(" ",Label.CENTER);
           Label LabelGrad = new Label(" ",Label.CENTER);
         //This is the Display Label, which is declared as a label so the user will not
            //be able to enter any text into it to possibly crash the calculator
           Label lcdDisplay = new Label("0",Label.RIGHT);
           Label SciCalc = new Label ("Sci Calc V1.0",Label.CENTER);
    //      END OF LABEL DECLARATIONS 
    public void surround (Graphics g){
        g.setColor(new Color(0,0,0));
        g.drawRect(0,0,350,400);
    //      DELCLARATION OF NUMERIC BUTTONS
           Button button1 = new Button("1");
           Button button2 = new Button("2");
           Button button3 = new Button("3");
           Button button4 = new Button("4");
           Button button5 = new Button("5");
           Button button6 = new Button("6");
           Button button7 = new Button("7");
           Button button8 = new Button("8");
           Button button9 = new Button("9");
           Button button0 = new Button("0");
    //      END OF NUMERIC BUTTON DECLARATION
    //     DECLARATION OF OPERATOR BUTTONS
           Button buttonMinus      = new Button("-");
           Button buttonMultiply   = new Button("x");
           Button buttonPlus       = new Button("+");
           Button buttonEquals     = new Button("=");
           Button buttonDivide     = new Button("�");
           Button buttonClear      = new Button("C");
           Button buttonDecimal    = new Button(".");
           Button buttonMPlus      = new Button("M+");
           Button buttonMClear     = new Button("MC");
           Button buttonMRecall       = new Button("MR");
    //     END OF OPERATOR BUTTON DECLARATION 
    //     SCIENTIFIC BUTTON DECLARATION
           Button buttonPi            = new Button("Pi");
           Button buttonSqrt       = new Button("Sqrt");
           Button buttonCbrt       = new Button("Cbrt");
           Button buttonx2            = new Button("x2");
           Button buttonyX         = new Button("yX");
           Button buttonPlusMinus  = new Button("+-");
           Button buttonRad        = new Button("RAD");
           Button buttonGrad       = new Button("GRAD");
           Button buttonDeg        = new Button("DEG");
           Button buttonSin        = new Button("SIN");
           Button buttonCos           = new Button("COS");
           Button buttonTan        = new Button("TAN");
           Button buttonExp        = new Button("EXP");
           Button buttonLogn           = new Button("Ln");
           Button buttonOpenBracket  = new Button("(");
           Button buttonLog        = new Button("log");
    //     END OF SCIENTIFIC BUTTON DECLARATION
    //     START OF INIT METHOD
    //This the only method that is called explicitly -- every other method is
    //called depending on the user's actions.
    public void init()
    //Allows for configuring a layout with the restraints of a grid or
    //something similar
         setLayout(null);
             //APPLET DEFAULTS
        //This will resize the applet to the width and height provided
             resize(350,400);
        //This sets the default font to Helvetica, plain, size 12
                  setFont(new Font("Helvetica", Font.PLAIN, 12));
        //This sets the applet background colour
                       setBackground(new Color(219,240,219));
         //END OF APPLET DEFAULTS
         //LABEL INITIALISATION     
    //Display Panel, which appears at the top of the screen. The label is
    //placed and sized with the setBounds(x,y,width,height) method, and the
    //font, foreground color and background color are all set. Then the
    //label is added to the layout of the applet.
             lcdDisplay.setBounds(42,15,253,30);
             lcdDisplay.setFont(new Font("Helvetica", Font.PLAIN, 14));
             lcdDisplay.setForeground(new Color(0,0,0));
             lcdDisplay.setBackground(new Color(107,128,128));
             add(lcdDisplay);
    //Memory Panel, which appears just to the right of the Display Panel.
    //The label is placed and sized with the setBounds(x,y,width,height)
    //method, and the font, foreground color and background color are all
    //set. Then the label is added to the layout of the applet.
             LabelMem.setBounds(20,15,20,30);
             LabelMem.setFont(new Font("Helvetica", Font.BOLD, 16));
             LabelMem.setForeground(new Color(193,0,0));
             LabelMem.setBackground(new Color(0,0,0));
             add(LabelMem);
    //Rad,Grad and Deg panels,which appear below the memory panel.
             LabelRad.setBounds(20,50,20,15);
             LabelRad.setFont(new Font("Helvetica", Font.BOLD, 8));
             LabelRad.setForeground(new Color(193,0,0));
             LabelRad.setBackground(new Color(0,0,0));
             add(LabelRad);
             LabelDeg.setBounds(20,70,20,15);
             LabelDeg.setFont(new Font("Helvetica", Font.BOLD, 8));
             LabelDeg.setForeground(new Color(193,0,0));
             LabelDeg.setBackground(new Color(0,0,0));
             add(LabelDeg);
             LabelGrad.setBounds(20,90,20,15);
             LabelGrad.setFont(new Font("Helvetica", Font.BOLD, 8));
             LabelGrad.setForeground(new Color(193,0,0));
             LabelGrad.setBackground(new Color(0,0,0));
             add(LabelGrad);
    //SciCalc v1.0 Label, this merely indicates the name.        
             SciCalc.setBounds(60,350,200,50);
             SciCalc.setFont(new Font("papyrus", Font.BOLD, 25));
             SciCalc.setForeground(new Color(0,50,191));
             SciCalc.setBackground(new Color(219,219,219));
             add(SciCalc);
         //END OF LABEL INITIALISATION
         //NUMERIC BUTTON INITIALISATION
             button1.addActionListener(this);
             button1.setBounds(42,105,60,34);
             button1.setForeground(new Color(0,0,0));
             button1.setBackground(new Color(128,128,128));
             button1.setFont(new Font("Dialog", Font.BOLD, 18));
             add(button1);
             button2.addActionListener(this);
             button2.setBounds(106,105,60,34);
             button2.setForeground(new Color(0,0,0));
             button2.setBackground(new Color(128,128,128));
             button2.setFont(new Font("Dialog", Font.BOLD, 18));
             add(button2);
             button3.addActionListener(this);
             button3.setBounds(170,105,60,34);
             button3.setForeground(new Color(0,0,0));
             button3.setBackground(new Color(128,128,128));
             button3.setFont(new Font("Dialog", Font.BOLD, 18));
             add(button3);
             button4.addActionListener(this);
             button4.setBounds(42,145,60,34);
             button4.setForeground(new Color(0,0,0));
             button4.setBackground(new Color(128,128,128));
             button4.setFont(new Font("Dialog", Font.BOLD, 18));
             add(button4);
             button5.addActionListener(this);
             button5.setBounds(106,145,60,34);
             button5.setForeground(new Color(0,0,0));
             button5.setBackground(new Color(128,128,128));
             button5.setFont(new Font("Dialog", Font.BOLD, 18));
             add(button5);
             button6.addActionListener(this);
             button6.setBounds(170,145,60,34);
             button6.setForeground(new Color(0,0,0));
             button6.setBackground(new Color(128,128,128));
             button6.setFont(new Font("Dialog", Font.BOLD, 18));
             add(button6);
             button7.addActionListener(this);
             button7.setBounds(42,185,60,34);
             button7.setForeground(new Color(0,0,0));
             button7.setBackground(new Color(128,128,128));
             button7.setFont(new Font("Dialog", Font.BOLD, 18));
             add(button7);
             button8.addActionListener(this);
             button8.setBounds(106,185,60,34);
             button8.setForeground(new Color(0,0,0));
             button8.setBackground(new Color(128,128,128));
             button8.setFont(new Font("Dialog", Font.BOLD, 18));
             add(button8);
             button9.addActionListener(this);
             button9.setBounds(170,185,60,34);
             button9.setForeground(new Color(0,0,0));
             button9.setBackground(new Color(128,128,128));
             button9.setFont(new Font("Dialog", Font.BOLD, 18));
             add(button9);
             button0.addActionListener(this);
             button0.setBounds(106,225,60,34);
             button0.setForeground(new Color(0,0,0));
             button0.setBackground(new Color(128,128,128));
             button0.setFont(new Font("Dialog", Font.BOLD, 18));
             add(button0);
         //END OF NUMERIC BUTTON INITIALISATION        
         //OPERATOR BUTTON INITIALISATION         
             buttonDecimal.addActionListener(this);
             buttonDecimal.setBounds(42,225,60,34);
             buttonDecimal.setForeground(new Color(0,0,0));
             buttonDecimal.setBackground(new Color(254,204,82));
             buttonDecimal.setFont(new Font("Dialog", Font.BOLD, 18));
             add(buttonDecimal);
             buttonPlusMinus.addActionListener(this);
             buttonPlusMinus.setBounds(106,325,60,17);
             buttonPlusMinus.setForeground(new Color(0,0,0));
             buttonPlusMinus.setBackground(new Color(0,118,191));
             buttonPlusMinus.setFont(new Font("Dialog", Font.BOLD, 16));
             add(buttonPlusMinus);
             buttonMinus.addActionListener(this);
             buttonMinus.setBounds(234,145,60,34);
             buttonMinus.setForeground(new Color(0,0,0));
             buttonMinus.setBackground(new Color(254,204,82));
             buttonMinus.setFont(new Font("Dialog", Font.BOLD, 18));
             add(buttonMinus);
             buttonMultiply.addActionListener(this);
             buttonMultiply.setBounds(234,225,60,34);
             buttonMultiply.setForeground(new Color(0,0,0));
             buttonMultiply.setBackground(new Color(254,204,82));
             buttonMultiply.setFont(new Font("Dialog", Font.BOLD, 18));
             add(buttonMultiply);
             buttonPlus.addActionListener(this);
             buttonPlus.setBounds(234,105,60,34);
             buttonPlus.setForeground(new Color(0,0,0));
             buttonPlus.setBackground(new Color(254,204,82));
             buttonPlus.setFont(new Font("Dialog", Font.BOLD, 18));
             add(buttonPlus);
             buttonEquals.addActionListener(this);
             buttonEquals.setBounds(170,225,60,34);
             buttonEquals.setForeground(new Color(0,0,0));
             buttonEquals.setBackground(new Color(254,204,82));
             buttonEquals.setFont(new Font("Dialog", Font.BOLD, 18));
             add(buttonEquals);
             buttonDivide.addActionListener(this);
             buttonDivide.setBounds(234,185,60,34);
             buttonDivide.setForeground(new Color(0,0,0));
             buttonDivide.setBackground(new Color(254,204,82));
             buttonDivide.setFont(new Font("Dialog", Font.BOLD, 18));
             add(buttonDivide);
             buttonClear.addActionListener(this);
             buttonClear.setBounds(234,65,60,34);
             buttonClear.setFont(new Font("Dialog", Font.BOLD, 18));
             buttonClear.setForeground(new Color(0,0,0));
             buttonClear.setBackground(new Color(193,0,0));
             add(buttonClear);
             buttonMPlus.addActionListener(this);
             buttonMPlus.setBounds(170,65,60,34);
             buttonMPlus.setFont(new Font("Dialog", Font.BOLD, 18));
             buttonMPlus.setForeground(new Color(0,0,0));
             buttonMPlus.setBackground(new Color(254,204,82));
             add(buttonMPlus);
             buttonMClear.addActionListener(this);
             buttonMClear.setBounds(42,65,60,34);
             buttonMClear.setForeground(new Color(193,0,0));
             buttonMClear.setBackground(new Color(254,204,82));
             buttonMClear.setFont(new Font("Dialog", Font.BOLD, 18));
             add(buttonMClear);
             buttonMRecall.addActionListener(this);
             buttonMRecall.setBounds(106,65,60,34);
             buttonMRecall.setForeground(new Color(0,0,0));
             buttonMRecall.setBackground(new Color(254,204,82));
             buttonMRecall.setFont(new Font("Dialog", Font.BOLD, 18));
             add(buttonMRecall);
         //END OF OPERATOR BUTTON INITIALISATION
         // SCIENTIFIC BUTTONS INITIALISATION   
             buttonPi.addActionListener(this);
             buttonPi.setBounds(42,265,60,17);
             buttonPi.setForeground(new Color(0,0,0));
             buttonPi.setBackground(new Color(0,118,191));
             buttonPi.setFont(new Font("Dialog", Font.BOLD, 10));
             add(buttonPi);
             buttonSqrt.addActionListener(this);
             buttonSqrt.setBounds(106,265,60,17);
             buttonSqrt.setForeground(new Color(0,0,0));
             buttonSqrt.setBackground(new Color(0,118,191));
             buttonSqrt.setFont(new Font("Dialog", Font.BOLD, 10));
             add(buttonSqrt);
             buttonCbrt.addActionListener(this);
             buttonCbrt.setBounds(170,265,60,17);
             buttonCbrt.setForeground(new Color(0,0,0));
             buttonCbrt.setBackground(new Color(0,118,191));
             buttonCbrt.setFont(new Font("Dialog", Font.BOLD, 10));
             add(buttonCbrt);
             buttonyX.addActionListener(this);
             buttonyX.setBounds(42,285,60,17);
             buttonyX.setForeground(new Color(0,0,0));
             buttonyX.setBackground(new Color(0,118,191));
             buttonyX.setFont(new Font("Dialog", Font.BOLD, 10));
             add(buttonyX);
             buttonx2.addActionListener(this);
             buttonx2.setBounds(234,265,60,17);
             buttonx2.setForeground(new Color(0,0,0));
             buttonx2.setBackground(new Color(0,118,191));
             buttonx2.setFont(new Font("Dialog", Font.BOLD, 10));
             add(buttonx2);
             buttonRad.addActionListener(this);
             buttonRad.setBounds(170,285,60,17);
             buttonRad.setForeground(new Color(0,0,0));
             buttonRad.setBackground(new Color(0,118,191));
             buttonRad.setFont(new Font("Dialog", Font.BOLD, 10));
             add(buttonRad);
             buttonGrad.addActionListener(this);
             buttonGrad.setBounds(234,285,60,17);
             buttonGrad.setForeground(new Color(0,0,0));
             buttonGrad.setBackground(new Color(0,118,191));
             buttonGrad.setFont(new Font("Dialog", Font.BOLD, 10));
             add(buttonGrad);
             buttonDeg.addActionListener(this);
             buttonDeg.setBounds(106,285,60,17);
             buttonDeg.setForeground(new Color(0,0,0));
             buttonDeg.setBackground(new Color(0,118,191));
             buttonDeg.setFont(new Font("Dialog", Font.BOLD, 10));
             add(buttonDeg);
             buttonSin.addActionListener(this);
             buttonSin.setBounds(42,305,60,17);
             buttonSin.setForeground(new Color(0,0,0));
             buttonSin.setBackground(new Color(0,118,191));
             buttonSin.setFont(new Font("Dialog", Font.BOLD, 10));
             add(buttonSin);
             buttonCos.addActionListener(this);
             buttonCos.setBounds(106,305,60,17);
             buttonCos.setForeground(new Color(0,0,0));
             buttonCos.setBackground(new Color(0,118,191));
             buttonCos.setFont(new Font("Dialog", Font.BOLD, 10));
             add(buttonCos);
             buttonTan.addActionListener(this);
             buttonTan.setBounds(170,305,60,17);
             buttonTan.setForeground(new Color(0,0,0));
             buttonTan.setBackground(new Color(0,118,191));
             buttonTan.setFont(new Font("Dialog", Font.BOLD, 10));
             add(buttonTan);
             buttonExp.addActionListener(this);
             buttonExp.setBounds(234,305,60,17);
             buttonExp.setForeground(new Color(193,0,0));
             buttonExp.setBackground(new Color(0,118,191));
             buttonExp.setFont(new Font("Dialog", Font.BOLD, 10));
             add(buttonExp);
             buttonLogn.addActionListener(this);
             buttonLogn.setBounds(234,325,60,17);
             buttonLogn.setForeground(new Color(0,0,0));
             buttonLogn.setBackground(new Color(0,118,191));
             buttonLogn.setFont(new Font("Dialog", Font.BOLD, 10));
             add(buttonLogn);
             buttonOpenBracket.addActionListener(this);
             buttonOpenBracket.setBounds(42,325,60,17);
             buttonOpenBracket.setForeground(new Color(0,0,0));
             buttonOpenBracket.setBackground(new Color(0,118,191));
             buttonOpenBracket.setFont(new Font("Dialog", Font.BOLD, 10));
             add(buttonOpenBracket);
             buttonLog.addActionListener(this);
             buttonLog.setBounds(170,325,60,17);
             buttonLog.setForeground(new Color(0,0,0));
             buttonLog.setBackground(new Color(0,118,191));
             buttonLog.setFont(new Font("Dialog", Font.BOLD, 10));
             add(buttonLog);
         //END OF SCIENTIFIC BUTTON INITIALISATION     
         //DISPLERROR INITIALISATION      
             DisplError.setBounds(42,45,253,15);
             DisplError.setFont(new Font("Dialog", Font.BOLD, 8));
             DisplError.setForeground(new Color(16711680));
             DisplError.setBackground(new Color(0));
             add(DisplError);
         //END OF DISPLERROR INITIALISATION
             Clicked_Clear();      //calls the Clicked_Clear method (C button)
         } //END OF INIT METHOD
    //The following integers are declared as final as they will
    //be used for determining which button has been pushed
         public final static int OpMinus=11,
                                     OpMultiply=12,
                                     OpPlus=13,
                                     OpDivide=15,
                                     OpMPlus=19,
                                     OpMClear=20,
                                     OpMR=21,
                                     OpyX=22,
                                     OpExp=23;
    //This method is called whenever anything needs to be displayed
    //in the error message field at the bottom of the calculator,
    //accepting a String as an argument
      void DisplayError(String err_msg)
    //Calls the setText method of the Label DisplError, sending
    //whatever string it received initially
        DisplError.setText(err_msg);
    //This method is called whenever a numeric button (0-9) is pushed.
    public void NumericButton(int i)
         DisplayError(" ");      //Clears the error message field
    //Declares a String called Display that will initialize to whatever
    //is currently displayed in the lcdDisplay of the calculator
        String Display = lcdDisplay.getText();
    //Checks if an operator key has just been pressed, and if it has,
    //then the limit of 20 digits will be reset for the user so that
    //they can enter in up to 20 new numbers
             if (OperatorKey == true)
               Counter = 0;
             Counter = Counter + 1;    //increments the counter
    //This is a condition to see if the number currently displayed is zero OR
    //an operator key other than +, -, *, or / has been pressed.
             if ((Display == "0") || (Status == "FIRST"))
               Display= "";      //Do not display any new info
             if (Counter < 21)     //if more than 20 numbers are entered
    //The number just entered is appended to the string currently displayed
         Display = Display + String.valueOf(i);
             else
    //call the DisplayError method and send it an error message string
         DisplayError("Digit Limit of 20 Digits Reached");
         lcdDisplay.setText(Display);       //sets the text of the lcdDisplay          
                                       //Label
        Status = "VALID";            //sets the Status string to valid
        OperatorKey = false;           //no operator key was pressed
        FunctionKey = false;           //no function key was pressed
    //This method is called whenever an operator button is pressed, and is   
    //sent an integer value representing the button pressed.
           public void OperatorButton(int i)
         DisplayError(" ");      //Clears the error message field
    //Creates a new Double object with the specific purpose of retaining
    //the string currently on the lcdDisplay label, and then immediately
    //converts that string into a double-precision real number and then
    //gives that number to the variable Result.
             Result = (new Double(lcdDisplay.getText())).doubleValue();
    //If no operator key has been pressed OR a function has been pressed
         if ((OperatorKey == false) || (FunctionKey = true))
         switch (Operator)     //depending on the operation performed
    //if the user pressed the addition button, add the two numbers
    //and put them in double Result
            case OpPlus     : Result = Operand + Result;
                      break;
    //if the user pressed the subtraction button, subtract the two
    //numbers and put them in double Result
         case OpMinus    : Result = Operand - Result;
                      break;
    //if the user pressed the multiplication button, multiply
    //the two numbers and put them in double Result
            case OpMultiply : Result = Result * Operand;
                      break;
    //if the user pressed the yX button, take first number
    //and multiply it to the power of the second number                 
         case OpyX : double temp1=Operand;
                        for (int loop=0; loop<Result-1; loop++){
                              temp1= temp1*Operand;
                        Result=temp1;
                      break;
    //if the user pressed the Exp button -----------------Find out what this does-------------         
         case OpExp :  temp1=10;
                          for(int loop=0; loop<Result-1; loop++)
                          temp1=temp1*10;
                           Result=Result*temp1;
                     break;
    //if the user pressed the division button, check to see if
    //the second number entered is zero to avoid a divide-by-zero
    //exception
            case OpDivide   : if (Result == 0)
                        //set the Status string to indicate an
                        //an error
                        Status = "ERROR";
                        //display the word "ERROR" on the
                        //lcdDisplay label
                        lcdDisplay.setText("ERROR");
                        //call the DisplayError method and
                        //send it a string indicating an error
                        //has occured and of what type
                        DisplayError("ERROR: Division by Zero");
                      else
                        //divide the two numbers and put the
                        //answer in double Result
                   Result = Operand / Result;
    //if after breaking from the switch the Status string is not set
    //to "ERROR"
              if (Status != "ERROR")
            Status = "FIRST";      //set the Status string to "FIRST" to
                                 //indicate that a simple operation was
                                 //not performed
            Operand = Result; //Operand holds the value of Result
            Operator = i;   //the integer value representing the
                            //operation being performed is stored
                            //in the integer Operator
            //The lcdDisplay label has the value of double Result
            //displayed
         lcdDisplay.setText(String.valueOf(Result));
            //The boolean decimal flag is set false, indicating that the
            //decimal button has not been pressed
         DecimalFlag = false;
            //The boolean sign flag is set false, indicating that the sign
            //button has not been pressed
         SignFlag = false;
            //The boolean OperatorKey is set true, indicating that a simple
            //operation has been performed
         OperatorKey = true;
            //The boolean FunctionKey is set false, indicating that a
            //function key has not been pressed
         FunctionKey = false;
            DisplayError(" ");    //Clears the error message field
      }     //end of OperatorButton method
      //This is a method that is called whenever the decimal button is
      //pressed.
      public void DecimalButton()
        DisplayError(" ");    //Clears the error message field
      //Declares a String called Display that will initialize to whatever
      //is currently displayed in the lcdDisplay of the calculator
        String Display = lcdDisplay.getText();
        //if a simple operation was performed successfully
         if (Status == "FIRST")
          Display = "0";    //set Display string to character 0
        //If the decimal button has not already been pressed
         if (!DecimalFlag)
          //appends a decimal to the string Display
          Display = Display + ".";
        else
               //calls the DisplayError method, sending a string
               //indicating that the number already has a decimal
          DisplayError("Number already has a Decimal Point");
             //calls the setText method of the Label lcdDisplay and
              //sends it the string Display
        lcdDisplay.setText(Display);
         DecimalFlag = true;        //the decimal key has been pressed
             Status = "VALID";        //Status string indicates a valid
                               //operation has been performed
        OperatorKey = false;         //no operator key has been pressed
      } //end of the DecimalButton method
      /* This method is called whenever the percent button is pressed
      void Open_Bracket(){
        String Display = "(";
        lcdDisplay.setText(Display);//-----------Change this--------------
    //This method is called first when the calculator is initialized
    //with the init() method, and is called every time the "C" button
    //is pressed
      void Clicked_Clear()
        Counter = 0;        //sets the counter to zero
        Status = "FIRST";   //sets Status to FIRST
        Operand = 0;        //sets Operand to zero
        Result = 0;         //sets Result to zero
        Operator = 0;       //sets Operator integer to zero
        DecimalFlag = false;         //decimal button has not been
                                     //pressed
        SignFlag = false;          //sign button has not been pressed
        OperatorKey = false;         //no operator button has been
                                //pressed
        FunctionKey = false;         //no function button has been
                                //pressed
    //calls the setText method of Label lcdDisplay and sends
    //it the character "0"
        lcdDisplay.setText("0"); 
        DisplayError(" ");           //clears the error message field
    //This method is called whenever the sign button is pressed
         void PlusMinusButton()
        DisplayError(" ");           //clears the error message field
    //Declares a String called Display that will initialize to whatever
    //is currently displayed in the lcdDisplay of the calculator
        String Display = lcdDisplay.getText();
    //if Status is not set to FIRST and the Display string does not
    //hold the value "0"
        if ((Status != "FIRST") || (Display != "0"))
    //Creates a new Double object with the specific purpose of retaining
    //the string currently on the lcdDisplay label, and then immediately
    //converts that string into a double-precision real number and then
    //gives that number to the variable Result.
          Result = (new Double(lcdDisplay.getText())).doubleValue();
          //sets the double Result to it's negative value
          Result = -Result;
          //call the setText method of Label lcdDisplay and send it the string
          //that represents the value in Result
          lcdDisplay.setText(String.valueOf(Result));
          Status = "VALID";        //sets Status string to VALID
          SignFlag = true;         //the sign button has been pressed
          DecimalFlag = true;        //a decimal has appeared
      } //end of the PlusMinusButton method
    //This method is called whenever the square button is pressed */
         void SqrButton()
        DisplayError(" ");      //clears the error message field
    //Declares a String called Display that will initialize to whatever
    //is currently displayed in the lcdDisplay of the calculator
        String Display = lcdDisplay.getText();
    //if Status is not set to FIRST and the Display string does not
    //hold the value "0"
        if ((Status != "FIRST") || (Display != "0"))
    //Creates a new Double object with the specific purpose of retaining
    //the string currently on the lcdDisplay label, and then immediately
    //converts that string into a double-precision real number and then
    //gives that number to the variable Result.
          Result = (new Double(lcdDisplay.getText())).doubleValue();
    //multiply the double Result by itself, effectively squaring
    //the number
          Result = Result * Result;
    //call the setText method of Label lcdDisplay and send it the string
    //that represents the value in Result
         lcdDisplay.setText(                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                &

    Chris,
    Two issues:
    1) Applet has init(), start(), etc. Application has main().
    2) Applet is a container and you can add stuff to it. With application, you need to create your own container.
    What you want to do is code so that you can run either way. In the applet, create a Panel or JPanel and add everything to the panel. Then add the panel to the applet. Get that working as an applet.
    Now add a main(). All it has to do is create a Frame or JFrame, add the panel to the frame and then call init().
    On another subject, your code looks very good, except for the method length getting out of hand. Try breaking init() into pieces in a bunch of methods:
    public void init() {
       doThis();
       doThat();
       doTheOther();
    private void doThis() {
       // maybe a couple dozen lines here
    // etc.

  • What happens to the rendered animated buttons on sub-menus

    I am on a 3GB of memory MacBook Pro using Encore (CS3). Here is a description of how I have produced a working DVD...so far 3 out of 5 DVDs I have tried to render have worked.
    ANYWAY...seems that Encore implodes when I try to render the same project more than one at a time. Encore chokes and I am back in the MAC OS.
    HERE is my main question...every time it blows it seems to blow away the RENDERED ANIMATED BUTTONS on the secondary menu. SO each time I try this again I have to re-render the buttons taking about 1.5 hours. Why do I have to re-render...why aren't the rendered 2nd level menus SAVED.
    To make it clear...after I rendered the menus...previewed...saw the buttons are animated...SAVED...try to write a DVD Disc from the Current Project...succeed...try to burn another DVD...it aborts (why...I have no idea)...I empty trash...bring up Encore again...try to preview the secondary menu...NO ANIMATION there so have to rerender and start all over.
    I have been reading about compatibility of DVD disc, computer players and DVD players...what a PILE...without all the techies our there we can't make a dependable environment to create, burn and play DVDs...these companies should be ashamed...all they are doing is producing a whole bunch of frustrated producers (or lack of producing producers).
    Can anyone shed a light on my problem!?!?
    Thanks, --bill
    p.s. Are there better forums than here at Adobe? Seems I don't get many if any replies to queries.

    Bill,
    A couple of questions, mainly to make sure that I understand what is happening.
    1.) There are two files (an audio and a MOV), that show in the Orphanage, when you Check Project. Do they appear there BEFORE you Check Project, or only AFTER?
    2.) Do they appear BEFORE in your Project Panel, or only AFTER you Check Project?
    3.) Since they are Orphans, I assume that you do not intend to use them in this Project - right? Were they ever in the Project (Imported as Assets, or Timelines)?
    4.) Was this Project started fresh, or did you modify an existing Project, to create it, say using a Save_As, etc.?
    5.) If they were not Imported into this Project, were they Imported into another Project, that is/was being worked on coincidental to this one?
    6.) Can you find these files on your system? Where are they located?
    If 1.) is After and 2.) is After, then your Project might be corrupt. The Assets/Timelines/etc. are linked to the Project by XML. This can become corrupt for many reasons, most are often unknown - power dip, or hardware issue on Save, etc..
    Two ways to check this theory, is to start the Project from scratch, and see what happens. Another is to use a freeware program, XML Wrench, and run the Project file through it. Aside from pointing out broken links, and other problems, it should also allow you to search for these files names in the body. Save a copy of the Project file, so you will have it untouched, and then remove any lines, that reference these files. Save_As (new Project name) and open that in Encore. Being on MAC, doesnt every data file have a finder file, associated with it? Could this finder file be cross-linked, in some way, to your real Assets?
    It could be that there is a hardware issue, and this causes the links to the Rendered files to become broken, and also to link to files, that should not be included. Any other strange things with your system lately? I do not know the MAC folder/file structure, but can you do the equivalent of Windows Check Disk? If so, set it to find lost clusters, or whatever MAC calls them.
    Also, being on PC, I do not know what utilities might be available for your OS, or what other programs might be causing a problem. On PCs, other DVD burning software, especially if their packet-writing applet is installed, can cause havoc with Encore and are discouraged. Anything else installed, and/or running, that you can think of?
    Sorry to play twenty questions, but Id like to be as clear, as I can, on exactly what is happening, before I make too many more guesses.
    Hunt

  • JAWS does not always read  Swing menus

    I have come across a problem that involves JAWS 4.51 and Java menus in Internet Explorer.
    I have a Java application that has a JMenuBar. The menu bar contains several JMenus that in turn contain several JMenuItems.
    When navigating through a menu, JAWS reads every JMenuItem. However, once a disabled JMenuItem is reached, JAWS no longer reads the JMenuItems below the disabled one in the open JMenu.
    The problem occurs only in Internet Explorer on "plain" menu items that follow a disabled menu item. The problem does not affect "complex" menu items, such as those that open sub menus.
    I can only reproduce this problem in Internet Explorer 6. Netscape Communicator 7, Web Start clients and a command line launch do not suffer from this problem. Also, JAWS 4.02 is fine as well; only 4.51 has this problem.
    Attached at the end is a sample application that recreates the issue. You'll notice in the sample application that JAWS will not read "A check box menu item" and "Another one" while it will read "A submenu."
    Does anyone have a solution to this? Thanks a lot!
    Sample application:
    ======================================================
    Note: The code below is a modification of the Sun menu tutorial found at http://java.sun.com/docs/books/tutorial/uiswing/components/menu.html
    middle.gif can be downloaded from http://java.sun.com/docs/books/tutorial/uiswing/components/example-1dot4/images/middle.gif
    MenuLookDemoApplet.java:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.JMenu;
    import javax.swing.JMenuItem;
    import javax.swing.JCheckBoxMenuItem;
    import javax.swing.JRadioButtonMenuItem;
    import javax.swing.ButtonGroup;
    import javax.swing.JMenuBar;
    import javax.swing.KeyStroke;
    import javax.swing.ImageIcon;
    import javax.swing.JPanel;
    import javax.swing.JTextArea;
    import javax.swing.JScrollPane;
    import javax.swing.JApplet;
    /* MenuLookDemoApplet.java is a 1.4 application that requires images/middle.gif. */
    * This class exists solely to show you what menus look like.
    * It has no menu-related event handling.
    public class MenuLookDemoApplet extends JApplet {
        JTextArea output;
        JScrollPane scrollPane;
        public JMenuBar createMenuBar() {
            JMenuBar menuBar;
            JMenu menu, submenu;
            JMenuItem menuItem;
            JRadioButtonMenuItem rbMenuItem;
            JCheckBoxMenuItem cbMenuItem;
            //Create the menu bar.
            menuBar = new JMenuBar();
            //Build the first menu.
            menu = new JMenu("A Menu");
            menu.setMnemonic(KeyEvent.VK_A);
            menu.getAccessibleContext().setAccessibleDescription(
                    "The only menu in this program that has menu items");
            menuBar.add(menu);
            //a group of JMenuItems
            menuItem = new JMenuItem("A text-only menu item",
                                     KeyEvent.VK_T);
            //menuItem.setMnemonic(KeyEvent.VK_T); //used constructor instead
            menuItem.setAccelerator(KeyStroke.getKeyStroke(
                    KeyEvent.VK_1, ActionEvent.ALT_MASK));
            menuItem.getAccessibleContext().setAccessibleDescription(
                    "This doesn't really do anything");
            menu.add(menuItem);
            ImageIcon icon = createImageIcon("images/middle.gif");
            menuItem = new JMenuItem("Both text and icon", icon);
            menuItem.setMnemonic(KeyEvent.VK_B);
            menu.add(menuItem);
            menuItem = new JMenuItem(icon);
            menuItem.setMnemonic(KeyEvent.VK_D);
            menu.add(menuItem);
            //a group of radio button menu items
            menu.addSeparator();
            ButtonGroup group = new ButtonGroup();
            rbMenuItem = new JRadioButtonMenuItem("A radio button menu item");
            rbMenuItem.setSelected(true);
            rbMenuItem.setMnemonic(KeyEvent.VK_R);
            group.add(rbMenuItem);
            menu.add(rbMenuItem);
            rbMenuItem = new JRadioButtonMenuItem("Another one");
            rbMenuItem.setMnemonic(KeyEvent.VK_O);
            group.add(rbMenuItem);
            menu.add(rbMenuItem);
            rbMenuItem.setEnabled(false);   //@dpb
            //a group of check box menu items
            menu.addSeparator();
            cbMenuItem = new JCheckBoxMenuItem("A check box menu item");
            cbMenuItem.setMnemonic(KeyEvent.VK_C);
            menu.add(cbMenuItem);
            cbMenuItem = new JCheckBoxMenuItem("Another one");
            cbMenuItem.setMnemonic(KeyEvent.VK_H);
            menu.add(cbMenuItem);
            //a submenu
            menu.addSeparator();
            submenu = new JMenu("A submenu");
            submenu.setMnemonic(KeyEvent.VK_S);
            menuItem = new JMenuItem("An item in the submenu");
            menuItem.setAccelerator(KeyStroke.getKeyStroke(
                    KeyEvent.VK_2, ActionEvent.ALT_MASK));
            submenu.add(menuItem);
            menuItem = new JMenuItem("Another item");
            submenu.add(menuItem);
            menu.add(submenu);
            //Build second menu in the menu bar.
            menu = new JMenu("Another Menu");
            menu.setMnemonic(KeyEvent.VK_N);
            menu.getAccessibleContext().setAccessibleDescription(
                    "This menu does nothing");
            menuBar.add(menu);
            return menuBar;
        public Container createContentPane() {
            //Create the content-pane-to-be.
            JPanel contentPane = new JPanel(new BorderLayout());
            contentPane.setOpaque(true);
            //Create a scrolled text area.
            output = new JTextArea(5, 30);
            output.setEditable(false);
            scrollPane = new JScrollPane(output);
            //Add the text area to the content pane.
            contentPane.add(scrollPane, BorderLayout.CENTER);
            return contentPane;
        /** Returns an ImageIcon, or null if the path was invalid. */
        protected static ImageIcon createImageIcon(String path) {
            java.net.URL imgURL = MenuLookDemo.class.getResource(path);
            if (imgURL != null) {
                return new ImageIcon(imgURL);
            } else {
                System.err.println("Couldn't find file: " + path);
                return null;
        public void init() {
            MenuLookDemoApplet demo = new MenuLookDemoApplet();
            setJMenuBar(demo.createMenuBar());
            setContentPane(demo.createContentPane());
    applet.html:
    <html>
    <head>
        <title>Menu Test Page </title>
    </head>
    <body>
    Here's the applet:
    <applet code="MenuLookDemoApplet.class" width="300" height="300">
    </applet>
    </body>
    </html>

    Unfortunately the menu items are fully accessible (or so our internal accessibility tool claims). It doesn't seem to be a problem on that level, but I was hoping that perhaps something else was interfeering.
    As for the JTable reading the previous cell, I've notice that it reads the last non-empty cell (regardless of whether it was the previous cell or not) when clicking or moving with the arrow keys to an empty cell. It works fine when clicking or moving to non-empty cells.
    I don't have any empty cells in the actual application so I did not try to fix it. My suspicions are that either an event is not being fired or the selection position is not being updated on the empty cells.

  • PopupMenu  displayed incorrectly in applet on Mac 9.2 and Netscape 7.02

    Hi All,
    I am running an applet on Mac OS 9.2 with Netscape 7.02 (with default jvm, no additional plug-in installed).
    The applet contains menubar with 5 Menus (implemented using PopupMenu) options. The diffrent menus are File, Edit, Zoom, Transform and Help, with diffrent menu-items added to them.
    When any of the menus is selected for the first time the contents of Zoom menu pops up (even if user clicks on File or Edit etc). This happens only for the first time. From second time onwards no such problem repeates.
    The code has been checked thoroughly and various changes done, but the problem could not be solved.
    Has anyone come across similar problem? Is there any solution for the specified problem?
    Thanx & Regards,
    Charu

    It would be nice to see the sources...
    Usually, people don't use PopupMenu for implementing menus in menu bar - they use JMenu for this. Did you try that? Or do you use JMenu and still have problems?

  • Events in a SIM toolkit applet

    Hi,
    I am looking at some sample (and simple) code:
    public MyApplet() {
              // Define the applet Menu Entry
              idMenu1 = reg.initMenuEntry(Menu1, (short) 0, (short) Menu1.length,
                        PRO_CMD_SELECT_ITEM, false, (byte) 0, (short) 0);
              // Define the Unformatted SMS PP event that trigger the applet
              reg.setEvent(EVENT_UNFORMATTED_SMS_PP_ENV);
    public void processToolkit(byte event) {
              EnvelopeHandler envHdlr = EnvelopeHandler.getTheHandler();          
              if (event == EVENT_MENU_SELECTION) {
                   byte selectedItemId = envHdlr.getItemIdentifier();
                   if (selectedItemId == idMenu1) {
                        menu1Action();
              if (event == EVENT_UNFORMATTED_SMS_PP_ENV) {
                   UnformattedSmsPpAction();
    In processToolkit we procees EVENT_MENU_SELECTION and EVENT_UNFORMATTED_SMS_PP_ENV, yet in the ctor we subscribed only for the latter. Does that mean that it is not necessary to subscribe to EVENT_MENU_SELECTION and that this event is always delivered to the applet (that created the menu)?

    For UICC, SIM etc check this link: [http://en.wikipedia.org/wiki/UICC]
    For ETSI, 3GPP etc., this is where it gets confusing, you should do the research for yourself. As for using the latest specification, you actually want to use the specification your card complies to, i.e. if the card is old it may not comply with the latest specifications.
    Regarding Java applets and toolkit applets:
    To send commands to a Java applet you first select (see GlobalPlatform standard) it and then you send it some APDUs as specified in the 7816-4 and GlobalPlatform standards. You can also implement custom APDUs that only your applet will recognize.
    The toolkit applets are Java applets, you can send them APDUs (first you select them) as well. The difference is that toolkit applets can also receive events from the mobile phone like SMS received or user selected some menu. You can also send commands to the phone to display text, menus etc.
    A Java applet can do what a toolkit applet does, but to implement it yourself you be very hard. The Java API that is used in toolkit applet programming provides facilities to (for example) show something on the phone's display without sending and receiving heaps of APDUs.
    If your card will be used in a mobile phone then you write a toolkit applet (to which you can still send APDUs if you have to). If your card will be used for something else, like access card or a bank card then you don't need toolkit applet functionality.
    The biggest problem with this technology that there are almost no books, only the standards, which you do have to read, and forums.

  • Loading Apps Applet

    Hi All,
    I have a question, i.e, as soon as we logon into apps from the front end, we see the products list for apps and the list of menus and responsibilities. on which after choosing any one the apps applet is loaded. During this loading of the applet and the jar files, sometimes time is enormously consumed due to network traffic at peak times, hence leading to deterioration of performance.
    I wanted to know whether we can keep these files loaded in the user's local machine along with the J-initiator. So that the barest minimum time is required to run apps applet. As in oracle apps, the applet plays a pivotal role in compiling the forms 6 to be displayed as a web based applet. As after the apps is loaded, we only require a constant connection with the database, and so in the near future if the files get updated they can be automatically downloaded to the user's local machine.
    Thnx ...
    Rgds
    Shruti

    Also, check you have the JAR cache size configured on your local JInitiator client (Under Control Panel -> JInitiator 1.3.1.x). The JInitiator control panel will indicate the local JAR cache location (Usually under c:\Documents and Settings\<User>\Local Settings\Application Data\Oracle)
    By default, JInitiator is configured with a 50Mb local cache, which should be enough for the 11i Jar files.
    Also, note that the cache is individual to the windows user logged on - e.g. different logins will have separate disk cache areas.
    Hope it helps,
    B.

  • [SOLVED]kdeplasma-applets-menubar doesn't work.

    I've just installed the following applications:
        kdeplasma-applets-menubar,
        libdbusmenu,
        libdbusmenu-qt,
        appmenu-gtk,
        appmenu-qt.
    But kdeplasma-applets-menubar doesn't work on my KDE4.10. The menu still show in the window and the applet only has the onmipresent "File" menu.
    Last edited by mert (2013-06-22 14:22:20)

    Go to 'System Settings' -> 'Application Appearance' -> 'Style' -> 'Fine Tuning' and change 'Menubar style' to 'Only export'. Just checked, works fine with qt applications.
    I'm not sure about gtk apps, though. I recall reading somewhere that, in addition to installing appmenu-gtk and its dependencies, one needed to specify something in the .gtkrc and/or .config/gtk-3.0/settings.ini file(s). Well that or my memory might just be playing tricks on me.
    EDIT:
    If for some reason gtk apps refuse to export their menus, you might want to look at this webupd8 article. Good luck!
    Last edited by andy_v (2013-06-22 12:36:50)

Maybe you are looking for