Solved

Resize JFrame/JDeskTopPane

Posted on 2006-07-02
4
963 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

776 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