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 07-07-2008, 09:07 AM
Member
 
Join Date: Jul 2008
Posts: 18
JavaLerner is on a distinguished road
Dialog
Hi All

I am student of MCA.I want to know how can i develop a About Dialog.About Dialog means..A dialog have a one picture and multiple label.As we see all software have a help menu and help menu have a About Dialog.As like that i want to develop.Can any one give me example link or some code...

Plz help me..
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-07-2008, 09:18 AM
Eku Eku is offline
Senior Member
 
Join Date: May 2008
Location: Makati, Philippines
Posts: 188
Eku is on a distinguished road
You want to create your own style of dialog boxes?

You can try creating your own Dialog function with a JFrame and just call it. You can have as may pictures you like and many labels.

I hope i shared some ligth into your question
__________________
Mind only knows what lies near the heart, it alone sees the depth of the soul.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-07-2008, 09:19 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,875
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Search the Google my friend. There are lots of examples.

Suns' official website is a good choice too.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on September 4, 2008)

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
  #4 (permalink)  
Old 07-07-2008, 09:22 AM
Senior Member
 
Join Date: Jun 2008
Posts: 150
masijade is on a distinguished road
JDialog*«*Swing*«*Java Tutorial
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 07-07-2008, 09:25 AM
Senior Member
 
Join Date: Jun 2008
Posts: 150
masijade is on a distinguished road
Quote:
Originally Posted by Eku View Post
You can try creating your own Dialog function with a JFrame and just call it. You can have as may pictures you like and many labels.
What? No reason. JDialog can be used exactly as if it were a JFrame (minus the min/max and maybe some other window functions). There is no reason to use JFrame and attempt to control modality and everything else inherit in a Dialog yourself. Dialogs are not just JOptionPane.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 07-07-2008, 09:29 AM
Member
 
Join Date: Jul 2008
Posts: 18
JavaLerner is on a distinguished road
Sir i have a code which have picture and one label show on dialog.But i want to do show more than one label on dialog.I found some code from this forum.It ia very hekp full for me...
Plz help me
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 07-07-2008, 09:31 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,875
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
I think Eku is talking about calling a JFrame within a JOptionPane. Because I agreed with masijade too, with the following.

Quote:
Dialogs are not just JOptionPane.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on September 4, 2008)

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
  #8 (permalink)  
Old 07-07-2008, 09:32 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,875
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Quote:
Originally Posted by JavaLerner View Post
Sir i have a code which have picture and one label show on dialog.But i want to do show more than one label on dialog.I found some code from this forum.It ia very hekp full for me...
Plz help me
Are you talking about JDialog or JOptionPane? Can you clarify it little more.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on September 4, 2008)

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
  #9 (permalink)  
Old 07-07-2008, 09:32 AM
Senior Member
 
Join Date: Jun 2008
Posts: 150
masijade is on a distinguished road
Quote:
Originally Posted by JavaLerner View Post
Sir i have a code which have picture and one label show on dialog.But i want to do show more than one label on dialog.I found some code from this forum.It ia very hekp full for me...
Plz help me
Did you go to that tutorial?

I posted that one because it deals with JDialog, not JOptionPane. Sun's tutorials, are now, unfortunately, solely concerned with JOptionPane, and just give references to JDialog, but don't actually demonstrate anything with it.
Bookmark Post in Technorati
Reply With Quote
  #10 (permalink)  
Old 07-07-2008, 09:48 AM
Member
 
Join Date: Jul 2008
Posts: 18
JavaLerner is on a distinguished road
Quote:
Originally Posted by masijade View Post
Did you go to that tutorial?

I posted that one because it deals with JDialog, not JOptionPane. Sun's tutorials, are now, unfortunately, solely concerned with JOptionPane, and just give references to JDialog, but don't actually demonstrate anything with it.
yes sir i got it but there is nothing for Background Picture..
Bookmark Post in Technorati
Reply With Quote
  #11 (permalink)  
Old 07-07-2008, 09:51 AM
Member
 
Join Date: Jul 2008
Posts: 18
JavaLerner is on a distinguished road
Quote:
Originally Posted by masijade View Post
Did you go to that tutorial?

I posted that one because it deals with JDialog, not JOptionPane. Sun's tutorials, are now, unfortunately, solely concerned with JOptionPane, and just give references to JDialog, but don't actually demonstrate anything with it.
Sir i got some code from this forum.Code is here

Code:
import java.awt.* ; import java.awt.Image; import javax.swing.* ; public class JFrameBg extends JDialog{ public JFrameBg() { super() ; setTitle( "Background Image on JFrame or JDialog or JApplet" ) ; setDefaultCloseOperation( EXIT_ON_CLOSE ) ; setContentPane( new MyPanel() ) ; getContentPane().add( new JLabel( "It is a Label" , new ImageIcon( "D:/Personal/Shilu/teddy,bmp" ) , JLabel.CENTER ) ) ; setSize( 400 , 300 ) ; setVisible( true ) ; } public class MyPanel extends JPanel { private Image img ; public MyPanel() { setLayout( new BorderLayout() ) ; img = new ImageIcon( "D:/Personal/Shilu/rose.jpg" ).getImage() ; if( img == null ) { System.out.println( "Image is null" ); System.exit( 1 ) ; } if( img.getHeight(this) <= 0 || img.getWidth( this ) <= 0 ) { System.out.println( "Image width or height must be +ve" ); System.exit( 2 ) ; } } public void drawBackground( Graphics g ) { int w = getWidth() ; int h = getHeight() ; int iw = img.getWidth( this ) ; int ih = img.getHeight( this ) ; for( int i = 0 ; i < w ; i+=iw ) { for( int j = 0 ; j < h ; j+= ih ) { g.drawImage( img , i , j , this ) ; } } } protected void paintComponent(Graphics g) { super.paintComponent(g); drawBackground( g ) ; } } public static void main(String[] args) { new JFrameBg() ; }
It is working fine but i need to add more label on this Dialog.
Bookmark Post in Technorati
Reply With Quote
  #12 (permalink)  
Old 07-07-2008, 09:53 AM
Senior Member
 
Join Date: Jun 2008
Posts: 150
masijade is on a distinguished road
Quote:
Originally Posted by JavaLerner View Post
yes sir i got it but there is nothing for Background Picture..
So? I thought your question was simply on how to use a JDialog, not how to use a background picture.

And, judgiung by your next post, you're not even asking about that, but rather, how to add more labels.

So what, exactly, is it you're having problems with?
Bookmark Post in Technorati
Reply With Quote
  #13 (permalink)  
Old 07-07-2008, 09:57 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,875
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Think about some layout and add components there first.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on September 4, 2008)

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
  #14 (permalink)  
Old 07-07-2008, 10:00 AM
Member
 
Join Date: Jul 2008
Posts: 18
JavaLerner is on a distinguished road
Quote:
Originally Posted by Eranga View Post
Think about some layout and add components there first.
which layout i use for this..i am useing
Code:
setLayout( new BorderLayout() )
for picture...
Bookmark Post in Technorati
Reply With Quote
  #15 (permalink)  
Old 07-07-2008, 10:03 AM
Senior Member
 
Join Date: Jun 2008
Posts: 150
masijade is on a distinguished road
Go through this entire tutorial, thoroughly, as you seem to have no idea how to use Swing.

Trail: Graphical User Interfaces (The Java™ Tutorials)
Bookmark Post in Technorati
Reply With Quote
  #16 (permalink)  
Old 07-07-2008, 10:03 AM
Member
 
Join Date: Jul 2008
Posts: 18
JavaLerner is on a distinguished road
Quote:
Originally Posted by masijade View Post
So? I thought your question was simply on how to use a JDialog, not how to use a background picture.

And, judgiung by your next post, you're not even asking about that, but rather, how to add more labels.

So what, exactly, is it you're having problems with?
Sir i want to set background picture and multipe label on dialog. And same thing i written in first post...
Bookmark Post in Technorati
Reply With Quote
  #17 (permalink)  
Old 07-07-2008, 10:07 AM
Senior Member
 
Join Date: Jun 2008
Posts: 150
masijade is on a distinguished road
Quote:
Originally Posted by JavaLerner View Post
Sir i want to set background picture and multipe label on dialog. And same thing i written in first post...
Except that you already have parts of it, and according to your last post, need only to know how to add labels to that, which is entirely different than "the first post" as that post is essentially asking "How do I use JDialog?", and you're last post is, "How do I add additional JLabels to a JPanel?".

Completely different things. Anyway, go through the Swing tutorials.
Bookmark Post in Technorati
Reply With Quote
  #18 (permalink)  
Old 07-07-2008, 10:07 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,875
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Quote:
Originally Posted by masijade View Post
Go through this entire tutorial, thoroughly, as you seem to have no idea how to use Swing.

Trail: Graphical User Interfaces (The Java™ Tutorials)
Yes, it's better to go through this link and have an idea.

At the minute, JavaLerner, there are different layouts you can use. Each has strength and weaknesses, depends on the situation you can use the best one. Better to read about them too.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on September 4, 2008)

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
  #19 (permalink)  
Old 07-07-2008, 10:45 AM
Member
 
Join Date: Jul 2008
Posts: 18
JavaLerner is on a distinguished road
Quote:
Originally Posted by Eranga View Post
Yes, it's better to go through this link and have an idea.

At the minute, JavaLerner, there are different layouts you can use. Each has strength and weaknesses, depends on the situation you can use the best one. Better to read about them too.
I need some code example to understand...So plz if it is possibel then give me
Bookmark Post in Technorati
Reply With Quote
  #20 (permalink)  
Old 07-07-2008, 10:49 AM
Senior Member
 
Join Date: Jun 2008
Posts: 150
masijade is on a distinguished road
Quote:
Originally Posted by JavaLerner View Post
I need some code example to understand...So plz if it is possibel then give me
You, seemingly, do not understand the code you already have, so how is giving you more going to help?

Go through the tutorials and learn alittle bit about how to use Layouts, Windows, and Components in general, then try to make this change.
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