Swing image Icons

Hi all,
I used Imageicons(like error, Up, down arrows, etc...) to my swing pplication 2 years back using some image "Jar" file from Sun.
but now I didn't find it and fotgot the jar file name. does anyone know the name of the jar file that contains all image icons.
Thanks,
Ramesh

Was it here?
http://java.sun.com/docs/books/tutorial/information/download.html#egs

Similar Messages

  • How do you make an array of image icons and then call them?

    How do you make an array of image icons and then call them, i have searched all over the internet for making an array of icons, but i have
    found nothing. Below is my attempt at making an array of icons, but i cant seem to make it work. Basically, i want the image to match the value of the roll of the dice (rollVal)
    Any help would be greatly appreciated, some code or link to tuturial, ect.
    /** DiceRoller.java
    * Roll, print, Gui
    import javax.swing.*;
    public class DiceRoller extends JFrame
         private ImageIcon[] image  ;
         public String[] images = { "empty", "dice1.jpg",
                   "dice2.jpg", "dice3.jpg", "dice4.jpg",
                   "dice5.jpg", "dice6.jpg" };
         public Dice die;
         private int rollVal;
         public int rollNum;
         private JLabel j1;
         public DiceRoller(){
              j1= new JLabel("");
           die =new Dice();
           int rollVal;
           rollVal = die.roll();     
           image = new  ImageIcon[images.length];
         for(int i = 0; i < images.length; i++){
          image[i] = new ImageIcon(images);
         if (image!=null){
              j1.setIcon(image[rollVal]);
         System.out.println("Roll = "+die.roll());

    Demo:
    import java.awt.*;
    import java.net.*;
    import javax.swing.*;
    public class IconExample {
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable(){
                public void run() {
                    launch();
        static void launch() {
            try {
                Icon[] icons = new Icon[6];
                for(int i=0; i<icons.length; ++i) {
                    String url = "http://www.eureka-puzzle.be/cast/images/dice" + (i + 1) + ".jpg";
                    icons[i] = new ImageIcon(new URL(url));
                display(icons);
            } catch (MalformedURLException e) {
                throw new RuntimeException(e);
        static void display(Icon[] icons) {
            JPanel cp = new JPanel();
            for(Icon icon : icons) {
                cp.add(new JLabel(icon));
            JFrame f = new JFrame();
            f.setContentPane(cp);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • Image Icon with JAR

    Hi,
    I would like to replace the standard coffee cup window icon with a custom image for a stand-alone Swing application, all packaged as a JAR file. As a quick test, I wrote the following:
    package me.swinginfo1;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    public class IconWindow extends JFrame {
         public IconWindow() {
              this.setSize(300, 200); //set the window size
              this.setLocationRelativeTo(null); //centers window on screen
              this.setTitle("Window with Icon"); //set the window title
              this.setDefaultCloseOperation(EXIT_ON_CLOSE); //end the program when window closed
              java.net.URL imageURL = this.getClass().getResource("images/red_circle.png");
              this.setIconImage(new ImageIcon(imageURL).getImage());
         * Executes Swing window... no arguments.
         public static void main(String[] args) {
              IconWindow myWindow = new IconWindow();
              myWindow.setVisible(true);
    When I run this class from the IDE (Eclipse, in this case), the program runs fine, and my icon image appears in the corner of the window as desired. However, when I package the program into a JAR, the JAR will not execute. My method of packaging is simply to use File -> Export -> JAR.
    Note: if I comment out the two lines related to the Icon Image, then the JAR executes as expected (but without my custom image icon, of course).
    I am concerned that perhaps the resource folder containing the image is not being included in the JAR. Is there an easy way to check this? Or is there something else I am doing wrong?
    Thanks!

    Thanks for the information atmguy. After checking the jar contents, I found that my resource files (the "red_circle.png" in this case) were not being packaged into the jar. It looks like the reason for this was that I had just added the directory to my project "src" directory by hand, rather than importing the files with Eclipse. Thus, when I packaged the jar using Eclipse, it was unaware of the resource files and therefore did not include them in the jar.
    Also, I found that in Windows a handy way of quickly viewing jar files is to rename the jar as a .zip, and then just explore the zip file. (As mentioned here: http://en.kioskea.net/faq/sujet-556-to-see-the-content-of-a-jar-file).
    The jar now executes as expected. Thanks!

  • How to change this code to drag and drop image/icon into it??

    Dear Friends:
    I have following code is for drag/drop label, But I need to change to drag and drop image/icon into it.
    [1]. code 1:
    package swing.dnd;
    import java.awt.*;
    import javax.swing.*;
    public class TestDragComponent extends JFrame {
         public TestDragComponent() {
              super("Test");
              Container c = getContentPane();
              c.setLayout(new GridLayout(1,2));
              c.add(new MoveableComponentsContainer());
              c.add(new MoveableComponentsContainer());
              pack();
              setVisible(true);
         public static void main(String[] args) {
              try {
                   UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              catch (Exception ex) {
                   System.out.println(ex);
              new TestDragComponent();
    }[2]. Code 2:
    package swing.dnd;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.border.*;
    import java.awt.dnd.*;
    import java.awt.datatransfer.*;
    import java.awt.image.*;
    import java.awt.dnd.DragSource;
    import java.awt.dnd.DropTarget;
    public class MoveableComponentsContainer extends JPanel {     
         public DragSource dragSource;
         public DropTarget dropTarget;
         private static BufferedImage buffImage = null; //buff image
         private static Point cursorPoint = new Point();
         public MoveableComponentsContainer() {
              setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, Color.white, Color.gray));
              setLayout(null);
              dragSource = new DragSource();
              ComponentDragSourceListener tdsl = new ComponentDragSourceListener();
              dragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, new ComponentDragGestureListener(tdsl));
              ComponentDropTargetListener tdtl = new ComponentDropTargetListener();
              dropTarget = new DropTarget(this, DnDConstants.ACTION_MOVE, tdtl);
              setPreferredSize(new Dimension(400,400));
              addMoveableComponents();
         private void addMoveableComponents() {
              MoveableLabel lab = new MoveableLabel("label 1");
              add(lab);
              lab.setLocation(10,10);
              lab = new MoveableLabel("label 2");
              add(lab);
              lab.setLocation(40,40);
              lab = new MoveableLabel("label 3");
              add(lab);
              lab.setLocation(70,70);
              lab = new MoveableLabel("label 4");
              add(lab);
              lab.setLocation(100,100);
         final class ComponentDragSourceListener implements DragSourceListener {
              public void dragDropEnd(DragSourceDropEvent dsde) {
              public void dragEnter(DragSourceDragEvent dsde)  {
                   int action = dsde.getDropAction();
                   if (action == DnDConstants.ACTION_MOVE) {
                        dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveDrop);
                   else {
                        dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveNoDrop);
              public void dragOver(DragSourceDragEvent dsde) {
                   int action = dsde.getDropAction();
                   if (action == DnDConstants.ACTION_MOVE) {
                        dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveDrop);
                   else {
                        dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveNoDrop);
              public void dropActionChanged(DragSourceDragEvent dsde)  {
                   int action = dsde.getDropAction();
                   if (action == DnDConstants.ACTION_MOVE) {
                        dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveDrop);
                   else {
                        dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveNoDrop);
              public void dragExit(DragSourceEvent dse) {
                 dse.getDragSourceContext().setCursor(DragSource.DefaultMoveNoDrop);
         final class ComponentDragGestureListener implements DragGestureListener {
              ComponentDragSourceListener tdsl;
              public ComponentDragGestureListener(ComponentDragSourceListener tdsl) {
                   this.tdsl = tdsl;
              public void dragGestureRecognized(DragGestureEvent dge) {
                   Component comp = getComponentAt(dge.getDragOrigin());
                   if (comp != null && comp != MoveableComponentsContainer.this) {
                        cursorPoint.setLocation(SwingUtilities.convertPoint(MoveableComponentsContainer.this, dge.getDragOrigin(), comp));
                        buffImage = new BufferedImage(comp.getWidth(), comp.getHeight(), java.awt.image.BufferedImage.TYPE_INT_ARGB_PRE);//buffered image reference passing the label's ht and width
                        Graphics2D graphics = buffImage.createGraphics();//creating the graphics for buffered image
                        graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));     //Sets the Composite for the Graphics2D context
                        boolean opacity = ((JComponent)comp).isOpaque();
                        if (opacity) {
                             ((JComponent)comp).setOpaque(false);                         
                        comp.paint(graphics); //painting the graphics to label
                        if (opacity) {
                             ((JComponent)comp).setOpaque(true);                         
                        graphics.dispose();
                        remove(comp);
                        dragSource.startDrag(dge, DragSource.DefaultMoveDrop , buffImage, cursorPoint, new TransferableComponent(comp), tdsl);     
                        revalidate();
                        repaint();
         final class ComponentDropTargetListener implements DropTargetListener {
              private Rectangle rect2D = new Rectangle();
              Insets insets;
              public void dragEnter(DropTargetDragEvent dtde) {
                   Point pt = dtde.getLocation();
                   paintImmediately(rect2D.getBounds());
                   rect2D.setRect((int) (pt.getX()-cursorPoint.getX()),(int) (pt.getY()-cursorPoint.getY()),buffImage.getWidth(),buffImage.getHeight());
                   ((Graphics2D) getGraphics()).drawImage(buffImage,(int) (pt.getX()-cursorPoint.getX()),(int) (pt.getY()-cursorPoint.getY()),MoveableComponentsContainer.this);
                   dtde.acceptDrag(dtde.getDropAction());
              public void dragExit(DropTargetEvent dte) {
                   paintImmediately(rect2D.getBounds());
              public void dragOver(DropTargetDragEvent dtde) {
                   Point pt = dtde.getLocation();
                   paintImmediately(rect2D.getBounds());
                   rect2D.setRect((int) (pt.getX()-cursorPoint.getX()),(int) (pt.getY()-cursorPoint.getY()),buffImage.getWidth(),buffImage.getHeight());
                   ((Graphics2D) getGraphics()).drawImage(buffImage,(int) (pt.getX()-cursorPoint.getX()),(int) (pt.getY()-cursorPoint.getY()),MoveableComponentsContainer.this);
                   dtde.acceptDrag(dtde.getDropAction());
              public void dropActionChanged(DropTargetDragEvent dtde) {
                   Point pt = dtde.getLocation();
                   paintImmediately(rect2D.getBounds());
                   rect2D.setRect((int) (pt.getX()-cursorPoint.getX()),(int) (pt.getY()-cursorPoint.getY()),buffImage.getWidth(),buffImage.getHeight());
                   ((Graphics2D) getGraphics()).drawImage(buffImage,(int) (pt.getX()-cursorPoint.getX()),(int) (pt.getY()-cursorPoint.getY()),MoveableComponentsContainer.this);
                   dtde.acceptDrag(dtde.getDropAction());
              public void drop(DropTargetDropEvent dtde) {
                   try {
                        paintImmediately(rect2D.getBounds());
                        int action = dtde.getDropAction();
                        Transferable transferable = dtde.getTransferable();
                        if (transferable.isDataFlavorSupported(TransferableComponent.COMPONENT_FLAVOR)) {
                             Component comp = (Component) transferable.getTransferData(TransferableComponent.COMPONENT_FLAVOR);
                             Point location = dtde.getLocation();
                             if (comp == null) {
                                  dtde.rejectDrop();
                                  dtde.dropComplete(false);
                                  revalidate();
                                  repaint();
                                  return;                              
                             else {                         
                                  add(comp, 0);
                                  comp.setLocation((int)(location.getX()-cursorPoint.getX()),(int)(location.getY()-cursorPoint.getY()));
                                  dtde.dropComplete(true);
                                  revalidate();
                                  repaint();
                                  return;
                        else {
                             dtde.rejectDrop();
                             dtde.dropComplete(false);
                             return;               
                   catch (Exception e) {     
                        System.out.println(e);
                        dtde.rejectDrop();
                        dtde.dropComplete(false);
    }Thanks so much for any help.
    Reagrds
    sunny

    Well, I don't really understand the DnD interface so maybe my chess board example will be easier to understand and modify:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=518707
    Basically what you would need to do is:
    a) on a mousePressed you would need to create a new JLabel with the icon from the clicked label and add the label to the glass pane
    b) mouseDragged code would be the same you just repaint the label as it is moved
    c) on a mouseReleased, you would need to check that the label is now positioned over your "drop panel" and then add the label to the panel using the panels coordinates not the glass pane coordinates.

  • Error loading an image into an image icon

    Im having trouble with a gui that has to load external images, and ive isolated the loading to one spot. When I ask the Image icon for its status it always returns errored, but i dont know what error or how to fix it.
    Pulling My Hair Out
    JTuba
    import java.awt.*;
    import javax.swing.*;
    public class test
         public static void main(String[] args)
              JFrame.setDefaultLookAndFeelDecorated(true);
              JFrame frame = new JFrame("FrameDemo");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              Container c = frame.getContentPane();
              JPanel panel = new JPanel()
                   public void paintComponent(Graphics g)     
                        ImageIcon img = new ImageIcon("CA.jpg");
         System.out.println(String.valueOf(img.getImage()==null));
                        ///These bouth output 4\\\\\
                   System.out.println(img.getImageLoadStatus());
                   System.out.println(MediaTracker.ERRORED);
                        ///The iomage is NEVER drawn\\\
                   g.drawImage(img.getImage(), 0, 0, null);
                        super.paintComponent(g);
              panel.setOpaque(true);
              c.add(panel);
              //panel.validate();
              //panel.repaint();
              //panel.pack();
              frame.setSize(750,450);
              frame.setVisible(true);
    }

    Hello,
    you should paint the background(super.paintComponent) before all other:JPanel panel = new JPanel()
    Image img Toolkit.getDefaultToolkit().getImage(yourCorrectPath);
         public void paintComponent(Graphics g)
              super.paintComponent(g);
              g.drawImage(img, 0, 0, this);
    };regards,
    Tim

  • Image Icon not showing in "get info" for OS 10.9.4

         I  now have PS CC 2014 and the image icons are showing the "generic" .jpg and .psd files in the "get info" finder window, but on my desktop the images are showing their
         proper image icon.
         I was previously using PS CS 5 and the icons are showing up in the "get info" window, but with PS CC 2014 these icons are showing up as generic.
         To be clear the images I saved using PS CS 5 are showing the icons vs. the images I saved in CC 2014 where the icons are not showing in the "get info" window.
         I've compared preference settings with PS 2014 and PS 5 but their basically about the same.
         I'm including 2 images so you can see what I'm explaining. IMG_1627 is a PS CC2014 created image and Arturo is a PS 5 image.
         I did read about other PS users having similar issues but it looked to be unresolved.
         You may think what's the big deal, but I use these image icons to label my folders. A "trick" I've doing for over decade which helps keep my folders visually on track for me.
         Is anyone out there able to solve this issue??  

    I do on occasion get jpgs and pngs that won't render a thumbnail or preview in MacOS.  I have 10.9.5
    I don't have this problem, although I just have CC and CC 2014 on my Macbook.
    I would open those up in Preview.app and try a Save As... and I would get the thumbnail and thumbnail preview back.
    Not really the best idea,but you can see if it helps.
    These  are my file saving options, perhaps there is something there you can try.
    Gene

  • Help needed in Drag and Drop and  resizing of image icons

    Hi all,
    I'm doing a project on Drag and Drop and resizing of image icons.
    There is one DragContainer in which i have loaded the image icons and i want to drop these image icons on to the DropContainer.
    After Dropping these icons on to the DropContainer i need to resize them.
    I have used the Rectangle object in resizing.
    The problem now i'm facing is when i drag, drop and resize an image icon and when i try to drag, drop a second image icon the first image icon gets erased.
    can any one help me in fixing this error.
    if u want i can provide the source code.
    thanks in advance
    murali

    the major restrictions in its implemented only in
    jdk1.1.Why!

  • Macbook Pro Retina 15" flashing image/icon of world on screen at startup

    My Macbook Pro (retina 15"), flashed an image/icon of the world when started up, and it had to be restarted before starting up properly. What's the reason for this? Is this an issue?

    Search on globe at startup.
    When I did up came some answers from way back in 2006.
    It said to go to preferences startup & select the start up.  I tried that & then restarted & while it seemed to take awhile then the rest has been faster.
    It was saying something about losing where to find the start up so it was hunting until it found it.  Something like that.
    I'm on a 2012 13" MacBookPro running Mavericks.
    Before this I had noticed it flashing back & forth between a gray screen & Mavericks screen on boot up (I was back & forth while booting & came back to see that. knew it wasn't good so shut down. Waited a few & then started up. It worked.)
    It was funny since I had been wanting to go to Apple store & had talked about going w sister in law. That morning they said they were going in because hers wasn't working at all. So then I booted up & had that happen.
    So I called & made a Genius bar appt. They checked & didn't find anything, but I had been getting the globe on bootup which kind of concerned me. Also its been rather slow booting & shutting down.

  • Not showing image in basic copy gif image icon and place on html page

    Trying to do a basic copy gif image icon and place it on a basic html page.
    The image shows up in my local page and shows on remote side but when I go to view in browser it does not show as a image. It shows the border but no image.
    The directions were (working with windows xp and IE8)
    Download the image to your C:\temp folder.
    4. Copy the gif file from your C:\temp folder and paste it in the same folder where your .html or .asp file is.
    I copied the image with right click save as in many different areas of computer. I even put on desktop.
    I add image and it shows on the site I am working in but when putting to remote side it does not view as an image on the browser.
    I have cleared cashe as well as pressed cntrl/refresh and still nothing.
    Other images work and show.
    on-line-vacations.com
    Thanks!

    Basic assumptions:
    You have Defined a site.
    All files reside within the defined site (including image files)
    All files use the appropriate file extensions, for example, image.gif
    You have saved and uploaded all site files to your server.
    You are EXACTLY naming the source image (no errant capital letters) in the link.
    If your other images are linking properly and showing, delete this image and insert it again (or re-link it to the image file within your site structure).
    Z

  • Preview Image icon in Finder

    Hi everyone!
    I couldnt exactly find a help topic for this...
    I just want to know why the image icon in the finder windows doesnt change when you alter the image in preview? Say I cropped an image in preview or rotated it, the preview icon of the image in finder is the original but when you click to open it, its the altered image.
    Should I have clicked on something in the preferences? Or is it really like that.
    Because in my desktop, the image does change when it got restarted but not in the finder window.
    Any reply would be appreciated....thanks!

    I have the same problem. I edit my pictures with HP Photosmart Studio. I might crop it, rotate or change it to black and white but the icon will stay the same. When I open it in Preview it is fine. I also have Windows XP installed through parallels, the strange thing is when I go to XP windows explorer it shows the correct Icon and correct image for the picture.
    It really buggin me please help.
    Also when I try to upload a picture I can not switch it to thumbnail like in Windows to see the picture I am attaching. Any ideas???

  • How do I make image icons in finder window previews of the image?

    The image icons in my finder window are just generic jpeg icons (they are set to open automatically in Preview). How do I make them previews of the images themselves? When I "get info" on the icon, there is a very nice preview of the image - I would like to see the same quality preview in the icons themselves.
    Thank you very much for your help.
    Sam
    Powerbook   Mac OS X (10.4.6)  

    Hi Sam,
    From your Finder "View" menu (without a Finder window open) >> "Show view options" >> do you have "show icon preview" check marked? And with the Finder window open "show icons" and "show preview icons" checkmarked?
    EDIT: I may have misunderstood your question. If you're talking about the small file icons, not in the preview frame if you have PhotoShop it should do it with a save as PS file. Otherwise you may be able to paste the image but I'm not sure.
    -mj
    [email protected]
    Message was edited by: macjack

  • Which Listener I should use if I drag and Drop an image/icon into a JPanel?

    Dar Friends:
    Happy new year.
    I try to drag and Drop an image/icon into a JPanel, and hope I can immediately detect it after DND,
    Which Listener I should use in this JPanel if I drag and Drop an image/icon into a JPanel??
    Thanks

    Thank camickr .
    I can dnd an image into a JPanel called JPanelOld already, I hope to use another JPanel or JTree to listen to any Dropped Image in JPanelOld later on so I can take some action in another JPanel or JTree.
    so what kind of Listener I should use for my purpose??
    where to add this Listeners??
    Happy New Year.

  • Drag Drop images/icons JApplet

    Hi! I would like to implement a Drag Drop of images/icons between two JPanels in a JApplet. Can someone give me a working example of the code that I have to implement ???
    Thanks to you !!!!
    TGuido

    The standard procedure is to post a small message to make your old post go to the top

  • Place image icon onto a 3D cube

    Hi, I am currently doing a project on 3D java. I have created 3D color cube and
    i am planning to put movable image icon on the cube so that i can move the image
    icon to anywhere on the cube. The color cube can be rotated, translated and
    zoomable. Lastly, when the cube is being rotated,the image icon on the cube must
    move together also.
    i am currently stuck at the part where i dont know how to do the coding on
    creating the image icon and when the cube is rotated, the image icon will move
    also. Can you give me some sample code on doing that as this is my first time
    using java 3D.
    Below is the code that i use to create the cube.
    CODE
    * IconGlassPanel3D.java
    * Created on October 30, 2006, 2:57 PM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package Pas3DGUI;
    import CobraNet.Zone;
    import DbConnection.DAOFactory;
    import DbConnection.ZoneDAO;
    import Pas2DGUI.ZoneIcons;
    import java.applet.Applet;
    import java.awt.BorderLayout;
    import java.awt.Frame;
    import com.sun.j3d.utils.applet.MainFrame;
    import com.sun.j3d.utils.geometry.ColorCube;
    import com.sun.j3d.utils.universe.*;
    import com.sun.j3d.utils.behaviors.mouse.*;
    import java.awt.Graphics;
    import java.awt.Point;
    import javax.media.j3d.*;
    import javax.vecmath.*;
    import java.awt.Image;
    import java.awt.Toolkit;
    import java.awt.event.*;
    import java.util.Enumeration;
    * @author 042255f
    public class IconGlassPanel3D extends Applet {
    // nImg =
    Toolkit.getDefaultToolkit().getImage("C:\\TEMP\\unselected_speaker.gif");
    /** Creates a new instance of IconGlassPanel3D */
    public BranchGroup createSceneGraph() {
    // Create the root of the branch graph
    BranchGroup objRoot = new BranchGroup();
    TransformGroup objTransform = new TransformGroup();
    objTransform.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    objTransform.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
    objRoot.addChild(objTransform);
    objTransform.addChild(new ColorCube(0.4));
    // objRoot.addChild(new Axis());
    MouseRotate myMouseRotate = new MouseRotate();
    myMouseRotate.setTransformGroup(objTransform);
    myMouseRotate.setSchedulingBounds(new BoundingSphere());
    objRoot.addChild(myMouseRotate);
    MouseTranslate myMouseTranslate = new MouseTranslate();
    myMouseTranslate.setTransformGroup(objTransform);
    myMouseTranslate.setSchedulingBounds(new BoundingSphere());
    objRoot.addChild(myMouseTranslate);
    MouseZoom myMouseZoom = new MouseZoom();
    myMouseZoom.setTransformGroup(objTransform);
    myMouseZoom.setSchedulingBounds(new BoundingSphere());
    objRoot.addChild(myMouseZoom);
    // Let Java 3D perform optimizations on this scene graph.
    objRoot.compile();
    return objRoot;
    } // end of CreateSceneGraph method of MouseBehaviorApp
    // Create a simple scene and attach it to the virtual universe
    public IconGlassPanel3D() {
    setLayout(new BorderLayout());
    Canvas3D canvas3D = new Canvas3D(null);
    add("Center", canvas3D);
    BranchGroup scene = createSceneGraph();
    // SimpleUniverse is a Convenience Utility class
    SimpleUniverse simpleU = new SimpleUniverse(canvas3D);
    // This will move the ViewPlatform back a bit so the
    // objects in the scene can be viewed.
    simpleU.getViewingPlatform().setNominalViewingTransform();
    simpleU.addBranchGraph(scene);
    } // end of MouseBehaviorApp (constructor)
    // The following allows this to be run as an application
    // as well as an applet
    public static void main(String[] args) {
    System.out.println("Hold the mouse button while moving the mouse to make
    the cube move.");
    System.out.println(" left mouse button - rotate cube");
    System.out.println(" right mouse button - translate cube");
    System.out.println(" Alt+left mouse button - zoom cube");
    Frame frame = new MainFrame(new IconGlassPanel3D(), 256, 256);
    } // end of main (method of MouseBehaviorApp)
    Thank You all for your help.I apprepciate it.

    Use a Box instead of the ColorCube.. This might give you a start.
    To texture the Box, assuming you have extended Applet -
            java.net.URL texImage = null;// the URL of the image to load
         Appearance app = new Appearance();
         Texture tex = new TextureLoader(texImage, this).getTexture();
         app.setTexture(tex);
         TextureAttributes texAttr = new TextureAttributes();
         texAttr.setTextureMode(TextureAttributes.MODULATE);
         app.setTextureAttributes(texAttr);
         Box textureCube = new Box(0.4f, 0.4f, 0.4f,
                          Box.GENERATE_TEXTURE_COORDS, app);IMHO you will be well served by texturing a plane congruent in size with the sides of the cube and manipulating that using the coords of each side of a Box derived from Shape3D.getGeometry. Don`t forget to add a Light or two.
    regards

  • Remove Image Icon in DataTable

    Hai EveryBody,
    I had implemented a Data Table with dynamic rows and columns using JSF and now I would like to invoke a Trash Image Icon(<h:graphicimage>) in one of the column in the datatable.so if I click that Icon the entire row of the DataTable should be erased.Could any give me a valuable inputs on this regarding..
    Thanks in Advance!!!

    Shakeel.Abbas wrote:
    you must use tomahawk datatable because <h:datatable have some bugs ie specially in case of command linkYou've never used a JSF version newer than 1.x_02 (out since 2006) ?
    in command link use <f:params to set parameters that will be used in action method ie the id of the record to be deletedRather use UIData#getRowData() to retrieve the actual row object in question. Also see [http://balusc.blogspot.com/2006/06/using-datatables.html].

Maybe you are looking for

  • Ipad 2 is asking for apple id after restoring

    I work for a school and we handed out several ipad 2 ,3 and airs over the years. It has come to my attention that I cannot go into recovery mode and restore an ipad any longer with out it asking for an apple id after restored. The problem is that sev

  • What's wrong with this dj rollover?

    Hi Been trying to do this (mouseOver the LAVAlamp image) http://www.istockphoto.com/file_search.php?text=lava+lamp&x=0&y=0&action=file&filetypeID=1 &s1=0&username=&MinWidth=&MinHeight=&color=61%2C1%2C164&form_cs_nw=xxx&form_cs_n=xxx&form_ cs_ne=xxx&f

  • Installing lightroom 5 onto iMac won't work.

    I am trying to install lightroom 5 onto my iMac and i keep getting a message that says "you cannon open the application setup64.exe because microsoft windows application are not supported OS X. please help, what am i to do? Is there something else I

  • Bing search results can't be clicked for many searches.

    I'm moving away from Google and am frustrated with either a bug in Firefox 13, or perhaps a plug in. I've looked at the HTML source for the Bing's search results and don't see any issues with their anchors. This doesn't happen on every search result,

  • Help! Problem with opening Mail

    I've been having a hugely annoying problem with mail and preview, and I nor any of the wizards at my local mac store can't solve it to save their lives. So, I've come here, to the experts. First of all, neither program will open or provide any errors