0

I have two Swing GUI.I successfully transferred some information between each other.

My problem is that,i try to show byte array in JLabel. I wrote code, but I can't show my image, because byte array is large. Here is source

jPanel1.setLayout(new FlowLayout());
ImageIcon icon = new ImageIcon(byteArray);
JLabel label = new JLabel();
label.setIcon(icon);
jPanel1.add(label);

I tested another small byte array (I inserted it in google) and it's working. Is it a possible to resize byte array before put in in another GUI? How i can solve my problem? Thanks

1 Answer 1

0

This question has a working answer here.

Basically, you have to convert your byte[] array to an ImageIcon object first and then add it to your label.

Cheers

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks your atthention. I also found this question and tested it.As you can see there is a static byte array,when i tested it ,it's worked,but not working when i use my byte array @xoX Zeus Xox
Could you please provide more of your code that is relevant to this question, e.g. your byte array declaration and initialization?
@Baggio, when i tested it ,it's worked, - so you have proven the concept of using a byte array works. but not working when i use my byte array - then your byte array doesn't contain valid data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.