|
|
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-01-2008, 11:00 AM
|
 |
Senior Member
|
|
Join Date: May 2008
Posts: 299
|
|
|
Ya send it....
I will have a look and chk if i can solve it.
__________________
To finish sooner, take your own time....
Nivedithaaaa
|
|

07-01-2008, 11:03 AM
|
|
Senior Member
|
|
Join Date: Mar 2008
Posts: 447
|
|
Originally Posted by Niveditha
Ya send it....
I will have a look and chk if i can solve it.
Hi
public class AboutDlg extends Dialog
{
private Button button;
private Label label1;
private Label label2;
private Label label3;
private Label label4;
private Label label5;
public AboutDlg(Frame parent)
{
super(parent,"About", false);
setLayout(new BorderLayout(15,15));
setResizable(false);
Font f;
label1 = new Label("",Label.CENTER);
label2 = new Label("",Label.CENTER);
label3 = new Label("",Label.CENTER);
label4 = new Label("",Label.CENTER);
label5 = new Label("",Label.CENTER);
Panel lab = new Panel();
lab.setLayout(new GridLayout(5,3));
lab.add(label1);
lab.add(label2);
add("Center", lab);
button = new Button(" OK ");
Panel p = new Panel();
p.setLayout(new FlowLayout(FlowLayout.CENTER,15, 15));
p.add(button);
add("South", p);
f = new Font("Terminal", Font.BOLD, 15);
label1.setFont(f);
f = new Font("Terminal", Font.PLAIN, 13);
label2.setText(" ");
pack();
Point fatherLocation = parent.location();
move(fatherLocation.x + 150,fatherLocation.y + 200);
show();
}
public boolean action (Event evt, Object arg)
{
if (evt.target instanceof Button)
{
hide();
dispose();
return true;
}
return false;
}
public boolean handleEvent (Event event)
{
switch (event.id) {
case Event.WINDOW_DESTROY:
dispose();
return true;
default:
return super.handleEvent(event);
}
}
}
I want to show picture on leftside corner and some text desplay on right side.
Plz help me
|
|

07-01-2008, 11:31 AM
|
 |
Senior Member
|
|
Join Date: May 2008
Posts: 299
|
|
|
Hello Mir,
Check the code i gave u previously that works with Jdialog too only 2 changes u have make is
1. To extend JDialog instead of Jframe.
2. There is a for loop which will add background image multiple times, you need to change it to ur requirement.
__________________
To finish sooner, take your own time....
Nivedithaaaa
|
|

07-01-2008, 11:49 AM
|
|
Senior Member
|
|
Join Date: Mar 2008
Posts: 447
|
|
Originally Posted by Niveditha
Hello Mir,
Check the code i gave u previously that works with Jdialog too only 2 changes u have make is
1. To extend JDialog instead of Jframe.
2. There is a for loop which will add background image multiple times, you need to change it to ur requirement.
ok i got the picture and label but it is always showing in center.I try to set it in left side it is not possibel for me.
I need to display Picture on left side corner and lebal right side.
Plz help me
|
|

07-01-2008, 11:57 AM
|
 |
Senior Member
|
|
Join Date: May 2008
Posts: 299
|
|
There is something like
getContentPane().add( new JLabel( "It is a Label" , new ImageIcon( "D:/Personal/Shilu/teddy.bmp" ) , JLabel.CENTER ) ) ;
In that line change JLabel.CENTER to JLabel.RIGHT and the image u have to change the values in drawBackground method to position ur image exactly where u want. Thats a bit trial and error
All the best... 
__________________
To finish sooner, take your own time....
Nivedithaaaa
|
|

07-01-2008, 12:04 PM
|
|
Senior Member
|
|
Join Date: Mar 2008
Posts: 447
|
|
Originally Posted by Niveditha
There is something like
getContentPane().add( new JLabel( "It is a Label" , new ImageIcon( "D:/Personal/Shilu/teddy.bmp" ) , JLabel.CENTER ) ) ;
In that line change JLabel.CENTER to JLabel.RIGHT and the image u have to change the values in drawBackground method to position ur image exactly where u want. Thats a bit trial and error
All the best... 
Thxs for help
i set the label center to right.But when i want to add more label then it is showing with same. And second thing I havn't abel to set the img position in code which is given by you.
So plz help me
|
|

07-01-2008, 12:57 PM
|
 |
Senior Member
|
|
Join Date: May 2008
Posts: 299
|
|
Use
g.drawImage( img ,0 ,ih , this ) ;
instead of
for( int i = 0 ; i < w ; i+=iw ) {
for( int j = 0 ; j < h ; j+= ih ) {
g.drawImage( img , i , j , this ) ;
}
// }
It was just a bit of trial and error u could have urself tried rite?
__________________
To finish sooner, take your own time....
Nivedithaaaa
|
|

07-01-2008, 01:00 PM
|
 |
Senior Member
|
|
Join Date: May 2008
Posts: 299
|
|
|
And for label thing what u can do is add all the labels into panel and then add that panel with image into JDialog.
__________________
To finish sooner, take your own time....
Nivedithaaaa
|
|

07-01-2008, 01:28 PM
|
|
Senior Member
|
|
Join Date: Mar 2008
Posts: 447
|
|
Originally Posted by Niveditha
And for label thing what u can do is add all the labels into panel and then add that panel with image into JDialog.
Thxs for help
ok i am try to do..
If i am not getting then i will told you..
|
|

07-01-2008, 04:01 PM
|
|
Senior Member
|
|
Join Date: Mar 2008
Posts: 447
|
|
Originally Posted by Niveditha
And for label thing what u can do is add all the labels into panel and then add that panel with image into JDialog.
Thxs for help
i got it...
One more thing how can i set Hyperlink of url on label.
Plz help me
|
|

07-02-2008, 09:16 AM
|
|
Senior Member
|
|
Join Date: Mar 2008
Posts: 447
|
|
Originally Posted by Niveditha
And for label thing what u can do is add all the labels into panel and then add that panel with image into JDialog.
Thsx for help
how to 3-d picture..
|
|

07-02-2008, 10:12 AM
|
 |
Senior Member
|
|
Join Date: May 2008
Posts: 299
|
|
One more thing how can i set Hyperlink of url on label.
What u can do is underline the text and add a mouseListener
__________________
To finish sooner, take your own time....
Nivedithaaaa
|
|

07-02-2008, 11:31 AM
|
|
Senior Member
|
|
Join Date: Mar 2008
Posts: 447
|
|
Originally Posted by Niveditha
What u can do is underline the text and add a mouseListener
Sir i am setting icon on frame titale bar through this code
mainFrame.setIconImage(Toolkit.getDefaultToolkit().getImage("abc.ico"));
then it is showing icon
but when i use abc.gif or abc.png then it is showing .Show can i use .ico
plz help me
|
|

07-02-2008, 01:18 PM
|
|
Senior Member
|
|
Join Date: Mar 2008
Posts: 447
|
|
Originally Posted by Niveditha
What u can do is underline the text and add a mouseListener
Plz help me
|
|

07-02-2008, 01:27 PM
|
 |
Senior Member
|
|
Join Date: May 2008
Posts: 299
|
|
|
Its simple Mir,its because you have "abc.ico" in that place and u dont have "abc.gif" or "abc.png" in that place/directory.
Store any image with name "abc.jpg" and then try running it,it ll run perfectly.
__________________
To finish sooner, take your own time....
Nivedithaaaa
|
|

07-02-2008, 01:39 PM
|
|
Senior Member
|
|
Join Date: Mar 2008
Posts: 447
|
|
Originally Posted by Niveditha
Its simple Mir,its because you have "abc.ico" in that place and u dont have "abc.gif" or "abc.png" in that place/directory.
Store any image with name "abc.jpg" and then try running it,it ll run perfectly.
ok but i want to set it as a icon.or .jpg picture is not showing good on icon.
show i want to add .ico picture.
Plz help me
|
|

07-02-2008, 01:47 PM
|
|
Senior Member
|
|
Join Date: Mar 2008
Posts: 447
|
|
Originally Posted by Niveditha
Its simple Mir,its because you have "abc.ico" in that place and u dont have "abc.gif" or "abc.png" in that place/directory.
Store any image with name "abc.jpg" and then try running it,it ll run perfectly.
How to set font of JLabel.Becouse i want to show like a normal font right now it is showing like a bold.Plz don,t say setfont() becouse i try to do with tish.And i am not getting ans. Plz help me
|
|

07-02-2008, 02:15 PM
|
|
Senior Member
|
|
Join Date: Mar 2008
Posts: 447
|
|
|
I got the solution of set font. Plz don't work on that..
Plz hep me for .ico
|
|
| 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
|
|
|
|
|