Solved

JFC

Posted on 1998-03-09
4
223 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

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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
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 learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

705 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

21 Experts available now in Live!

Get 1:1 Help Now