Solved

JFC

Posted on 1998-03-09
4
226 Views
Last Modified: 2013-11-23
Currently my application is in JDK1.1.5. I want to port it to JDK1.2.
I want to use Swing components in my application.
I have been using setLayout(null) method for absolute placing of the components.
setLayout(null) doesn't seem to work in JFC.

Is there any alternative for absolute placing of components.(i.e. any alternative method in Swing for setLayout(null) method.

Cheers swamy

0
Comment
Question by:sswami
  • 2
4 Comments
 

Expert Comment

by:wcrosman
ID: 1233484
I'd strongly recommend using layout managers.  Your current technique will not
work properly on differing platforms and screen resolutions.
0
 

Expert Comment

by:markoj
ID: 1233485
JFC works with null layout. I use it all the time.
Example:
 JButton button = new JButton("OK");
 button.setSize(100, 100);     // you can use button.reshape(100, 100, 100, 100) instead
 button.setLocation(100, 100);
 this.add(button);
0
 

Author Comment

by:sswami
ID: 1233486
The JFC doesn't work with null layout if your class extends JFrame.

Any other workaround.....

Cheers swamy
0
 

Accepted Solution

by:
markoj earned 50 total points
ID: 1233487
Add JPanel to your JFrame. (MyJFrame.getContentPane().add(new MyJPanel)).
JPanel works with null layout.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

837 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