i want to use a JButton with a rollover sound..so created a button with a sound using adobe macromedia flash...
how can i display it in the swf button in jpanel??
here is the button..button.swf

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

public class MyPanel extends JPanel {
    private JButton jcomp1;

    public MyPanel() {
        //construct components
        jcomp1 = new JButton ("button.swf");

        //adjust size and set layout
        setPreferredSize (new Dimension (220, 149));
        setLayout (null);

        //add components
        add (jcomp1);

        //set component bounds (only needed by Absolute Positioning)
        jcomp1.setBounds (55, 90, 100, 25);
    }


    public static void main (String[] args) {
        JFrame frame = new JFrame ("MyPanel");
        frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add (new MyPanel());
        frame.pack();
        frame.setVisible (true);
    }
}

Well, I can at least say that that's nicely formatted. Otherwise .....

Did you have some sort of question you wished to ask?

yes..i wanted to use a swf as JButton..how do i do that??
sorry i wasn't done yet with the post when you replied..:)

In that manner, you can't. Create an image that you can create an ImageIcon from to set as the button lable (see the API docs for JButton) and create a Sound file and use a MouseListener to play it with the MouseEntered event (See the Swing tutorials).

You better look into Java and Flex

.,uhhm..can you give me a sample code??im not really good at these kind of instructions..I'm just new to java prog..the code that i posted was from a software called guigenie,it lets me drag components in the frame and gives the code..

what is java and flex?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.