Search:

Type: Posts; User: theoriginalanomaly

Page 1 of 2 1 2

Search: Search took 0.08 seconds.

  1. Replies
    4
    Views
    1,054

    Re: Challenge for you

    String[random int]
  2. Replies
    2
    Views
    1,433

    Re: What is wrong with this method?

    Its cause your spaces. You split the first string into "5 ", and go through both characters. Space is not equal to a number so your valid is set to false. Then it goes to the next loop, and sets...
  3. Re: my loops are not working like they should

    That is a lot of closing brackets at the end. It is hard to tell with it unformatted, but I'd suspect you need to clean up and check your brackets.
  4. Replies
    4
    Views
    1,042

    Re: JRadioButton Won't Respond

    Your Radio buttons are responding, but you have not programmed them to do anything. The only programming you have of them is in the constructor, which gets called once and never again. You need to...
  5. Re: Drawing in JPanel not working as expected

    I think probably it is because, when you divide an int it rounds down to the nearest whole number.

    --- Update ---

    What is the width and height set at?
  6. Replies
    3
    Views
    1,128

    Re: This program won't show the graphics I want it to

    How are you passing the Graphics object? Why are you not using a JPanel? Creating the Demo Application (Step 1) (The Java™ Tutorials > Creating a GUI With JFC/Swing > Performing Custom Painting) has...
  7. Replies
    2
    Views
    1,336

    Re: ewww, a little JFrame problem.

    ...spoonfeeding removed
  8. Re: Advice on removing duplicates from a .txt file while writing to an array

    You could use a HashMap, and generate strings.hashCode() as the key. This would eliminate duplicates. And to get an array Collections<String> c = hm.values()
    Object[] array = c.toArray()
  9. Replies
    1
    Views
    1,072

    Re: new at robotic

    If you are completely new to it, arduino's might be a good place to start. Arduino - Introduction
  10. Re: Writing a program that calculates midpoints based on randomly picking vertices

    I imagine you are trying to plot a Sierpinski Triangle Fractal



    public void paint(Graphics g)
    {
    super.paint(g);

    int i = 0;
  11. Replies
    5
    Views
    1,111

    Re: Card Deck project not working

    If you read through the link Copeg supplied it answers the question. The problem isn't the for loop, it is a problem with your variables.
  12. Replies
    1
    Views
    1,282

    Re: no constructor found for thread

    new Thread(red); // Red or signal does not implement Runnable
    // Anonymous Thread and Runnable method
    new Thread(new Runnable(){

    @Override
    public void run() {
    // Dowork;...
  13. Re: Largest object in an array of objects

    In my interpretation, Object is just a generic name for a class. I think you create a class with a field variable String/Date/Rectangle, that implement Comparable<CLASSNAME>. Then you need to...
  14. Re: how can i make a jbutton to close a jframe??

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  15. Replies
    42
    Views
    3,640

    Re: A beginner needs help in oop

    Your Methods and Fields are static. Static XPosition, YPosition mean that there is only 1 for the whole class. You are drawing both squares, but the second square you draw is overlaying the first...
  16. Replies
    17
    Views
    1,832

    Re: How To Use Linear Search

    That is not correct. The initial values of the array are all 0's so it checks all 10 numbers to see if they match. Here is an example output after the first roll.


    ----------------
    d1: 4
    d2: 6...
  17. Replies
    17
    Views
    1,832

    Re: How To Use Linear Search

    You are calling the index "System.out.println("index is: " + sumArray[i]);" that is the value you want i. Also, you have the check running everytime you fill the index so it is checking a bunch of...
  18. Replies
    17
    Views
    1,832

    Re: How To Use Linear Search

    instead of break, you could break out of the first loop by i = sumArray.length -1;

    --- Update ---

    Now that I think about it. It would be more efficient to make the second for loop



    for...
  19. Replies
    17
    Views
    1,832

    Re: How To Use Linear Search

    for (int i = 0; i < sumArray.length; i++){
    for (int j = sumArray.length -1; j >= 0; j--){
    if (( i != j) && (sumArray[i] == sumArray[j])){
    System.out.println("You win!");
    ...
  20. Replies
    14
    Views
    1,607

    [SOLVED] Re: Simulation for Grid Game?

    By removing the "How can" and the "?" from your last sentence.
  21. Replies
    14
    Views
    1,607

    [SOLVED] Re: Simulation for Grid Game?

    You are assigning the values before the loop. Then going through the loop, with those assigned values.
  22. Replies
    14
    Views
    1,607

    [SOLVED] Re: Simulation for Grid Game?

    You didn't remove the semicolon from the end of the for loop. for (trial = 1; trial<=500;trial++) no semicolon. Other then that, you are sending the same numbers through the for loop, so even if it...
  23. Replies
    14
    Views
    1,607

    [SOLVED] Re: Simulation for Grid Game?

    in the for statement you need to separate with semicolons. for (color = 1; trial <=500; trial++) and not put a semicolon after the parentheses. In your if statements, you want to write != not...
  24. Replies
    42
    Views
    3,640

    Re: A beginner needs help in oop

    getters and setters are what they are usually called. Instead of using a constructor, you have a setMethod() and a getMethod(). At least that is one way. squareRed.setXposition(64), or...
  25. Replies
    42
    Views
    3,640

    Re: A beginner needs help in oop

    That is a lot of classes. Usually you wouldn't want that many classes that didn't do too much, I'm not sure if it is an assignment where you are supposed to have that many classes or not, but it can...
Results 1 to 25 of 33
Page 1 of 2 1 2