• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

button size and frame border

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am a complete noob with java so bear with me, anyway I have created a simple calculator in the windows style(well that is the idea), I am trying to change the blank button in my code to the same size as the memory buttons down the left hand side but it just stretches. Also I am trying to create a small border round the number, operator and text panels any ideas how to sort these?

heres a pic: http://www.itshops.co.uk/calc.jpg

 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Of course it stretches. Java Layout Managers are designed that when the size of the whole window changes, the individual components change too.

Go to Cay Horstmann's website, and find the GBC class, then use it to help with the GridBagLayout, which allows you to put an Inset around a button.

You can miss out the line about import java.lang.*; .
Also if you use J2SE 5.0 you can forget about pane and just add() all the components directly.
 
reply
    Bookmark Topic Watch Topic
  • New Topic