Solved

Resize JFrame/JDeskTopPane

Posted on 2006-07-02
4
948 Views
Last Modified: 2008-01-16
I have added components like JLabel, JTextFiled etc. to a JFrame/JDesktopPane. When the JDesktopPane is resized I want all components to be resized accordingly

How can I achieve this.
0
Comment
Question by:sree032397
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
hiteshgupta1 earned 500 total points
ID: 17029618
public static void main(String args[])

  {

    JFrame f = new JFrame();
    JLayeredPane layeredPane = new JLayeredPane();
    //layeredPane.setPreferredSize(new Dimension(50, 50));
    layeredPane.setBorder(BorderFactory.createTitledBorder(
                        "Move the Mouse to Move Duke"));


    JButton button = new JButton("test");
    //button.setBounds(120,120,120,120);
    layeredPane.setLayout(new BorderLayout());
    layeredPane.setLayer(button , JLayeredPane.DEFAULT_LAYER.intValue());
    layeredPane.add(button);
    f.getContentPane().add(layeredPane);

    f.pack();
    f.show();

}

The button resizes as the frame is resized

I think by default the layout for layeredpane is null
if you set the layout to layout manager you need
then it should behave just like
Layout manager is supposed to
0
 
LVL 8

Expert Comment

by:hiteshgupta1
ID: 17239178
Hi Venabili

No objection  from my side

Thanks
Hitesh
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article will show, step by step, how to integrate R code into a R Sweave document
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now