SPorter's Profile User Rating: -----

Reputation: 11 Tradesman
Group:
Contributors
Active Posts:
31 (0.04 per day)
Joined:
29-June 12
Profile Views:
1,165
Last Active:
User is offline Sep 27 2012 02:40 PM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
50
Icon   SPorter has not set their status

Posts I've Made

  1. In Topic: no suitable method found for error

    Posted 6 Sep 2012

    Instead of making all those card objects and initializing each one by hand, why not make an array of them and initialize them via a loop?

    			cardRandom = ran.nextInt(52) + 1;
    			cardRandomNumber = (int) Math.round( cardRandom );
    
    

    So, you have a Random object (ran) and are calling the nextInt method to return an int to assign to a double then rounding the int after you typecast the int to an int? This is not good... anyhow... the nextInt method for the random class returns an int. So you can get rid of cardRandom and typecasting and rounding and just use cardRandomNumber directly.

    Also, nextInt(52) will return a number between 0 and 52, so by adding the + 1 to it, you are making it able to return 53, which is also not good.

    	public void paint(Graphics g, String[] card)
    
    	{
    		setBackground( Color.green );
    		g.drawImage( card[0], 10, 10, this);
    	}
    
    


    Now you are calling a method which does not exist...
  2. In Topic: Help with QuickSort Java Netbeans(im stuck)

    Posted 14 Aug 2012

    http://www.cosc.cant...dsal/QSort.html

    This is a great site to use for studying, especially when it comes to sorts and data structures. The link I gave you will help you with quicksort. It's a lot easier than you think.
  3. In Topic: Infinitive loop?

    Posted 14 Aug 2012

    Kilorn is correct. Put your thread on a timer to check, oh I don't know, let's say once every hour. This will save the performance of your machine and still give you updates as you need them. You don't have to go every hour, but you get what I mean :)

    Don't have it on an infinite loop as this will check several times per second and tank your machine.
  4. In Topic: How to call a variable from JFrame to another java class?

    Posted 14 Aug 2012

    In your other class (we'll call it class2) you make a method which accepts a JTextField, name that data whatever it's called in class1. Done...

    So let's say class1 has a JTextField called myTextField.
    In class2, make a method which will accept a JTextField as a paramter and title the parameter the name of your JTextField
    public returnType methodName(JTextField myTextField);
    
    

    Use it

    This isn't the best practice, it would be better if the method just accepted a String then pass the String (myTextField.getText()) rather than passing the entire JTextField. My suggestion answers your question, but is poor design.
  5. In Topic: How to assign the value of array from a class to another class?

    Posted 14 Aug 2012

    Do you specifically want the input[i] of whatever i equals at that time to be passed to getPivot, or the whole array?

    If the whole array, listen to what sepp2k said, if it's what I said first, then you just have to make getPivot accept int's then call it in your loop.

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Programming Languages:
Java/Android
C#
Python

Contact Information

E-mail:
Private

Friends

SPorter hasn't added any friends yet.

Comments

SPorter has no profile comments yet. Why not say hello?