aspose file tools *
The moose likes Swing / AWT / SWT and the fly likes Swing/JButton Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Swing/JButton" Watch "Swing/JButton" New topic
Author

Swing/JButton

Sonara
Greenhorn

Joined: Jul 05, 2001
Posts: 5
Hello sir,
Thanks for u'r reply i got for my previous doubt in JTabbedPane.
Now i have a doubt & i need a solution.
I am using JButton.The size for the button is small but i the String to be displayed on the button is large.
So i need the text to displyed as for example:
the
title is
How should i write the constructor:
JButton jb1=new JButton("the title is");
i need the text to be displayed only as said above in two lines.
How should i specify in the constructor.
I am working in JBuilder.
It doesn't support the constructors like
JLabel jl=new JLabel("the
title is"); as it is supported by others(forte).
If jbuilder supports i must have applied this label to button
& my pbm must have solved.
so pl.. help me as soon as possible.
with regards,
Sonara.

Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
"Sonara",
Re-requesting your cooperation.
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks
ps: Please note that you were already informed about this in your other post by Frank.

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Sonara,
Try this:
JButton jB = new JButton( "< HTML >Middle
button< / HTML >" );
Regards,
Manfred.
Manfred:
I edited the HTML tags and added spaces so that they show-up properly.
regds.
- satya

[This message has been edited by Madhav Lakkapragada (edited July 06, 2001).]
Sonara
Greenhorn

Joined: Jul 05, 2001
Posts: 5
hello Sir ,
I am really happy with the replies with what i get.
It works perfectly for me.Thanks a lot.
One More problem, i have panel1.
Panel1-North has Panel2(panel2 has 5 buttons).
Panel1-center has Panel3.
when each button is pressed i have add a panel(which is different for each 5 buttons say p1,p2,p3,p4,p5) ,but all to Panel3.
one common Panel-panel3 but when button pressed different panels to be added only to panel3.
when 1st button is pressed i add p1 to panel3.
when 2nd button is pressed i give jpanel3.removeAll() & then add p2 to panel3.
But removeAll doesn't work .
pl suggest me a solution.
excepting u'r reply today itself.Pl... sir.
with regards
Sonara.
San Su
Ranch Hand

Joined: Jul 06, 2001
Posts: 313

> jpanel3.removeAll() & then add p2 to panel3.
add the following code after you add the panel2 to panel3
jpanel3.removeAll(); |
jpanel3.add(p2); | Your code...
// add the following..
((JComponent)jpanel3.getParent()).revalidate();
jpanel3.revalidate();
jpanel3.repaint();

This should solve your problem. I didnt test it. If it
doesnt work, please let me know..
 
wood burning stoves
 
subject: Swing/JButton