Extending DefaultTreeCellRenderer, Jlabel setOpaque(false) no effect

Hi, im using the code below, but my JLabel component.setOpaque(false) is having no effect, is this possible?
private class MyRenderer extends DefaultTreeCellRenderer {
            ImageIcon tabIconOnline, tabIconOffline;
            String status;
            public MyRenderer() {
            public Component getTreeCellRendererComponent(
                    JTree tree,
                    Object value,
                    boolean sel,
                    boolean expanded,
                    boolean leaf,
                    int row,
                    boolean hasFocus) {
                JLabel jl = (JLabel)super.getTreeCellRendererComponent(
                        tree, value, sel,
                        expanded, leaf, row,
                        hasFocus);
                                 jl.setOpaque(false); // not working
                setOpaque(false); // not working
                tree.setOpaque(false); // not working
                                 setBackgroundSelectionColor(MyGUI.ITEM_SELECTION_COLOUR);
                setBackgroundNonSelectionColor(null);  // not working
                setBorderSelectionColor(new Color(10, 10, 255));
                return jl;
    }

heres the full code, im using:
        private class MyRenderer extends DefaultTreeCellRenderer {
            ImageIcon tabIconOnline, tabIconOffline;
            String status;
            public MyRenderer() {
            public Component getTreeCellRendererComponent(
                    JTree tree,
                    Object value,
                    boolean sel,
                    boolean expanded,
                    boolean leaf,
                    int row,
                    boolean hasFocus) {
                JLabel jl = (JLabel)super.getTreeCellRendererComponent(
                        tree, value, sel,
                        expanded, leaf, row,
                        hasFocus);
                DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
                //jl.setOpaque(false);
               // setOpaque(false);
                tree.setOpaque(false);
                if (node == rootNode) {
                    setForeground(new Color(255, 255, 255));
                } else if ((node == nodeFriends) ||(node == nodeRecent)||(node == nodeIgnored)) {
                    if (leaf) {
                        setIcon(createImageIcon("images/icon_noChildren.gif"));
                    setForeground(new Color(255, 255, 255));
                    setToolTipText("To add a Friend , Right click then 'Add A Friend'");
                } else if (node.getParent() == nodeFriends) {
                    Friend friend = (Friend)(node.getUserObject());
                    if (friend.getStatus().equals("online")) {
                        setForeground(new Color(255, 255, 255));
                        setIcon(createImageIcon("images/icon_online.gif"));
                        setToolTipText("Is " + friend.getStatus());
                    } else {
                        setIcon(createImageIcon("images/icon_offline.gif"));
                        setToolTipText("Is " + friend.getStatus());
                        setForeground(new Color(255, 255, 255));
                } else if (node.getParent() == nodeRecent) {
                    setForeground(new Color(255, 255, 255));
                } else if (node.getParent() == nodeIgnored) {
                    setForeground(new Color(255, 255, 255));
                    setToolTipText("You are ignoring this user");
                if (sel) {
                    setForeground(Color.black);
                //jl.setBackground(null);
                setBackgroundSelectionColor(MyGUI.ITEM_SELECTION_COLOUR);
                //setBackgroundNonSelectionColor(null);
                setBorderSelectionColor(new Color(10, 10, 255));
                return jl;
    }

Similar Messages

  • Extending DefaultTreeCellRenderer, setOpaque has no effect

    Hello
    I'm building a JTree and want the tree and all its nodes to not be opaque, i.e. when I have a background image, the image should be visible.
    When I have searched the forum for this subject I came across another thread with some suggestions on the DefaultTreeCellRenderer but the suggestions did not seem to work for the guy who made the post.
    The code below works somewhat, i.e. the tree is clear and the selected nodes/leafs are clear but not the nonselected nodes/leafs.
    public class PrefsTreeCellRenderer extends DefaultTreeCellRenderer {
      public PrefsTreeCellRenderer() {
        super();
      } /* PrefsTreeCellRenderer */
      public Component getTreeCellRendererComponent(JTree tree, Object value,
          boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
        super.getTreeCellRendererComponent(
            tree, value, sel, expanded, leaf, row, hasFocus);
        this.setBackgroundSelectionColor(null);
        this.setBorderSelectionColor(null);
        this.setBackgroundNonSelectionColor(null); // Seems not to be working.
        return this;
      } /* getTreeCellRendererComponent */
    } /* PrefsTreeCellRenderer */I'd appreciate any suggestions on this.
    aqd

    this.setBackgroundNonSelectionColor(new Color(0,0,0,0));

  • How to make a JPanel transparent? Not able to do it with setOpaque(false)

    Hi all,
    I am writing a code to play a video and then draw some lines on the video. For that first I am playing the video on a visual component and I am trying to overlap a JPanel for drawing the lines. I am able to overlap the JPanel but I am not able to make it transparent. So I am able to draw lines but not able to see the video. So, I want to make the JPanel transparent so that I can see the video also... I am posting my code below
    import javax.media.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import java.lang.Math;
    import javax.media.control.FramePositioningControl;
    import javax.media.protocol.*;
    import javax.swing.*;
    class MPEGPlayer2 extends JFrame implements ActionListener,ControllerListener,ItemListener
         Player player;
         Component vc, cc;
         boolean first = true, loop = false;
         String currentDirectory;
         int mediatime;
         BufferedWriter out;
         FileWriter fos;
         String filename = "";
         Object waitSync = new Object();
         boolean stateTransitionOK = true;
         JButton bn = new JButton("DrawLine");
         MPEGPlayer2 (String title)
              super (title);
              addWindowListener(new WindowAdapter ()
                   public void windowClosing (WindowEvent e)
                            dispose ();
                            public void windowClosed (WindowEvent e)
                         if (player != null)
                         player.close ();
                         System.exit (0);
              Menu m = new Menu ("File");
              MenuItem mi = new MenuItem ("Open...");
              mi.addActionListener (this);
              m.add (mi);
              m.addSeparator ();
              CheckboxMenuItem cbmi = new CheckboxMenuItem ("Loop", false);
              cbmi.addItemListener (this);
              m.add (cbmi);
              m.addSeparator ();
              mi = new MenuItem ("Exit");
              mi.addActionListener (this);
              m.add (mi);
              MenuBar mb = new MenuBar ();
              mb.add (m);
              setMenuBar (mb);
              setSize (500, 500);
              setVisible (true);
         public void actionPerformed (ActionEvent ae)
                        FileDialog fd = new FileDialog (this, "Open File",FileDialog.LOAD);
                        fd.setDirectory (currentDirectory);
                        fd.show ();
                        if (fd.getFile () == null)
                        return;
                        currentDirectory = fd.getDirectory ();
                        try
                             player = Manager.createPlayer (new MediaLocator("file:" +fd.getDirectory () +fd.getFile ()));
                             filename = fd.getFile();
                        catch (Exception exe)
                             System.out.println(exe);
                        if (player == null)
                             System.out.println ("Trouble creating a player.");
                             return;
                        setTitle (fd.getFile ());
                        player.addControllerListener (this);
                        player.prefetch ();
         }// end of action performed
         public void controllerUpdate (ControllerEvent e)
              if (e instanceof EndOfMediaEvent)
                   if (loop)
                        player.setMediaTime (new Time (0));
                        player.start ();
                   return;
              if (e instanceof PrefetchCompleteEvent)
                   player.start ();
                   return;
              if (e instanceof RealizeCompleteEvent)
                   vc = player.getVisualComponent ();
                   if (vc != null)
                        add (vc);
                   cc = player.getControlPanelComponent ();
                   if (cc != null)
                        add (cc, BorderLayout.SOUTH);
                   add(new MyPanel());
                   pack ();
         public void itemStateChanged(ItemEvent ee)
         public static void main (String [] args)
              MPEGPlayer2 mp = new MPEGPlayer2 ("Media Player 2.0");
              System.out.println("111111");
    class MyPanel extends JPanel
         int i=0,j;
         public int xc[]= new int[100];
         public int yc[]= new int[100];
         int a,b,c,d;
         public MyPanel()
              setOpaque(false);
              setBorder(BorderFactory.createLineBorder(Color.black));
              JButton bn = new JButton("DrawLine");
              this.add(bn);
              bn.addActionListener(actionListener);
              setBackground(Color.CYAN);
              addMouseListener(new MouseAdapter()
                             public void mouseClicked(MouseEvent e)
                   saveCoordinates(e.getX(),e.getY());
         ActionListener actionListener = new ActionListener()
              public void actionPerformed(ActionEvent aae)
                        repaint();
         public void saveCoordinates(int x, int y)
                    System.out.println("x-coordinate="+x);
                    System.out.println("y-coordinate="+y);
                    xc=x;
              yc[i]=y;
              System.out.println("i="+i);
              i=i+1;
         public Dimension getPreferredSize()
    return new Dimension(500,500);
         public void paintComponent(Graphics g)
    super.paintComponent(g);
              Graphics2D g2D = (Graphics2D)g;
              //g2D.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR, 0.0f));
              g2D.setColor(Color.GREEN);
              for (j=0;j<i;j=j+2)
                   g2D.drawLine(xc[j],yc[j],xc[j+1],yc[j+1]);

    camickr wrote:
    "How to Use Layered Panes"
    http://java.sun.com/docs/books/tutorial/uiswing/components/layeredpane.html
    Add your video component to one layer and your non-opaque panel to another layer.Did you try that with JMF? It does not work for me. As I said, the movie seems to draw itself always on top!

  • Why does setOpaque(false) on Mac interfere with functionality of JSlider?

    Hello, here is an SSCCE with a slider that works normally on my PC:
    import javax.swing.*;
    public class Foobar extends JApplet
         public  void init()
              JPanel panel = new JPanel();
              panel.setOpaque(false);
              panel.add(new JSlider());
              setContentPane(panel); 
    }But on my sister's Mac, the slider functionality is broken: one cannot drag the thumb with the mouse. To move the thumb, she has to click on the rail. If I comment out the setOpaque(false) call, then everything works fine.
    I need that setOpaque call and I want the program to work both on Mac and PC. Why does it break on the Mac and how to fix it? Thank you for your insight. Mark

    So then you haven't actually ran that SSCCE on a MAC then? No, no, she ran it on her Mac, my sis. I asked her to run it several times, and she definitely cannot move the thumb. Now, if I comment out the setOpaque(false), then she can move it all right.
    But, I found a workaround. I did not realize that before, that Apple actually does include the "cross-platform" look and feel, not only their own Aqua. On the Sun website, it sort of implies that Apple only has Aqua, but on Apple website, I found they also support the cross-platform look.
    And voila, I changed to the cross-platform, and now, everything works. Not only the sliders in non-opaque panels, but I had also a HUGE number of other problems getting my app to work on the Mac, and now, with the cross-platform look, they all disappeared!!
    Thank you.
    Mark

  • JPanel setOpaque(false) isn't transparent ?

    Hi,
    I've set a JPanel as the only thing added to a JFrame container. I've set a picture to this JPanel by using the following code
              JPanel temp = new JPanel()
                   public void paintComponent(Graphics g)
                         Dimension d = getSize();
                         g.drawImage(icon.getImage(), 0, 0, d.width, d.height, null);
                        setOpaque( false );
                        super.paintComponent(g);
              };Now I've added another JPanel onto this one. I've set its background to RED, so there is a red square over my picture on my JFrame. However I want this JPanel to be fully transparent, so you can't actually see it at all, so the picture behind it on the original JPanel shows through.
    But when I use setOpaque(false), I just get a gray square instead of a red one, it doesn't show anything through at all.
    Anyone know why this would be ?
    Thanks

    Here you go, the background picture is not shining through. You'll have to change the jpg name to whatever you want to use.
    Thanks
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.border.*;
    public class OneToOneChat extends JFrame
         protected JPanel leftZone, rightZone, totalZone;
         protected JTextPane bottomLeftZone, topLeftZone;
         protected JScrollPane topScroll, bottomScroll;
         public static void main(String args[])
              new OneToOneChat();          
         public OneToOneChat()
              setSize(400,400);          
              setTitle("My Opaque Problem");
              setLocation(200,200);
              setResizable(false);     
              Container con = getContentPane();
              leftZone = new JPanel(new BorderLayout());
              rightZone = new JPanel(new BorderLayout());          
              totalZone = new JPanel(new BorderLayout());               
              topLeftZone = new JTextPane();                              
              bottomLeftZone = new JTextPane();     
              topScroll = new JScrollPane(topLeftZone, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                                                     JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);          
                    topScroll.setPreferredSize(new Dimension(250,150));          
              bottomScroll = new JScrollPane(bottomLeftZone,
                                           JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                                           JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);                                      
              bottomScroll.setPreferredSize(new Dimension(250,150));                                      
              rightZone.setOpaque(false);          
              rightZone.setBackground(Color.RED);          
              rightZone.setBorder( new LineBorder(Color.GREEN) );          
              rightZone.setPreferredSize(new Dimension(250,300));                                             
              leftZone.add(topScroll, "North");
              leftZone.add(bottomScroll,"South");
              totalZone.add(leftZone,"West");
              totalZone.add(rightZone,"East");
              final ImageIcon icon = new ImageIcon("ripple.jpg");                    
              JPanel temp = new JPanel()
                   public void paintComponent(Graphics g)
                        Dimension d = getSize();
                        g.drawImage(icon.getImage(), 0, 0, d.width, d.height, null);
                        setOpaque( false );
                        super.paintComponent(g);
              temp.setBorder(new EmptyBorder(8,8,8,8));                    
              temp.add(totalZone);                                             
              con.add(temp);     
              pack();
              setVisible(true);
    }

  • JPopupMenu ignores setOpaque(false) near screen edges

    Dear group
    I try to paint a custom JPopupMenu with transparency, but this is ignored when the popup is opened so it overlaps near screen edges (bottom and right side). This is also the case if the popup overlaps the Microsoft Windows toolbar at the bottom.
    I may be able to emulate JPopupMenus using custom components in a JLayeredPane, but can anyone explain the above behaviour?
    Thanks and Best Regards,
    Aksel, Denmark
    Environment: j2sdk-se 1.6.0_10 and windows xp
    Example:
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.Rectangle;
    import java.awt.Toolkit;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPopupMenu;
    public class TransparencyPopupNearBorderTest {
    public static void main(String[] args) {
    final JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setLocationRelativeTo(null);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setBounds(new Rectangle(screenSize));
    frame.setUndecorated(true);
    frame.setPreferredSize(screenSize);
    frame.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseReleased(MouseEvent e) {
    JPopupMenu popup = new JPopupMenu();
    popup.setOpaque(false);
    JLabel label = new JLabel("TRANSPARENT");
    label.setFont(new Font("Helvetica", Font.PLAIN, 42));
    popup.add(label);
    popup.setLightWeightPopupEnabled(false);
    popup.show(frame, e.getX(), e.getY());
    frame.getContentPane().setBackground(Color.BLUE);
    frame.pack();
    frame.setVisible(true);
    }

    Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.
    I don't know if transparency painting has changed in 1.6.0_10. Prior to that I believe transparency can only be achieved in lightweight components (ie. Swing does all the painting). JFrame, JWindow and JDialog are not lightweight because they use OS components.
    In the case of a popup, it is lightweight when entirely contained within its parent frame. But a lightweight popup can not be painted outside the bounds of the frame so a JWindow (I believe) is used as the popup, which can't be transparent.

  • Defining different icons for TreeNode by extending DefaultTreeCellRenderer

    Hello all,
    I'm using a JTree to display project, folder and files. I'd like to have different icons for open project, close project, open folder, close folders, and files
    but i got for the root which is a project object a folder icon and for folder when it is not expanded i got project icon and the when i expand it i got a folder icon, can someone help me please
    Here is my code :
    public class MyTreeCellRenderer extends DefaultTreeCellRenderer {
         private Icon openIcon = null;
         private Icon closeIcon = null;
         private Icon leafIcon = null;
         private Icon projectOpenIcon = new ImageIcon("icons/book_open.png");
         private Icon projectCloseIcon = new ImageIcon("icons/book_blue.png");
         private Icon folderOpenIcon = new ImageIcon("icons/folder.png");
         private Icon folderCloseIcon = new ImageIcon("icons/folder_closed.png");
         private Icon fileIcon = new ImageIcon("icons/document.png");
         @Override
         public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected,
                   boolean expanded, boolean leaf, int row, boolean hasFocus) {
              super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row,
                        hasFocus);
              LogescoTreeNode node =
                   (LogescoTreeNode)value;
              Object obj = node.getUserObject();
              System.out.println(obj.getClass().toString());
              if(openIcon == null) {
                   openIcon = this.getOpenIcon();
                   if(openIcon != null) {
                        if(obj instanceof LProject) {
                             openIcon = projectOpenIcon;
                             this.setOpenIcon(openIcon);
                             openIcon = null;
                        } else if(obj instanceof LFolder) {
                             openIcon = folderOpenIcon;
                             this.setOpenIcon(openIcon);     
                             openIcon = null;
              if(closeIcon == null) {
                   closeIcon = this.getClosedIcon();
                   if(closeIcon != null) {
                        if(obj instanceof LProject) {
                             closeIcon = projectCloseIcon;
                             this.setClosedIcon(closeIcon);
                             closeIcon = null;
                        } else if(obj instanceof LFolder) {
                             closeIcon = folderCloseIcon;
                             this.setClosedIcon(closeIcon);
                             closeIcon = null;
              this.setLeafIcon(fileIcon);
              return this;
    }Thank you.

    Hi all,
    I changed my code a bit knowing that the renderer is global to the tree so my (openIcon == null) is called only once for the first node.
    Here is my new code :
    public class MyTreeCellRenderer extends DefaultTreeCellRenderer {
         private Icon projectOpenIcon = new ImageIcon("icons/book_open.png");
         private Icon projectCloseIcon = new ImageIcon("icons/book_blue.png");
         private Icon folderOpenIcon = new ImageIcon("icons/folder.png");
         private Icon folderCloseIcon = new ImageIcon("icons/folder_closed.png");
         private Icon fileIcon = new ImageIcon("icons/document.png");
         @Override
         public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected,
                   boolean expanded, boolean leaf, int row, boolean hasFocus) {
              super.getTreeCellRendererComponent(tree, value, selected,
                        expanded, leaf, row, hasFocus);
              LogescoTreeNode node =
                   (LogescoTreeNode)value;
              Object obj = node.getUserObject();
              System.out.println(obj.getClass().toString());
              if(obj instanceof LProject) {
                   this.setIcon(expanded ? projectOpenIcon : projectCloseIcon);
              } else if(obj instanceof LFolder) {
                   this.setIcon(expanded ? folderOpenIcon : folderCloseIcon);
              } else {
                   this.setIcon(fileIcon);
              return this;
         }

  • Can 3D work from photoshop extended cs5 be transferred into after effects cs4?

    Can 3D work from photoshop extended cs5 be transferred into after effects cs4? please help

    Why would you post this in the "Photoshop Elements" forum...?
    Try here;  http://forums.adobe.com/community/aftereffects_general_discussion
    or here; http://forums.adobe.com/community/photoshop

  • SetOpaque(false) doesn't work

    Hi,
    I'm looking for help to have background transparent panels. I tried to use JPanel with setOpaque(false), but I still have a lightGrey background ! Is it normal ??? I don't think so. Could anyone help me please...

    Thanks for your answers.
    I get rid of JComponent, I prefer not to use Swing for my application.
    So I will ask another question. I still want transparent panels and labels but in AWT. I found code to make them transparent, but when I draw an image on the last panel (in the background), I have the trace of the panels and labels which are above, and their backgrounds have the same color than the panel on which I draw my image.
    I DON'T UNDERSTAND !!!
    I'm looking for a solution to have a background image in my labels, but I have the text or the background, never both, even using drawString instead of label constructor.
    An idea ?
    Excuse my English, I'm French. :0�

  • SetOpaque(false);

    Hello:
    I have got your code on how to set a background image. Thank you so much.
    But I have another question , my question is that
    what is the purpose of the following method
    setOpaque(false);
    and also this method belongs to which class?

    DON'T CREATE A NEW THREAD EACH TIME YOU REPLY.
    THE REPLY BUTTON IS LOCATED AT THE UPPER RIGHT CORNER.
    REPLY TO THIS THREAD.
    http://forum.java.sun.com/thread.jspa?threadID=5223082&tstart=0

  • "Urgent---Any Light will be appreciated"

    Dear All,
    I am having a terrible problem. If anyone can help with any light in this topic I would be grateful. The application I am developing has two windows. What I meant is when I start two windows comes togather. The 2nd window basically is a viewer. From the first windows's menu I can say "Import Image" and that image is displayed in the 2nd window. I have the ability to rotate the image and then draw a rectangle in the image. Once I draw the rectangle it feeds some data in the first windows table.
    Here is the problem: When I draw the image and then rotate the image 90 degree the rectangle also moves. I don't want that. I want to do something so even if I rotate the image 100 times still the rectangle should stay in the area where I have drawn that.
    If you can tell me how to do this or if you can tell me where should I research about it would be great.
    Thanks

    Or if u so wish,
    1. Try creating an icon of the rectangle,
    2. Place this icon into a JLabel and
    3. Have the JLabel placed on top of the image
    b. set the JLabel.setOpaque(false)
    Just another idea. Whaddaya think?
    Reformer!

  • Set property for  background color for JButton

    I am attempting to change the colors of the UI for JButton. The change does not appear to be taking. The reason appears to be that JButton, and for that matter JLabel setOpaque(false); How can I globally change this to setOpaque(true);
    Second is there a way to save the default property hash table after the changes are made so that it will run the next time the program is executed.

    Thank you for responding. I don't feel that I have been clear in the statement of the problem. I have written a medium size desktop application(20,000 statements). I am trying to customize the color scheme by modifying the default laf properties color entries. I can modify JPanel through a put to the properties hash table. When I attempt to change the background color for JLabel and JButton it doesn't seem to take. I believe that the reason it doesn't take is because opaque(false). Is there a property that allows the overide of opaque to true or do I have to change all of the numerous JButtons in my program.
    I have decided to store all changes in a file and make the changes at the point that the program initializes each time its run.
    I am not looking for specific code but an approach.
    I would appreciate your advice.

  • How can you get  the public variables from object that extends JLabel?

    I'm using the mouseClickedListener method e.getComponent(); to get the component that is clicked on the sceen. The component i clicked is type "object" and extends a jlabel, and i really need to acces a variable from it. Heres the code i'm using-
    MouseListener listenerDown=new java.awt.event.MouseListener() {
            public void mousePressed(MouseEvent e){
                paintAll();
                mX=e.getX();
                mY=e.getY();
            public void mouseClicked(MouseEvent e) {
                Component c = e.getComponent();
                drawResizeBox(c);
                selected=c;
            public void mouseReleased(MouseEvent e) {
            public void mouseEntered(MouseEvent e) {
            public void mouseExited(MouseEvent e) {
    package javapoint;
    import java.awt.Color;
    import java.awt.Graphics2D;
    import java.awt.Image;
    import java.awt.Rectangle;
    import java.awt.RenderingHints;
    import java.awt.geom.Line2D;
    import java.awt.image.BufferedImage;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JLabel;
    public class object extends JLabel{
        public object(Rectangle rect,int id){
            idNum=id;
            Rect=rect;
            BufferedImage image = new BufferedImage((int)rect.getWidth()+1, (int)rect.getHeight()+1, BufferedImage.TYPE_INT_ARGB);
            Graphics2D g = (Graphics2D) image.getGraphics();       
            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g.drawRect((int)rect.getX(), (int)rect.getY(), (int)rect.getWidth(), (int)rect.getHeight());
            Icon icon = new ImageIcon((Image)image);
            setIcon(icon);
            setBounds((int)rect.getX()-1, (int)rect.getY()-1, (int)rect.getWidth()+1, (int)rect.getHeight()+1);
            mainFrame.slideArr[mainFrame.sIndx].add(this);
            setVisible(true);
            r=true;       
        object(Oval oval,int id){
            idNum=id;       
            setBounds(oval.getX(), oval.getY(), oval.getWidth(), oval.getHeight());
            getGraphics().drawOval(oval.getX(), oval.getY(), oval.getWidth(), oval.getHeight());
            o=true;
            setVisible(true);
        object(Line2D line,int id){
            idNum=id;       
            setBounds((int)line.getX1(), (int)line.getY1(), (int)line.getX2(), (int)line.getY2()); //Not gunna work
            getGraphics().drawLine((int)line.getX1(), (int)line.getY1(), (int)line.getX2(), (int)line.getY2());
            l=true;
            setVisible(true);
        object(Icon icon,int id){
            idNum=id;
            setIcon(icon);
            setBounds(50,50,icon.getIconWidth(),icon.getIconHeight());
            i=true;
            setVisible(true);
        void drawObject(object obj){
            if(r){
                Rectangle rect=obj.Rect;
                setBounds((int)rect.getX()-1, (int)rect.getY()-1, (int)rect.getWidth()+1, (int)rect.getHeight()+1);          
                Rect=rect;
                BufferedImage image = new BufferedImage((int)rect.getWidth()+1, (int)rect.getHeight()+1, BufferedImage.TYPE_INT_ARGB);
                Graphics2D g = (Graphics2D) image.getGraphics();           
                g.setColor(Color.red);
                g.drawRect(0, 0, (int)rect.getWidth(), (int)rect.getHeight());           
                Icon icon = new ImageIcon((Image)image);
                setIcon(icon);
            }else if(l){
            }else if(o){
            }else if(i){
        public boolean r=false;
        public Rectangle Rect;
        public boolean o=false;
        public Oval Oval;
        public boolean l=false;
        public Line2D Line;
        public boolean i=false;
        public Icon Icon;
        public JLabel label;
        public int idNum;
    }Edited by: ghostbust555 on Feb 12, 2010 2:14 PM

    ghostbust555 wrote:
    Well see the problem is i have an array of 200 objects.What does that have to do with anything? And if it does, why isn't it in the code you posted?
    I dont understand what you mean in your "Edit..." part. could you show some code/ explain farther? sorry if its a dumb question I'm still a bit of a novice at java.Yeah.
    object yuck = (object) e.getComponent(); // That's a cast.
    boolean yucksR = yuck.r; // Get the "r" variable from the object.

  • How to Diasble JLabel since enable(false) method is deprecated in jdk1.4

    Hi friends
    i am using jdk1.4 in which enable method is deprecated.
    i am disabling my jlabel using jlabel.enable(false); method
    however this is deprecated.
    what method should i then use
    please do help

    You just try with the .setEnabled(false); This will
    help to solve your problem.Hey Thanks Mr. Sumode , its working with .setEnabled(false);

  • How do i extend a sound-effect clip???

    Just wanted to find out how can i extend the durarion of a sound-effect clip that i imported into F.C.P. The clip can't extend past 10 sec, so I thought the best way to do it is to loop it but i don't know how.
    Any ideas???
    Thanks.

    I have already done that. I put several duplicates of the same clip in a row, but there's a clear break between each clip. For example, the sound-effect clip is rain; so if i copy, paste it and put it after the original you can hear the break between the clips.
    There's a way to fix that, i know, by putting audio cross fades between each clip, which works, but as you can tell is a hassle.
    I just thought there's was a much easier and faster way of looping the short clip so that you can constantly hear it (without any breaks) for a longer period of time.

Maybe you are looking for

  • Course Cost - Free of Charge

    Dear Experts, I have created a course with internal and external price. But when the user view the course details in Learners Portal, Free of charge is displayed. I have made the settings as below, In OOKR transaction, I have set the SEMIN CCOST to '

  • Problem Scrolling with T400

    I have a recent problem with the middle button (scroll) feature for the trackpoint on my T400 with Windows XP 32-bit.  Previously, holding down the middle button would freeze the cursor and enable scrolling with the nubbin. However, now the scrolling

  • Microsoft outlook sync?

    upgraded from torch to z10 and now cant sync with outlook calendar and contacts etc, something which is very important to my job. Am i doing something wrong or is it not supported? If the latter, then this is poor... Love the phone but it has to do i

  • Cannot access the iTunes radio

    Hello, I am trying to access the new iTunes radio.  I've added a few radio stations to play as well.  With the new update a couple weeks ago, it started off fine.  Now, it's not working.  I've updated to version 11.1.1 this morning and rebooted my co

  • Sign in problems on Samsung SmartTV

    Hi, I have a Samsung SmartTV UE32F5570 connected vie LAN and Router and DSL. When I purchased the TV 1 month ago Skype login worked. However, now, when I start the Skype app it stays in the loading loop. it is configured to login automatically. I add