Solved

JFC

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

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

Suggested Solutions

Title # Comments Views Activity
thymeleaf natural templating vs JSP 2 95
map related example 6 47
Oracle SQL syntax check  without executing 6 50
sql import cannot be resolved jsp 3 17
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

808 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