• Post Reply Bookmark Topic Watch Topic
  • New Topic

GUI building in netbeans  RSS feed

 
Peter Ream
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been coding in Java for about 2 years as a hobby (I like to program).  I do not particularly like to code my screens.  I have tried Eclipse, but thought Netbeans had easier screen design.  I have not coded many screens, so I am not very good at it.  I have major problems getting them to look the way I want.  I have a simple screen that I designed as such jFrame, FlowLayout, jPanel, CardLayout, 3 Panels (3 different cards).  Each card is made up of a jPanel with BorderLayout.  The panel I have attached has a center panel and a south panel.  On all my panels I have a south panel for my back or exit button.  My other panels have a north, center, and south panel, so I used center and south on this one for consistency.  I can't get my exit button properly positioned for display.  It looks good in netbeans preview, but doesn't look the same when running.  Any idea what I could be doing wrong.

If I were to change my panel layouts, how can I do this without losing all my coding for buttons, textFields, etc.?
Preview-screen.png
[Thumbnail for Preview-screen.png]
Preview
Running-scrren.png
[Thumbnail for Running-scrren.png]
Running
 
Stefano Carniel
Greenhorn
Posts: 27
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about Javafx? It's based on MVC pattern and you have complete separation between views (screens) and logic
 
Peter Ream
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stefano Carniel wrote:What about Javafx? It's based on MVC pattern and you have complete separation between views (screens) and logic


I have dabbled a little in JavaFx, just trying to figure it out.  Thought maybe it was the next and coming.  Getting mixed reviews.

I am interested in trying to figure out a solution to my immediate problem.
 
Knute Snortum
Sheriff
Posts: 4279
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have a solution to your immediate problem, but I have some observations as to why this kind of question is hard to handle.

1) Out of the three big IDEs, NetBeans is the least popular.  Eclipse and IntelliJ are used more with IntelliJ maybe having a slight lead (but I use Eclipse anyway).

2) It's difficult to know what GUI Designer you're using.  I'm guessing that it comes with the latest NetBeans, but my old copy of 8.2 doesn't seem to have anything like that (I may be missing it).

3) It's better to create GUIs with code.  Most GUI designers create terrible code that is hard to debug.  I suspect if you posted the code you produced it would be a big mess, hard to understand and debug.  I would say most (almost all) programmers use code to produce their GUIs.

So...

* tell us what GUI designer you're using.
* if you can, post your code here.
 
Rob Camick
Ranch Hand
Posts: 2828
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any idea what I could be doing wrong.


Seriously? How would expect us to guess what the problem is by looking at a picture?

Post a proper SSCCE that demonstrates the problem.

Since you question is about layout, then all you need is the frame and the components (not any of the processing logic of the components). By simplifying the problem it is easier to find the solution.

And my advice is to NOT use an IDE to generate code. The code will not be maintainable if you ever move to another IDE. Instead create the layout code yourself and just use the IDE for compiling and debugging etc.
 
Peter Ream
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Camick wrote:
Any idea what I could be doing wrong.


Seriously? How would expect us to guess what the problem is by looking at a picture?

Post a proper SSCCE that demonstrates the problem.

Since you question is about layout, then all you need is the frame and the components (not any of the processing logic of the components). By simplifying the problem it is easier to find the solution.

And my advice is to NOT use an IDE to generate code. The code will not be maintainable if you ever move to another IDE. Instead create the layout code yourself and just use the IDE for compiling and debugging etc.


I knew when I posted this was probably a bad idea.  I wasn't looking for a solution; I was hoping maybe someone would say in case like this you generally look at ...  As to Eclipse vs Netbeans, or Intellij, that is for another discussion.  I have tried both Eclipse and Netbeans and there are things in each I like better than the other.  I do like the GUI design feature of Netbeans better than Eclipse.  In all that I have read, everyone says don't use an IDE for GUI design, code it manually.  For my purposes simple GUIs, the IDE has worked, albeit I probably would not be having this problem.  I am using the built-in GUI designer in Netbeans 8.2.

I didn't want to include my code because I thought it would look like I was wanting someone to debug my code, which is not what I was looking for.  For what it is worth here is the pertinent code:

 
Campbell Ritchie
Marshal
Posts: 56545
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter Ream wrote:. . . In all that I have read, everyone says don't use an IDE for GUI design, code it manually. . . .
Whoever said that is correct. Actually, I would suggest that you can use an automatic GUI builder once you have enough experience to create a GUI and layout by hand.

Note the names which the GUI builder gives the components by default: jLabel5. That isn't helpful.
You would appear to have edited some of those names, but you have used the bad sort of so‑called Hungarian notation (look it up). Something like mntmLearnMode is difficult to understand.
Rob C is correct. Post code which demonstrates the problem and nothing else.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!