• Post Reply Bookmark Topic Watch Topic
  • New Topic

swing or awt for graphic display?  RSS feed

 
steve gunning
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm a java beginner and having problems. i need to display basic graphics (lines, rectangles, ellipses )alongside user changeable text fields. i can display the graphics using awt.geom but dont know how to display the text field alongside the shapes or at all for that matter - below is an attempt at coding this problem.
i would really appreciate help pls...thanks steve.

ps:
Please use the [ code ] opening and closing tags (without the spaces) while posting source code. I edited the msg for you.
Thanks for your cooperation.
- satya

[This message has been edited by Madhav Lakkapragada (edited July 09, 2001).]
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Steve,
You must be aware that JFrame has a BorderLayout as default. You will either want to change that to a GridLayout or a GridBagLayout so that you can control the positioning easier. You didn't specify how you wanted to layout your components. As an example with GridLayout (2 columns):
textfield1 canvas1
textfield2 canvas2
...
textfieldN canvasN
Regards,
Manfred.
 
steve gunning
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks manfred,
i was thinking of using a GridBagLayout - not sure if it will do what i want though. This is a rough sketch of what i want to achieve, do you think its possible? http://www.cs.aston.ac.uk/~gunninsp/galatean_model.gif
kind regards,
steve
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve,
The GridBagLayout is your only hope. It looks like the widget layout will be very easy. Start with the drawing you have a divide it up into rows and columns to figure out how to specify the GBL constraints.
I am not really sure about drawing the lines connecting components though ... I have never done it or seen it, so the results should be interesting and very unique!
I am thinking that the GBL layout might remove the lines because it manages the children. If that happens then you might need to use a Null layout and place all the components yourself. That is not very hard, but can be unpredicatable when your original frame is resized.
Good Luck,
Manfred
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!