Search:

Type: Posts; User: Shivam24

Search: Search took 0.56 seconds.

  1. [SOLVED] Re: How to use the same instance of an object in two methods

    Never mind. I solved my issue. All I had to do was make frame a static public object.
  2. [SOLVED] How to use the same instance of an object in two methods

    My issue is that in my code, I create a new JFrame object called frame. In another method I want to close that frame. Any suggestions?



    // Non-relevant code
    private static class oddbutton...
  3. Thread: main error

    by Shivam24
    Replies
    4
    Views
    353

    [SOLVED] Re: main error

    all i needed to was restart the IDE. Thanks
  4. Thread: main error

    by Shivam24
    Replies
    4
    Views
    353

    [SOLVED] main error

    I've written code to draw a rectangle. I'm pretty sure i did everything right. This is my code:



    package hmm;

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
  5. Replies
    3
    Views
    444

    [SOLVED] I don't know what's wrong

    I'm trying to display an oval but the oval doesn't show.
    This is my code:



    package guitut;
    import javax.swing.*;
    import java.awt.*;

    public class GUItut {
  6. Replies
    6
    Views
    342

    Re: I can't understand the error.

    what are the errors? forgive me for being a noob at java programming
  7. Replies
    6
    Views
    342

    I can't understand the error.

    When i try running my program i get this error:
    java.lang.NoSuchMethodError: main
    Exception in thread "main" Java Result: 1

    This is my code:

    package button_game;

    import javax.swing.*; ...
  8. Replies
    19
    Views
    528

    Re: Game Program HELPPPP

    im very sorry
  9. Replies
    19
    Views
    528

    Re: Game Program HELPPPP

    Im sorry again.
    I messed up and posted "while (randomInt != randomInt)"
    it should be "while (number != randomInt)"
    "!=" means does not equal and that's why your program stops. a variable can never...
  10. Replies
    19
    Views
    528

    Re: Game Program HELPPPP

    Ok i see. I'm sorry i forgot to add a bracket so the while loop should look like this


    while (randomInt != randomInt) {
    if (number < randomInt)
    {
    c.print("The number you have guessed is too...
  11. Replies
    19
    Views
    528

    Re: Game Program HELPPPP

    ur welcome : )
  12. Replies
    19
    Views
    528

    Re: Game Program HELPPPP

    Try using a while loop instead of a for loop and change the position of your loop.
    Also in your if statements have the user enter input.
    It would look something like this


    //your code
    int...
  13. Replies
    9
    Views
    525

    [SOLVED] Re: Need Loop Help for Game

    Im not sure exactly what you meant by starting a new thread. Do you mean start it inside:


    private static class A1 implements ActionListener{
    public void actionPerformed(ActionEvent e){
    ...
  14. Replies
    3
    Views
    402

    Re: Need Help with Game

    sorry this is the error: method main in class button_game.Button_Game cannot be applied to given types;
    required: java.lang.String[]
    found: no arguments
    reason: actual and formal argument...
  15. Replies
    3
    Views
    402

    Need Help with Game

    I am trying to start a new thread to call main() but i can't understand the error.



    package button_game;

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class...
  16. Replies
    9
    Views
    525

    [SOLVED] Re: Need Loop Help for Game

    never mind they un-align when i post the code
  17. Replies
    9
    Views
    525

    [SOLVED] Re: Need Loop Help for Game

    By whole thing, I mean that I want the whole program to run again and again as long as you keep clicking Button A1 and it to exit when you click Button B1.

    Here is my revised code:
    I think i got...
  18. Replies
    9
    Views
    525

    [SOLVED] Re: Need Loop Help for Game

    I want to loop the whole program so that if you click on button A, the whole thing restarts and the buttons shift positions. If you click button B, the program exits.

    Alright i think this is what...
  19. Replies
    9
    Views
    525

    [SOLVED] Re: Need Loop Help for Game

    please someone respond!
  20. Replies
    9
    Views
    525

    [SOLVED] Need Loop Help for Game

    im trying to create a game where there are two buttons and you have to click the one with the even number to continue or else you lose. I need help on how to make it loop. I am a noob at java...
Results 1 to 20 of 20