Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: How can i make the components resizable?

  1. #1
    Junior Member
    Join Date
    Aug 2009
    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default How can i make the components resizable?

    Hi everyone!

    I'm currently using swing in building an interface for my app.... I need it to be resizable, together with the images, panels, labels,and buttons? How can I make it possible????

    Thanks in advance!


  2. #2
    Senile Half-Wit Freaky Chris's Avatar
    Join Date
    Mar 2009
    Posts
    834
    My Mood
    Cynical
    Thanks
    7
    Thanked 105 Times in 90 Posts

    Default Re: How can i make the components resizable?

    How exactly do you want it resizable, so as they drag te window bigger the buttons get bigger?

  3. #3
    Junior Member
    Join Date
    Aug 2009
    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: How can i make the components resizable?

    Quote Originally Posted by Freaky Chris View Post
    How exactly do you want it resizable, so as they drag te window bigger the buttons get bigger?
    yes, is that possible???

  4. #4
    Junior Member
    Join Date
    Sep 2009
    Location
    Cairo,Egypt
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How can i make the components resizable?

    i think there's a method called "resizable" in most swing objects,i use it in netbeans' GUI editor

  5. #5
    Junior Member
    Join Date
    Oct 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How can i make the components resizable?

    If you are using the NetBeans IDE to develop your project, you can set the point(s) to which your objects are anchored and then set which direction you want them to automatically resize.

    Now, I know that this can be done manually in your code, but I always figure, why work harder than you have to? If someone was nice enough to develop an IDE that will take care of GUI setup tasks like making your widgets re-sizable, then why not take advantage of it?

    However, if you are dead set on doing this yourself manually, you will want to take a look at the Sun Swing Tutorial and pay special attention to the information on the SpringLayout layout manager. You can view this tutorial here:

    Lesson: Laying Out Components Within a Container (The Java™ Tutorials > Creating a GUI With JFC/Swing)

    Cheers,

    Sean C.
    PekinSOFT Systems

Similar Threads

  1. How to create directory in Java?
    By JavaPF in forum Java Programming Tutorials
    Replies: 2
    Last Post: December 24th, 2011, 12:53 PM
  2. count components inside a JPanel
    By dewboy3d in forum AWT / Java Swing
    Replies: 1
    Last Post: August 2nd, 2009, 03:17 PM
  3. Change JFrame components problem
    By bruno88 in forum AWT / Java Swing
    Replies: 0
    Last Post: June 30th, 2009, 01:25 PM
  4. Replies: 2
    Last Post: March 6th, 2009, 03:00 PM
  5. Java algorithm for bank program to connect database
    By araujo3rd in forum Algorithms & Recursion
    Replies: 1
    Last Post: December 10th, 2008, 01:34 PM