Panel Using Swings
I am trying Swings on my own. This is my first day.开发者_JAVA技巧 I have been working on GWT for long. I am trying to get a hashMap with both String as key value pair and trying to display both the strings as two adjacent columns and a text box in third column.
Can someone help me with the exact code.
Am using JLabel, JTextField and JComponent.
Thanks.
First, you should decide on the Layoutmanager you want to use for further development.
See here: http://download.oracle.com/javase/tutorial/uiswing/layout/using.html
When you have decided on that, go on and add your Components to a JFrame, using said Layoutmanagaer.
Pretty much everything you're looking for can be found in the linked tutorial. And I suppose you know how to retrieve key-value pairs from a Map - so no need to clarify on that?
cheers
Check out GridLayout. It is similar to FlexTable in GWT One possible drawback is that it resizes all components to the same size. JTable or GridBagLayout will give you finer control, but you might find them conceptually difficult if you are starting out with Swing.
精彩评论