|
|
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.
|
|

07-07-2008, 09:07 AM
|
|
Member
|
|
Join Date: Jul 2008
Posts: 18
|
|
|
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..
|
|

07-07-2008, 09:18 AM
|
|
Senior Member
|
|
Join Date: May 2008
Location: Makati, Philippines
Posts: 188
|
|
|
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.
|
|

07-07-2008, 09:19 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,875
|
|
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.
|
|

07-07-2008, 09:22 AM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 150
|
|
|
|
|

07-07-2008, 09:25 AM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 150
|
|
Originally Posted by Eku
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.
|
|

07-07-2008, 09:29 AM
|
|
Member
|
|
Join Date: Jul 2008
Posts: 18
|
|
|
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
|
|

07-07-2008, 09:31 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,875
|
|
I think Eku is talking about calling a JFrame within a JOptionPane. Because I agreed with masijade too, with the following.
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.
|
|

07-07-2008, 09:32 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,875
|
|
Originally Posted by JavaLerner
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.
|
|

07-07-2008, 09:32 AM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 150
|
|
Originally Posted by JavaLerner
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.
|
|

07-07-2008, 09:48 AM
|
|
Member
|
|
Join Date: Jul 2008
Posts: 18
|
|
Originally Posted by masijade
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..
|
|

07-07-2008, 09:51 AM
|
|
Member
|
|
Join Date: Jul 2008
Posts: 18
|
|
Originally Posted by masijade
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
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.
|
|

07-07-2008, 09:53 AM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 150
|
|
Originally Posted by JavaLerner
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?
|
|

07-07-2008, 09:57 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,875
|
|
|
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.
|
|

07-07-2008, 10:00 AM
|
|
Member
|
|
Join Date: Jul 2008
Posts: 18
|
|
Originally Posted by Eranga
Think about some layout and add components there first.
which layout i use for this..i am useing
setLayout( new BorderLayout() )
for picture...
|
|

07-07-2008, 10:03 AM
|
|
Member
|
|
Join Date: Jul 2008
Posts: 18
|
|
Originally Posted by masijade
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...
|
|

07-07-2008, 10:07 AM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 150
|
|
Originally Posted by JavaLerner
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.
|
|

07-07-2008, 10:07 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,875
|
|
Originally Posted by masijade
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.
|
|

07-07-2008, 10:45 AM
|
|
Member
|
|
Join Date: Jul 2008
Posts: 18
|
|
Originally Posted by Eranga
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
|
|

07-07-2008, 10:49 AM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 150
|
|
Originally Posted by JavaLerner
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.
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
| |