How to build UI Framework using Java
Please help me create my own custom layout, container, component, layout manager... Example: Containers and Layout Managers
- Create a window frame.
- Nest panels within a frame for better layout control.
- Create and display buttons in a panel.
- List two component attributes that are controlled by a layout manager.
- Set the layout manager for a container.
- Place components in a panel using BorderLayout, GridLayout, and FlowLayout.
- Name one advantage of each of the layout managers.
- Create panels with titles.
i was search on google but can't find any that match my requirement
Thanks for your help Edit: I was found with keyword "Open Source UI"
开发者_C百科Updated: 31, Oct 2016 I would like to updated some information to make it clearly for someone who concern. Back in 6 years ago what i want to know is how to build "UI Framework" from beginning.
If you have interesting like me i would like recommend Android UI Framework is good start because of open source and well document. Enjoy deep dive in to legacy code :) Good luck
Create a window frame
new JFrame();
Nest panels within a frame for better layout control
final JFrame jframe = new JFrame();
final JPanel innerOne = new JPanel();
jframe.add(innerOne);
innerOne.add(otherComponents);
Create and display buttons in a panel
innerOne.add(new JButton("Hello World!"));
List two component attributes that are controlled by a layout manager
Obviously check out JavaDoc of BorderLayout: BorderLayout.NORTH
and SOUTH
Set the layout manager for a container
innerOne.setLayout(...);
Place components in a panel using BorderLayout, ...
Just apply the layout, and add
providing the arguments for the LayoutManager:
innerOne.setLayout(new BorderLayout());
innerOne.add(..., BorderLayout.NORTH);
Name one advantage of each of the layoutmanager.
Check out the JavaDoc's. They are really helpful in these situations.
Create panels with titles.
innerOne.setBorder(new TitledBorder("Hello World"));
You could use the following set of tutorials: http://java.sun.com/docs/books/tutorial/uiswing/.
精彩评论