3

I'll try to be as specific as possible.

What I currently know:

I am good at programming(JAVA) i.e. logics, algorithms, etc and when it comes to gui I am good at event handling and I can do it all through manual coding, but the problem I face is in designing the gui itself.

I always rely on the windows builders of netbeans and eclipse to make my gui i.e. positioning of the components, etc.

My Question:

I want to make the gui on my own as well and I have studied all the layouts but the problem is that no matter what I do? no matter which layout I use I can't position any component at the exact location like the IDEs.

For e.g. if I use any particular layout and position a component(for e.g. JTextField, etc) I am not able position it at the same location as the free designing(drag and drop) of the IDEs do.

Please suggest me what I can do or what I can study to make a gui just like the IDEs do but by manual coding, I am a student and I want to improve myself.

Thank You!

7
  • Are you even using Layouts or which one are you using ? Commented Apr 21, 2015 at 14:19
  • MigLayout is complex but allows for very precise layout Commented Apr 21, 2015 at 14:19
  • @MuratK. He said he was Commented Apr 21, 2015 at 14:19
  • @MuratK, I use the appropriate layouts depending upon the requirements, I use all of them i.e Gird,Card, etc Commented Apr 21, 2015 at 14:37
  • @ManOfPanda Sir! The MigLayout you suggested, I googled it and found it to be really useful but is it an additional api I mean it's not inbuilt to JAVA right? Commented Apr 21, 2015 at 14:38

1 Answer 1

1

GUIs in Java applications are made using Swing. It seems your problem is making the interfaces visually appealing? That's what the drag-and-drop GUI builders are for. They help you quickly generate screen layouts (code is generated automatically and is modifiable).

You should try using Eclipse's Window Builder

Study any concepts of relative or absolute layouts relevant to Swing. This will help you position widgets within your GUI.

Java provides some standards or "best practices" for GUI design

Window Builder is very helpful, but to position and modify size of widgets you must know what attributes are related to that widget, this is provided in Oracle's Swing documentation.

For starters, skip the builders and start writing code on your own. Then refer to documentation on how to move those components and position them in the window as you want. There are plenty of code samples and tutorials available like this one

Sign up to request clarification or add additional context in comments.

2 Comments

thank you so much about the absolute layout point, I searched for it and found it to be really useful, but by relative layout and widgets aren't you talking about android?
Relative layout and widget are just terms often used in many languages and component libraries, they often mean the same thing across languages. Yes, relative layout is a feature in Android. You should look up resizing or similar equivalents in Java Swing - like relative positioning.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.