Results 1 to 9 of 9
  1. #1
    Roclemir is offline Member
    Join Date
    May 2010
    Posts
    3
    Rep Power
    0

    Default .setVisible(false); not working... grr...

    Been workin on code all day. Everything works, including the .setVisible on other JFrames, but this one friggen thing won't. Look in the code, around line 309 starts the public class submitDetails implements ActionListener for a button.

    In that block of code, at line 352, there's jfProdDet.setVisible(false);
    and yet the frame remains....

    Could someone please enlighten me as to what the hell i'm doing wrong!

    You can find my code here:
    Java | import java.awt.*; import java - Anonymous - rvmWUFf8 - Pastebin.com

  2. #2
    Roclemir is offline Member
    Join Date
    May 2010
    Posts
    3
    Rep Power
    0

    Default

    No online right now?

  3. #3
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,233
    Rep Power
    7

    Default

    In that block of code, at line 352, there's jfProdDet.setVisible(false);
    I'm not about to read through 400 lines of code in order to understand what your program does.

    Do some basic debugging like adding System.out.println(...) to see if that section of code is executed.

    If you need more help post your SSCCE.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

    Default

    Often times something doesn't happen because the code is not executed or another piece of code undoes it.

  5. #5
    Roclemir is offline Member
    Join Date
    May 2010
    Posts
    3
    Rep Power
    0

    Default

    1st - Thank you for you lack of help in the java help forums

    2nd - I have been debugging the code for hours using lines like JOptionPane.showMessageDailog(null, "Whatever here"); and all assignments awe working, but for some reason stringName.compareTo("blah") doesn't get the comparison right.

    3rd, why post on my thread if you are going to make useless statements like that - I specifically said where the error was, so you DIDN"T have to ready 400 lines of code to understand it. If you don't have anything inteligent to say, stay off my thread.

    4th, this is the newbie forum - I don't even know what the last thing you said is...

  6. #6
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    Quote Originally Posted by Roclemir View Post
    1st - Thank you for you lack of help in the java help forums

    2nd - I have been debugging the code for hours using lines like JOptionPane.showMessageDailog(null, "Whatever here"); and all assignments awe working, but for some reason stringName.compareTo("blah") doesn't get the comparison right.

    3rd, why post on my thread if you are going to make useless statements like that - I specifically said where the error was, so you DIDN"T have to ready 400 lines of code to understand it. If you don't have anything inteligent to say, stay off my thread.

    4th, this is the newbie forum - I don't even know what the last thing you said is...
    You didn't mention anything about compareTo() in your first post.

    Java Code:
                    if (strStoreName.compareTo("callaghan") != 0 &&
                            strStoreName.compareTo("lambton") != 0) {
    Choose one of these options to fix this:
    1. Capitalize "Callaghan" and "Lambton" as you did in the initializations on lines 8 and 9.
    2. Use compareToIgnoreCase() instead of compareTo().
    3. Use equals() in combination with option 1, or equalsIgnoreCase() instead of compareTo().

    We still don't know what the problem is with your setVisible() call, and we can't run your code because we don't have your Store class.

    Try not to get annoyed if the answers you get aren't what you wanted. You actually got some good advice, even though it's frustrating, I know. Camickr gave you a link to tell you what an SSCCE is, and how to prepare one. If you go through the process of isolating your problem, you'll very likely discover what the cause is, and if not, you'll make it a lot easier for us. Also, we prefer to have your code posted directly in the forum, with CODE tags. It's more convenient for us, and it's better for search engines.

    -Gary-

  7. #7
    m00nchile is offline Senior Member
    Join Date
    Feb 2010
    Location
    Ljubljana, Slovenia
    Posts
    470
    Rep Power
    5

    Default

    Whoa dude, chill for a bit. Look, even if you specify where the problem occurs, someone still has to understand the program flow to see why the error occured. It's like saying, hey, I'm getting a NullPointerException on line 293 of my code:
    Java Code:
    MyClass m = list.get(i);
    what's the problem?
    Even though I specified the place where the error occured, someone should look through the code to first see what MyClass does, what type of Collection list is, and how it's getting filled, and where is i set and calculated. It's not as easy as it sounds, and try not to alienate people who want to help you.
    Ever seen a dog chase its tail? Now that's an infinite loop.

  8. #8
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by gcalvin View Post
    Try not to get annoyed if the answers you get aren't what you wanted. You actually got some good advice, even though it's frustrating, I know. Camickr gave you a link to tell you what an SSCCE is, and how to prepare one. If you go through the process of isolating your problem, you'll very likely discover what the cause is, and if not, you'll make it a lot easier for us. Also, we prefer to have your code posted directly in the forum, with CODE tags. It's more convenient for us, and it's better for search engines.
    -Gary-
    Strongly seconded. To the OP, you're making it difficult to motivate others to help you. Is this really what you want to do?

  9. #9
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

    Default

    Yeah, the OP sounds like a jerk. But it is an interesting problem.
    Try overriding the setVisible() method and printing out the value of the this variable. It seems there is a ghost window (title=<empty>) that is created and then setVisible(false)
    Suspect that it has to do with usage of jfProdDet static variable.

Similar Threads

  1. can't get setVisible(false) to work
    By alexander.s in forum AWT / Swing
    Replies: 0
    Last Post: 04-27-2010, 08:33 PM
  2. swirling becomes false,why?
    By arefeh in forum New To Java
    Replies: 2
    Last Post: 01-18-2010, 06:12 PM
  3. Replies: 4
    Last Post: 02-26-2009, 11:46 PM
  4. [SOLVED] Problem with setVisible(); on LINUX
    By lepetitprince in forum AWT / Swing
    Replies: 9
    Last Post: 11-22-2008, 04:14 PM
  5. setVisible(true) does not work
    By Gajesh Tripathi in forum AWT / Swing
    Replies: 2
    Last Post: 10-27-2007, 07:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •