Results 1 to 20 of 28
Thread: Dialog
- 07-07-2008, 08:07 AM #1
Member
- Join Date
- Jul 2008
- Posts
- 18
- Rep Power
- 0
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, 08:18 AM #2
Senior Member
- Join Date
- May 2008
- Location
- Makati, Philippines
- Posts
- 234
- Rep Power
- 6
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 questionMind only knows what lies near the heart, it alone sees the depth of the soul.
- 07-07-2008, 08:19 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Search the Google my friend. There are lots of examples.
Suns' official website is a good choice too.
- 07-07-2008, 08:22 AM #4
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
- 07-07-2008, 08:25 AM #5
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
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, 08:29 AM #6
Member
- Join Date
- Jul 2008
- Posts
- 18
- Rep Power
- 0
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, 08:31 AM #7
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
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.
- 07-07-2008, 08:32 AM #8
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 07-07-2008, 08:32 AM #9
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
- 07-07-2008, 08:48 AM #10
Member
- Join Date
- Jul 2008
- Posts
- 18
- Rep Power
- 0
- 07-07-2008, 08:51 AM #11
Member
- Join Date
- Jul 2008
- Posts
- 18
- Rep Power
- 0
Sir i got some code from this forum.Code is here
It is working fine but i need to add more label on this Dialog.Java 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() ; }
- 07-07-2008, 08:53 AM #12
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
- 07-07-2008, 08:57 AM #13
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Think about some layout and add components there first.
- 07-07-2008, 09:00 AM #14
Member
- Join Date
- Jul 2008
- Posts
- 18
- Rep Power
- 0
- 07-07-2008, 09:03 AM #15
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Go through this entire tutorial, thoroughly, as you seem to have no idea how to use Swing.
Trail: Graphical User Interfaces (The Java™ Tutorials)
- 07-07-2008, 09:03 AM #16
Member
- Join Date
- Jul 2008
- Posts
- 18
- Rep Power
- 0
- 07-07-2008, 09:07 AM #17
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
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, 09:07 AM #18
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 07-07-2008, 09:45 AM #19
Member
- Join Date
- Jul 2008
- Posts
- 18
- Rep Power
- 0
- 07-07-2008, 09:49 AM #20
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Similar Threads
-
Printing (no dialog)
By Java Tip in forum Java TipReplies: 0Last Post: 02-04-2008, 09:36 AM -
Example of SWT Dialog
By Java Tip in forum Java TipReplies: 0Last Post: 01-09-2008, 12:01 PM -
Yes/No confirm dialog box
By mandrake446 in forum Advanced JavaReplies: 2Last Post: 12-09-2007, 05:31 AM -
Dialog Box
By uncopywritable in forum New To JavaReplies: 2Last Post: 07-30-2007, 12:42 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks