Results 1 to 8 of 8
  1. #1
    habiler is offline Member
    Join Date
    Sep 2016
    Posts
    44
    Rep Power
    0

    Default Icon of checkbox changing if

    Hello,

    How can I obtain this one ?
    It a result of a Jdbc query .
    If (rs3.getString(11) isSelected;
    It s doesnt work
    Thanks

    Habiler

    Icon of checkbox changing if-capture.jpg
    Last edited by habiler; 03-17-2017 at 10:11 AM.

  2. #2
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,983
    Rep Power
    8

    Default Re: Icon of checkbox changing if

    It must be in here somewhere: https://duckduckgo.com/?q=non.png&t=ha&iax=1&ia=images be

    Make sure the license allows you to copy/paste it.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  3. #3
    habiler is offline Member
    Join Date
    Sep 2016
    Posts
    44
    Rep Power
    0

    Default Re: Icon of checkbox changing if

    Ok I have then Icons, but can I obtain such result with the code. If checkbox checked then non.png else Oui.png.

  4. #4
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,983
    Rep Power
    8

    Default Re: Icon of checkbox changing if

    Quote Originally Posted by habiler View Post
    Ok I have then Icons, but can I obtain such result with the code. If checkbox checked then non.png else Oui.png.
    Isn't that in the code in the same screenshot? Am I missing your point?
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    26

    Default Re: Icon of checkbox changing if

    JCheckBox extends AbstractButton.
    You can give the JCheckBox constructor an Icon to use as the normal image, and you can then use the setSelectedIcon method to give it a different Icon for when it is checked.

    I'm pretty sure that's how it works.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  6. #6
    habiler is offline Member
    Join Date
    Sep 2016
    Posts
    44
    Rep Power
    0

    Default Re: Icon of checkbox changing if

    HEllo,

    Thanks for your answer, but can yoou you me an example? I don t find a solution for my problem.

    Habiler

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    26

    Default Re: Icon of checkbox changing if

    Java Code:
    JCheckBox myCheckBox = new JCheckBox(<my original Icon>);
    jCheckBox.setSelectedIcon(<my selected Icon>);
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    19,967
    Rep Power
    32

    Default Re: Icon of checkbox changing if

    I don t find a solution for my problem.
    You need to look further down in the API doc. The setSelectedIcon method is in a class that the JCheckBox class extends. The methods for the extended classes follow the methods for the class itself in the Methods inherited from ... section
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Checkbox changing row colour
    By prajnajain5 in forum AWT / Swing
    Replies: 3
    Last Post: 05-24-2013, 07:14 AM
  2. Replies: 7
    Last Post: 07-12-2011, 04:19 PM
  3. Replies: 3
    Last Post: 07-27-2010, 09:52 AM
  4. Changing Java Icon
    By Adam Cruge in forum Java 2D
    Replies: 20
    Last Post: 07-21-2009, 02:32 AM
  5. Changing icon of JOptionPane
    By mew in forum New To Java
    Replies: 3
    Last Post: 12-21-2007, 07:01 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
  •