Page 3 of 3 FirstFirst 123
Results 41 to 47 of 47
Like Tree2Likes

Thread: random numbers with no duplicate

  1. #41
    KSBeyaz is offline Member
    Join Date
    Nov 2011
    Posts
    50
    Rep Power
    0

    Default Re: random numbers with no duplicate

    I have already used setIcon method on main class.
    Java Code:
    public void setPicture(int click,int freezone){
    		cpy.setIcon(btn[freezone].getIcon());
    		btn[freezone].setIcon(btn[click].getIcon());	
    		btn[click].setIcon(cpy.getIcon());
    		btn[freezone].setEnabled(true);
    		btn[click].setEnabled(false);
    		bosluk=click;
    	}
    i have MyButton Constructer like this:

    Java Code:
    public MyButton(int field, String imageFile) {
    		this.field = field;
    	setIcon(imageFile);
    //(still on proggress)

    Im Usıng String for imagefiles.i did string array which contains name of pictures. and then i shuffle them then im adding them to jbutton.
    if i use setIcon on Mybutton need to change main class aswell :(

    any other ways ?

  2. #42
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,883
    Rep Power
    25

    Default Re: random numbers with no duplicate

    How many icons for each MyButton object? How are they used?

  3. #43
    KSBeyaz is offline Member
    Join Date
    Nov 2011
    Posts
    50
    Rep Power
    0

    Default Re: random numbers with no duplicate

    There is 20 object for MyButton.

    i checked my codes and im wrong i only used setIcon for copy pictures and changing pictures on method setPicture().
    but i need string for MyButton class and setIcon requires icon object
    Last edited by KSBeyaz; 12-09-2011 at 10:51 PM.

  4. #44
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,883
    Rep Power
    25

    Default Re: random numbers with no duplicate

    Sorry, I can not see the code you are talking about.
    The MyButton takes the place of the JButton that was in the MyButton class.

  5. #45
    KSBeyaz is offline Member
    Join Date
    Nov 2011
    Posts
    50
    Rep Power
    0

    Default Re: random numbers with no duplicate

    Quote Originally Posted by Norm View Post
    Sorry, I can not see the code you are talking about.
    The MyButton takes the place of the JButton that was in the MyButton class.
    i solved my problem with this code :D :D :D :D

    Java Code:
    setIcon(new ImageIcon(imageFile))
    ;
    now i hope program can understand which button is clicked :D

  6. #46
    KSBeyaz is offline Member
    Join Date
    Nov 2011
    Posts
    50
    Rep Power
    0

    Default Re: random numbers with no duplicate

    Norm how can i give you rep on forum

    its perfectly working :D you saved me :D

  7. #47
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,883
    Rep Power
    25

    Default Re: random numbers with no duplicate

    Glad you got it working.

Page 3 of 3 FirstFirst 123

Similar Threads

  1. removing duplicate numbers from an array
    By ozzyman in forum New To Java
    Replies: 1
    Last Post: 03-14-2011, 09:22 PM
  2. Replies: 8
    Last Post: 04-19-2009, 06:50 PM
  3. Help with random numbers
    By checkmylongboarding in forum New To Java
    Replies: 2
    Last Post: 01-12-2009, 06:47 AM
  4. random string are duplicate
    By googgoo in forum New To Java
    Replies: 3
    Last Post: 04-03-2008, 11:01 AM
  5. random numbers without random class`
    By carlos123 in forum New To Java
    Replies: 4
    Last Post: 01-17-2008, 11:44 PM

Posting Permissions

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