Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-20-2008, 10:44 AM
Member
 
Join Date: Jun 2008
Posts: 6
Peter_APIIT is on a distinguished road
Layout Manager of JApplet
Hello to all expect Java developer, i quite new to java developer.

My assignment is want to me code a JApplet without a layout manager which allow me to adjust the location of button or other components.

I know how to create a JButton but not adjust location.

Not only that, i also want to make ImageIcon to the applet.

Please help me. I really need your help.


Thanks for your help.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-20-2008, 12:32 PM
Member
 
Join Date: Jun 2008
Posts: 6
Peter_APIIT is on a distinguished road
Another requirement is when applet application scale to full screen, all element inside the container should fit properly.

What i want is JApplet ?

Please provide some example and some explanation.

Thanks for your help.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 06-20-2008, 02:33 PM
sukatoa's Avatar
Senior Member
 
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 524
sukatoa is on a distinguished road
Send a message via Yahoo to sukatoa
Quote:
My assignment is want to me code a JApplet without a layout manager which allow me to adjust the location of button or other components.
That may be possible by setting the layout into null....
You may use the setBounds for adjusting...
And have patience on setting its location...
You may compile the program several times just to set the desired location within the container....
Quote:
Not only that, i also want to make ImageIcon to the applet.
Try to browse the JLabel's documentation about on how to do that.... and also the other components.....
__________________
A specific, detailed, simple, well elaborated, and "tested before asking" question may gather more quick replies. hopefully
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Last edited by sukatoa : 06-20-2008 at 02:36 PM.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 06-21-2008, 06:16 AM
Member
 
Join Date: Jun 2008
Posts: 6
Peter_APIIT is on a distinguished road
Quote:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.awt.*;
import javax.swing.*;
import javax.swing.JApplet;

/**
*
* @author nicholas_tse
*/
public class Test extends JApplet {

/**
* Initialization method that will be called after the applet is loaded
* into the browser.
*/
@Override
public void init() {
// TODO start asynchronous download of heavy resources

Container content = getContentPane();
//content.setBackground(Color.white);
content.setLayout(null);

content.add(new JButton("Button 1"));
content.add(new JButton("Button 2"));
content.add(new JButton("Button 3"));
}

// TODO overwrite start(), stop() and destroy() methods

}
ImageIcon any = new ImageIcon("D:\\Java\\SodaMachine\\cola_5.jpg");
JLabel tenCents = new JLabel(any);
content.add(tenCents);

This one is ok.

What is the difference between JPanel and Container ?

I have try the folloing but doesn't get any reusly yet.

Please provide some example to me.

Thanks for your help.

Last edited by Peter_APIIT : 06-21-2008 at 07:01 AM.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 06-24-2008, 12:58 PM
Member
 
Join Date: Jun 2008
Posts: 6
Peter_APIIT is on a distinguished road
Any help please.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 06-24-2008, 03:50 PM
sukatoa's Avatar
Senior Member
 
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 524
sukatoa is on a distinguished road
Send a message via Yahoo to sukatoa
Quote:
What is the difference between JPanel and Container ?
JPanel's documentation

Quote:
Please provide some example to me.
More detailed samples from the net.....
__________________
A specific, detailed, simple, well elaborated, and "tested before asking" question may gather more quick replies. hopefully
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 06-28-2008, 05:55 AM
Member
 
Join Date: Jun 2008
Posts: 6
Peter_APIIT is on a distinguished road
The JPanel documentation doesn't provide difference between JPanel and container ?

I don't want to create null layout manager myself.
I want some built in API.

Thanks for your help.
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 06-30-2008, 05:03 AM
Senior Member
 
Join Date: Jun 2008
Posts: 194
Fubarable is on a distinguished road
Quote:
I don't want to create null layout manager myself.
I want some built in API.
This confuses me greatly. There is no "null layout manager" and no need to create one, as a null layout is essentially that -- no layout manager. Maybe I'm missing something here?
Bookmark Post in Technorati
Reply With Quote
  #9 (permalink)  
Old 06-30-2008, 05:59 AM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: SW MO, USA
Posts: 939
Norm is on a distinguished road
Quote:
What is the difference between JPanel and Container ?
JPanel extends Container (one level removed) so JPanel is a Container that provides some more functionality. Reading the API doc should show you what JPanel provides that Container doesn't.

You should become familiar with reading the API to help you use and understand java.

If you have the JDK installed, there is a src.zip file in the folder with the JDK that has all the source for the java classes. Pick one of the simpler Layout managers and extract its source from the zip and look at that to see how a layout manager works.
Bookmark Post in Technorati
Reply With Quote
  #10 (permalink)  
Old 07-08-2008, 08:18 PM
Nicholas Jordan's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Southwest
Posts: 421
Nicholas Jordan is on a distinguished road
null is a special value
Quote:
Originally Posted by Fubarable View Post
This confuses me greatly. There is no "null layout manager" and no need to create one, as a null layout is essentially that -- no layout manager. Maybe I'm missing something here?
To get rid of somthing, we can set it to null. LayoutManagers are a special case, trying to set a layout manager to null will likely foul up other built-ins that are expecting it to be there. A JPanel (Java 2 Platform SE 5.0) is close to the base of the class for javax.swing.JFrame

You can add a JPanel to a JFrame, just call add( .... ); with a constructed JPanel being passed into the add()

Quote:
And the child will be added to the contentPane. The content pane will always be non-null. Attempting to set it to null will cause the JFrame to throw an exception. The default content pane will have a BorderLayout manager set on it. Refer to RootPaneContainer for details on adding, removing and setting the LayoutManager of a JFrame.
__________________
Please provide your feedback on our
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
Bookmark Post in Technorati
Reply With Quote
  #11 (permalink)  
Old 07-19-2008, 06:37 AM
Member
 
Join Date: Jun 2008
Posts: 6
Peter_APIIT is on a distinguished road
Do you have any example code ?

Please provide it here and let other benefits.

Thanks for your help.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database to JApplet Preethi New To Java 0 03-26-2008 06:18 AM
Another problem in JApplet :S juju Java Applets 2 12-30-2007 08:46 PM
help with converting to JApplet Simmy AWT / Swing 2 08-09-2007 09:45 AM
JApplet and html paty Java Applets 1 08-02-2007 06:41 PM
MiG Layout Manager 2.4 levent Java Announcements 0 05-16-2007 06:11 AM


All times are GMT +3. The time now is 09:26 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org