JAVA SOUND APPLICATION not applet.....help needed.....cheers

hey there people heres the deal I need to complete this before 5 today but im completely stumped...we have to make a sound file player with a swing interface I have it playing(kind of!) but where now...I would be forever in your debt as my masters degree hangs in the balance! de de duhhhh! cheers
iT WORKS ALRIGHT JUST NEED STOP PAUSE BUTTON FUNCTION..........
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.event.*;
import java.io.File;
import java.io.IOException;
import javax.sound.sampled.*;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.LineEvent;
import javax.sound.sampled.LineListener;
import javax.sound.sampled.LineUnavailableException;
public class AudioPlayer extends JFrame implements ActionListener, ChangeListener{
boolean playing;
boolean looping;
String filename = File.separator+"tmp";
File selFile;
Clip clip;
JFileChooser fc = new JFileChooser();
JButton btnOpen = new JButton("Open");
JButton btnPlay = new JButton("Play");
JButton btnStop = new JButton("Stop");
JButton btnPause = new JButton("Pause");
JButton btnLoop = new JButton("Loop");
JSlider volume = new JSlider(SwingConstants.HORIZONTAL,0,100,0);
JSlider panning = new JSlider(SwingConstants.HORIZONTAL,0,100,0);
public AudioPlayer(){
Container contentPane = getContentPane();
contentPane.setLayout(new FlowLayout());
contentPane.add(btnOpen);btnPlay.addActionListener(this);
contentPane.add(btnPlay);btnPlay.addActionListener(this);
contentPane.add(btnStop);btnStop.addActionListener(this);
contentPane.add(btnPause);btnPause.addActionListener(this);
contentPane.add(btnLoop);btnLoop.addActionListener(this);
// Show open dialog; this method does not return until the dialog is closed
fc.showOpenDialog(this);
selFile = fc.getSelectedFile();
volume.addChangeListener(this);
panning.addChangeListener(this);
volume.putClientProperty("JSlider.isFilled", Boolean.TRUE);
volume.setPaintTicks(true);volume.setPaintLabels(true);
volume.setMajorTickSpacing(20);volume.setMinorTickSpacing(10);
contentPane.add(volume);
panning.putClientProperty("JSlider.isFilled", Boolean.TRUE);
panning.setPaintTicks(true);panning.setPaintLabels(true);
panning.setMajorTickSpacing(20);panning.setMinorTickSpacing(10);
contentPane.add(panning);
addWindowListener(
new WindowAdapter () {
public void windowClosing(WindowEvent e){
setVisible(false);
public void actionPerformed(ActionEvent e){
int returnVal = JFileChooser.APPROVE_OPTION;
//Handle open file action.
if (e.getSource() == btnOpen)
System.out.println("FA1");
returnVal = fc.showOpenDialog(AudioPlayer.this);
if (returnVal == JFileChooser.APPROVE_OPTION)
{ selFile = fc.getSelectedFile();
//This is where a real application would open the file.
else
if(e.getSource() == btnPlay)
playAudio();
public void stateChanged(ChangeEvent e)
public static void main(String[] args)
AudioPlayer audioPlayer = new AudioPlayer();
audioPlayer.setSize(400,400);
audioPlayer.show();
public void playAudio ()
playing = true;
AudioInputStream audiosource = null;
try
audiosource = AudioSystem.getAudioInputStream(selFile);
System.out.println("here");
//System.out.println(audiosource.getFormat());
DataLine.Info dataLineInfo = new DataLine.Info(Clip.class,audiosource.getFormat());
clip = (Clip)AudioSystem.getLine(dataLineInfo);
clip.open(audiosource);
catch (UnsupportedAudioFileException e)
catch (LineUnavailableException e)
catch (IOException e)
//catch (Exception e) {}
if (looping)
clip.loop(clip.LOOP_CONTINUOUSLY);
else
clip.loop(0);
playing = false;
}

You have not added the actionListener to all the button D'oh
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.event.*;
import javax.sound.sampled.*;
* Description of the Class
*@author rsmazara
*@created 28 February 2003
public class AudioPlayer extends JFrame implements ActionListener, ChangeListener {
File selFile;
JFileChooser fc = new JFileChooser();
JButton btnOpen = new JButton( "Open" );
JButton btnPlay = new JButton( "Play >" );
JButton btnStop = new JButton( "Stop" );
JButton btnPause = new JButton( "Pause ||" );
JCheckBox btnLoop = new JCheckBox( "Loop" );
JSlider volume = new JSlider( SwingConstants.HORIZONTAL, 0, 100, 0 );
JSlider panning = new JSlider( SwingConstants.HORIZONTAL, 0, 100, 0 );
JLabel label = new JLabel( " " );
public AudioPlayer() {
Container contentPane = getContentPane();
contentPane.setLayout( new FlowLayout() );
btnOpen.addActionListener( this );
contentPane.add( btnOpen );
btnPlay.addActionListener( this );
contentPane.add( btnPlay );
btnPlay.addActionListener( this );
contentPane.add( btnStop );
btnStop.addActionListener( this );
contentPane.add( btnPause );
btnPause.addActionListener( this );
contentPane.add( btnLoop );
btnLoop.addActionListener( this );
btnPlay.setEnabled( false );
btnStop.setEnabled( false );
btnPause.setEnabled( false );
// Show open dialog; this method does not return until the dialog is closed
// fc.showOpenDialog( this );
// selFile = fc.getSelectedFile();
volume.addChangeListener( this );
panning.addChangeListener( this );
volume.putClientProperty( "JSlider.isFilled", Boolean.TRUE );
volume.setPaintTicks( true );
volume.setPaintLabels( true );
volume.setMajorTickSpacing( 20 );
volume.setMinorTickSpacing( 10 );
contentPane.add( volume );
panning.putClientProperty( "JSlider.isFilled", Boolean.TRUE );
panning.setPaintTicks( true );
panning.setPaintLabels( true );
panning.setMajorTickSpacing( 20 );
panning.setMinorTickSpacing( 10 );
contentPane.add( panning );
contentPane.add( label );
addWindowListener(
new WindowAdapter() {
public void windowClosing( WindowEvent e ) {
setVisible( false );
System.exit( -100 );
public void actionPerformed( ActionEvent e ) {
int returnVal = JFileChooser.APPROVE_OPTION;
//Handle open file action.
System.out.println( e.getActionCommand() );
///open
if ( e.getSource() == btnOpen ) {
System.out.println( "FA1" );
returnVal = fc.showOpenDialog( AudioPlayer.this );
if ( returnVal == JFileChooser.APPROVE_OPTION ) {
selFile = fc.getSelectedFile();
player = new Player( selFile );
label.setText( "File loaded : " + selFile.getAbsolutePath() );
btnPlay.setEnabled( true );
btnStop.setEnabled( false );
btnPause.setEnabled( false );
//This is where a real application would open the file.
} else {
//play
if ( e.getSource() == btnPlay ) {
player.go( btnLoop.isSelected() );
btnPlay.setEnabled( false );
btnStop.setEnabled( true );
btnPause.setEnabled( true );
// playAudio();
// pause
if ( e.getSource() == btnPause ) {
player.pause();
btnPlay.setEnabled( true );
btnStop.setEnabled( true );
btnPause.setEnabled( false );
if ( e.getSource() == btnStop ) {
player.finish();
btnPlay.setEnabled( true );
btnStop.setEnabled( false );
btnPause.setEnabled( false );
public void stateChanged( ChangeEvent e ) {
private Player player = null;
public static void main( String[] args ) {
AudioPlayer audioPlayer = new AudioPlayer();
audioPlayer.setSize( 400, 400 );
audioPlayer.show();
* Description of the Class
*@author rsmazara
*@created 28 February 2003
class Player {
Clip clip;
private java.io.File selectedFile = null;
private boolean looping = false;
public Player( File file ) {
selectedFile = file;
AudioInputStream audiosource = null;
try {
audiosource = AudioSystem.getAudioInputStream( selectedFile );
System.out.println( "here" );
//System.out.println(audiosource.getFormat());
DataLine.Info dataLineInfo = new DataLine.Info( Clip.class, audiosource.getFormat() );
clip = ( Clip ) AudioSystem.getLine( dataLineInfo );
clip.open( audiosource );
} catch ( UnsupportedAudioFileException e1 ) {
e1.printStackTrace();
} catch ( LineUnavailableException e2 ) {
e2.printStackTrace();
} catch ( IOException e3 ) {
e3.printStackTrace();
private boolean work = false;
public void go( boolean loop ) {
looping = loop;
playAudio();
public void finish() {
clip.stop();
public boolean isWorking() {
return clip.isRunning();
long pausePosition = ( long ) 0;
public void pause() {
pausePosition = clip.getMicrosecondPosition();
clip.stop();
public void restart() {
clip.setMicrosecondPosition( pausePosition );
playAudio();
public void loop( boolean loop ) {
looping = loop;
private void playAudio() {
if ( looping ) {
clip.loop( clip.LOOP_CONTINUOUSLY );
} else {
clip.loop( 0 );

Similar Messages

  • Java script does not execute - help would be appreciated.

    How can i tell the user where they are based upon the page url?
    I have put the following script at the top of the large product page
    and have the latest version of js installed.
    <script type="text/javascript">
    if (document.location.href.match('brands')) {
    alert('dont forget you are on the brands page');
    else if (document.location.href.match('fish')) {
    alert('dont forget you are on the fish page');
    </script>
    Any help would be appreciated.
    Thank you.

    Hi Peter, Posting snippets of code is not really helpful, Need to see it running. You could have other script errors and we can better see what your trying to achieve.

  • How to add images into a java application (not applet)

    Hello,
    I am new in java programming. I would like to know how to add images into a java application (not an applet). If i could get an standard example about how to add a image to a java application, I would apreciated it. Any help will be greatly apreciated.
    Thank you,
    Oscar

    Your' better off looking in the java 2d forum.
    package images;
    import java.awt.*;
    import java.awt.image.*;
    import java.io.FileInputStream;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    /** * LogoImage is a class that is used to load images into the program */
    public class LogoImage extends JPanel {
         private BufferedImage image;
         private int factor = 1; /** Creates a new instance of ImagePanel */
         public LogoImage() {
              this(new Dimension(600, 50));
         public LogoImage(Dimension sz) {
              //setBackground(Color.green);      
              setPreferredSize(sz);
         public void setImage(BufferedImage im) {
              image = im;
              if (im != null) {
                   setPreferredSize(
                        new Dimension(image.getWidth(), image.getHeight()));
              } else {
                   setPreferredSize(new Dimension(200, 200));
         public void setImageSizeFactor(int factor) {
              this.factor = factor;
         public void paintComponent(Graphics g) {
              super.paintComponent(g);
              //paint background 
              Graphics2D g2D = (Graphics2D) g;
              //Draw image at its natural size first. 
              if (image != null) {
                   g2D.drawImage(image, null, 0, 0);
         public static LogoImage createImage(String filename) { /* Stream the logo gif file into an image object */
              LogoImage logoImage = new LogoImage();
              BufferedImage image;
              try {
                   FileInputStream fileInput =
                        new FileInputStream("images/" + filename);
                   image = ImageIO.read(fileInput);
                   logoImage =
                        new LogoImage(
                             new Dimension(image.getWidth(), image.getHeight()));
                   fileInput.close();
                   logoImage.setImage(image);
              } catch (Exception e) {
                   System.err.println(e);
              return logoImage;
         public static void main(String[] args) {
              JFrame jf = new JFrame("testImage");
              Container cp = jf.getContentPane();
              cp.add(LogoImage.createImage("logo.gif"), BorderLayout.CENTER);
              jf.setVisible(true);
              jf.pack();
    }Now you can use this class anywhere in your pgram to add a JPanel

  • "Error: Application Not Found" Help?

    Hey everybody, I was just wondering if anyone could help me out here. Everytime I go to open iTunes, I get an error saying "Application Not found" and I don't know why. I did some researching and heard that Nortons Anti virus might be the problem. WhichI think is probably true because Iinstalled Norton, ran a virus scan, and I can't open quite a few files. iTunes, FireFox, Google Chrome, etc... Anyone know how to fix it? I've uninstalled iTunes and re-installed it and nothing. I also went to the settings in Norton and changed iTunes from 'Auto' to 'Allow' but it still won't work. Any one know what to do?

    I figured out the problem - no need to reply.
    I mistakenly added an authentication scheme instead of an authorization scheme.
    Fixed it - works fine.
    Thanks,
    David

  • Java card application and applet

    Hi
    I' am developing a java card application which has three applets (1-ID, 2-Purse, 3-Library). I mean the same card should be use for personal ID, purse, and as library card. Using eclipse I first have to create a new project.
    File-New-New project-java card project. Then in the package Explorer view right click src then New-other-java card Applet. My question is because my java card application has more than one applet how do I add the other two. Should I add the other two by clicking src again or just add them under the same source code belonging to the java card Applet created at the beginning.

    you mean by again doing right click src then New-other-java card Applet.

  • Help on moving of image across screen(java application,not applet)

    I've searched the entire internet and everything I've found is on java applets and I'm an alien to the differences between an applet and an application.
    This is actually for a java game I'm creating using Eclipse's visual editor and I'm failing miserably.
    What I'm trying to do is to find some java source code that enables me to start an image automatically moving across the screen that only stops when I click on it. I did find some applet codes but when I tried converting it to application code a load of errors popped out.
    Thanks for the help if there's any! I'm getting desperate here because the game's due this friday and I'm stuck at this stage for who knows how long.

    Here is one of the codes I found ,it's not mine but I'm trying to edit it into a java application instead of an applet...Sort of like: ' public class MovingLabels extends JFrame ' or some code that I can copy and paste into another java program.
    * Swing version.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class MovingLabels extends JApplet
    implements ActionListener {
    int frameNumber = -1;
    Timer timer;
    boolean frozen = false;
    JLayeredPane layeredPane;
    JLabel bgLabel, fgLabel;
    int fgHeight, fgWidth;
    int bgHeight, bgWidth;
    static String fgFile = "wow.gif";
    static String bgFile = "Spring.jpg";
    //Invoked only when run as an applet.
    public void init() {
    Image bgImage = getImage(getCodeBase(), bgFile);
    Image fgImage = getImage(getCodeBase(), fgFile);
    buildUI(getContentPane(), bgImage, fgImage);
    void buildUI(Container container, Image bgImage, Image fgImage) {
    final ImageIcon bgIcon = new ImageIcon(bgImage);
    final ImageIcon fgIcon = new ImageIcon(fgImage);
    bgWidth = bgIcon.getIconWidth();
    bgHeight = bgIcon.getIconHeight();
    fgWidth = fgIcon.getIconWidth();
    fgHeight = fgIcon.getIconHeight();
    //Set up a timer that calls this object's action handler
    timer = new Timer(100, this); //delay = 100 ms
    timer.setInitialDelay(0);
    timer.setCoalesce(true);
    //Create a label to display the background image.
    bgLabel = new JLabel(bgIcon);
    bgLabel.setOpaque(true);
    bgLabel.setBounds(0, 0, bgWidth, bgHeight);
    //Create a label to display the foreground image.
    fgLabel = new JLabel(fgIcon);
    fgLabel.setBounds(-fgWidth, -fgHeight, fgWidth, fgHeight);
    //Create the layered pane to hold the labels.
    layeredPane = new JLayeredPane();
    layeredPane.setPreferredSize(
    new Dimension(bgWidth, bgHeight));
    layeredPane.addMouseListener(new MouseAdapter() {
    public void mousePressed(MouseEvent e) {
    if (frozen) {
    frozen = false;
    startAnimation();
    } else {
    frozen = true;
    stopAnimation();
    layeredPane.add(bgLabel, new Integer(0)); //low layer
    layeredPane.add(fgLabel, new Integer(1)); //high layer
    container.add(layeredPane, BorderLayout.CENTER);
    //Invoked by the applet browser only.
    public void start() {
    startAnimation();
    //Invoked by the applet browser only.
    public void stop() {
    stopAnimation();
    public synchronized void startAnimation() {
    if (frozen) {
    //Do nothing. The user has requested that we
    //stop changing the image.
    } else {
    //Start animating!
    if (!timer.isRunning()) {
    timer.start();
    public synchronized void stopAnimation() {
    //Stop the animating thread.
    if (timer.isRunning()) {
    timer.stop();
    public void actionPerformed(ActionEvent e) {
    //Advance animation frame.
    frameNumber++;
    //Display it.
    fgLabel.setLocation(
    ((frameNumber*5)
    % (fgWidth + bgWidth))
    - fgWidth,
    (bgHeight - fgHeight)/2);
    //Invoked only when run as an application.
    public static void main(String[] args) {
    Image bgImage = Toolkit.getDefaultToolkit().getImage(
    MovingLabels.bgFile);
    Image fgImage = Toolkit.getDefaultToolkit().getImage(
    MovingLabels.fgFile);
    final MovingLabels movingLabels = new MovingLabels();
    JFrame f = new JFrame("MovingLabels");
    f.addWindowListener(new WindowAdapter() {
    public void windowIconified(WindowEvent e) {
    movingLabels.stopAnimation();
    public void windowDeiconified(WindowEvent e) {
    movingLabels.startAnimation();
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    movingLabels.buildUI(f.getContentPane(), bgImage, fgImage);
    f.setSize(500, 125);
    f.setVisible(true);
    movingLabels.startAnimation();
    }

  • Repaint in Java application (not Applet)

    Hi,
    I have server application with GUI containing TextArea. On any connection request from client, the application creates a thread which deals with the client request. Once the client request finishes, I want to show the detail of the client which connected to the server in the TextArea. Now I have extended the main server class for the thread class, which deals with the client, and have a method in the main server class which appends string on the textarea. BUT, when thread call that function nothing appears in the TextArea. I have checked that the thread is calling the method correctly, I think I need to repaint the TextArea. How? I am looking for your help. I have tried repaint, it does not work. Appreciate any help in this regard,
    Here is the code.
    Server side.......
    public synchronized void displayMessage( String thismessage) {
         System.out.println("-----> " + thismessage);
         editPan.setEditable(true);
         editPan.append(thismessage + "\n");
    public void run() {
    while(true) {
    try {
    server = new ServerSocket( 5000, 100 );
    while(listening) {
    connection = server.accept();
    if(connection != null) {
    alertDialog cThread = new alertDialog(connection, errorNumber);
    (new Thread(cThread)).start();
    errorNumber++;
    connection = null;
    catch( IOException e ) {
    System.out.println("Exception : " + e.toString() );
    Client Attender Thread class (alertDialog) which extends server class......
    public void run() {
    try {
    BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    String inputLine = in.readLine();
    System.out.println(" " + dateString + " " + inputLine );
    // super.editPan.append(" Test from alert.. \n");
         super.displayMessage(" " + dateString + " " + inputLine);
    JOptionPane.showMessageDialog(null, inputLine, "Alert....", JOptionPane.ERROR_MESSAGE);
    in.close();
    } catch (IOException e) {

    Be careful when calling Swing methods from outside the EventDispatch thread. If you call a swing method from a thread, you should use SwingUtilities.invokeAndWait() or SwingUtilities.invokeLater().
    See http://java.sun.com/docs/books/tutorial/uiswing/mini/threads.html for more details.

  • How to change heap memory size for general java applications (not applets)

    Hi. I made a java class which manipulates images and I sometimes get an out of memory error when the files are large. In these cases I can run it successfully from the command line using:
    java -Xms32m -Xmx128m myappbut as I run this class from a firefox extension, I can't use this technique.
    Could some one tell me how to set this globally? I've found a lot of info on setting it for applets in the control panel but that's it. I also tried editing my deployment.properties file by adding:
    deployment.javapi.jre.1.6.0_11-b03.args=-Xmx128mbut none of these options seem to work.
    Thanks for any help.

    Also you can use use [JAVA_TOOL_OPTIONS|http://java.sun.com/j2se/1.5.0/docs/guide/jvmti/jvmti.html#tooloptions], with more documentation here. JAVA_TOOLS_OPTIONS is available since 1.5. There is no direct documentation on [_JAVA_OPTIONS|http://java.sun.com/j2se/1.5.0/docs/guide/2d/flags.html] but was made available since at least 1.3.
    The recent existing forum thread [Java Programming - How to change the default memory limits for java.|http://forums.sun.com/thread.jspa?threadID=5368323&messageID=10615245&start=36] has a long discussion on the issue.
    You specified you are not using applets, but if you do, I would also suggest you use the next Generation Plug-in (since 1.6.0_10) that allows you specify the max memory in the applet without having to instruct the user how to make the change. See [JAVA_ARGUMENTS|https://jdk6.dev.java.net/plugin2/#JAVA_ARGUMENTS] for applets. Java Webstart uses resources.

  • Simple java applet help needed

    hi, im having trouble with an applet im developing for a project.
    i have developed an applet with asks the user for simple information( name,address and phone) through textfields, i wish for the applet to store this information in an array when an add button below the textfeilds is pressed.
    client array[];
    array=new client[];//needs to be an infinate array!
    I have created the client class with all the set and get methods plus constructors needed but i dont know how to take the text typed into the textfields by the user and store them in the array.
    i also need to save this info to a file and be able to load it back into the applet.
    Could some please help! Thank you for your time.

    Better maybe redefine the idea using an data structure :
    public class client{
    private char name[];
    private char address[];
    private int phone;
    public class vector_clients{
    private client vect[];
    // methods for vect[]
    What is your opinion about ???

  • Please help. Start a client application (not applet) from a web page.

    Hi,
    It may be very simple, but I can not find it quickly.
    Anyone can give me an example page that can start an application by click something.
    Thanks very much.

    Hi,
    This works on my PC (of course it's not portable to all clients)
    <HTML>
    <BODY>
    Click here to start notepad
    </BODY>
    </HTML>

  • Java Application freeze! Help needed

    Hi there
    I have en application that recive a corba calls from one server and translate it to HTTP calls and call to diffrent server (about 50 calles per second)
    Now every thing is working for 5-6 hours, and then the application freeze for 5 minuts and then start to work again like nothing had heppend, after 2-3 hours again the application freeze for 5 minuts and so on and so on
    Any idea?
    I will be more then heppy for any kind of help :)
    10x
    [email protected]

    Try taking a thread dump.
    This should show you what the application is doing.
    On UNIX this is kill -QUIT {process}
    I don't know how to do this on Windows.

  • Works in application, not applet, why

    connection = new Socket(
    InetAddress.getByName("mailbox.oneonta.edu"), 25);
    this line works in my application but i get a java.security.AccessControlException when i try to use the code in an applet. can anyone help?

    I think there is more then enough great documentation on this very site to help you out. Explaining things like how to sign an applet, or a jar, that are docuemented so your little sister can do it is a waste of time. I'm not being rude at all, I'm trying to get you to use the resources of this site. The java tutorials is a great place to start.

  • Applications not working, help! Pleasssse.

    Okay so, I'm not entirely sure if this is the correct "category" Or whatever to post this question in, but I need some help.
    So regardless, it would be nice if I could get an answer.
    Alright, so I got this macbook laptop. I'm not sure what model it is or anything, but whatever.
    My mom got it for me for school from one of her friends, and it was really annoying that next to the little home icon in the finder it's his name "Charlie." I believe it's called the short name or something? Well anyway, so I did all this complicated stuff to change that, and change it so I have a new admin account with my name instead, but the thing is, I've been using his account for the past few months, so I already have my music, my pictures, and everything on his, so I did tried to put them into my new"directory" or whatever. And it seemed to work, becuase all of my info and pictures and music and everything is there. But the only thing, is that whenever I try to open pretty much anything, (iTunes, iPhoto, Firefox....) It gives me this message saying "The folder <Whatever> is on a locked disk or you do not have permissions for this folder."
    And yes, I did the whole "Command i" Thing to get to the information and it says I have reading & writing on the program but still it's NOT working. Please please please help me.

    Open the Terminal in the /Applications/Utilities/ folder and run the following:
    sudo chown -R $UID ~
    chmod -R u+rwX ~
    The first command wil ask for an administrator password, which won't produce anything in the Terminal window.
    (53205)

  • Urgent Applet Help Needed

    Hi All,
    I have a following problem. I have included a JTable inside a JScrollPabe in an applet.
    However when the web page loads. There is nothing shown. When I tried 'refreshing' the page several times in quick succession , occasionally the contents is shown. What coule be the problem?
    Another issue is when I switch to another application, the contents disappear again. How can i fix the contents without it disapperaing when the web page is minimised or has lost focus?
    Below is the code for my applet.
    import javax.swing.JApplet;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.io.*;
    import java.util.*;
    import java.net.*;
    import com.sns.legal.lit.applet.*;
    public class Simple extends JApplet{
         //private MultiLineTable table = null;
         //private Vector vecResult = null;
         public Simple() {
        public void init() {
        public void start() {
             Object[][] data = new Object[][] {{"first row", "\"I was drunk last night, crawled home across the lawn.  By accident I put the car key in the door lock.  The house started up.  So I figured what the hell, and drove it around the block a few times.  I thought I should go park it in the middle of the freeway and yell at everyone to get off my driveway.\"\n                -- Steven Wright"},
                              {"second row", "The most advantageous, pre-eminent thing thou canst do is not to exhibit nor display thyself within the limits of our galaxy, but rather depart instantaneously whence thou even now standest and flee to yet another rotten planet in the universe, if thou canst have the good fortune to find one.\n                -- Carlyle"}};
                 Object[] columns = new Object[] {"first column", "fortune cookie"};
                 JTable table2 = new JTable(data, columns);
             System.out.println("Start.......................");
             JScrollPane scrollPane = new JScrollPane(table)
             this.getContentPane().add(scrollPane, BorderLayout.CENTER);     
             this.setVisible(true);
             System.out.println("End.......................");
        public void stop() {
        public void destroy() {
        public void paint(Graphics g){
        }     Thank alot!

    You haven't set the Layout of the getContentPane() to new BorderLayout()
    You make the assumption that thats the default layout manager.
    Try adding that first.
    You may have to add some pack() or doLayout() calls at the end of your start() routine if it still doesn't work.
    regards,
    Owen

  • Java FX application not loading other machine

    Hi all,
    I have faced the problem when run the simple jafaFx sample application
    The code below :
    <html>
    <head>
    <title>EffectsPlayground</title>
    </head>
    <body>
    <h1>EffectsPlayground tttt</h1>
    <script src="http://dl.javafx.com/dtfx.js"></script>
    <script>
    javafx(
    archive: "EffectsPlayground.jar",
    draggable: true,
    width: 600,
    height: 560,
    code: "effectsplayground.Main",
    name: "EffectsPlayground"
    </script>
    </body>
    </html>
    It's Working fine in my machine
    Not working in other machine in Network
    I deployed in Tomcat
    Plz help me
    Navaneeth
    Edited by: Navaneethakrishnan.Shanmugam on Apr 22, 2009 6:56 AM

    Can't say much, based on the (lack of) information you provide. Except: ensure the other browser has JavaScript enabled, and uses the right version of Java.

Maybe you are looking for

  • Problem Installing Developer Suite on WIndows Vista

    Hi! i'm a student of computer science, and i need to install developer suite for a proyect i need to do for one of my classes. I have a problem installing developer suit on Windows Vista. After i download and unzip both disk, i run the setup from the

  • XY graphing with large amount of data

    I was looking into graphing a fairly substantial amount of data.  It is bursted across serial. What I have is 30 values corresponding to remote data sensors.  The data for each comes across together, so I have no problem having the data grouped.  It

  • DVD-Drive detection

    Hi to all Perhaps somebody has an idea to the following problem. I'm using a 845E Max2 board and Microsoft Millennium Edition as operting system. After installing a DVD-Drive, it is correctly recognized on IDE1 in the Mainboard Bios. When Windows the

  • How do add CD cover artwork for

    cover flow? I hope I have that term correct. Some album covers show up some don't. Is there an easy way to add album cover? Thanks, SP

  • Migrate from G4 to new Macbook.. Not your typical question

    Good morning. My wife was using an iBook G4 for some time. Our 13 month old grandson one day made a quick move and pulled on the display, pulling it towards him. The machine now only shows a grey/white screen when booting. It sounds like it is starti