• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Disappearing swing elements

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all, i'm new to the forum this is my first post.

so what i'm trying to do is, when i click on setting. it will go to my settings panel. the information just display accordingly. But when i go back to summary panel, the name just literally disappeared. When i click back the settings the information has also disappear after retrieving..

Settings.java


Summary.java


MainPanel.java



Another issue is, my change password seems not able to update in the database.

Changepass.java


This is the method for my updatepassword Which is a different java file. the other method just work fine.


 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The flow is really difficult to follow here, largely because your inheritance seems wrong.
There's a lot of duplicated code around the constructors, so both the MainPanel and its subclasses are checking for null uData, for example.

The interactions seems overly complex, and that's probably where the issue lies.

So...first off, stick some debugging in there, around the constructors, to see what is being passed around, specifically in the case of the uData.
I expect it's not getting populated the way you think.
 
wee long ong
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To make my explanation i've attach an picture below.

1. When i logon, it will come to this panel.



2. When i go to the settings it will come to this panel.



3. When i click back the summary button. My welcome, admin and the admin on the top right just disappeared.



4. When i click back the settings button. My information just disappeared.

So i was wondering, whats wrong with my code and i couldn't figure it out.
 
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
...and welcome to the Ranch
 
Dave Tolls
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, so that layout says to me that you want a layout (BorderLayout looks about right) for the content pane in the JFrame, where the TOP part is another panel containing the buttons.  That part doesn't change (possibly)?

The CENTRE part of the content pane would then have different panels in it, one for each of the screens displayed when the buttons are clicked.  I would have a Controller of some sort handle the actual changing around, and that Controller could also maintain the data that it looks like you want passed around between screens.

That would remove the slightly odd inheritance thing going on.

But I would still recommend sticking some debugging in there to see how your  data object is getting populated and passed around.
 
wee long ong
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes but if i removed some odd of inheritance, Some of my other Panel would throw me some sort of an unknown error.  
 
Dave Tolls
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is because the various parts of your app are too closely tied together.

There is no reason the bottom part of your GUI needs to know anything about the top (button) part.
 
Campbell Ritchie
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't been able to try out your program because I don't have the necessary database, but if you are doing things with, “odd inheritance,” that worries me. Remember that a GUI is there for display and nothing else. You shou‍ld be able to run your application from the command line with no hint of a GUI. Can you run it from the command line? If not, then you are probably putting business logic in the display classes, and business logic doesn't belong in a display. It is related to what DT said about the parts of your application being too closely tied together.
 
wee long ong
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Dave,

The bottom part of my GUI is just for testing. i thought it would automatically solve in miracle. So i just leave it there. When i finalize i will remove it.

@Ritchie  

I didn't know anything about command line. mostly depended on the GUI. Basically this is somehow a business logic for my high school project. I do approach my lecturer for some help. Unfortunately some explanation were given. i still don't understand.

Besides that, Could you check out what's wrong with my change password? i can't seems to be updating my password from my database.

My apologies. It may look frustrating for you guys trying to make me understand.
 
Campbell Ritchie
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

wee long ong wrote:. . . . So i just leave it there. When i finalize i will remove it.

No, you won't. You will forget it. Remove it now. I have heard so many people say they will do something when the project is finished...

. . . I didn't know anything about command line. mostly depended on the GUI. . . .

Where is your business logic? It ought to be in different classes from your display.
 
wee long ong
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes it's a different classes. What is your suggestion to improve it? All I want is the display appropriately.
 
I've never won anything before. Not even a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic