Results 1 to 12 of 12
Thread: im have a string problem
- 01-23-2013, 10:50 PM #1
Member
- Join Date
- Oct 2012
- Posts
- 31
- Rep Power
- 0
- 01-24-2013, 04:00 AM #2
Member
- Join Date
- Oct 2012
- Posts
- 31
- Rep Power
- 0
Re: im have a string problem
hey am i using string operator right?
it should have put the word picstart in there ,i must be missing something
Java Code:private void showhumandoms() { Graphics g = game.getGraphics(); hstring="picstart"; for (int i=0;i<21;i++) { if (holdyourhand[i]!=-1){ g.drawPixmap(Assets. + hstring + , 128, 160); } } }
- 01-24-2013, 07:16 AM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 29
Re: im have a string problem
Have you defined 'hstring' somewhere (in scope) so the compiler knows that you're talking about a String?
kind regards,
JosBuild a wall around Donald Trump; I'll pay for it.
- 01-24-2013, 11:12 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 27
Re: im have a string problem
What error(s) are you getting?
Give the full text of them.
Highlight the line(s) on which they occur as well.Please do not ask for code as refusal often offends.
** This space for rent **
- 01-24-2013, 03:10 PM #5
Member
- Join Date
- Oct 2012
- Posts
- 31
- Rep Power
- 0
Re: im have a string problem
in my main class i have this
String hstring ;
its line 10.
assets are under lined and hstring are under lined.
in post 2
Multiple markers at this line
- Syntax error on token ".", , expected
- Assets cannot be resolved to a variable
- Type mismatch: cannot convert from
String to int
- Syntax error on token "+", ++ expected
- 01-24-2013, 03:43 PM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 27
Re: im have a string problem
Since I can't find the drawPixMap method on the only Graphics class I know, I can only assume it takes String, int, int parameters?
So that first thing needs to be a String.
What do you want the String to look like?Please do not ask for code as refusal often offends.
** This space for rent **
- 01-24-2013, 03:58 PM #7
Member
- Join Date
- Oct 2012
- Posts
- 31
- Rep Power
- 0
Re: im have a string problem
picstart is a png image.
i have domino images.
it can be the first domino called up1.png ,so hstring="up1"; is all that would work.
thanks
- 01-24-2013, 04:58 PM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 27
Re: im have a string problem
So, going back to Jos' post up there...where is hstring defined?
Please do not ask for code as refusal often offends.
** This space for rent **
- 01-24-2013, 06:26 PM #9
Member
- Join Date
- Oct 2012
- Posts
- 31
- Rep Power
- 0
Re: im have a string problem
in this class
Java Code:public class GameScreen extends Screen { enum GameState { Ready, Running, Paused, GameOver } GameState state = GameState.Ready; boolean runonce; boolean isthere; boolean skipit; String hstring ; String holdstring; int oldScoreH = 0; String scoreH = "0"; int oldScoreC = 0; String scoreC = "0"; int[][] playershand; int[][] computerhand; int[][] boneyard; int holdyourhand[] = new int[21]; int holdcomputerhand[] = new int[21]; int holdbonepile[] = new int[14]; final int BLANK = -1;// location empty
- 01-24-2013, 06:39 PM #10
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 27
Re: im have a string problem
...and is that the same class as the showhumandoms method above?
And what is 'Asset' supposed to be?
(This is getting very similar to trying to get blood from a stone).Please do not ask for code as refusal often offends.
** This space for rent **
- 01-24-2013, 07:01 PM #11
Member
- Join Date
- Oct 2012
- Posts
- 31
- Rep Power
- 0
Re: im have a string problem
im so sorry
its bound to be simple ,im probly over looking something.
thank you all for trying
i need to go back and do alot of reading ,thanks
- 01-24-2013, 07:08 PM #12
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 27
Re: im have a string problem
It is.
When you post up code for a problem you are having, especially if it is just a few lines, then you need to explain what all the bits in there are. That is, any variables that are not declared in that snippet, and where they come from, and any classes that are non-standard. And also what, exactly, you are trying to do.
In your case, if hstring is accessible at that point in the code then something like:
Java Code:g.drawPixmap(hstring, 128, 160);
Whether it would work properly I do not know, as I do not know what values you require for drawPixMap...since I don't recognise it.Please do not ask for code as refusal often offends.
** This space for rent **
Similar Threads
-
Problem with <s:if> and string
By SomeoneHere in forum StrutsReplies: 1Last Post: 08-24-2012, 10:44 PM -
Having a problem with to String
By thorobred in forum New To JavaReplies: 20Last Post: 06-02-2012, 09:24 AM -
Basic string problem, just need to extract two numbers out of string
By gonzoateafly in forum New To JavaReplies: 6Last Post: 12-06-2010, 10:26 AM -
Problem with string tokenizer
By twinytwo in forum AWT / SwingReplies: 2Last Post: 03-26-2009, 12:27 PM -
String Problem
By gnomewise in forum New To JavaReplies: 1Last Post: 10-19-2008, 01:37 PM
Bookmarks