Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed help for a parsing array imageicon into JButton
    primarykey
    data
    text
    <p>this is the code i am having error with:</p> <pre><code>pic = new ImageIcon("Koala.jpg"); picArr = ImageUtil.sliceImage(3, 3, pic); for (int i = 0; i &lt; picArr.length; i++){ leftbut[i].setIcon(new ImageIcon(picArr[i])); } </code></pre> <p>This is the exact line of error: </p> <pre><code>leftbut[i].setIcon(new ImageIcon(picArr[i])); </code></pre> <p>This is the error:</p> <pre><code>no suitable constructor found for ImageIcon(ImageIcon) constructor ImageIcon.ImageIcon() is not applicable (actual and formal argument lists differ in length) constructor ImageIcon.ImageIcon(byte[]) is not applicable (actual argument ImageIcon cannot be converted to byte[] by method invocation conversion) constructor ImageIcon.ImageIcon(byte[],String) is not applicable (actual and formal argument lists differ in length) constructor ImageIcon.ImageIcon(Image) is not applicable (actual argument ImageIcon cannot be converted to Image by method invocation conversion) constructor ImageIcon.ImageIcon(Image,String) is not applicable (actual and formal argument lists differ in length) constructor ImageIcon.ImageIcon(URL) is not applicable (actual argument ImageIcon cannot be converted to URL by method invocation conversion) constructor ImageIcon.ImageIcon(URL,String) is not applicable (actual and formal argument lists differ in length) constructor ImageIcon.ImageIcon(String) is not applicable (actual argument ImageIcon cannot be converted to String by method invocation conversion) constructor ImageIcon.ImageIcon(String,String) is not applicable (actual and formal argument lists differ in length) </code></pre> <p>Additional info - leftbut.[i] is array of 9 buttons and i want to set imageicon on each one of them by using the above method and slicing the 1 image into 9 peices Please help me. Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload