How to set specific height in JLabel but vary in width ...
Hi,
I want to set the height of JLabel to fix height but vary the width according to the content of the label...
How does I do that ??
JLabel lbl = new JLabel("Hello this is aman");
lbl.setPreferredSize(100,30);
If the the text is changed, the width will be truncated at 100 pixels... how do I change
that to height 30, but width change according to text ?
thank
Hi..
may be this works for you ---
since u want to adjust the width with the text size.. means that you will be taking an input from the user and then set it on the label.. so before setting the text on the label & width of label .. get the length of the text and set this length as the width parameter to method setPrefferedSize()..
ex:
// get the text from textbox
String userinp = textbox.getext();
JLabel lbl = new JLabel();
lbl.setPreferredSize(userinp.length,30);
lbl.setText(userinp);
Similar Messages
-
How to set row height for each row
Hi
i am trying to set rowheight of row in a JTable using setRowHeight(row,rowheight)
it is not affecting on Table.but if i use setRowheight(rowheight) it applying
entire table ,please help me to solve this problem
after setRowHeight(row,rowheight), i am calling firechanged() method also ,i t will not affecting please hemp me
how to set row height at runtime in a JTableOk fine... do one thing... post ur code here let me check and tell u....
Ciya..... -
How to set a JButton,JTextfield, JLabel in a given location
Hi am designing a login screen and i dont know how to set my JLabels and JButtons on the screen. Can some one pls help
Thanx
Edited by: nadeesha on Oct 2, 2007 2:21 AMnadeesha
If you want to really learn, go to the javaTutorial.
http://java.sun.com/docs/books/tutorial/uiswing/TOC.html
If you don't want to learn but finish quick, here is :
For login, you need JDialog, JLabel, JTextField, JButton,
given location? --> You must know layout. --> if you want to learn go to the link above; learn The best is GridBagLayout.
if you don't want to learn but finish quick, here is :
// x, y, width, height ==> you must put int value
class MyDialog extends JDialog {
this.setLayout(null);
JLabel myLabel = new JLabel("Login");
myLabel.setBounds(x, y, width, height);
myLabel.setBorder(new EtchedBorder()); ---> to see the actual bound of the component.
JLabel myLabel2 = new JLabel("Password");
myLabel2 .setBounds(x, y, width, height);
myLabel2 .setBorder(new EtchedBorder()); ---> to see the actual bound of the component.
JTextField myLoginTextField1 = new JTextField();
myLoginTextField1.setBounds(x, y, width, height);
JTextField myPasswordTextField2 = new JTextField();
myPasswordTextField2 .setBounds(x, y, width, height);
JButton myOKButton = new JButton("OK");
myOKButton.setBounds(x, y, width, height);
JButton myCancelButton = new JButton("Cancel");
myCancelButton.setBounds(x, y, width, height);
{code}____________________________________________________
This will do. Etched border will help you to have proper size. of width and height.
Play around, you will find fun - -
How to set the height of a textarea dynamically
Hi,
I have been trying to set the ui.textarea's height dynamically and I am not able to do it. This is what I am doing.
<ui:textArea binding="#{assignment$EditResult.textArea2}" id="textArea2" style="height: 90%" text="#{currentRow.value['comments']}"/>
The height is being ignored and it is set to the default size. How can I set the height of this component to fit to the size of its cell, which is dynamic?
Thanks for your help.Thank you for your help! It worked for something like this:
getTextArea2().setStyle("color : red");
but this does not work still.
getTextArea2().setStyle("height: 90%");
I think it still does not know the size of the cell at this point yet. But this is a good tip, thanks anyway!
~Kazzie -
How to set Panel height to browser height?
I have a panel in a module in an application (App > Module > Panel). I would like the panel to take up the full height of the browser window. How can I achieve this? Trying to set height="100%" doesn't work, and makes the panel disappear. Setting the layout to absolute also doesn't work when setting top and bottom margins to 20.
Any ideas welcome.
Thanks!
MikeThere is something odd going on. I did what you suggested, but then the module doesn't display. However, when I remove the percentage-based height tags everything shows up.
It seems that the Panel object is sensitive to height being percentage-based. As soon as I set its height to "500" instead of "100%" it displays. -
As SAPUI5 prefer XML views, I'm rewriting JS view into XML views.
When I translate the statements below, I can not set sap.ui.core.CSSSize array for property "widths" of Control MatrixLayout.
JS version:
var oLayout = new sap.ui.commons.layout.MatrixLayout({
id : 'matrix3'
columns : 3,
width : '600px',
widths : ['100px', '200px', '300px']
XML version:
<l:MatrixLayout
id="matrix3"
columns="3"
width="600px"
widths="['100px', '200px', '300px']">
<l:MatrixLayout>
The error says: Uncaught Error: "[100px, 200px, 300px]" is of type object, expected sap.ui.core.CSSSize[] for property "widths" of Element sap.ui.commons.layout.MatrixLayout.
Same problem with property `backgroundDesign` of MatrixLayoutCell, I can only use a workaround to use String "Fill1" not the Class "sap.ui.commons.layout.BackgroundDesign.Fill1".
When we meet a property which need a Class object as value, we can not set it in String Format for XML views. That's a pity or I did not find the right way to set NON-String values as property for XML Controls.Hi,
any settings that are not possible in the XML, need to be set in the controller instead.
Using the string value of an enum is fine, though.
Regards
Andreas -
Flex 4: How 2 Set Application Height/Width with Script?
I am new to Flex 4 and going through the 3 to 4 migration pain.
I need to set the size of my application programmatically. In Flex 3, I did it this way:
mx.core.Application.application.width = theWidth; (equivalent for height).
I can not figure out how to do this with Flex 4. Searched high and low.
Help, please! TIA
BruceYou can use this.height and this.width properties.
-
How to set cell Height in a GridControl?
How can I change the Height of a cell in a GridControl?
And how can I change the margins of a cell?
I tried using CustomPaintSite.setItemMargins(), it works
only for left, right margin, but never affects top & bottom,
I found GridControl is very annoying.
Shaomei
nullFirst of all: do not use table (like the MS Word table). Create a tale "look and feel" using subforms: one for row and one for the table. Then accessing the row and its value is not a problem and has been explained many times here or in the manuals. The same way you will manipulate the font properties of the cells.
Otto -
How to set row height of the row in the interactive report?
Some of the values in the columns of my interactive report are wrapped up changing the height of the row to 2 or 3 characters.
Is there any way to change it? I would like to have all rows set to 2 characters height.
RobertAdd the following style sheet to the page HTML Header.
<style>
table.apexir_WORKSHEET_DATA td {
height: 2.8em;
</style> -
How to set specific blur levels
I'm using Photoshop 7.0 and want to be able to apply specific blur levels to images. I can do so using Gaussian blur but this doesnt give the effect I want.
Firstly, can someone explain exactly what Gaussian blur is?
Secondly, is there any way I can adjust the regular blur level (i.e. not gaussian) to specific amounts (e.g. as a percentage blur)?
Thanks.Cat,
This is the Photoshop 'Elements' forum. There is a separate forum for the bigger main product that is Photoshop. You may therefore wish to consider posting your query in that forum not least because Photoshop proper offers far more control over some of the features than Elements.
A quick search of Wikipedia offers the following explanation of Gaussian Blur:
"Gaussian blur is a widely used effect in graphics software such as Adobe Photoshop, GIMP, Inkscape, and Paint.NET. It is typically used to reduce image noise and reduce detail levels. The visual effect of this blurring technique is a smooth blur resembling that of viewing the image through a translucent screen, distinctly different from the bokeh effect produced by an out-of-focus lens or the shadow of an object under usual illumination. Gaussian smoothing is also used as a pre-processing stage in computer vision algorithms in order to enhance image structures at different scalessee scale-space representation and scale-space implementation.
Mathematically speaking, applying a Gaussian blur to an image is the same as convolving the image with a Gaussian or normal distribution. (In contrast, convolving by a circle (i.e., a circular box blur) would more-accurately reproduce the bokeh effect.) Since the Fourier transform of a Gaussian is another Gaussian, applying a Gaussian blur has the effect of low pass filtering the image."
Good luck
Mark -
How to set minimum height size for an empty XML Form iview
Hi,
I'm trying to configure the minimum height size of an XML Form iview without sucess. Even when there is no content to show, iview height size is around 80 pixels. When there is content the automatic configuration works fine and the iview is resized properly.
The iview has automatic size and the minimum size for automatic is with 5 pixels...
Any ideas?
Thanks,
MarceloHi,
I'm trying to configure the minimum height size of an XML Form iview without sucess. Even when there is no content to show, iview height size is around 80 pixels. When there is content the automatic configuration works fine and the iview is resized properly.
The iview has automatic size and the minimum size for automatic is with 5 pixels...
Any ideas?
Thanks,
Marcelo -
How to set screen height / dead line of pixels - cant read
Hi there,
I recently installed arch on my notebook, the issue now is that it has a line of dead pixels at the bottom, which makes it impossible to read my input or the console output. It would be sufficient if I could change it for the Xserver or in my window manager. I tried to find something in the xmonad wiki but no solution there. Any suggestions?
I'm using Xorg with xmonad and xmobar.
Thanks in advance and a happy new year!You have to put 'nomodeset' on the kernel line, ie
title archlinux
root (hd0,X)
kernel /vmlinuz26 ro root=/dev/sdaY ro vga=771 nomodeset
initrd /kernel26.img -
How to set specific value of attached file in CRM 2013
Hi,
I have a requirement when I attach a file in notes it should has some value in currency. how to assign value for each attachment file?Hello,
That's not possible.
In case you want to implement it I would suggest to create additional entity, store value in currency inside, add reference to your initial record and store that data in this way.
Dynamics CRM MVP/ Technical Evangelist at
SlickData LLC
My blog -
How to set specific URL for broadcasting web templates from WAD
Hi experts,
I have created a sample web template in WAD by using SAP BI standerd query.When I am executing the web template,it is redirecting me to some unintended web portal.I know the correct portal URL.Can anybody tell me where the redirecting portal URL settings are maintained in BI/BEx/WAD??
Regards,
Mandar.Hi Suman,
Thanks a lot for your valuable reply.
By the navigation you mentioned,I was able to identify where exactly I have to change the URL prefix.However,when I am saving the changes I made to URL prefix,system is redirecting me to "Varient Attributes" screen.I don't know what exactly this screen is about.Please help..
Regards,
Mandar. -
How do i increase height of mc and keep its width?
i have a mc which seize is height = 150 and width = 2 (like a line).
i have a script which rotate this line and increases its length. this works, however i dont know how to keep the width so that it wil remain 2.
this is the scrip in as3 :
function rotateMoveClip_u(e:Event)
var target=(center.x);
e.target.rotation=((-target+45)/4)*1.25;
mc.height = Math.sqrt((target-75)*(target-75) + 150*150);
mc.width=2
//this line is is wrong
maybe using "height" and "width" is wrong?
thank youEven though you rotate your line (to say, horizontal), you still need to adjust the height (because it's original orientation was a vertical line). So when you rotate the line so it's horizontal you do not update width, you still update height. Just leave width alone.
Same goes if your line was originally horizontal and you wanted it to be vertical. If the original width was 150 and height was 2 (horizontal line) and you rotate it 90 degrees to be a vertical line, you would not adjust height to make it a longer vertical line. You'd adjust width.
Maybe you are looking for
-
Iphone cannont be used required sofware not installed
I finally got ITunes reinstalled on Windows XP after many laborous hours. Now when I plug in my Iphone 5 I of course get a new message. THIS IPHONE CANNOT BE USED BECAUSE THE REQUIRED SOFTWARE IS NOT INSTALLED. RUN THE ITUNES INSATLLER TO REMOVE I
-
SAP Adobe Print forms - Issue with Chinese characters
Hi All, We are using SAP Adobe Print forms to create a business document. This is designed using Adobe Life Cycle Designer (ALD). The form is displayed in Chinese language. The requirement is to display captions for few fields in bold. When designing
-
It has also gotten rid of the "personal hotspot" option. How do I get that back?
-
EJB3: When do Entities get detached in practice?
Hi, I am currently improving my first EJB3 / JSF prototype in order to get a good feeling for that new technology. I am using Sun Appserver 9, NetBeans 5.5. I have the followiong design-setup: JSF-BackingBean ===uses===> @Remote Stateless Session Bea
-
Enable User Defined toolbar button on click - editable alv grid using oops
Hi all, I have created editable alv using oops concept. created 2 user defined toolbar button save and print using method toolbar ls_toolbar-text = 'Print'. "#EC NOTEXT ls_toolbar-quickinfo = space. ls_toolbar