Results 1 to 2 of 2
Like Tree1Likes
  • 1 Post By DarrylBurke

Thread: Need help for aligning JButton(to fit more text in less space)

  1. #1
    BenMoon is offline Member
    Join Date
    Jun 2013
    Posts
    1
    Rep Power
    0

    Unhappy [Done] Need help for aligning JButton(to fit more text in less space)

    I am making a swing application, and I came across a problem.
    I created a JButton, used for submitting data from a JTextField.
    I then realized that the button was 1.5 times as wide as the text.
    All I want is a small button that isn't so wide.
    Thank you to anyone that reads this and gives help so I can create my App.

    Answer: button1.setMargin(new Insets(5,5,5,5));
    Last edited by BenMoon; 06-25-2013 at 10:20 PM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: Need help for aligning JButton(to fit more text in less space)

    setMargin to a new Insets with the margins of your choice.

    db
    BenMoon likes this.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. I can not remove space or tab from text file
    By waelyafooz in forum New To Java
    Replies: 0
    Last Post: 11-18-2012, 10:00 AM
  2. Replies: 1
    Last Post: 11-13-2012, 05:27 AM
  3. [SOLVED] remove all white space from text file
    By loki in forum New To Java
    Replies: 10
    Last Post: 04-26-2009, 12:52 PM
  4. problem aligning both image/text inside a button
    By rick_cols in forum SWT / JFace
    Replies: 0
    Last Post: 09-18-2008, 09:20 PM
  5. Waste Space & Text Field
    By Gajesh Tripathi in forum AWT / Swing
    Replies: 2
    Last Post: 12-01-2007, 08:44 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •