• 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Can't select an object in JPanel (mouse clicks through panel to objects underneath)

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Code Ranchers,

I am using WindowBuilder in Eclipse to design a Swing GUI. I'm using one JPanel in a card layout. Within this card layout, I have a number of JPanels. Each of these have various buttons and text boxes.

My issue is editing the JPanels which belong to the Card Layout. For all of the JPanels except one, I can select the JPanel by name from the nested list. Window Builder brings that JPanel to the top. Once on the top, I can freely select individual components to edit on that JPanel.

However, for one JPanel in the Card Layout ("calibrationPanel", shown in the pictures), when I attempt to edit the components by clicking on them, it's as though the panel doesn't exist and my mouse selects objects from panels "under" the shown panel. This makes it difficult or impossible to determine if one label is jLabel1 or jLabel2, for example. I'm going bananas.

I'm using Eclipse 2019-12 with WindowBuilder "Last Good Build" from here: http://download.eclipse.org/windowbuilder/lastgoodbuild/ . I've also tried Eclipse 2020-3 with the same problem.

Any feedback is appreciated.
Screen-Shot-2020-05-03-at-9.21.07-PM-copy-2.jpg
[Thumbnail for Screen-Shot-2020-05-03-at-9.21.07-PM-copy-2.jpg]
Screen-Shot-2020-05-03-at-9.22.27-PM-copy.jpg
[Thumbnail for Screen-Shot-2020-05-03-at-9.22.27-PM-copy.jpg]
 
Ranch Hand
Posts: 127
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The screenshots doesn't help any, the issue was described clearly in your text.
Anyway, as I never used a GUI builder but always crafted by GUIs by hand (using GridBagLayout) at least I would need to see some code generated by the gui builder to maybe spot some issues.
Aside from that: In the style of "Have you turned it off and on again?": Have to tried to delete the Panel in question and just rebuild it? Or, to maybe don't scrap your work: How about just creating a new Panel?
Make sure not to blindly copy'n'paste but rather rebuild everything by hand from scratch to avoid the error gets copied over to the new panel.
Yes, I know this is hard work, but when one tries to make life easy by using a gui builder such issues just wait to happen. And to fix them cost time and effort. No way around it.
 
Marshal
Posts: 72995
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This sounds more like a problem with Eclipse than with Swing, so I shall add you to our Eclipse forum.
Make sure to save the current state of your code before making major changes.
 
Simon McNamara
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Many thanks for the replies. I clicked about in the panel for, say, 7 to 10 hours between yesterday and today and I found my problem. The tabbed panel in the JPanel was making things a mess. My error log was propagating null pointer exceptions, but without any stack entry related to my GUI class. After I deleted and rebuilt the tabbed panel, those seem to be gone completely and I can click individual objects properly. I'm still getting pretty frequent "Unhandled event loop executions" while moving things about, but they don't seem to be doing much, so I'm carrying on.

Thanks,
 
Who knew that furniture could be so violent? Put this tiny ad out there to see what happens:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic