Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2007

Tip: Looking for answers? Try searching our database.

Content Pane Problems

Thread view: 
Darum - 17 Jul 2007 19:51 GMT
Greetings!

I'm facing two related problems in developing a Java Applet.

My applet class extends JApplet.

1) The current default layout of the whole window (not individual
components) seems to be a flowLayout. I'd like to set the layout to a
gridBagLayout, however the setLayout command does not seem to be
understood (my compiler is eclipse, JRE 1.5.0 and JDK 5.0), so I
cannot get the following code to work, no specific error msg
generated:
    getContentPane.setLayout(new GridBagLayout);

2) similar problem, cannot setBackground or setForeground of the
overall pane.

Please Advise, thanks.

-Darum
Roedy Green - 17 Jul 2007 20:23 GMT
>   getContentPane.setLayout(new GridBagLayout);

getContentPane is a method, not a variable.

My JApplets have code like this:

Container contentPane = this.getContentPane();
contentPane.setLayout( new GridBagLayout());
contentPane.setBackground( INTERESTINGCOLOUR );
contentPane.add ( component , .... );

see http://mindprod.com/jgloss/japplet.html
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

SadRed - 19 Jul 2007 00:20 GMT
> Greetings!
>
[quoted text clipped - 16 lines]
>
> -Darum

getContentPane().setLayout(new GridBagLayout());


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.