• 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

Help with creating a panel?

 
Ranch Hand
Posts: 86
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can I design a scrollable panel as a separate file or entity using Eclipse windowsbuilder?  I have a tabbed pane.  The first tab is generic and is automatic when the window is open.  When the window is called it will be passed an object.  That object will contain several other objects.  There will be a list of a specific object.  The window will iterate and build a tab and add it to the tabbed pane.  Since there is no actual max of tabs (theoretically).

I tried doing it through "New" -> "Other" -> "JPane" but then realized I needed a panel not a pane to add a tab.

Have an idea how to do it in code but honestly, I suck at layout and GUI with code.  I would much rather build it with windowbuilder then modify the code later to populate the components.  I was hoping I could have a separate java file with the Jpane in it and call it as I need it.  Right now I am going to build a second tab to the tabbed pane, design it as I need it then, copy and paste the code into a seperate method.  then use a foreach loop to iterate the list and build add the panel.

Just for background; the application is a Repair Shop technicians management software.  It will allow the technician to monitor, manage and complete tasks all in one organized place.  I have been a technician for 20+ years, I have yet to see a program that fits the needs.  Most of the 3rd party software are written by non-technicians.  I feel as having expert knowledge in the field I probably could do a better job (feature wise).  I'm not saying the guys who wrote the ones I have seen are bad, but they are given direction from shop managers who themselves don't know either!

With the background in mind, I have the main program that contains the RepairOrder (RO) object (basically, when the vehicle is brought in an RO is made to document and trace the repairs from customer drop off to billing.  An RO can have an unlimited number of complaints. For example C1 - Engine noise, C2 - Wipers INOP, C3-DOT insspection.  Since each complaint themselves have several different components (Description, technician assigned, date opened, customer, tech diagnostics, tech recommended repairs, warranty/customer pay, SRT's and values for estimate, SRT's and values for final bill, Final repair storey and a lot of other things) I decided the complaint should also be its own object.  Since each RO can have multiple complaints I need a way to build a tab in code for each complaint!

As I said I would love to have a seperate JPanel file in the program structure, that I design with windowbuilder.

Just had a thought.  As I said earlier can I design the tab in the RO window with windowbuilder --> Then create a pnlComplaint.java file in the program structure --> Copy and paste the code from the RO tab to pnlComplaint.java --> use code like below to add the new panel?



On that note I would like each complaint panel to have a sperate name not all of them:
              JPanel complaint = new pnlComplaint(objComplaint);

Since I am using a list of Complaints could I possible use:



After all the name "complaint" in the line "JPanel complaint = new pnlComplaint(objComplaint);" is just a String data type at this point right? So as long as com.getNumer returns a string like "One". then it should work???

Any suggestions on better ways to solve any this will be appreciated.  I am about to start doing some testing myself!

Thank You All  
 
Dwayne Barsotta
Ranch Hand
Posts: 86
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found a way to do it,  But is this the most effective?  Can anyone suggest a better one??  I am guessing I could move the "addTab(Person per)" to another class, import that class and get same result  but that would be ludicrous unless I had a ton of different things to do that was similar.

For the test project I borrowed a "Person" class from my main project (keep in mind it's. not done yet, it is just operational):



Now for the code that makes the window and adds the tabs.  The final will loop through a list, Not make each object "Person here" individually.  Also I wrote it fast the code maybe a little diry.  Please critique away if you want!



PLEASE if there is an easier way I am missing, please advise.  Also even though I wrote this in bed, after taking pills and being yelled at by the wife.  I know the code maybe messy or against "best practice".   If you feel so - point it out.  That way if there is something I didn't actually know I can fix it.

Thank You all.....  BTW I have shoulders like a tout all the shit/shad you send slips off so say as you wish in the name of helping a newby!!!

 
Marshal
Posts: 79512
379
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dwayne Barsotta wrote:. . . Eclipse windowsbuilder? . . . I tried doing it through "New" -> "Other" -> "JPane" . . . I suck at layout and GUI with code.  I would much rather build it with windowbuilder  . . .

Unfortunately that is exactly what you shouldn't do. You shou‍ld get used to writing your own code because that is the only way you will learn anything.
Please explain how much of that code you wrote and how much was generated automatically.
There is no such thing as a scrollable panel. There is scrolling and there are panels. Fortunately, it is quite easy to create a scrolling pane and add a panel to it. Start reading here in the Java™ Tutorials.

But if you are feeling ill, don't do anything until you get better. And get better soon
 
Dwayne Barsotta
Ranch Hand
Posts: 86
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Unfortunately that is exactly what you shouldn't do. You shou‍ld get used to writing your own code because that is the only way you will learn anything.
Please explain how much of that code you wrote and how much was generated automatically.
There is no such thing as a scrollable panel. There is scrolling and there are panels. Fortunately, it is quite easy to create a scrolling pane and add a panel to it. Start reading here in the Java™ Tutorials.

But if you are feeling ill, don't do anything until you get better. And get better soon



I do totally agree that I should learn it by hand coding it.  I have a few issues.  First the company I work for as a technician does not have anything like what I'm working on.  So this project, even though it is a learning process does have a practical end point (at least for me).  GUI design is not my strong suit to start with.  Let alone doing it blind through code.  For this reason I have been doing this project through windowbuilder.  I have another (a lot smaller) project in mind next that I totally intend to concentrate on pure code designing.

On that note, my second set of code above actually did work.  Unless I can find another way of it that is better.  I did how ever get the idea of panel and pane reversed.    
 
Blueberry pie is best when it is firm and you can hold in your hand. Smell it. And smell this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic