LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-09-2010, 12:00 PM   #1
Infasoft
Member
 
Registered: Aug 2008
Location: Salem, Oregon
Distribution: Windows 7 home premium X86_64 | Linux
Posts: 63

Rep: Reputation: 15
Java - "Type mismatch: cannot convert from element type Object to int[]"


Code:
public void mouseClicked(MouseEvent e) {
/* 35 */     if (this.bot.pixelDebug) {
/* 36 */       ArrayList hsvBuffer = new ArrayList();
/* 37 */       for (int x = e.getX(); x < e.getX() + 5; ++x)
/* 38 */         for (int y = e.getY(); y < e.getY() + 5; ++y) {
/* 39 */           int[] hsv = MathSet.colorToHSV(new Color(this.bot.getClientWrapper().getImage().getRGB(x, y)));
/* 40 */           hsvBuffer.add(hsv);
/*    */         }
/*    */       HSVDemo bounds;
/* 44 */       if ((bounds = this.methods.getScreen().teshHSV(new rsItem(hsvBuffer), Constants.FULLSCREEN)) != null) {
/* 45 */         String text = "";
/* 46 */         this.lastFoundHSV = bounds.getPos();
/* 47 */         JOptionPane.showMessageDialog(null, "Please check if theres a rectangle on the area you want to use in your script\nIf there is no rectangle on such area the HSV is instable and its recommended you pick another one.");
/* 48 */         
					for (int hsv[] : hsvBuffer) {
/* 49 */           text = text + hsv[1]+ "," + hsv[2] + "," + hsv[3] + ":";
/*    */         }
/* 51 */         text = text + "x";
/* 52 */         text = text + bounds.getWhites();
/* 53 */         Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
/* 54 */         StringSelection str = new StringSelection(text);
/* 55 */         clipboard.setContents(str, null);
/* 56 */         JOptionPane.showMessageDialog(null, "The acquired data is now on your clipboard, you can paste it into your script.");
/*    */       }
/*    */     }

This part :
Code:
for (int hsv[] : hsvBuffer) {
/* 49 */           text = text + hsv[1]+ "," + hsv[2] + "," + hsv[3] + ":";
that part returns an error:

Code:
Type mismatch: cannot convert from element type Object to int[]
Any ideas? thanks!
 
Old 07-09-2010, 12:23 PM   #2
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,337

Rep: Reputation: 1499Reputation: 1499Reputation: 1499Reputation: 1499Reputation: 1499Reputation: 1499Reputation: 1499Reputation: 1499Reputation: 1499Reputation: 1499
Use generics:
Code:
ArrayList<int[]> hsvBuffer = new ArrayList<int[]>();
 
Old 07-09-2010, 01:06 PM   #3
Infasoft
Member
 
Registered: Aug 2008
Location: Salem, Oregon
Distribution: Windows 7 home premium X86_64 | Linux
Posts: 63

Original Poster
Rep: Reputation: 15
Thanks mate that did the trick
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert "string" type to "char * " in c++ pranavojha Programming 18 06-05-2008 03:10 PM
"array type has incomplete element type" compiling 2.4.32 kernel Akabaka Linux - General 1 01-08-2006 12:48 PM
arrays of elements with [gcc4]array type has incomplete element type lmmix Linux - Software 0 02-26-2005 08:07 AM
Cannot convert string "%s" to type %s jamaso Slackware 1 05-05-2002 04:06 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration