Results 1 to 1 of 1
  1. #1
    charlotte is offline Member
    Join Date
    May 2008
    Posts
    1
    Rep Power
    0

    Smile Girl from Sweden needs help fast!!! :):)

    HI!
    Im have problems with developing av program. Could someone please help me? Im totally stuck. I have made the graphics but now I dont known what to do.....!!!!
    :eek:

    Im supposed to make the buttons work....but Idont know how to connected the buttons with a make it play......
    :D
    The musicmaker is supposed to randomize sound when a button is clicked on..and play a already existing sound: a base, dums and synth togather so that i creates a randomized song....if someone could help me with this I would be really greatefull!!!!

    Best regards/
    Charlotte:)

    package javaapplication9;


    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.io.InputStream;
    import java.lang.Object;
    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.LineUnavailableException;
    import javax.sound.sampled.UnsupportedAudioFileException;







    public abstract class AudioFileReader {

    private Clip sound;

    private void initSound(String soundFile) {

    InputStream in = null;
    AudioInputStream stream = null;
    try {
    stream = AudioSystem.getAudioInputStream(new File(soundFile));
    AudioFormat format = stream.getFormat();
    DataLine.Info info = new DataLine.Info(Clip.class, stream.getFormat());
    sound = (Clip) AudioSystem.getLine(info);
    sound.open(stream);
    } catch (LineUnavailableException ex) {
    System.out.println("Error when creating sound from file " + soundFile);
    ex.printStackTrace();
    } catch (UnsupportedAudioFileException ex) {
    System.out.println("Error when creating sound from file " + soundFile);
    ex.printStackTrace();
    } catch (FileNotFoundException ex) {
    System.out.println("Error when creating sound from file " + soundFile);
    ex.printStackTrace();
    } catch (IOException ex) {
    System.out.println("Error when creating sound from file " + soundFile);
    ex.printStackTrace();
    } finally {
    try {
    stream.close();
    } catch (IOException ex) {

    }
    }
    }

    public void play() {
    if (sound != null) {
    sound.flush();
    sound.setFramePosition(0);
    System.out.println("Playing");
    sound.start();

    } else {
    System.out.println("No sound available");
    }
    }
    }

    package javaapplication9;

    /*
    * Panel.java
    *
    * Created on May 14, 2008, 9:42 AM
    */
    /**
    *
    * @author Administrator
    */
    public class Panel extends javax.swing.JFrame {

    int tempo;

    public Panel() {
    initComponents();
    }

    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {
    bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

    loadFiles = new javax.swing.JFileChooser();
    saveFiles = new javax.swing.JFileChooser();
    musicMakerPanel = new javax.swing.JPanel();
    bassButton = new javax.swing.JButton();
    synthButton = new javax.swing.JButton();
    drumButton = new javax.swing.JButton();
    loadButton = new javax.swing.JButton();
    saveButton = new javax.swing.JButton();
    tempoSlider = new javax.swing.JSlider();
    hareButton = new javax.swing.JButton();
    snailButton = new javax.swing.JButton();
    quitButton = new javax.swing.JButton();
    currentInstrument = new javax.swing.JTextField();
    tempoProgressBar = new javax.swing.JProgressBar();

    loadFiles.setApproveButtonText("Load");
    loadFiles.setBackground(new java.awt.Color(255, 255, 255));
    loadFiles.setDialogTitle("Load song");

    saveFiles.setDialogTitle("Save song");
    saveFiles.setDialogType(javax.swing.JFileChooser.S AVE_DIALOG);
    saveFiles.setForeground(new java.awt.Color(255, 255, 255));

    setDefaultCloseOperation(javax.swing.WindowConstan ts.EXIT_ON_CLOSE);
    setTitle("Awesome Shitty Wicked Music Maker 0.345");
    setBackground(new java.awt.Color(102, 255, 102));
    setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    setResizable(false);

    musicMakerPanel.setBackground(new java.awt.Color(128, 128, 128));
    musicMakerPanel.setBorder(javax.swing.BorderFactor y.createBevelBorder(javax.swing.border.BevelBorder .RAISED));

    bassButton.setBackground(new java.awt.Color(128, 223, 227));
    bassButton.setIcon(new javax.swing.ImageIcon("D:\\Svinto\\IAL 07\\Object Oriented Programming\\NetBeans\\WickedMusicMaker\\img\\bass .gif")); // NOI18N
    bassButton.setMaximumSize(new java.awt.Dimension(125, 75));
    bassButton.setMinimumSize(new java.awt.Dimension(125, 75));
    bassButton.setName("bassButton"); // NOI18N
    bassButton.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    bassButtonActionPerformed(evt);
    }
    });

    synthButton.setIcon(new javax.swing.ImageIcon("D:\\Svinto\\IAL 07\\Object Oriented Programming\\NetBeans\\WickedMusicMaker\\img\\synt h.gif")); // NOI18N
    synthButton.setMaximumSize(new java.awt.Dimension(125, 75));
    synthButton.setMinimumSize(new java.awt.Dimension(125, 75));
    synthButton.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    synthButtonActionPerformed(evt);
    }
    });

    drumButton.setIcon(new javax.swing.ImageIcon("D:\\Svinto\\IAL 07\\Object Oriented Programming\\NetBeans\\WickedMusicMaker\\img\\drum .gif")); // NOI18N
    drumButton.setMaximumSize(new java.awt.Dimension(125, 75));
    drumButton.setMinimumSize(new java.awt.Dimension(125, 75));
    drumButton.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    drumButtonActionPerformed(evt);
    }
    });

    loadButton.setIcon(new javax.swing.ImageIcon("D:\\Svinto\\IAL 07\\Object Oriented Programming\\NetBeans\\WickedMusicMaker\\img\\load .gif")); // NOI18N
    loadButton.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseClicked(java.awt.event.MouseEvent evt) {
    loadButtonMouseClicked(evt);
    }
    });
    loadButton.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    loadButtonActionPerformed(evt);
    }
    });

    saveButton.setIcon(new javax.swing.ImageIcon("D:\\Svinto\\IAL 07\\Object Oriented Programming\\NetBeans\\WickedMusicMaker\\img\\save .gif")); // NOI18N
    saveButton.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    saveButtonActionPerformed(evt);
    }
    });

    tempoSlider.setBackground(new java.awt.Color(128, 128, 128));
    tempoSlider.setForeground(new java.awt.Color(0, 0, 0));

    org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBindi ng(org.jdesktop.beansbinding.AutoBinding.UpdateStr ategy.READ_WRITE, tempoProgressBar, org.jdesktop.beansbinding.ELProperty.create("${val ue}"), tempoSlider, org.jdesktop.beansbinding.BeanProperty.create("val ue"));
    bindingGroup.addBinding(binding);

    tempoSlider.addChangeListener(new javax.swing.event.ChangeListener() {
    public void stateChanged(javax.swing.event.ChangeEvent evt) {
    tempoSliderStateChanged(evt);
    }
    });

    hareButton.setBackground(new java.awt.Color(128, 128, 128));
    hareButton.setIcon(new javax.swing.ImageIcon("D:\\Svinto\\IAL 07\\Object Oriented Programming\\NetBeans\\WickedMusicMaker\\img\\hare .gif")); // NOI18N
    hareButton.setMaximumSize(new java.awt.Dimension(50, 50));
    hareButton.setMinimumSize(new java.awt.Dimension(50, 50));
    hareButton.setPreferredSize(new java.awt.Dimension(50, 50));

    binding = org.jdesktop.beansbinding.Bindings.createAutoBindi ng(org.jdesktop.beansbinding.AutoBinding.UpdateStr ategy.READ_WRITE, tempoProgressBar, org.jdesktop.beansbinding.ELProperty.create("${val ue}"), hareButton, org.jdesktop.beansbinding.BeanProperty.create("sel ected"));
    bindingGroup.addBinding(binding);

    hareButton.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    hareButtonActionPerformed(evt);
    }
    });

    snailButton.setBackground(new java.awt.Color(128, 128, 128));
    snailButton.setIcon(new javax.swing.ImageIcon("D:\\Svinto\\IAL 07\\Object Oriented Programming\\NetBeans\\WickedMusicMaker\\img\\snig el.gif")); // NOI18N
    snailButton.setMaximumSize(new java.awt.Dimension(50, 50));
    snailButton.setMinimumSize(new java.awt.Dimension(50, 50));
    snailButton.setPreferredSize(new java.awt.Dimension(50, 50));
    snailButton.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    snailButtonActionPerformed(evt);
    }
    });

    quitButton.setIcon(new javax.swing.ImageIcon("D:\\Svinto\\IAL 07\\Object Oriented Programming\\NetBeans\\WickedMusicMaker\\img\\quit .gif")); // NOI18N
    quitButton.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    quitButtonActionPerformed(evt);
    }
    });

    currentInstrument.setBackground(java.awt.Color.gra y);
    currentInstrument.setEditable(false);
    currentInstrument.setHorizontalAlignment(javax.swi ng.JTextField.CENTER);
    currentInstrument.setBorder(javax.swing.BorderFact ory.createBevelBorder(javax.swing.border.BevelBord er.RAISED));

    javax.swing.GroupLayout musicMakerPanelLayout = new javax.swing.GroupLayout(musicMakerPanel);
    musicMakerPanel.setLayout(musicMakerPanelLayout);
    musicMakerPanelLayout.setHorizontalGroup(
    musicMakerPanelLayout.createParallelGroup(javax.sw ing.GroupLayout.Alignment.LEADING)
    .addGroup(musicMakerPanelLayout.createSequentialGr oup()
    .addGroup(musicMakerPanelLayout.createParallelGrou p(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(musicMakerPanelLayout.createSequentialGr oup()
    .addGroup(musicMakerPanelLayout.createParallelGrou p(javax.swing.GroupLayout.Alignment.TRAILING)
    .addGroup(javax.swing.GroupLayout.Alignment.LEADIN G, musicMakerPanelLayout.createSequentialGroup()
    .addContainerGap()
    .addComponent(currentInstrument, javax.swing.GroupLayout.DEFAULT_SIZE, 129, Short.MAX_VALUE))
    .addGroup(javax.swing.GroupLayout.Alignment.LEADIN G, musicMakerPanelLayout.createSequentialGroup()
    .addGap(22, 22, 22)
    .addGroup(musicMakerPanelLayout.createParallelGrou p(javax.swing.GroupLayout.Alignment.TRAILING, false)
    .addGroup(musicMakerPanelLayout.createSequentialGr oup()
    .addComponent(snailButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(hareButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addComponent(tempoSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)))
    .addGroup(javax.swing.GroupLayout.Alignment.LEADIN G, musicMakerPanelLayout.createSequentialGroup()
    .addContainerGap()
    .addComponent(bassButton, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)))
    .addGroup(musicMakerPanelLayout.createParallelGrou p(javax.swing.GroupLayout.Alignment.TRAILING)
    .addGroup(musicMakerPanelLayout.createSequentialGr oup()
    .addGap(82, 82, 82)
    .addComponent(drumButton, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, 76, Short.MAX_VALUE)
    .addComponent(synthButton, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGroup(musicMakerPanelLayout.createSequentialGr oup()
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED)
    .addGroup(musicMakerPanelLayout.createParallelGrou p(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(quitButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGroup(javax.swing.GroupLayout.Alignment.TRAILI NG, musicMakerPanelLayout.createParallelGroup(javax.sw ing.GroupLayout.Alignment.LEADING, false)
    .addComponent(loadButton, javax.swing.GroupLayout.Alignment.TRAILING, 0, 0, Short.MAX_VALUE)
    .addComponent(saveButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE))))))
    .addGroup(musicMakerPanelLayout.createSequentialGr oup()
    .addContainerGap()
    .addComponent(tempoProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
    .addContainerGap())
    );
    musicMakerPanelLayout.setVerticalGroup(
    musicMakerPanelLayout.createParallelGroup(javax.sw ing.GroupLayout.Alignment.LEADING)
    .addGroup(musicMakerPanelLayout.createSequentialGr oup()
    .addGap(45, 45, 45)
    .addGroup(musicMakerPanelLayout.createParallelGrou p(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(drumButton, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(synthButton, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(bassButton, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGap(40, 40, 40)
    .addComponent(currentInstrument, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED, 44, Short.MAX_VALUE)
    .addGroup(musicMakerPanelLayout.createParallelGrou p(javax.swing.GroupLayout.Alignment.TRAILING)
    .addGroup(musicMakerPanelLayout.createSequentialGr oup()
    .addGroup(musicMakerPanelLayout.createParallelGrou p(javax.swing.GroupLayout.Alignment.TRAILING)
    .addComponent(snailButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(hareButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED)
    .addComponent(tempoSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGroup(musicMakerPanelLayout.createSequentialGr oup()
    .addComponent(saveButton, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED)
    .addComponent(loadButton, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED)
    .addComponent(quitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)))
    .addGap(2, 2, 2)
    .addComponent(tempoProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addContainerGap())
    );

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING)
    .addComponent(musicMakerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    );
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING)
    .addComponent(musicMakerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    );

    bindingGroup.bind();

    pack();
    }// </editor-fold>
    private void bassButtonActionPerformed(java.awt.event.ActionEve nt evt) {

    currentInstrument.setText("Bass");

    }

    private void synthButtonActionPerformed(java.awt.event.ActionEv ent evt) {
    currentInstrument.setText("Synth");
    }

    private void hareButtonActionPerformed(java.awt.event.ActionEve nt evt) {
    tempoSlider.setValue(100);
    return;
    }

    private void loadButtonMouseClicked(java.awt.event.MouseEvent evt) {
    // TODO add your handling code here:
    }

    private void snailButtonActionPerformed(java.awt.event.ActionEv ent evt) {
    tempoSlider.setValue(0);
    return;
    }

    private void quitButtonActionPerformed(java.awt.event.ActionEve nt evt) {
    System.exit(0);
    }

    private void drumButtonActionPerformed(java.awt.event.ActionEve nt evt) {
    currentInstrument.setText("Drum");
    }

    private void tempoSliderStateChanged(javax.swing.event.ChangeEv ent evt) {




    }

    private void loadButtonActionPerformed(java.awt.event.ActionEve nt evt) {
    loadFiles.showDialog(loadFiles, "Load");
    }

    private void saveButtonActionPerformed(java.awt.event.ActionEve nt evt) {
    saveFiles.showDialog(saveFiles, "Save");
    }

    /**z
    * @param args the command line arguments
    */
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {

    public void run() {
    new Panel().setVisible(true);
    }
    });
    }
    // Variables declaration - do not modify
    private javax.swing.JButton bassButton;
    private javax.swing.JTextField currentInstrument;
    private javax.swing.JButton drumButton;
    private javax.swing.JButton hareButton;
    private javax.swing.JButton loadButton;
    private javax.swing.JFileChooser loadFiles;
    private javax.swing.JPanel musicMakerPanel;
    private javax.swing.JButton quitButton;
    private javax.swing.JButton saveButton;
    private javax.swing.JFileChooser saveFiles;
    private javax.swing.JButton snailButton;
    private javax.swing.JButton synthButton;
    private javax.swing.JProgressBar tempoProgressBar;
    private javax.swing.JSlider tempoSlider;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration
    }

    package javaapplication9;

    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.io.InputStream;
    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.LineUnavailableException;
    import javax.sound.sampled.UnsupportedAudioFileException;

    /**
    * Super class that represents any item that can show up in a room.
    * All items that can be shown in rooms are Showables
    * @author Sandra Nilsson
    */
    public abstract class Playable {
    /** The image representing this item*/


    /**The sound representing this item*/
    private Clip sound;

    /**The room that this item is located in*/


    /**
    * Create a new Showable represented by the given image
    * @param imgName the file name of the image that shall represent this showable
    */

    /**
    * Create a new Showable represented by the given image and the given sound
    * @param imgName the file name of the image that shall represent this showable
    * @param soundName the file name of the sound file that shall represent this showable
    */
    public Playable(String soundName){

    initSound(soundName);
    }

    public Clip getSound() {
    return sound;
    }


    /**
    * Reads the given sound file and saves it for later use.
    * @param soundFile the path to the sound file.
    */
    private void initSound(String soundFile) {
    // Open an input stream to the audio file.
    InputStream in = null;
    AudioInputStream stream = null;
    try {
    stream = AudioSystem.getAudioInputStream(new File(soundFile));
    AudioFormat format = stream.getFormat();
    DataLine.Info info = new DataLine.Info(Clip.class, stream.getFormat());
    sound = (Clip) AudioSystem.getLine(info);
    sound.open(stream);
    } catch (LineUnavailableException ex) {
    System.out.println("Error when creating sound from file " + soundFile);
    ex.printStackTrace();
    } catch (UnsupportedAudioFileException ex) {
    System.out.println("Error when creating sound from file " + soundFile);
    ex.printStackTrace();
    } catch (FileNotFoundException ex) {
    System.out.println("Error when creating sound from file " + soundFile);
    ex.printStackTrace();
    } catch (IOException ex) {
    System.out.println("Error when creating sound from file " + soundFile);
    ex.printStackTrace();
    } finally {
    try {
    stream.close();
    } catch (IOException ex) {
    //Do not bother about this
    }
    }
    }

    /**
    * Plays the sound file of this showable (if any)
    */
    public void play() {
    if (sound != null) {
    sound.flush();
    //Restart the sound every time
    sound.setFramePosition(0);
    System.out.println("Playing");
    sound.start();

    } else {
    // System.out.println("No sound available");
    }
    }
    }

    package javaapplication9;


    import javax.swing.JFrame;
    import javax.swing.JPanel;

    public class ShowColors {

    public static void main(String args[]) {

    JFrame frame = new JFrame("Shittywickedmusicmaker");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);

    JPanel colorJPanel = new JPanel();
    frame.add(colorJPanel);
    frame.setSize(497, 500);
    frame.setVisible(true);
    }
    }

    package javaapplication9;

    import java.awt.Graphics;
    import java.awt.Color;
    import javax.swing.JPanel;
    import javax.swing.JComponent;
    import java.awt.Container;
    import java.awt.Component;
    import java.awt.Cursor;

    public class ColorJPanel extends JPanel {


    public void paintComponent(Graphics g) {
    super.paintComponent(g);

    this.setBackground(Color.BLACK);
    this.setSize(497,500);









    }




    }
    Last edited by charlotte; 05-25-2008 at 04:09 PM.

Similar Threads

  1. Fast Data Transfer 0.9.1
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 04-24-2008, 06:41 PM
  2. Fast Data Transfer 0.8.5
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 11-12-2007, 06:11 PM
  3. Fast Data Transfer 0.6.7
    By Jamie in forum Java Software
    Replies: 0
    Last Post: 06-14-2007, 02:55 PM
  4. Fast Data Transfer 0.6.4
    By levent in forum Java Software
    Replies: 0
    Last Post: 05-21-2007, 10:11 AM
  5. Fast Data Transfer 0.6.4
    By levent in forum Java Software
    Replies: 0
    Last Post: 05-20-2007, 08:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •