Centering JSpinner text

I have a simple JSpinner that allows the user to select from a String array.
The selected string is always displayed at the leftmost edge of the spinner text area, which is OK, but it's too close to the left edge, with no padding between the left-most pixel of the character and the border of the text area. The selected string remains left-justified even if I make the spinner wider.
As a workaround, I've added a blank to the front of each string, but that makes non-display-related code have to be aware of the display problem.
Is there a simple way to center a String in the spinner text area or to add a few pixels to the left of the String for padding?
Suggestions would be appreciated.

OK, I'm clearly just not understanding something here.
I was pretty sure I needed to get to the JFormattedTextField or the JTextComponent somehow from the JSpinner, but that's the step I can't seem to figure out.
I create the spinner with the following:String[]theArray = {" North", " South", " West", " East"};
JSpinner theSpinner = new JSpinner(new SpinnerListModel(theArray)); but although the API documentation for the ListEditor says that it inherits the getTextField method from the class javax.swing.JSpinner.DefaultEditor, I get an error indicating that it's an invalid method every time I try to invoke the getTextField method.
I tried this:JComponent theTextField = theSpinner.getEditor().getTextField(); and get the dreaded "cannot resolve symbol" diagnostic from the compiler.
How do I get to the JFormattedTextField or JTextComponent given only a handle to the JSpinner?
Obviously I'm missing something here - can you steer me in the right direction?

Similar Messages

  • Simple centering of text on page?

    I am new at using Buzzword, and am trying to center individual lines on a page of a new document I am typing.  How do I do this?  I see that on this screen for the creation of a new discussion topic on the forum, a quick and easy icon to click onto that centers text, but nowhere on my Buzzword document screen do I see such a icon, or reference to a drop-down file to "center."

    Thank you Michelle, very helpful!   One more question:  how do you close the toolbar (paragraph or otherwise) once it has been opened?  I assume that it automatically closes if a function is selected, but if this is not the case, I cannot find the way to close what has been opened!
    Date: Wed, 10 Feb 2010 17:05:31 -0700
    From: [email protected]
    To: [email protected]
    Subject: Simple centering of text on page?
    Hi,
    Thanks for your post. The center text option is somewhat hidden - it's on the Paragraph toolbar (not the default Font toolbar). To select the Paragraph toolbar, choose the small orange paragraph symbol on the far right of the screen. It will open and slide over to the left, then you will see the text - alignment options.
    http://forums.adobe.com/servlet/JiveServlet/showImage/19820/center_text.jpg
    Hope this helps!
    Let me know if you have additional questions as you get used to Buzzword.
    Best,
    Michelle
    >

  • Centering Imported Text

    Hi,
    I am importing a few thousand lines of text  via variable/datasets from a csv on cs4.
    This text varies in length from a few lines long up to almost a dozen.
    The import is working fine, however is there any way of centering the text vertically with the text paragraph box upon import?
    I really dont want to have to go through every exported psd and manually reposition.
    Any Idea?
    Cheers
    P.Pop

    Add line-height: 36px; to your 'tracks' class css, as below:
    .tracks {
        font-family: "Goudy Old Style";
        color: #000;
        padding-left: 120px;
        margin-top: 60px;
    line-height: 36px;

  • Centering Label Text over front Panel Indicator

    How can I get the Text in the Label of a Front Panel LED Indicator Control in LabVIEW 2009 to be centered over the LED?
    How can I change the Font an Font Size of the Text of a Label?

    Hi,
    Label to be center at the object.
    There are many Ways like
    1) what the JackDunaway has explained  Text Settings Toolbar button.
    2) Other you can dynamically change the property of label.
    Like you can change programmically change label justification, size, color, and many property.
    Just right click on object.Go to creat property node. refer screen shot for more help.
    Thank you.
    CLAD
    Labiew programmer
    Attachments:
    Lebel property.png ‏133 KB
    Lebel property.png ‏133 KB
    Lebel property.png ‏133 KB

  • IPhone: Vertically centering UILabel text

    The UILabel permits horizontal centering of its text via the textAlignment property, but there seems to be no way to align the text vertically. I have 3 labels, the last holding from one line to several. It if only has a single line, the text is vertically centered giving a big gap from he previous text. That looks uncool. (and in the Mac world, cool is everything). Is there some secret magical way to get UILabel to vertically center is text as well, or do I need to abandon labels and just drop down to drawRect.

    Check out NSString(UIStringDrawing). It has the following method, which you can use to calculate the size of the text as it would be in the label. Then you can set the label height to the minimum necessary for the text, which will solve your vertically centering problem.
    sizeWithFont:minFontSize:actualFontSize:forWidth:lineBreakMode:

  • Centering Nodes/Text - Vertically & Horizontally

    Since JavaFX v1 was released overnight the ability to align text VERTICALLY and horizontally has been removed/changed.
    Horizontal alignment is more or less the same as there is Text.textAlignment
    Vertical alignment is now missing. In preview1 we could set and x/y for the Text and then we could also set vertical alignment on the Text: [SEE HERE|http://javafx.com/releases/preview1/docs/api/javafx.scene/javafx.scene.VerticalAlignment.html]. Just bind a translation to the middle x/y of the parent.
    Using v1 I would expect the to see "BLAH" in the middle of the scene:
    public class CenteredText extends Text {
            override var textAlignment = TextAlignment.CENTER;
            override var textOrigin = TextOrigin.TOP;  //???
            override var translateX = bind (boundsInParent.width - boundsInLocal.width) / 2 ;
            override var translateY = bind (boundsInParent.height - boundsInLocal.height) / 2 ;
    function run(){
        Stage {
            title: "BLAH"
            scene: Scene {
                width: 800
                height: 400
                content: [
                    CenteredText{
                        content: "BLAH"}
    }}Finally, this is not really a requirement of Text, all nodes should be able to align themselves in the middle of their parent.

    Hello dgrieve,
    You suggest using "parent" instead of "scene" for the general case, however, I cannot get this to work. I put the text in a Group as you mentioned, but I just get a StackOverflowError. This is using parent.boundsInLocal as well as parent.boundsInParent.
    Could you or anybody look at the following code to see what I did wrong? Thank you.
    import javafx.scene.text.Text;
    import javafx.scene.text.TextAlignment;
    import javafx.scene.text.TextOrigin;
    import javafx.scene.Scene;
    import javafx.stage.Stage;
    import javafx.scene.Group;
    public class CenteredText extends Text {
       override var textAlignment = TextAlignment.CENTER;
       override var textOrigin = TextOrigin.TOP;
    //   override var translateX = bind (scene.width - boundsInLocal.width) / 2 ;
    //   override var translateY = bind (scene.height - boundsInLocal.height) / 2 ;
       override var translateX = bind (parent.boundsInLocal.width - boundsInLocal.width) / 2 ;
       override var translateY = bind (parent.boundsInLocal.width - boundsInLocal.height) / 2 ;
    //   override var translateX = bind (parent.boundsInParent.width - boundsInLocal.width) / 2 ;
    //   override var translateY = bind (parent.boundsInParent.width - boundsInLocal.height) / 2 ;
        public function run(args : String []) : Object {
            Stage {
                title: "Vertical and Centered Text Node Example"
                scene: Scene {
                    width: 800
                    height: 400
                    content: [
                        Group {
                            content: [
                                CenteredText{
                                    content: "ONE\nTWO\nTHREE\nFOUR"
    }

  • Rotating and Centering Masked Text

    I'm in the process of creating a textual watermark for my photos in photoshop but have come across a big problem. I am using the horizontaly text mask tool but I cannot rotate nor center (both horizontally and vertically) my text before turning it into a layer. If I  rotate and center the text after putting it into a new layer it wont work since the text will move and leave the writing embossed onto the picture. Any help is kindly appreciated !

    Do not use Mask Text use a Text layer set its fill to 0 and give it a layer style.
    Crafting Actions Package UPDATED Aug 14, 2012 Changed AspectRatioSelection Plug-in script added Path support.
    Contains
    Action Actions Palette Tips.txt
    Action Creation Guidelines.txt
    Action Dealing with Image Size.txt
    Action Enhanced via Scripted Photoshop Functions.txt
    CraftedActions.atn Sample Action set includes an example Watermarking action
    Sample Actions.txt Photoshop CraftedActions set saved as a text file.
    12 Scripts for actions
    Example
    Download

  • Vertically Centering Dynamic Text

    I am trying to get the text I am loading into a dynamic text
    box vertically aligned. There are from 3 to 8 lines of text that
    load into the dynamic text box via an array. I haven't found
    anything to do this. Can I get a coordinate that tells me the
    height of the loaded in text? Thanks for any help...

    I have the answer to my own question....
    placeText = function(){
    //this first line just creates a variable with the button
    number pushed
    var currentButton = _parent._parent.buttNo;
    //oBox_txt is my dynamic text box
    oBox_txt.autoSize = "center";
    //this line populates the text box with text from an array
    using the predefined
    //variable "currentButton"
    oBox_txt.text = textual[currentButton];
    oBox_txt._y = ((100 - oBox_txt._height) / 2);
    This assumes that the box is at the _y coordinate 0, and that
    the box is 100 pixels high.

  • Centering the Text on an Accordion Header

    By default, the header text on an Accordion component is left
    justified. I would like to center it. Can anyone please give me
    some advice?
    Thank you.
    Dave

    I don't think the components let you alter this default
    behaviour in any easy way (at least none that I can think of). You
    can set the useHandCursor property at the accordian header level,
    but the component (being very helpful) resets it to false.
    You can do it with a bit of hackery, just continually setting
    it at the frame rate:
    If your accordian is called myAccordian then put this in a
    frame on the timeline where it exists (or add it to an existing
    onEnterFrame handler if you already have one) :
    this.onEnterFrame = function() {
    for (var b = 0; b<myAccordian.numChildren;b++) {
    myAccordian.getHeaderAt(b).useHandCursor = true;

  • Centering text & wrapping words on lines

    Hi all,
    I need to have a JLabel that centers the text in it, and allows for multiple lines, where if a line is too long, it wraps onto the next line.
    I started off with a JTextArea, setting "setLineWrap" and "setWrapStyleWord", and this works fine for long lines of text. But, I need to have the text centered as well. Is there any way of doing this? I know JTextPane can do it, but I can't see how to do it in JTextArea.
    any help much appreciated,
    Justin

    Use a JLabel, with HTML text content and set the preferred size of the label as well. This will do auto line wrap;
    ie. ew JLabel("<html><center>The long text</center></html>");ICE

  • Using Javascript & Actions to resize an image and add the filename as text

    Hello,
    I am currently working on a way to take an image, resize it and add exactly what is in it's file name (before extension) as a text layer. I have succeded in this BUT am having issues with file names that require more than one line of text.
    I need the text to align to the bottom of the image & the script or action must then resize the image so that the text does not overlap.
    Any ideas on how this can be done?
    At the moment I am using:
    -"Fit Image.jsx" to resize my image to a specific size (This was included in the Photoshop CS5 scripts)
    - A script to add the file name without extension and place the file name at a specific position.
    AdFileName.jsx
    if ( documents.length > 0 )
    var originalRulerUnits = preferences.rulerUnits;
    preferences.rulerUnits = Units.PIXELS;
    try
      var docRef = activeDocument;
      // Now create a text layer at the front
      var myLayerRef = docRef.artLayers.add();
      myLayerRef.kind = LayerKind.TEXT;
      myLayerRef.name = "Filename";
      var myTextRef = myLayerRef.textItem;
      // strip the extension off
      var fileNameNoExtension = docRef.name;
      fileNameNoExtension = fileNameNoExtension.split( "." );
      if ( fileNameNoExtension.length > 1 ) {
       fileNameNoExtension.length--;
      fileNameNoExtension = fileNameNoExtension.join(".");
      myTextRef.contents = fileNameNoExtension;
      // off set the text to be in the middle
      myTextRef.position = new Array( docRef.width / 2, docRef.height / 2 );
      myTextRef.size = 12;
            myTextRef.font="Arial-BoldMT"
            //set position of text
            myTextRef.justification = Justification.CENTER;
            myTextRef.kind = TextType.PARAGRAPHTEXT;
            myTextRef.width= docRef.width;
            myTextRef.height= docRef.height/ 2;
            myTextRef.position= [0, docRef.height * 0.88];
    catch( e )
      // An error occurred. Restore ruler units, then propagate the error back
      // to the user
      preferences.rulerUnits = originalRulerUnits;
      throw e;
    // Everything went Ok. Restore ruler units
    preferences.rulerUnits = originalRulerUnits;
    else
    alert( "You must have a document open to add the filename!" );
    Can the position be changed to allow more rows of text but keep it aligned with the bottom of the layer?
    How can I script in a way to make the image resize based on the amount of text lines?
    Any help would be greatly appreciated.

    You can add a text layer any where the only thing you need to worry about is the size of the font you use.  You can normally calculate a font size by saving the images resoltuion and then setting its resolution to 72 DPI calculate a font size basied of the images pixel width and the number of characters you want in a line. After adding the text layer you can restore the image to its original resolution and align the text layer by making a selection and alignint the text layer to the selection.  There are nine posibilites like the positions in the selection you can align to like a tick tack toe board. You need to use a script to add the text layer because your retrieving the filename.  The positioning of the text layer could be done easily in an action the would use the scriot to add a text layer the do a select all  the align the added text layer to the selection.
    About your script don't make text paragraph just add new line characters to make a multi line text layer So it can be positioned easily
    I do just that with my stampexif action.  The action uses my stampexif Photoshop java script to add a multi line text layer containing some formatted EXIF data then the action centers the text layer and add a layer style to it. Link http://www.mouseprints.net/old/dpr/StampExif.jsx Example

  • Center text horizontally and vertically on composition?

    Hello,
    I'm working on a short projects (15 minutes length). Every 30 seconds a title fade in/out against a blank (grey) composition. How do I go about easily centering the text (single word) on the composition both horizontally and vertically? I know I can horizontally center via the paragraphs pallet, but how do I center on the vertical at the same time?
    Right now I'm modifying the Anchor Point of the text so it's in the center (visually) of the text, and then set the Position to the center of the composition, but every time I increase the type size, I have to go through this all over again...and with different titles coming up every 30 seconds or so, a simple text size change turns into a lot of work.
    I can only image there's a better way to do this and would appreciate any advice for an AE newb!
    Thanks,
    Kristin.

    It is possible to do this via scripting, but it won't be "live", i.e. you would have to run a script to grab the dimensions of the text layer each time you want to update its vertical alignment.
    It is also possible to roughly align text vertically using expressions given three limitations:
    1) You'll have to be willing to consider the height of the text layer to only extend from the cap height of the first line to the baseline of the last line, meaning descenders and ascenders wouldn't be counted as part of the height of the text layer.
    2) You'll have to manually locate the center of the first line of text.
    3) You'll have to be happy with a consistent point size and line spacing throughout.
    Given those limitations, vertical alignment can be done as follows:
    Add a Position animator to your text layer. Delete the default range selector you won't need it. Next add the Line Spacing property to the newly-created animator (using its "Add" menu). In the Character panel, set your text layer's line spacing to 0 (it will really be set to .01, but the difference shouldn't be noticeable once we're done). In the Line Spacing animator, set the desired line spacing (unfortunately, "Auto" isn't an option).
    Now set your Text layer's anchor point such that it falls in the center of the text's cap height (the height of a capital letter with no ascender or descenders).
    Next, add the following expression to the Position property of the text animator (NOT the Position property of the text layer's Transform group):
    >STA = text.sourceText.split("\r");
    >value - [0, (STA.length-1)*propertyGroup(countUp = 2).property.lineSpacing[1]]/2
    The second line should be all one line, but the forum insists on wrapping it. Be aware that if you later decide to change the point size of the font, you'll need to temporarily disable the text animator and center up the anchor point again.
    You can also use this method to force the text layer to shift up to accommodate new lines by deleting the "/2" at the end of the second line of the expression.

  • Why is text disappearing from my webpage?

    When I insert text in my webpage, the first letter of the first word of each sentence is either incomplete or it not there at all. HOw do I solve this?

    You're right. I can now see the layout.
    I can avoid the problem by centering all text.
    But I am left with the soft grey lines which mark my page and the heavy grey lines which show the layout.
    How can I make them identical?

  • CSS: text align in a table

    Alright well all day at work today, my boss helped me with my
    website. I am an intern for an online business, and I do all the
    graphic design work there, and my boss manages the site in
    Dreamweaver. Well since I'm an intern, I asked him to help me out,
    and he taught me alot about CSS and tables, and how to build sites
    in Dreamweaver. I got almost my whole template done for my whole
    site today. Lots of work to do yet, but still, lots of progress...
    ***Ok my question:
    I have a style sheet for my site with a bunch of stuff in
    there already, but when I type text in a table, it automatically
    centers the text vertically in the table. What is the CSS "code" or
    whatever you call it, to tell it to position the text in that table
    at the top of the table as if it were a normal text document? This
    will help me out alot. Thanks guys. My site is already looking 10X
    better than before, when I sliced it up in Illustrator.
    -Jeff

    <td align="top">This will be at the top of the
    cell</td>
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "jmilin5931" <[email protected]> wrote in
    message
    news:e6nhlg$n3l$[email protected]..
    > Alright well all day at work today, my boss helped me
    with my website. I
    > am an
    > intern for an online business, and I do all the graphic
    design work there,
    > and
    > my boss manages the site in Dreamweaver. Well since I'm
    an intern, I asked
    > him
    > to help me out, and he taught me alot about CSS and
    tables, and how to
    > build
    > sites in Dreamweaver. I got almost my whole template
    done for my whole
    > site
    > today. Lots of work to do yet, but still, lots of
    progress...
    >
    > ***Ok my question:
    >
    > I have a style sheet for my site with a bunch of stuff
    in there already,
    > but
    > when I type text in a table, it automatically centers
    the text vertically
    > in
    > the table. What is the CSS "code" or whatever you call
    it, to tell it to
    > position the text in that table at the top of the table
    as if it were a
    > normal
    > text document? This will help me out alot. Thanks guys.
    My site is
    > already
    > looking 10X better than before, when I sliced it up in
    Illustrator.
    >
    > -Jeff
    >

  • When adding Custom Text to a slideshow in Aperture, I can no longer centre the text in the text box. Is there something I am missing? I am running Aperture 3.6 on Yosemite. Any ideas gratefully received, thanks.

    When adding Custom Text to a slideshow in Aperture, I can no longer centre the text in the text box. Is there something I am missing? I am running Aperture 3.6 on Yosemite. Any ideas gratefully received, thanks.

    Which theme are you using?
    When I am adding text in a slideshow, I found, that it will depend on the theme, if the text will be centered or flushed left.  The Classic and Ken Burns theme are centering the text, the newer themes will present it flushed left.
    I found no way to select a custom justification for the text.

Maybe you are looking for

  • What is difference between 10.5.6 COMBO Update and 10.5.6 Update ? Both say

    Both say +"The 10.5.6 Update is recommended for all users running Mac OS X Leopard and includes general operating system fixes that enhance the stability, compatibility and security of your Mac."+ *Mac OS X 10.5.6 Combo Update* (669 MB) http://suppor

  • Sharpness of photos

    When I transfer photos into IMovie from either Iphoto or as clips, they lose sharpness. Is there any way to avoid this and why does this happen?

  • Help! I'm losing my logged timecode!

    I am editing a documentary with 40 hours of DVCAM footage. I had batched 90% of the footage using a rented MacBook Pro down-converting to offlineRT Photo Jpeg with a rented Sony DSR-11. All was well. Then I moved to my G5 PowerPC and I captured the r

  • Trouble with OracleResultSet...pls help

    Hello all, I'm trying to insert a word file into Oracle 9i using Blobs. Thanks to somebody in this forum, i have been able to finally use the oracle.sql.BLOB class using Tomcat. Every code snippet i've seen uses the regular java.sql.ResultSet first t

  • Spry Accordion not collapsing properly in IE & Firefox

    My design portfolio is on my testing server. The accordion works perfect in Safari but it will not collapse in Firefox and Internet Explorer. Here is the link: http://deptart2.memphis.edu/~jwilcoxen/web_portfolio/home.php . Please help. I attached my