Outputting an int variable in an applet?

Hey all i will keep this short, i am modifying an applet for a university project and am trying to output an integer variable to screen, i tried using g.drawString but i apparently can only use it to output "text in the double quotes" and if i try putting the variable in without the double quotes it throws an error, i was just wondering how would you output a int variable to screen in an applet, thanks

To convert an int to a String, use:
String.valueOf(int)

Similar Messages

  • How to convert an int variable into String type

    hi everybody
    i want to know how to convert an interger variable into string variable
    i have to implement a code which goes like this
    Chioce ch;
    for(int i=0;i<32;i++)
    // here i need a code to convert the int variable i into a string variable
    ch.add(String variable);
    how do i convert that int variable i into a String type variable??
    can anyone help me?

    Different methods:
    int a;
    string s=a+"";or
    String.valueOf(int) is the better option because Int.toString() generated an intermediate object to get the endresult
    Ema

  • How to set report output to session variable

    Hi,
    Is there any way to set report output to session variable . If my report returns 1 row and 1 column.
    I have a dashboard prompt where i am selecting Name , but i want to find out the ID of that name .
    that ID i want to pass to a column Fx , to achieve this i created a intermediate report and i got the ID. Now my problem is how do i set this ID in session variable .
    Please help if anyone knows...

    Did you read this:
    how to set session / presentation variable in repository variable
    Dashboard prompt on Month Name but report filter on month ID:
    Re: Dashboard prompt on Month Name but report filter on month ID needed
    If you have dashboard prompt (name) then you may have only one report that is filtered by name but show id or not show id but use id in the function. Or two reports like in the solution in the second link above and the second report has id in the function and filter by id from the first report. You don't need to set this ID in session variable for this example.
    Please close your previous threads if they are answered.
    Regards
    Goran
    http://108obiee.blogspot.com

  • How to access the int variable in the inner class

    hi all,
    i can't access the int variable in the inner class. can any one help me
    int count = 0;
    MouseMoveListener mouseMove = new MouseMoveListener() {
         public void mouseMove(MouseEvent e) {
              count1++;
              System.out.println(count);
    };how to access count variable
    thanks

    for this how can i access the countIf the count variable is a local variable you can't access it from within the
    inner class. Make it a member variable of the outer class instead:public class Outer {
       private int count;
       MouseMoveListener mouseMove= new MouseMoveListener() {
          public void mouseMove(MouseEvent me) {
             count++;
             System.out.println(count);
    }Alternatively, if you don't need that count variable anywhere else, you
    could simply make it a member variable of the inner class itself:public class Outer {
       MouseMoveListener mouseMove= new MouseMoveListener() {
          private int count;
          public void mouseMove(MouseEvent me) {
             count++;
             System.out.println(count);
    }kind regards,
    Jos

  • Compare values in an ArrayList to another int variable

    Hi all i'm just starting to use and understand ArrayList's, however i've come upon a problem and am a bit stuck! I want to compare an int variable, say int num to the values in an arrayList to see if the arrayList contains a match to num. I've looked through several tutorials and haven't found anything that talks about this, so is it possible and if so how?

    @Keith: Hey, I was only reading the question ;)!
    is there a way of adding multiple ints to an array list in one statementAdding to a list, not creating one...
    @OP: Run this. And weep. (Or, at least be aware of the problem.)
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.List;
    public class AddAllEg {
        public static void main(String[] args) {
            test1();
            test2();
        public static void test1() {
            List<Integer> list = new ArrayList<Integer>();
            list.addAll(Arrays.asList(1, 42, -1));
            System.out.println(list);
                // later...
            list.add(0);
            System.out.println(list);
        public static void test2() {
            List<Integer> list = Arrays.asList(new Integer[] {1, 42, -1});
            System.out.println(list);
                // later...
            list.add(0);
            System.out.println(list);
    }[Arrays.asList()|http://java.sun.com/javase/6/docs/api/java/util/Arrays.html#asList(T...)] does more than merely "make" a list.

  • Substring for Strings, what do I use for a int variable???

    Hi!
    substring for Strings...
    String s1 = p.substring(1,2);
    but what do I use for a int variable?
    int i1 = integ."???????"(1,2);
    /Henrik

    why, you use maths of course!!
    or if you're not up to that, try this:
    int x = 931;
    String s = x+"";
    String res = s.substring(1, 2);
    and of course set it back to an int
    with Integer.parseInt(res);

  • 2 separate programs share one int variable

    Let's say I compile and execute a java program that returns an integer. It is just saved temporarily in an int variable and the code cannot be changed. After that, I want to compile and execute a second program that fetches the integer that had been returned in the previous program. I cannot save the integer in a text file for later use. Is there any possibility to do that? How would such a second program look like?

    I took that as emphasising that the second program
    couldn't have any kind of dependency upon its earlier
    invocation (for example, it couldn't set up a named
    pipe, or start a thread, or something).
    Dave.Ok, that makes sense. But it still doesn't explain:
    I cannot save the integer in a text file for later use. Does that mean that he doesn't control the first application, or is it because it's a distributed system? He says that he isn't allowed to recompile the first application, so he actually wants to attach to that proccess and read the value? I.e. write an proccess that uses the debugging api?
    /Confused

  • Set Variables in an applet

    Hello,
    Basically i wanna do all of the function listend in this code with an applet in the background. however it seems that I can't run any JOptionPane's simotaneously with the applet. Is there any way i can run teh applet, set the variables, and run back and forth from files like I want to do?
    import java.*;
    import javax.swing.*;
    import java.awt.*;
    public class FinalJava extends Object{
         String choicestring,twodchoicestring, intersectionchoicestring;
         String linexonestring, lineyonestring, linextwostring, lineytwostring;
         int choice,twodchoice,intersectionchoice;
         int linexone,lineyone,linextwo,lineytwo;
              public static void main(String [] args)
              FinalJava g = new FinalJava();
              g.Choice();
              public void Choice()
                   choicestring = JOptionPane.showInputDialog("Enter 0 to chooose 2D shapes to draw\nEnter 1 to plot some intersections\nEnter 2 to draw some 3D shapes");
                   choice = Integer.parseInt(choicestring);
                   if(choice == 0)
                        LineDraw ld = new LineDraw();
                        ld.VariablesEnter();
                   else if (choice == 1)
                        this.PlotIntersectionsChoice();
                   else if (choice == 2)
                        //ThreeDShapesChoice();  not made yet
              }//end Choice() void
         public void PlotIntersectionsChoice()
              //see waht type of intersection the user wants
              intersectionchoicestring = JOptionPane.showInputDialog(null,"Enter one to intersect between line and line\n Enter two for line and circle\nEnter three for circle and circle");
              intersectionchoice = Integer.parseInt(intersectionchoicestring);
              if (intersectionchoice == 1)
                   LineIntersect li = new LineIntersect();//go to my line-line intersect class
                   li.VariablesEnter();
              else if (intersectionchoice == 2)
                   LineCircleIntersect lci = new LineCircleIntersect();//go to my line circle intersect class
                   lci.EnterVariables();
              else if (intersectionchoice == 3)
                   CircleIntersect ci = new CircleIntersect();//go to my circle-circle intersect calss
                   ci.CircleDefinition();
    }           

    Also....I want to be able to run taht applet in the FinalJava program so taht i can draw the line in the linedrawing program below...Also is tehre a way to tell it to jump from VariablesEnter() to the paint void?
    Also.....it would be better if i could run an applet from this class....and still have the capability of moving back to my origial file after the appelt draws the line....so basically...how do i run an applet from this class; while still bieng able to go extend my FinalJava that i posted above.
    import java.*;
    import javax.swing.*;
    import java.awt.*;
    public class LineDraw  extends JApplet {
         String xonestring, yonestring,xtwostring,ytwostring;
         int xone, yone, xtwo, ytwo;
         public static void main(String args [])
              LineDraw ld = new LineDraw();
              ld.VariablesEnter();     
         public void VariablesEnter()
               xonestring = JOptionPane.showInputDialog(null, "Please enter x1");
               yonestring = JOptionPane.showInputDialog(null, "Please enter y2");
               xtwostring = JOptionPane.showInputDialog(null, "Please enter x2");
               ytwostring = JOptionPane.showInputDialog(null, "Please enter y2");
               xone = Integer.parseInt(xonestring);
               yone = Integer.parseInt(yonestring);
               xtwo = Integer.parseInt(xtwostring);
               ytwo = Integer.parseInt(ytwostring);
         public void paint(Graphics g)
              super.paint(g);
              g.drawLine(xone,yone,xtwo,ytwo);
         FinalJava fj = new FinalJava();
         fj.Choice();
    }

  • Question about .swf and HTML5 output and passing variables via querystring

    Hello,
    I am using Captivate 7. We're developing a program that we would like to output both for desktop users and mobile users.If I'm correct, multiscreen.html will determine whether or not to load index.html (which is for mobile users) or yourprogram.htm (for desktop users).
    Currently, we pull and push data from the database using .NET via a querystring and Javascript into yourprogram.htm. In the program, there's a Response.Redirect which sends that data (what screen you've finished reviewing as well as quiz data). So it basically reloads yourprogram.htm after each "save" point. We're wondering how to best approach it if multiscreen.html is first loaded, we imagine the variables may not get passed back and forth correctly into the index.html(HTML5 output)? Has anyone had experience with developing a program this way?
    Looking forward to your insights, recommendations and anything to look out for.
    Thanks,
    Ruth

    Basically, the code is meant to be an example of using a wrapper to modify output before it gets written to the file. So, println is called and the wrapper just alters any text that comes to it before it gets printed to the file. Think of writing to a message to an error log and appending the Date and time to the front.
    The code works fine if you only work on the string that is passed in by itself such as:
    s = s.replace('1', '2');When I try to add text onto the string s I run into problems. I need to send the length of the string to the write function but then length ends up being 8202 on the new string. I don't understand why. I am wondering if this has to do with converting chars to string or the way strings are passed to methods.
    This method is called first and then calls the write method with the string as a param.
    public void write(char[] cbuf, int off, int len) throws IOException {
                    String s= new String(cbuf);
                    this.write(s, off, len);
            }but for some reason when I try to create a new string from the string passed in or try to append text to it, the length of the string gets message up.
    Does that help?
    Sorry, I am just trying to understand what is going on here.
    Thanks.

  • How do I use the print function to output a numeric variable with a fixed amount of leading zeroes

    I need to create an output from a T-SQL query that picks a numeric variable and uses the print function to output with leading zeroes if it is less than three characters long when converted to string.  For example if the variable is 12 the output should
    be 012 and if the variable is 3 the output should be 003.
    Presently the syntax I am using is PRINT STR(@CLUSTER,3) .  But if @CLUSTER which is numeric is less than three characters I get spaces in front.
    Please help!

    >> I need to create an output from a T-SQL query .. <<
    NO! NO! In RDBMS, we have a presentation layer that handles displays. We do not ever do it in the database. This is fundamental. But more than that, the purpose of PRINT is for debugging in T-SQL and never for output.
    You are still writing 1960's COBOL or BASIC, but you want to to it in SQL.  You probably picked the wrong data type (a numeric that should be a string) and are trying to repair your design error.  
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • How can I turn this output into a variable

    I have a script to query all the servers in AD
    Import-Module active*
    $rtn = $null
    Get-ADComputer -Filter {operatingsystem -like "*server*"} |
    ForEach-Object {
    $rtn = Test-Connection -CN $_.dnshostname -Count 1 -BufferSize 16 -Quiet
    IF($rtn -match 'True') {write-host -ForegroundColor green $_.dnshostname}
    I want to make the output a variable
    Easy way would be:
    $Servers = Get-ADComputer -Filter {operatingsystem -like "*server*"}
    Problem is this would waist time waiting for queries against disabled/powered off machines to error out
    I don't know how to use if statements in variables

    Hi,
    You can do something like this:
    $aliveServers = @()
    Get-ADComputer -Filter "OperatingSystem -like '*Server*'" | ForEach {
    If (Test-Connection -ComputerName $_.Name -Count 1 -Quiet) {
    $aliveServers += $_
    $aliveServers | Sort Name
    Don't retire TechNet! -
    (Don't give up yet - 12,950+ strong and growing)

  • How can I pass a variable to an applet in JSP?

    I want to invoke an Applet in JSP and pass a variable( ie. port) to the Applet. I do as follows:
    <applet code="best.Applet1.class" width=400 height=300 >
    <param name=port1 value=port>
    </applet>
    in Applet1.java , I use getParameter("port1"),yet I got character string "port" ,not the value of port(i.e. 100).
    How can I get 100 not "port"? Thanks!!!

    Assuming that port is a variable defined and initailized in the jsp:
    <applet code="best.Applet1.class" width=400 height=300 >
    <param name=port1 value=<%= port %>>
    </applet>

  • How to show the output of Idoc variable on content server console

    Hi,
    Where & How the IDOC Script functions or variable output i can see..
    Mean to say..
    I have written idoc script regarding work flow, where can i see the output before implementing to check whether my code is fine or what

    Check this out: http://download.oracle.com/docs/cd/E17904_01/doc.1111/e10726/c08_config_ref.htm#CSIDO985
    (you can go with console or log:
    #console, to display to a console
    #log to log a message in the HTML log files)

  • How to convert an int variable into Number

    Hi all,
    I am using Jdeveloper 11.1.1.2
    When I insert a row in a entity object I want to create another row in another entity object, but when I am setting the attribute for the new row I have a problem.
    Here is the code:
    int a = EO1Impl.paramA;
    NameEO2Impl.setAttribute("Attribute1", a);
    The error is that variable a is an int, while Attribute1 is a Number.
    How can convert an int to a Number.
    Thank you.

    Andrea9,
    If a, as you say is an int, and assuming you mean an oracle.jbo.domain.Number,
    NameEO2Impl.setAttribute("Attribute1", new oracle.jbo.domain.Number(a));works just fine.
    John

  • Query output into ODI variable

    Hi,
    I want to take the output (multiple rows and multiple columns) into an ODI variable of Text type.
    I have created the variable and put the query and set the variable type as Text type. But when I send the value of this variable to other variable, it comes as blank.
    Can anyone tell me how can I do that
    Thanks in advance
    Arun

    Hello Neha,
    Though i have been working with APDs since some time. But havent actually been involved in designing one. But you could find many documents for the APD on web. And as far as i know, you will need a program to save file from APD.
    I have a document which explains how you can use APD in  process chain. can forward you the same if you want.
    I am sorry as i wasnt of much help for you, as i havent worked on similar requirement before, but this thing just striked in my mind.
    Regards,
    Anuj

Maybe you are looking for

  • Current Proccesor in normal correction activity

    Dear all helpers. Please, what is actual role for Current processor in activity normal correction? Is it developer? Or is it simple the one, who proccess the activity NOW, I this role is changing during life cycle of correction? My concern is, that t

  • Business Graphics: Speedometer chart: Change Maximum value on runtime

    Hi Skilled, We faced a little problem in our project. We use Business Graphics component and Speedometer chart on the View and we should change maximum value of the graphics on runtime. I could easily change the maximum on design time in Chart Design

  • Where is "extimated file size" ?

    Hello I'm using an IMac with Premiere Pro. When I want to export a video, I don't have the "extimated file size" in the export options box. where is it? can I find it somewhere?

  • Combobox PHP Forms

    Hi everyone, still trying to get this form working!!! Basically i want to send data from my combobox fields to my email via PHP. The code i have in the FLA file is as follow: // Add Item to List. this.comboBox_reformat.addItem({data:1, label:"list na

  • Error -3259 while downloading OS 4 update for iPod touch

    I am trying to update my iPod touch 3G OS from version 3.1.3 to 4.0. I am using the latest version of iTunes(9.2.1.5) for doing it. When I download the update, it gets downloaded fully (366.4 MB/366.4 MB) but in the last moment, it stops downloading