Disappearing Shapes in the Palette

I've only been using DVDSP for two or three days so apologies if I'm asking an obvious question. But my shapes keep disappearing from my palette every time I reopen my project.
I have several buttons on a menu that I have set up fine with shapes that I created in Photoshop. I import them ok into the Custom tab in the palette from an external hard disc, am fine when i place them as a button and they work great in the simulator. But if I close the project, I'm told that they are missing when I restart it.
The strange thing is though, that when I reimport them, I'm told that shapes of that filename are already in the palette (even though there are no icons visible).
I'm really confused, and a bit wound up by this.
Can anyone help?
Tim
12 Powerbook G4   Mac OS X (10.4.2)  

ok, so it's been alomst two weeks and there's not a single reply to this so far...
does this mean that i'm the only one who has this problem is or is there nobody out there re-using or even re-opening projects with custom shapes???
any suggestions as to what could be causeing dvdsp to loose custom shapes used in a project would be much appreciated.
thanks

Similar Messages

  • Disappearing shapes from the palette?

    so, i followed, step by step, the ken stone tutorial on making custom shapes - highly recommended set of tutorials on this and other topics - but am having a problem applying them.
    that is, i can apply them and save my project.
    if i then close the project, dvdsp clears the "custom shapes" palette - even though i did __not select "for this project only" when importing the shapes....
    now when i re-open the project, dvdsp will complain about the shape it itself has made disappear and removes the shapes from menu.
    re-importing the shape into the "custom shapes" palette triggers another error message about the shape already being there even though the shapes palette is totally empty...
    what am i missing here????
    thanks

    ok, so it's been alomst two weeks and there's not a single reply to this so far...
    does this mean that i'm the only one who has this problem is or is there nobody out there re-using or even re-opening projects with custom shapes???
    any suggestions as to what could be causeing dvdsp to loose custom shapes used in a project would be much appreciated.
    thanks

  • My tool bar (the one that is usually to the left - not the palettes on the right) has disappeared.  How do I get it back?

    My tool bar (the one that is usually to the left - not the palettes on the right) has disappeared.  How do I get it back?

    Window > Tools

  • How do i get the tab on the right where i type in words to search to come back? It disappeared, as did the arrows on the right.

    I was online, the page I was on redirected me to another site. when that happened my bar changed. The space on the left totype in words to search disappeared as did the arrows on the left side of the bar.

    Make sure that toolbars like the "Navigation Toolbar" and the "Bookmarks Toolbar" are visible: "View > Toolbars"
    * If items are missing then open the Customize window via "View > Toolbars > Customize"
    * If a missing item is in the toolbar palette then drag it back from the Customize window on the toolbar
    * If you do not see an item on a toolbar and in the toolbar palette then click the "Restore Default Set" button to restore the default toolbar set up.
    See also:
    * http://kb.mozillazine.org/Toolbar_customization
    * https://support.mozilla.com/kb/Back+and+forward+or+other+toolbar+items+are+missing

  • Please bring color back to vector shapes in Layer Palette with no-thumbnails.

    Please bring the color box back to vector shapes!
    I am one not to use images in my layer palette, and in CS5 this was a breeze, but now the icons are different, there is no white box on the icons anymore (which really helps when scanning, and differentiating from folders), and I can't preview the color of the vector shape that I created in Photoshop. Vector shapes are a big part of my work. Before it would show a box with the color, now it shows nothing. The linking vector box is not neccesarily important as long as when I click it, the points become live.
    Also the dividing lines for layers is not strong enough, doesn't have to be white, but at least gray. Black is definately not helping to divide the layers. And for nested layers, having the dividing line go half way to the edge really helps alot.
    I noticed that a lot is different about the "no-thumbnails" version of the layer palette, and some I can live with, some changes I cannot. But being able to preview the color of a vector shapes is important for me, and seeing the white box behind the icon really helps when scaning a lot of layers. I've attached a comparison, also I have attached an image of how my layer palette looks on a daily basis from CS5 and CS6, I also opened the folder, and matched the palettes so you can see what I mean. Those little things really make a difference when scanning up and down 50-100 layers.
    Even though setting the layer palette to no images may be a rarity among photoshop users, it's something that I value in photoshop, especially since my documents have hundreds of layers.

    I think it was a fair assessment given the circumastances of the answer you provided, Jeanne. Also, another thing is that posting under an "employee" account, you are speaking for the company. You are representing the company whether it is your intention or not. Even if you explictly state that what you say is your personal opinion, people might have mixed feelings about what you say and mistake it for a belief that the whole company shares. So be careful with that, just as a note for the future.
    But anyway, as for the issue at hand... That still doesn't give us anything other than "we won't do it." And again, I advise you to look through the post I referenced to. There are some very easy solutions there that help make the layers palette much easier to scan and work with. It's not too difficult to fix this and as already said above, you're already working on a fix for the thumbnails themselves anyway.
    The solution to this problem could be as easy as this (I can provide another graphic for the darker UI settings, if you want):
    What you do is:
    Display a bigger thumbnail of the layer icon (yes, that will use up more space in the no-thumbnail view, but that's not a huge problem compared to what you have now)
    Clearly display the content of the layer (in this case, both layers are gradients, but it could also just have a solid color fill)
    Lighten the color of unselected layer's names (to make the properties of the layer itself stand out better),
    Make the layer thumbnail itself (if it's a vector layer) toggle the path outline on and off and
    Bring back the separation line from CS5, which indicated the layer's position in the grouping hierarchy.
    If you do that, you've already solved quite a lot of the scannability and readability problems. In the future, you could improve the iconography to be better optimized for quick scanning, to make them stand out better (give them more depth) and so on, but for now, this should be enough to make things better for most people. And also, this will not take up too much development time. You've already got the logic of the separation lines from CS5, for example. Shouldn't be too much of a problem to implement in CS6. I'm not going to speak for the other things, because I don't know too much of the internal workings of the program, but it shouldn't be too much of an issue.
    Trust me, this change will make a world of difference. People will love this even if they don't understand that it's there or why they love it.
    Would you like me to provide detailed wireframes and documentation, so your designers don't have to worry their heads about this one? Just asking, because this is a change that should really be pushed through, no matter what.
    Cheers,
    Riho Kroll

  • How can I change the palette of a BufferedImage

    How can I change the palette of a BufferedImage ?
    My image uses an IndexColorModel but I want to use a web safe palette.
    I can't see a way to make a setColorModel() to my image.
    Any ideas ?
    Thanks...

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.io.*;
    import java.net.*;
    import javax.imageio.*;
    import javax.swing.*;
    public class ICMExample extends JComponent {
        private BufferedImage original, copy;
        private Point mouseLocation = new Point();
        public ICMExample(BufferedImage original, BufferedImage copy) {
            this.original = original;
            this.copy = copy;
            addMouseMotionListener(new MouseMotionAdapter(){
                public void mouseDragged(MouseEvent e) {
                    mouseLocation = e.getPoint();
                    repaint();
        public Dimension getPreferredSize() {
            return new Dimension(original.getWidth(), original.getHeight());
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D) g;
            g2.drawRenderedImage(original, null);
            Shape oldClip = g2.getClip();
            g2.clipRect(0, 0, mouseLocation.x, Integer.MAX_VALUE);
            g2.drawRenderedImage(copy, null);
            g2.setClip(oldClip);
        public static void main(String[] args) throws IOException {
            URL url = new URL("http://weblogs.java.net/jag/Image54-large.jpeg");
            BufferedImage original = ImageIO.read(url);
            JComponent app = new ICMExample(original, makeICMVersion(original));
            final JFrame f = new JFrame("Drag mouse over image");
                f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                f.getContentPane().add(app);
                f.pack();
                SwingUtilities.invokeLater(new Runnable(){
                    public void run() {
                        f.setLocationRelativeTo(null);
                        f.setVisible(true);
        static BufferedImage makeICMVersion(BufferedImage original) {
            int w = original.getWidth();
            int h = original.getHeight();
            IndexColorModel icm = createICM();
            BufferedImage copy = new BufferedImage(w, h, BufferedImage.TYPE_BYTE_INDEXED, icm);
            Graphics2D g = copy.createGraphics();
            g.drawRenderedImage(original, null);
            g.dispose();
            return copy;
        static IndexColorModel createICM() {
            byte MAX = (byte) 255;
            byte[] r = {MAX, MAX, MAX, MAX, 0, 0, 0, 0};
            byte[] g = {MAX, MAX, 0, 0, MAX, MAX, 0, 0};
            byte[] b = {MAX, 0, MAX, 0, MAX, 0, MAX, 0};
            return new IndexColorModel(3, 8, r, g, b);
    }

  • My iPod Nano 2nd gen. has a black caterpillar-like shape on the screen when turned off. I recharged and reset. What else should I do?

    My iPod Nano 2nd gen. has a black caterpillar-like shape on the screen when turned off.
    It disappears when turned on. It must mean something. I recharged and reset. What else, if anything, should I do?

    You can work through the remaining five 5 R's of troubleshooting.
    http://www.apple.com/support/ipod/five_rs/
    It might also be a good idea to let the iPod's battery fully drain. Then charge it back up and restore it once more in iTunes.
    Otherwise, it's likely a hardware issue with the iPod's LCD display, meaning you'll need to take or send your iPod in for service either via Apple or a third party repair service. Here is Apple's repair pricing.
    http://www.apple.com/support/ipod/service/prices/
    Note that they don't actually repair the device, but exchange it for one of the same generation, model, and capacity.  A third party service will actually replace the damage part for a little less.  Google "iPod screen repair" and you should get a number of results to work with.
    B-rock

  • DID YOU KNOW?? - ABOUT ADVANCED COMPONENTS IN THE PALETTE??

    <br>
    Hi All,
    DID YOU KNOW??
    The IDE ships with the following Advanced Components in the Palette.
    These advanced components are a set of JavaServer Page markup tags for advanced users. The components have no visual appearance and are useful to developers with experience in JSP and JavaServer Faces technologies.
    * Encoding
    * Faces Action Listener
    * Faces Converter
    * Faces Validator
    * Faces Value Change Listener
    * Faces Verbatim
    * Link
    * Load Bundle
    * Markup
    * Meta
    * Parameter
    * Script
    Lets look at MARKUP component in more detail.
    The MARKUP Component
    You can drag the Markup component Markup component icon from the Palette's Advanced category to the Visual Designer to create a standard HTML tag. The Markup component enables you to insert HTML elements into the JSP page in places that HTML is not permitted.
    When you drop this component on a page in the Visual Designer, you cannot see it on the page until you set the tag property. You can see it in the Outline window and you can select it there to edit its properties in the Properties window.
    Use the tag property to specify the type of HTML element to insert. For instance, to insert an <hr> tag, set the tag property to hr with no angle brackets and select the singleton property .
    To provide compliance with XHTML, if the HTML element you are inserting is a singleton element, you must specify the singleton property, which causes a trailing /> to be generated in the rendered HTML. For example, the <br> element is a singleton element that must be rendered as
    to make it XHTML compliant.
    If you want to specify HTML attributes in addition to id and style for the element you are inserting, use the extraAttributes property.
    Learn more :-
    http://developers.sun.com/prodtech/javatools/jscreator/reference/docs/help/2update1/components/advanced_list.html
    We would like to know the following from you :-
    1) Are you using these Advanced Components in applications you are building? If so How and Where?
    2) Did you face any challenges while using them?
    3) Did you find any special usages/scenarios for using these components?
    Thanks for all your inputs and for joining in the discussion.
    K
    </br>

    What would you like in the documentation? Do you have specific questions about particular components? Do you want examples? What's missing from the online help at http://developers.sun.com/prodtech/javatools/jscreator/reference/docs/help/2update1/components/advanced_list.html?

  • DID YOU KNOW?? - ABOUT DATAPROVIDER COMPONENTS IN THE PALETTE??

    Hi All,
    DID YOU KNOW??
    Practically all applications entail accessing data of some sort, often data stored in a relational database table or some sort of list, such as a vector or an array. Usually you need to read in data from the data source, but many times you have to update that data, too. The Sun Java Studio Creator integrated development environment, as another enhancement to its application model, provides data provider components that simplify accessing data sources, regardless of whether the data source is a relational database table, flat file, web service, vector, array, or some other type of data store.
    A data provider component is a nonvisual abstraction for wrapping sources of data, and it represents a more generic and flexible data binding mechanism. A glance at the Palette indicates that there are many different kinds of data providers available to you. These include data providers for cached RowSets, ResultSets, lists, arrays, maps, table rows, and method results.
    These data providers constitute a layer between a web application's components and its persistence tier, such as a database table, Array object, or Enterprise JavaBean object. This layer enables you to access data in a consistent way, even though data may come from different sources.
    Lets briefly discuss the CachedRowSetDataProvider
    The CachedRowSetDataProvider Component
    A CachedRowSetDataProvider is a wrapper to data held in a CachedRowSet. The primary purpose of a CachedRowSetDataProvider is to facilitate binding to components in the IDE. A CachedRowSet stores the data retrieved from a database. In fact, the only information held by the CachedRowSetDataProvider is a cursor position into the CachedRowSet. Multiple CachedRowSetDataProvider instances can reference the same CachedRowSet, and each instance will have its own cursor position into the CachedRowSet.
    Learn more :-
    Working With Data Providers
    http://developers.sun.com/jscreator/learning/tutorials/2/dataproviders.html
    Data Provider Components in Java Studio Creator
    http://developers.sun.com/jscreator/reference/fi/2/data-providers.html
    Using CachedRowSet and CachedRowSetDataProvider in the Sun Java Studio Creator IDE
    http://developers.sun.com/jscreator/reference/techart/2/insert_row_in_table.html
    We would like to know the following from you :-
    1) Which of the DataProviders are you using in applications you are building? Also How and Where?
    2) Did you face any challenges while using them?
    3) Did you find any special usages/scenarios for using these components?
    4) Do you have any feedback/comments/improvements which you would like to see with using Dataproviders?
    Thank you for all your inputs and for joining in the discussion.
    K

    .

  • I have multiple libraries on an external drive. Somehow all the iTunes library files i.e. iTunes Library.itl, xml, itdb, Media folder, etc disappeared! Only the music files remain. Now when I start iTunes w/option it can't find any of the old libraries!

    Help! I 'm using an old G4 powerbook, Mac OSX 10.5.8, iTunes ver 10. I have multiple iTunes libraries on an external drive. Everything was fine for a while, then all of the iTunes library files, i.e. iTunes Library.itl, xml, itdb, artwork folder, Media folder, etc mysteriously disappeared! Only the music files remain (thank god) So now when I start iTunes w/option key to choose a library, I can't choose any of them because iTunes won't recognize them. Because all the library stuff is missing. So can I re-create the library files? (I don't care if I lose my ratings)
    Or should I create a new empty library on the external drive, then manually move all the music files to the Media folder in the new library?
    I tried some stupid ideas like creating a new library just to start iTunes, then going into prefs and advanced, then under iTunes Media folder location, selecting the location of the old library on the external, to see if iTunes would then find all the music which is still there, but no workee.
    I'm out of ideas, and I searched the archives.
    Help! anyone?
    Scott

    I don't know if this is me adding files to iTunes when the external wasn't connected
    it is.
    is it OK to just keep deleting that library on the Air?
    i wouldn't - at least not until i
    mount the external
    point iTunes media folder location back to the external via preferences > advanced
    consolidate my library via file > library > organize library
    The ntfs hasn't seem to be causing any problems, but I've always wanted to know.
    in order for your Mac to write to NTFS drives, it needs some help by installing e.g. the NTFS 3G driver. apparently that or something similar is installed on your Mac already. preferably, it would be formatted for Mac but then windows machines would need to have e.g. MacDrive installed to recognize the drive.

  • Creating Smart Mailbox Folders in Mail.app (Lion): they do not save and disappear every time the application closes....

    Hello there -
    Hopefully someone can help, because this is just frustrating and weird.  In Mail on Mac OSX Lion, I can create all the Smart Mailboxes I want, but if I try to create a Smart Mailbox folder, it shows up just fine in the sidebar.  But, as soon as I close Mail, then re-open, the Smart Mailbox Folder is gone as if it never existed.  This happens whether or not I actually put any Smart Mailboxes in the folder.  Anyone else seen this issue and have suggestions?

    Okay, I think I just discoverd a workaround. This will work if you're lucky enough to already have a smart-mailbox folder that persists after close. (Somehow I had two such folders that already existed and weren't subject to the mysterious disappearances on closing the app; perhaps I created them in a previous OS X release?) Anyway, here goes:
    Locate an already existing smart mailbox folder that's working properly. Select the folder (in the sidebar).
    Duplicate that folder using the "Duplicate Smart Mailbox" Command. (It's on the contextual pop-up menu or available via the gear icon in the lower left of the window). This should produce and exact copy of the folder and the boxes inside, appearing at the bottom of the smart mailbox list.
    Edit the duplicate folder to put the smart mailboxes you want in it, and delete the previous mailboxes (duplicates) that you don't want.
    The new folder structure should now persist between launches of the app.
    There you go. Not the most elegant process, but workable. Don't know if there's a method if you don't have at least one smart mailbox folder already though.

  • Please, help! After upgrading to Yosemite, my dock has disappeared, along with the dashboard and the wallpaper! Can anyone help? I'm using a MacBook Pro, retina, bought it last year.

    Please, help!
    After upgrading to Yosemite, my dock has disappeared, along with the dashboard and the wallpaper! Can anyone help? I'm using a MacBook Pro, retina, bought it last year.
    Thanks

    Have you been trying to download from the app store? Did you get a message?
    As a suggestion, you might go to an Apple store (genius bar appointment) for help. As far as I know, there should be no charge.
    Barry

  • How can I Resize Two or More Shapes At The Same Time?

    I've got text over a rectangle over another rectangle. When I change my text, the size of the boxes needs to change and it's a drag ot have to do each one separately and constantly realign. Is there a way I can resize both of them at the same time tokeep the proportions the same?
    Or is there a way I can enter #s to resize, so I could just enter the same #s for each shape?
    Thanks,
    Amanda

    Here's an example of what Wyodor is referring to: text in shapes within another shape.. It goes one step further and adds the first shape+text into another shape but the concept is the same.
    OT

  • Overlay Images and Shapes on the same canvas

    The example copde below was taken from: http://math.hws.edu/eck/cs124/javanotes3/source/
    Is it possible to update the code so that images (jpg,gif) can be added as well as shapes?
    Any help with this is much appreciated.
        The ShapeDraw applet lets the user add small colored shapes to
        a drawing area and then drag them around.  The shapes are rectangles,
        ovals, and roundrects.  The user adds a shape to the canvas by
        clicking on a button.  The shape is added at the upper left corner
        of the canvas.  The color of the shape is given by the current
        setting of a pop-up menu.  The user can drag the shapes with the
        mouse.  Ordinarily, the shapes maintain a given back-to-front order.
        However, if the user shift-clicks on a shape, that shape will be
        brought to the front.
        A menu can be popped up on a shape (by right-clicking or performing
        some othe platform-dependent action).  This menu allows the user
        to change the size and color of a shape.  It is also possible to
        delete the shape and to bring it to the front.
        This file defines the applet class plus several other classes used
        by the applet, namely:  ShapeCanvas, Shape, RectShape, OvalShape,
        and RoundRectShape.
        David Eck
        July 28,  1998
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.Applet;
    import java.util.Vector;
    public class ShapeDrawWithMenu extends Applet {
       public void init() { 
            // Set up the applet's GUI.  It consists of a canvas, or drawing area,
            // plus a row of controls below the canvas.  The controls include three
            // buttons which are used to add shapes to the canvas and a Choice menu
            // that is used to select the color used for a shape when it is created.
            // The canvas is set as the "listener" for these controls so that it can
            // respond to the user's actions.  (The pop-up menu is created by the canvas.)
          setBackground(Color.lightGray);
          ShapeCanvas canvas = new ShapeCanvas();  // create the canvas
          Choice colorChoice = new Choice();  // color choice menu
          colorChoice.add("Red");
          colorChoice.add("Green");
          colorChoice.add("Blue");
          colorChoice.add("Cyan");
          colorChoice.add("Magenta");
          colorChoice.add("Yellow");
          colorChoice.add("Black");
          colorChoice.add("White");
          colorChoice.addItemListener(canvas);
          Button rectButton = new Button("Rect");    // buttons for adding shapes
          rectButton.addActionListener(canvas);
          Button ovalButton = new Button("Oval");
          ovalButton.addActionListener(canvas);
          Button roundRectButton = new Button("RoundRect");
          roundRectButton.addActionListener(canvas);
          Panel bottom = new Panel();   // a Panel to hold the control buttons
          bottom.setLayout(new GridLayout(1,4,3,3));
          bottom.add(rectButton);
          bottom.add(ovalButton);
          bottom.add(roundRectButton);
          bottom.add(colorChoice);
          setLayout(new BorderLayout(3,3));
          add("Center",canvas);              // add canvas and controls to the applet
          add("South",bottom);
       public Insets getInsets() {
            // Says how much space to leave between the edges of the applet and the
            // components in the applet.
          return new Insets(3,3,3,3);
    }  // end class ShapeDraw
    class ShapeCanvas extends Canvas implements ActionListener, ItemListener,
                                                MouseListener, MouseMotionListener {
          // This class represents a canvas that can display colored shapes and
          // let the user drag them around.  It uses an off-screen images to
          // make the dragging look as smooth as possible.  A pop-up menu is
          // added to the canvas that can be used to performa certain actions
          // on the shapes;
       Image offScreenCanvas = null;   // off-screen image used for double buffering
       Graphics offScreenGraphics;     // graphics context for drawing to offScreenCanvas
       Vector shapes = new Vector();   // holds a list of the shapes that are displayed on the canvas
       Color currentColor = Color.red; // current color; when a shape is created, this is its color
       ShapeCanvas() {
            // Constructor: set background color to white, set up listeners to respond to mouse actions,
            //              and set up the pop-up menu
          setBackground(Color.white);
          addMouseListener(this);
          addMouseMotionListener(this);
          popup = new PopupMenu();
          popup.add("Red");
          popup.add("Green");
          popup.add("Blue");
          popup.add("Cyan");
          popup.add("Magenta");
          popup.add("Yellow");
          popup.add("Black");
          popup.add("White");
          popup.addSeparator();
          popup.add("Big");
          popup.add("Medium");
          popup.add("Small");
          popup.addSeparator();
          popup.add("Delete");
          popup.add("Bring To Front");
          add(popup);
          popup.addActionListener(this);
       } // end construtor
       synchronized public void paint(Graphics g) {
            // In the paint method, everything is drawn to an off-screen canvas, and then
            // that canvas is copied onto the screen.
          makeOffScreenCanvas();
          g.drawImage(offScreenCanvas,0,0,this);
       public void update(Graphics g) {
            // Update method is called when canvas is to be redrawn.
            // Just call the paint method.
          paint(g);
       void makeOffScreenCanvas() {
             // Erase the off-screen canvas and redraw all the shapes in the list.
             // (First, if canvas has not yet been created, then create it.)
          if (offScreenCanvas == null) {
             offScreenCanvas = createImage(getSize().width,getSize().height);
             offScreenGraphics = offScreenCanvas.getGraphics();
          offScreenGraphics.setColor(getBackground());
          offScreenGraphics.fillRect(0,0,getSize().width,getSize().height);
          int top = shapes.size();
          for (int i = 0; i < top; i++) {
             Shape s = (Shape)shapes.elementAt(i);
             s.draw(offScreenGraphics);
       public void itemStateChanged(ItemEvent evt) {
              // This is called to respond to item events.  Such events
              // can only be sent by the color choice menu,
              // so respond by setting the current color according to
              // the selected item in that menu.
          Choice colorChoice = (Choice)evt.getItemSelectable();
          switch (colorChoice.getSelectedIndex()) {
             case 0: currentColor = Color.red;     break;
             case 1: currentColor = Color.green;   break;
             case 2: currentColor = Color.blue;    break;
             case 3: currentColor = Color.cyan;    break;
             case 4: currentColor = Color.magenta; break;
             case 5: currentColor = Color.yellow;  break;
             case 6: currentColor = Color.black;   break;
             case 7: currentColor = Color.white;   break;
       public void actionPerformed(ActionEvent evt) {
              // Called to respond to action events.  The three shape-adding
              // buttons have been set up to send action events to this canvas.
              // Respond by adding the appropriate shape to the canvas.  This
              // also be a command from a pop-up menu.
          String command = evt.getActionCommand();
          if (command.equals("Rect"))
             addShape(new RectShape());
          else if (command.equals("Oval"))
             addShape(new OvalShape());
          else if (command.equals("RoundRect"))
             addShape(new RoundRectShape());
          else
             doPopupMenuCommand(command);
       synchronized void addShape(Shape shape) {
              // Add the shape to the canvas, and set its size/position and color.
              // The shape is added at the top-left corner, with size 50-by-30.
              // Then redraw the canvas to show the newly added shape.
          shape.setColor(currentColor);
          shape.reshape(3,3,50,30);
          shapes.addElement(shape);
          repaint();
       // ------------ This rest of the class implements dragging and the pop-up menu ---------------------
       PopupMenu popup;
       Shape selectedShape = null;     // This is null unless a menu has been popped up on this shape.
       Shape draggedShape = null;      // This is null unless a shape has been selected for dragging.
       int prevDragX;  // During dragging, these record the x and y coordinates of the
       int prevDragY;  //    previous position of the mouse.
       Shape clickedShape(int x, int y) {
             // Find the frontmost shape at coordinates (x,y); return null if there is none.
          for ( int i = shapes.size() - 1; i >= 0; i-- ) {  // check shapes from front to back
             Shape s = (Shape)shapes.elementAt(i);
             if (s.containsPoint(x,y))
                return s;
          return null;
       void doPopupMenuCommand(String command) {
             // Handle a command from the pop-up menu.
          if (selectedShape == null)  // should be impossible
             return;
          if (command.equals("Red"))
             selectedShape.setColor(Color.red);
          else if (command.equals("Green"))
             selectedShape.setColor(Color.green);
          else if (command.equals("Blue"))
             selectedShape.setColor(Color.blue);
          else if (command.equals("Cyan"))
             selectedShape.setColor(Color.cyan);
          else if (command.equals("Magenta"))
             selectedShape.setColor(Color.magenta);
          else if (command.equals("Yellow"))
             selectedShape.setColor(Color.yellow);
          else if (command.equals("Black"))
             selectedShape.setColor(Color.black);
          else if (command.equals("White"))
             selectedShape.setColor(Color.white);
          else if (command.equals("Big"))
             selectedShape.resize(75,45);
          else if (command.equals("Medium"))
             selectedShape.resize(50,30);
          else if (command.equals("Small"))
             selectedShape.resize(25,15);
          else if (command.equals("Delete"))
             shapes.removeElement(selectedShape);
          else if (command.equals("Bring To Front")) {
             shapes.removeElement(selectedShape);
             shapes.addElement(selectedShape);
          repaint();
       synchronized public void mousePressed(MouseEvent evt) {
             // User has pressed the mouse.  Find the shape that the user has clicked on, if
             // any.  If there is a shape at the position when the mouse was clicked, then
             // start dragging it.  If the user was holding down the shift key, then bring
             // the dragged shape to the front, in front of all the other shapes.
          int x = evt.getX();  // x-coordinate of point where mouse was clicked
          int y = evt.getY();  // y-coordinate of point
          if (evt.isPopupTrigger()) {            // If this is a pop-up menu event that
             selectedShape = clickedShape(x,y);  // occurred over a shape, record which shape
             if (selectedShape != null)          // it is and show the menu.
                popup.show(this,x,y);
          else {
             draggedShape = clickedShape(x,y);
             if (draggedShape != null) {
                prevDragX = x;
                prevDragY = y;
                if (evt.isShiftDown()) {                 // Bring the shape to the front by moving it to
                   shapes.removeElement(draggedShape);  //       the end of the list of shapes.
                   shapes.addElement(draggedShape);
                   repaint();  // repaint canvas to show shape in front of other shapes
       synchronized public void mouseDragged(MouseEvent evt) {
              // User has moved the mouse.  Move the dragged shape by the same amount.
          if (draggedShape != null) {
             int x = evt.getX();
             int y = evt.getY();
             draggedShape.moveBy(x - prevDragX, y - prevDragY);
             prevDragX = x;
             prevDragY = y;
             repaint();      // redraw canvas to show shape in new position
       synchronized public void mouseReleased(MouseEvent evt) {
              // User has released the mouse.  Move the dragged shape, then set
              // shapeBeingDragged to null to indicate that dragging is over.
              // If the shape lies completely outside the canvas, remove it
              // from the list of shapes (since there is no way to ever move
              // it back onscreen).
          int x = evt.getX();
          int y = evt.getY();
          if (draggedShape != null) {
             draggedShape.moveBy(x - prevDragX, y - prevDragY);
             if ( draggedShape.left >= getSize().width || draggedShape.top >= getSize().height ||
                     draggedShape.left + draggedShape.width < 0 ||
                     draggedShape.top + draggedShape.height < 0 ) {  // shape is off-screen
                shapes.removeElement(draggedShape);  // remove shape from list of shapes
             draggedShape = null;
             repaint();
          else if (evt.isPopupTrigger()) {        // If this is a pop-up menu event that
             selectedShape = clickedShape(x,y);   // occurred over a shape, record the
             if (selectedShape != null)           // shape and show the menu.
                popup.show(this,x,y);
       public void mouseEntered(MouseEvent evt) { }   // Other methods required for MouseListener and
       public void mouseExited(MouseEvent evt) { }    //              MouseMotionListener interfaces.
       public void mouseMoved(MouseEvent evt) { }
       public void mouseClicked(MouseEvent evt) { }
    }  // end class ShapeCanvas
    abstract class Shape {
          // A class representing shapes that can be displayed on a ShapeCanvas.
          // The subclasses of this class represent particular types of shapes.
          // When a shape is first constucted, it has height and width zero
          // and a default color of white.
       int left, top;      // Position of top left corner of rectangle that bounds this shape.
       int width, height;  // Size of the bounding rectangle.
       Color color = Color.white;  // Color of this shape.
       void reshape(int left, int top, int width, int height) {
             // Set the position and size of this shape.
          this.left = left;
          this.top = top;
          this.width = width;
          this.height = height;
       void resize(int width,int height) {
             // Set the size without changing the position
          this.width = width;
          this.height = height;
       void moveTo(int x, int y) {
              // Move upper left corner to the point (x,y)
          this.left = x;
          this.top = y;
       void moveBy(int dx, int dy) {
              // Move the shape by dx pixels horizontally and dy pixels veritcally
              // (by changing the position of the top-left corner of the shape).
          left += dx;
          top += dy;
       void setColor(Color color) {
              // Set the color of this shape
          this.color = color;
       boolean containsPoint(int x, int y) {
             // Check whether the shape contains the point (x,y).
             // By default, this just checks whether (x,y) is inside the
             // rectangle that bounds the shape.  This method should be
             // overridden by a subclass if the default behaviour is not
             // appropriate for the subclass.
          if (x >= left && x < left+width && y >= top && y < top+height)
             return true;
          else
             return false;
       abstract void draw(Graphics g); 
             // Draw the shape in the graphics context g.
             // This must be overriden in any concrete subclass.
    }  // end of class Shape
    class RectShape extends Shape {
          // This class represents rectangle shapes.
       void draw(Graphics g) {
          g.setColor(color);
          g.fillRect(left,top,width,height);
          g.setColor(Color.black);
          g.drawRect(left,top,width,height);
    class OvalShape extends Shape {
           // This class represents oval shapes.
       void draw(Graphics g) {
          g.setColor(color);
          g.fillOval(left,top,width,height);
          g.setColor(Color.black);
          g.drawOval(left,top,width,height);
       boolean containsPoint(int x, int y) {
             // Check whether (x,y) is inside this oval, using the
             // mathematical equation of an ellipse.
          double rx = width/2.0;   // horizontal radius of ellipse
          double ry = height/2.0;  // vertical radius of ellipse
          double cx = left + rx;   // x-coord of center of ellipse
          double cy = top + ry;    // y-coord of center of ellipse
          if ( (ry*(x-cx))*(ry*(x-cx)) + (rx*(y-cy))*(rx*(y-cy)) <= rx*rx*ry*ry )
             return true;
          else
            return false;
    class RoundRectShape extends Shape {
           // This class represents rectangle shapes with rounded corners.
           // (Note that it uses the inherited version of the
           // containsPoint(x,y) method, even though that is not perfectly
           // accurate when (x,y) is near one of the corners.)
       void draw(Graphics g) {
          g.setColor(color);
          g.fillRoundRect(left,top,width,height,width/3,height/3);
          g.setColor(Color.black);
          g.drawRoundRect(left,top,width,height,width/3,height/3);
    }

    Manveer-Singh
    Please don't post in old threads that are long dead. When you have a question, please start a topic of your own. Feel free to provide a link to an old thread if relevant.
    I'm locking this 3 year old thread now.
    db
    edit You have earlier been advised not to post in old dead threads.
    [http://forums.sun.com/thread.jspa?threadID=354443]
    Continuing to ignore this advice will render your account liable to be blocked.
    Edited by: Darryl.Burke

  • My desktop disappeared. When the computer starts, it opens in finder. Also, it acts like something is running. The spinning circle is spinning, will stop for a minute then starts again. What is wrong? Help please.

    My Mac g5 starts and goes to finder. The desktop has disappeared. Also the circle keeps spinning. It will stop for a minute, then start again. It acts like something is running. I have restarted multiple times. Can anyone help please? Thank you.

    Spinning Beach Ball
    Spinning Beach ball (2)

Maybe you are looking for

  • At bottom of the page Report section Text is not adjusting.

    hi. i am having one problem. ie. i put one report section at under detail section of main report in report section again i put sub report in sub report at details section i put one field data is comming from the data base. this sub report field is ha

  • Macbook Pro won't load web pages

    I just bought a new Macbook a few months ago. I have never had this problem with my last computer but today I cannot load certain pages. When I first tried to use my computer absolutely none of the webpages would work. Some are working now, but a lot

  • Problem with multiple client numbers from a view

    Hi Gurus, I have a problem with a view Creates a view with a UNION ALL stmt ===================================== Create view vw_benifits as SELECT      Client_num, -- can have multiple values like 200,201,250      PERNR,           OBJPS,           E

  • Starting/Stoping Communication Channel programmatically

    Hello Experts, is there a way to stop/start PI communication channels programmatically? maybe sending a message to a special interface or smth? Best Regards, Artsiom Anichenka

  • Lite & Full optimize doesnt clear WB Table

    I think the subject line is self explaining, I have tried few times to optimize(full & lite) nothing seems to be helping. The WB table still has records. thanks. fyi -  I did do a count on the WB table, there is 109k records in it. Edited by: Zack Th