Please I need help with methods!

Could anyone please help me with this problem?
I know that objects are passed to methods by reference, including arrays also. Then I'm writing methods where I assign other values to argument objects.
However, when I call these methods from main() with null arguments, they still remain null (verified 100% in debugging)! How could this happen? Is it probably because I'm assigning the object values inside try blocks in the methods?

Could anyone please help me with this problem?
I know that objects are passed to methods by
reference, including arrays also. Then I'm
writing methods where I assign other values to
argument objects.
sigh
Objects are not passed by reference.
Object references are passed by value into methods.
Arrays are objects, so they're passed like all other objects.
Then I'm
writing methods where I assign other values to
argument objects.Since the reference is passed by value, you can't change it. You can change the state of the object that it points to, however, as long as it's not final or immutable.
However, when I call these methods from main() with
null arguments, they still remain null
(verified 100% in debugging)! How could this happen?
Is it probably because I'm assigning the object
values inside try blocks in the methods?Remember, of course, that declaring an array of objects means that all the references it points to are null. You have to set each one individually.
Better go back and re-read some fundamental stuff.
%

Similar Messages

  • Please i need help with switch from the us store to malaysian store how i can switch

    Please i need help with switch from the us store to malaysian store how i can switch

    Click here and follow the instructions to change the iTunes Store country.
    (82303)

  • Please I need help with swf folders.

    Hi everybody,
    I install adobe flash and when i surf on the internet it is
    working. But I have a lot of swf flash folders stored in my disk c.
    When I go to open them It appears like adobe flash is not install
    in my disk to be able to open these files. I only can open this
    files with firefox or microsoft explorer. Adobe flash is only
    installed in my system and as i told you i am able to see all the
    flash folders which i find on the internet when I enter to any
    website with flash adobe folders. I installed and unistalled adobe
    flash several times. But this is not resolved.
    Please I need help.
    Many thanks

    Click here and follow the instructions to change the iTunes Store country.
    (82303)

  • Need help with method calling

    I have a problem with method calling as it does the method but doesn't send the values to the main program. The Need section in the main should take in the Max and Allocation arrays from the setMax and setAllocation but it doesn't. I figure I'm missing a return call or something. Could you help me out.
        public class Project4
           public static void main (String[] args)
             int[] Available=new int[4];
             int[][]Max=new int[5][4];
             int[][]Allocation=new int[5][4];
             int[][] Need=new int[5][4];
             setMax();
             setAllocated();
             setAvailable();
           //Creates the need.
             int numMax, numAlloc, numNeed;
             for(int row=0; row<5; row++)
                for (int col=0; col<4; col++)
                   numMax=Max[row][col];
                   numAlloc=Allocation[row][col];
                   numNeed=numMax-numAlloc;
                   Need[row][col]=numNeed;
             for(int row=0; row<Need.length; row++)
                for (int col=0; col<Need[row].length; col++)
                   System.out.print (Need[row][col]);
                System.out.println();
             System.out.println();
            //From here on checks to see if available.     
             int[] processLeft=new int[5];
             int numChecker, numAvail, counter, check, num, stop, processCounter;
             int i=0; 
             num=0;
             stop=3;
             processCounter=0;
             for(int row=num; row<Need.length; row++)
                int col=0;
                counter=Need[row].length; 
                numChecker=Need[row][col];
                numAvail=Available[col];
                do
                   check=0;
                   numChecker= Need[row][col];
                   numAvail=Available[col];
                   col++;
                   if (numChecker<=numAvail)
                      check=1;
                   while(numChecker<=numAvail && col<counter);
                if(col==counter && check==1)
                   System.out.println("Process P"+row+" executes");
                   for(col=0; col<Allocation.length-1; col++)
                      numChecker=Allocation[row][col];
                      numAvail=Available[col];
                      numAvail=numChecker+numAvail;
                      Available[col]=numAvail;
                   num++; 
                   processCounter=processCounter+1;
                else
                   processLeft=row;
    i++;
    // Checks the processes left over
    int j=0;
    int row=0;
    int col=0;
    counter=Need[row].length;
    while(processLeft[j]!=5 && processCounter!=5)
    row=processLeft[j];
    do
    check=0;
    numChecker= Need[row][col];
    numAvail=Available[col];
    col++;
    if (numChecker<=numAvail)
    check=1;
    while(numChecker<=numAvail && col<counter);
    if(col==counter && check==1)
    System.out.println("Process P"+row+" executes");
    for(col=0; col<Allocation.length-1; col++)
    numChecker=Allocation[row][col];
    numAvail=Available[col];
    numAvail=numChecker+numAvail;
    Available[col]=numAvail;
    processCounter=processCounter+1;
    j++;
    safe(processCounter);
    public static void setAllocated()
         // Creates the Allocation
    int[][] Allocation= {{3,0,0,2},{1,0,0,0},{1,3,5,4},{0,6,3,2},{0,0,1,4}};
    for(int row=0; row<Allocation.length; row++)
    for (int col=0; col<Allocation[row].length; col++)
    System.out.print (Allocation[row][col]);
    System.out.println();
    System.out.println();
    public static void setMax()
         // Creates the max
    int[][] Max= {{3,0,1,2},{1,5,5,0},{2,3,5,6},{0,6,5,2},{0,6,5,6}};
    for(int row=0; row<Max.length; row++)
    for (int col=0; col<Max[row].length; col++)
    System.out.print (Max[row][col]);
    System.out.println();
    System.out.println();
    public static void setAvailable()
    // Creates the Available.
    int[] Available={3,5,2,0};
    public static void safe(int processCounter)
         // Prints if it is safe or not     
    if(processCounter!=5)
    System.out.println("\n The system is not safe");     
    else
    System.out.println("\n The system is safe");

    those methods declare and initialize variables that exist only within that specific method, so no other method can see them
    move the 4 arrays you declare in main() out of the method into the class body, then in the other methods, don't declare new arrays, simply initialize the ones you just moved into the class body
    or alternatively, you could make the methods return the arrays they create, and instead of your main method creating arrays, it simply works with whatever those methods return
    btw 20 minutes is a bit early to be getting impatient

  • Please I Need Help with nps

    Hi
    Please I need urgent Help !
    i make a backup for ( note + calendar ) my N70 Music With nokia pc suite V 6.83.14.1
    then  i Format my Mobile , But when i try to Restore The Backup File  i was made it, the computer Show me Only The calendar without the Note ( but the backup  file include both of note and calendar ) ,I mean i can only restore my calendar!!!!!
     please what i do to restore my Note??
    the Backup file is (nbu) format .
    Thanx A lot

    please ??? !!!

  • PLEASE I NEED HELP WITH MY 6800 GT IT DRIVING ME NUTS

    Please can anyone help i have a 6800 gt graphics card and it keeps crashing my pc every time i play a graphically intense game i get no error reports i have tried unistalling the driver and reistalling but it makes no difference i have checked the temp of the graphics card which runs about 60'c while playing and 50'c in idle the cpu temp is 40'c in idle and goes upto around 60 to 65'c when playing games so i cant see it being a heat problem please can anyone help or can anyone who has had this problem please tell me how they fixed it thanks for ur help
    cpu 3.0ghz p4
    mb=abit is7.es
    1.5gb of ram
    os=winxp pro sp2
    psu=450w

    Also please test RAM modules with Memtest found here Try each RAM module at a time and play game. If it still crahes I'd rule out memory competely. I don't think it very likey to be the problem though, that would usually restart the system.
    Could be a power supply problem, most likely.

  • Need help with method... wrote an addition program... have most of it

    Writing an addition program... have most of it below. Need help in getting the program to work.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Ch10program2 extends JFrame implements ActionListener
    private static final int FRAME_WIDTH = 750;
    private static final int FRAME_HEIGHT = 150;
    private static final int BUTTON_HEIGHT = 50;
    private static final int BUTTON_WIDTH = 50;
    private static final int BUTTON_Y_POSITION = 50;
    private static final String EMPTY_STRING = "";
    private int XbuttonPosition = 15;
    private JButton[] button;
    private String[] buttonLabels = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "=", "c"};
    private JTextField mytextfield;
    private int[] numberOne;
    private int[] numberTwo;
    private int[] sum;
    private int numberCounter = 0;
    private boolean adding = false;
    public static void main (String[] args)
    Ch10program2 frame = new Ch10program2 ();
    frame.setVisible (true);
    public Ch10program2 ()
    Container contentPane = getContentPane ();
    // set the frame properties
    setSize (FRAME_WIDTH, FRAME_HEIGHT);
    setLocation (200, 200);
    setTitle ("Big Integer Adder");
    setResizable (false);
    //set the content pane properties
    contentPane.setLayout (null);
    //creating each button
    button = new JButton [13];
    for (int i = 0 ; i < button.length ; i++)
    button = new JButton (buttonLabels [i]);
    button [i].setBounds (XbuttonPosition, BUTTON_Y_POSITION, BUTTON_WIDTH, BUTTON_HEIGHT);
    XbuttonPosition += 55;
    button [i].setForeground (Color.blue);
    if (i > 9)
    button [i].setForeground (Color.red);
    contentPane.add (button [i]);
    button [i].addActionListener (this);
    //set the arrays
    numberOne = new int [50];
    numberTwo = new int [50];
    //set the needed textfield
    mytextfield = new JTextField ("");
    mytextfield.setBounds (10, 10, 720, 25);
    mytextfield.setBorder (BorderFactory.createLoweredBevelBorder ());
    mytextfield.setHorizontalAlignment (JTextField.RIGHT);
    contentPane.add (mytextfield);
    setDefaultCloseOperation (EXIT_ON_CLOSE);
    public void actionPerformed (ActionEvent event)
    JButton clickedButton = (JButton) event.getSource ();
    String oldText = mytextfield.getText ();
    if ((event.getActionCommand ()).equals ("+"))
    mytextfield.setText (oldText + " + ");
    adding = true;
    numberCounter = 0;
    else if ((event.getActionCommand ()).equals ("="))
    mytextfield.setText (oldText + " = ");
    addArrays ();
    displayArray ();
    else if ((event.getActionCommand ()).equals ("c"))
    clearText ();
    else if (adding == false)
    mytextfield.setText (oldText + event.getActionCommand ());
    if (numberCounter == 0)
    numberOne [numberCounter] = Integer.parseInt (event.getActionCommand ());
    else
    for (int i = numberOne.length - 1 ; i > 0 ; i--)
    numberOne [i] = numberOne [i - 1];
    numberOne [0] = Integer.parseInt (event.getActionCommand ());
    numberCounter++;
    else
    mytextfield.setText (oldText + event.getActionCommand ());
    if (numberCounter == 0)
    numberTwo [numberCounter] = Integer.parseInt (event.getActionCommand ());
    else
    for (int i = numberTwo.length - 1 ; i > 0 ; i--)
    numberTwo [i] = numberTwo [i - 1];
    numberTwo [0] = Integer.parseInt (event.getActionCommand ());
    numberCounter++;
    oldText = mytextfield.getText ();
    public void addArrays ()
    int temp = 0;
    int carriedDigit = 0;
    for (int i = 0 ; i < 50 ; i++)
    temp = carriedDigit + numberOne [i] + numberTwo [i];
    if (temp > 10)
    sum [i] = (temp - 10);
    carriedDigit = 1;
    else
    sum [i] = temp;
    public void displayArray ()
    private void clearText ()
    mytextfield.setText (EMPTY_STRING);

    I don't know what you want to do
    but i have taken your program to get the GUI then the logic is your's
    You try solving it.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Ch10program2 extends JFrame implements ActionListener
    private static final int FRAME_WIDTH = 750;
    private static final int FRAME_HEIGHT = 150;
    private static final int BUTTON_HEIGHT = 50;
    private static final int BUTTON_WIDTH = 50;
    private static final int BUTTON_Y_POSITION = 50;
    private static final String EMPTY_STRING = "";
    private int XbuttonPosition = 15;
    private JButton[] button;
    private String[] buttonLabels = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "=", "c"};
    private JTextField mytextfield;
    private int[] numberOne;
    private int[] numberTwo;
    private int[] sum;
    private int numberCounter = 0;
    private boolean adding = false;
    public static void main (String[] args)
    Ch10program2 frame = new Ch10program2 ();
    frame.setVisible (true);
    public Ch10program2 ()
    Container contentPane = getContentPane ();
    // set the frame properties
    setSize (FRAME_WIDTH, FRAME_HEIGHT);
    setLocation (200, 200);
    setTitle ("Big Integer Adder");
    setResizable (false);
    //set the content pane properties
    contentPane.setLayout (null);
    //creating each button
    button = new JButton [13];
    for (int i = 0 ; i < button.length ; i++)
    button[i] = new JButton (buttonLabels);
    button[i].setBounds (XbuttonPosition, BUTTON_Y_POSITION, BUTTON_WIDTH, BUTTON_HEIGHT);
    XbuttonPosition += 55;
    button[i].setForeground (Color.blue);
    if (i > 9)
    button[i].setForeground (Color.red);
    contentPane.add (button[i]);
    button[i].addActionListener (this);
    //set the arrays
    numberOne = new int [50];
    numberTwo = new int [50];
    //set the needed textfield
    mytextfield = new JTextField ("");
    mytextfield.setBounds (10, 10, 720, 25);
    mytextfield.setBorder (BorderFactory.createLoweredBevelBorder ());
    mytextfield.setHorizontalAlignment (JTextField.RIGHT);
    contentPane.add (mytextfield);
    setDefaultCloseOperation (EXIT_ON_CLOSE);
    public void actionPerformed (ActionEvent event)
    JButton clickedButton = (JButton) event.getSource ();
    String oldText = mytextfield.getText ();
    if ((event.getActionCommand ()).equals ("+"))
    mytextfield.setText (oldText + " + ");
    adding = true;
    numberCounter = 0;
    else if ((event.getActionCommand ()).equals ("="))
    mytextfield.setText (oldText + " = ");
    addArrays ();
    displayArray ();
    else if ((event.getActionCommand ()).equals ("c"))
    clearText ();
    else if (adding == false)
    mytextfield.setText (oldText + event.getActionCommand ());
    if (numberCounter == 0)
    numberOne [numberCounter] = Integer.parseInt (event.getActionCommand ());
    else
    for (int i = numberOne.length - 1 ; i > 0 ; i--)
    numberOne[i] = numberOne [i - 1];
    numberOne [0] = Integer.parseInt (event.getActionCommand ());
    numberCounter++;
    else
    mytextfield.setText (oldText + event.getActionCommand ());
    if (numberCounter == 0)
    numberTwo [numberCounter] = Integer.parseInt (event.getActionCommand ());
    else
    for (int i = numberTwo.length - 1 ; i > 0 ; i--)
    numberTwo[i] = numberTwo [i - 1];
    numberTwo [0] = Integer.parseInt (event.getActionCommand ());
    numberCounter++;
    oldText = mytextfield.getText ();
    public void addArrays ()
    int temp = 0;
    int carriedDigit = 0;
    for (int i = 0 ; i < 50 ; i++)
    temp = carriedDigit + numberOne[i] + numberTwo[i] ;
    if (temp > 10)
    sum[i] = (temp - 10);
    carriedDigit = 1;
    else
    sum[i] = temp;
    public void displayArray ()
    private void clearText ()
    mytextfield.setText (EMPTY_STRING);
    All The Best

  • Please i need help with my blackberry 8520

    My host routing table is empty and when i try to register, it says registration message sent but i have no feedback afterward. please help out

    Hi and Welcome to the Community!
    If you did that with a good connection to your mobile service provider (e.g., NOT simply WiFi) AND you already have your voice services working from that provider, then you need to talk to them (the provider) about why their network is not properly communicating with your device. Only they can look at their network to determine what is wrong.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Please, i need help with my password.

    I seemed to have forgotten my password. I need it to install an app, but I dont know where to recover it. Can someone please help me with this? I am brand new to macs, so please could you make as simple as possible?

    I'm glad it all worked out for you OK. Now you know two things.
    First, the Help files in all the Apple apps are usually very helpful in understanding how everything works.
    Second, you know to guard your Install DVDs (or Retail Mac OS X disks) well because anyone Mac knowledgeable can access your Mac with those disks.

  • Hey please read need help with ipod

    how do I set my playlist so if i hook up my ipod it only downloads my songs but if anyone else hooks up there ipod there songs won't come into my playlist? PLEASE HELP
    Message was edited by: Alissa-55

    first of all, i'm not sure if i understand your question fully but i believe you just want your OWN playlist so that you can put the songs YOU want on it and no one ELSE can put their music in it?
    if that's the case, you just need to make your own playlist on your ipod.
    open up itunes and near the top, select "file".
    select "new playlist".
    this new playlist should appear on the left-hand side of itunes under 'playlists' right at the bottom. when it appears, it will read 'untitled playlist'. click it once then again, so that you are able to name the playlist to your liking.
    when it comes to putting songs into your own playlist, you can drag any song from your itunes library. choose a song from your itunes library and drag it over to your designated playlist til you see your playlist is outlined with blue and your cursor has a plus sign just below it.
    hope that helps.

  • Please I need help with mokia maps!

    Hello! I have bought my phone Nokia N76 and I found nokia maps v 1.2 in it, I tried to install nokia maps v 2 but it says "update error"!
    when I tried to remove nokia maps 1.2 from the menu, it says unable to delete I tried this from the menu as it is not listed in the application manger list ! what shalI do?! . I don't wan't to update the software (it's the lastest). please if anybody knows help me please?
    Message Edited by Twilight28 on 23-Nov-2009 06:53 PM
    Message Edited by Twilight28 on 23-Nov-2009 06:54 PM

    Reading above posts I seem to remember that for early versions of Nokia Maps the map data is stored in E:\Private\20001f63\diskcache\ NOT E:\CITIES as for later versions, so try deleting these + .qf file. You would need to enable "show hidden & system" files on your PC to see these however.
    Provided that you carry out *#7370# or three finger reset (erases ALL data) after deleting these folder/files, you should really be able to install Nokia_Maps_2.0_4503_3.1.sis from here: http://nds1.nokia.com/files/support/global/phones/software/Nokia_Maps_2.0_4503_3.1.sis
    You would need to run Nokia Maps application to create folder structure on memory card required to download mapping.
    Happy to have helped forum with a Support Ratio = 42.5

  • Please i need help with sound application! please?

    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
    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;
    }

    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 );

  • Please I Need Help With iTunes..!!

    Hi I am New In This Forum and I hope I Could Find The Help I Was Not Able To Find and Get at Apple Store / Support Dept Lots Of Times I Call Them Over The The Phone I Am Not Kidding When Say Probably 10-15 Times, Plus The Times I Went Ahead To One Nearest Apple Store To My House For The Same and The Only Unique Problem That I Been Complaining For The Last 6-8 Months....Error Messages Like This >>  iTunes : ERROR REQ Could Not Be Completed, Item You've Requested  Is Not Currently Available In The U.S Store...!!! I Really Don't Understand it what Happen I Was Using Before For Years, I Have Like 5,000 Songs and Videos, Movies, Pictures etc, I Mean I Was Able To Use it, I Can't Not Even Have Access To Login To My Account at All Either..and APPLE STORE, They Just Told Sorry They Don't Know What's Wrong With it Don't Know How To Help Me..
    My INFO IS: MacBook Pro 2010-2011
    MAC OS X
    VERSION: 10.8.2
    PROCESSOR: 2.4 GHz INTEL CORE 2DUO
    MEMORY: 4 GB 1867 MHz DDR8
    STARUP DISK: MACINTASH HD
    I Really Hope There's Someone Who Might Be Able To Help Me Out, To Resolve This Issue Or I am Going To Be Go Crazy About This Issue With iTunes...The Matters is That For Therapy I Really Need My Music and Its Not a Joke Music Its My Therapy Some How...Long Story...
    Once Again Thank You. God Bless You All
    Irene/[email protected]

    Windows doesn't detect iPhone: http://support.apple.com/kb/ts1538

  • Please, I need help with iBook!

    Hardware Overview:
    Machine Model: iBook
    CPU Type: PowerPC 750 (2.3)
    Number Of CPUs: 1
    CPU Speed: 800 MHz
    L2 Cache (per CPU): 512 KB
    Memory: 640 MB
    Bus Speed: 100 MHz
    Boot ROM Version: 4.6.4f1
    Memory:
    DIMM0/BUILT-IN:
    Size: 128 MB
    Type: Built-in
    Speed: Built-in
    System Software Overview:
    System Version: Mac OS X 10.3.9 (7W98)
    Kernel Version: Darwin 7.9.0
    Boot Volume: Hard Drive
    I recently purchased a used iBook G3. The computer itself is in EXCELLENT condition, however, I am unable to do anything with the current OS. (OS X 10.3.9)
    I would like to get the computer set up on the newest version of iTunes (8.2.1) since I have an iPhone and I use iTunes as my primary media player. I would also like to utilize the newest version of Safari which I believe is v.4, and add Windows Office.
    I normally use a newer Sony VAIO and I have always used and been extremely pleased with PC. I am not entirely sure I would like to continue on with any of the Mac operating systems (I am not even sure if i have the hardware capabilities to advance my software... Am I correct in my understanding that my iBook will not be able to run any MAC OS version higher than Tiger?)
    The VAIO that I currently have runs off of Windows XP-- that is what I am most comfortable with. With that being said, is it possible to set up Windows XP on my iBook? I have heard of using Apple's BootCamp, but I want to know what the best option is and also how likely will it be that I can get MS Windows Xp or XP Pro running as my primary OS.
    So basically here are my questions:
    (1) Do I have the hardware capabilities to run either Mac OS X Tiger (or higher version) OR Windows XP or XP Pro?
    (2) Is it possible to set up Windows XP or XP Pro on my iBook using Bootcamp? If not, what would you recommend?
    (3) Optional: Since I am a student, money is tight. What do you feel the cheapest option would be, and would it be worth my time?
    I purchased the iBook so that I could carry it to class and to the library etc. so that it would be easier to take notes because of portability.. I don't play games or do anything besides take notes, browse the net, listen to music, take photos and sync my iPhone...
    I would greatly appreciate any advice..

    Hi, and welcome to Apple Discussions.
    I just about cry when I read that someone is evaluating Macs and the Mac OS on the basis of a six-year-old iBook (with 128 MB of RAM, no less).
    You're right; Tiger (Mac OS X 10.4) is as high as you can go with the iBook. Mac OS 10.5 requires a newer Mac.
    You need to upgrade the RAM with a 512 MB RAM module in the one user available RAM slot in order to run Mac OS X 10.4. It takes a 3.3 V, PC100 or PC133 compliant, 1.25 inch SDRAM SO-DIMM. Instructions for installing it can be found here:
    http://docs.info.apple.com/article.html?artnum=111918
    Tiger requires a minimum of 256 MB of RAM, and will run much better with the 640 MB it will have after installing the 512 MB module. (In fact, Mac OS X 10.3.9 will run a lot better with the RAM maximized, too.)
    Boot Camp only works with a Mac that has an Intel processor (such as a newer MacBook). There is no way to satisfactorily run Windows on the iBook. Sorry.
    The iBook is also limited by its wimpy USB 1.1 ports. Anything done over USB takes much, much longer than it does with a computer which has USB 2.0 ports. The iPhone lists USB 2.0 as part of its system requirements.
    iTunes 8.2.1 requires a minimum of Mac OS X 10.4.10.
    Microsoft Office is a pricey piece of software, and you won't be able to run the latest version of it with a G3 processor. Can you get by with something else, such as AppleWorks (which would have come pre-installed on the iBook) or Open Office (which is free)?
    If you're wanting to use it wirelessly on the internet when on campus and it doesn't have an original AirPort Card installed, you're probably going to want one of those.
    I'm not sure what you mean when you say you can't do anything with Mac OS X 10.3.9. What exactly are you trying to do?

  • PLEASE I NEED HELP With my new mobile

    I just bought N73 music edition...
    the secondry camera doesnt seem to work right...
    when i use it to capture; blue points appear on the image and the image looks very bad and unclear
    i went back to the shop and the man said i must close the cover before i use the secondary camera.. and it worked when i was there
    now; i did everything he said and the blue points appear again....
    is there a problem with my secondary camera or is there something i should doo?

    26-Nov-200708:47 AM
    alluriganesh wrote:
    I AM USING N70 MUSIC EDITION..BUT AT ONE ONE TIME MY CELL IS HANGING..AT THAT TIME NO OPERATIONS WILL NOT WORK AND I CAN'T SWITCH OFF MY MOBILE.SIMPLY I HAVE TO REMOVE BATTERY.CAN U PLEASE HELP ME WHAT DO AT THAT TIME.....
    Try a soft reset.
    Ps. CAPS LOCK is considered as shouting ;-)
    The best way to get a quick response is to use the boards. Please do not be offended if I don't answer emails immediately.

Maybe you are looking for

  • When I open PDFs in firefox 4 RC my Synaptics touchpad 2-finger scrolling stops working.

    I am using Windows 7 and have Acrobat 9 Pro installed. Scrolling works fine when I do not have a pdf open in any tab. When I have a pdf open in any tab, I can scroll in the pdf's tab but not in any other. My logitech mousewheel works fine all the tim

  • Managing constants in large applications

    This is an issue that has come up many times in my projects. While I try to avoid the practice, I almost always have some sort of Constants.java class that contains a bunch of public static final constants. This includes things like application name,

  • German dates and "add iCal event" not working

    I have a german formatted date in a mail (like 01.08.2008 = October, 1. 2008) and Mail does recognize this as a date. But when I select "add iCal event", the popup shows the date 08.01.08 (= January, 8. 2008). This only happens with days <= 12. When

  • How can I turn off the Moving/Zoom effect on my photod?

    When i insert a photo in my project the image keeps moving up and down and zooming in. I want it to stay still. How do I turn this effect off? My iMovie version is 10.0.6

  • My iMac won't wake up from sleep, and often refuses to boot

    Hey guys, I recently became the proud owner of a 27" iMac.  However, when I first received it, it refused to start.  I had to plug it in, unplug it, plug it back in, hold the power button, unplug it, etc. for about 10 minutes before it finally starte