Results 1 to 6 of 6
  1. #1
    simlei is offline Member
    Join Date
    Feb 2010
    Posts
    3
    Rep Power
    0

    Default Handle Resizing of Swing Containers

    Hello,
    I hope you know the answer to my beginner question -- I have a JButton, which has an Image drawn to it. Now I tried to apply a Layout to this Button and the whole rest of my formular, and this works fairly good. The Button is resizing when I resize the Window. But I wish to make the Image on the Button smaller, when the Button shrinks, and bigger, when the button gets bigger. Is there any possibility to do this without too much hassle? Is there an autofit setting, or another way to get notified anytime the button gets resized?
    When there is such a notification: How do I get the size the button is tried to be resized to? Just with getSize()?
    And talking about "best practice" -- yea, what would the best practice be here?

    I hope this question doesn't annoy you too much; I am a total GUI beginner :/
    Thank you very much!

    Simon L.

  2. #2
    Michael Dunn is offline Member
    Join Date
    Jul 2008
    Posts
    62
    Rep Power
    0

    Default

    > I hope this question doesn't annoy you too much

    the question doesn't, the cross-posting does

    Handle Resizing of Containers (Swing / AWT / SWT / JFace forum at JavaRanch)

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by Michael Dunn View Post
    > I hope this question doesn't annoy you too much

    the question doesn't, the cross-posting does

    Handle Resizing of Containers (Swing / AWT / SWT / JFace forum at JavaRanch)
    Yup, both JavaRanch and we have a policy regarding cross-posting. It's always a good policy to read the FAQ's before posting. For instance: BeForthrightWhenCrossPostingToOtherSites

  4. #4
    simlei is offline Member
    Join Date
    Feb 2010
    Posts
    3
    Rep Power
    0

    Default

    I'm sorry, I didn't know this is discouraged. Do you have an answer for me, though?

  5. #5
    Michael Dunn is offline Member
    Join Date
    Jul 2008
    Posts
    62
    Rep Power
    0

    Default

    > ... I didn't know this is discouraged.

    so, common scenario -
    someone tries to help you in your unanswered post
    your post in another forum was answered (possibly) hours earlier
    the 'someone' has had their time totally wasted

    and you're happy with the above!

    > Do you have an answer for me, though?

    I posted the answer at javaranch (then deleted it when I saw the cross-post here)
    my time is unimportant to you, therefore you getting a solution is unimportant to me

  6. #6
    simlei is offline Member
    Join Date
    Feb 2010
    Posts
    3
    Rep Power
    0

    Default

    I, personally, wouldn't mind, if i would be the answer-giver. In real world, you ask multiple Persons about things, too, and dont waste your breath listing every single person you spoke with about your problem.

    So, intuitively, I knever would have come to the idea, that such a rule exists.

    And thanks for the help. I'm happy to waste even MORE of your time, because you seem to have big piles of it, reading this now. Searching crossposts. Thats not really the way to have a happy time -_-
    Last edited by simlei; 02-23-2010 at 03:22 AM.

Similar Threads

  1. JFrame resizing
    By carderne in forum New To Java
    Replies: 3
    Last Post: 07-22-2009, 08:42 PM
  2. panel resizing
    By kumar_gemi in forum New To Java
    Replies: 3
    Last Post: 03-13-2009, 03:51 AM
  3. First Java-game: Containers
    By eastviolence in forum New To Java
    Replies: 0
    Last Post: 04-04-2008, 07:09 PM
  4. Swing containers
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-07-2007, 01:06 PM
  5. Image resizing
    By alley in forum Java 2D
    Replies: 2
    Last Post: 11-13-2007, 11:10 AM

Posting Permissions

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