Seems like an easy question but?

I'm simply trying to right-justify text in a non-editable JTextField but I don't have the text available when i create the object. So i make it the maximum needed length, but when i call setText on it, and then setAlignmentX with the value JTextField.RIGHT_ALIGNMENT it seems to have no affect on the data. Is there a workaround or am i just missing something?

Nopeimport java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Test extends JFrame {
    JTextField jtf = new JTextField("Some Text",20);
    JCheckBox jcb = new JCheckBox("Right");
    public Test() {
     setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     Container content = getContentPane();
     content.setLayout(new FlowLayout());
     content.add(jtf);
     content.add(jcb);
     jcb.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent ae) {
          jtf.setHorizontalAlignment(jcb.isSelected()?JTextField.RIGHT:JTextField.LEFT);
     setSize(400,400);
     show();
    public static void main(String[] args) { new Test(); }
}

Similar Messages

  • I am trying to create mobile pages using the steps file new new document page from sample mobile starters jquery mobile (cdn).  When "page from sample" is selected, the subsequent options are not available.  This seems like a silly question, but how do I

    I am trying to create mobile pages using the steps file>new>new document>page from sample>mobile starters>jquery mobile (cdn).  When "page from sample" is selected, the subsequent options are not available.  This seems like a silly question, but how do I acquire these options?

    You can get the latest jQuery Mobile Themes directly from jQuery Mobile's web site.
    https://demos.jquerymobile.com/1.1.0/docs/api/themes.html
    Or roll your own with ThemeRoller
    http://themeroller.jquerymobile.com/
    Nancy O.

  • This may seem like a silly question but I need it answered plz

    This may seem like a silly question but I am pretty new to
    dreamweaver but I am learning it. The question I have is this. When
    your typing a paragraph and hit enter to make the next line of text
    it goes down 2 spaces. Sometimes I don't want those two spaces. I
    want no space between the two sentences. How do you put one
    sentence below another with no spaces? Thanks in advance. I seems
    to have figured out all the other basic stuff except for this one
    thing lol. Thanks for the help in advance.

    >>>This may seem like a silly question
    There are no silly questions, only stupid answers.
    Alan sorted you, don't be afraid of asking questions.
    Kind Regards
    Paul Dell
    Photography and Web
    www.dellimages.com
    Blog
    www.paul-dell.com
    "ancientone567" <[email protected]> wrote in
    message
    news:fq4is3$mln$[email protected]..
    > This may seem like a silly question but I am pretty new
    to dreamweaver but
    > I am
    > learning it. The question I have is this. When your
    typing a paragraph and
    > hit
    > enter to make the next line of text it goes down 2
    spaces. Sometimes I
    > don't
    > want those two spaces. I want no space between the two
    sentences. How do
    > you
    > put one sentence below another with no spaces? Thanks in
    advance. I seems
    > to
    > have figured out all the other basic stuff except for
    this one thing lol.
    > Thanks for the help in advance.
    >

  • HT4437 this may seem like a dumb question, but do you always have to have wifi on to play music using airplay through the tv

    This may seem like a dumb question, but once you have set up airplay from the ipad through the tv do you always need to have the internet on.

    It's not necessary to have an internet connection in order to AirPlay content to the Apple TV unless the content is protected. You will however need to keep your wifi network turned on.

  • This may seem like a dumb question, but

    How do I keep my hard drive from filling up with junk? I just purchased a new 13" MBA with 256 GB. My old MBP eventually got bogged down with so many duplicate files and applications and just plain junk. I was never sure what could be safely deleted.
    I guess my real question is how do I know what is safe to delete, which things are duplicates and can I delete a disk image after I install something? Also, how do I know if I've completely deleted an application that I no longer want (i.e. any hidden files or whatever). I want to keep my new MBA as clean as I can and not load up my hard drive space with anything unneccessary.
    Thanks!

    not a dumb question
    just be proactive about where everything is saved to and backup important things via external USB HD
    Clear out itunes often of duplicate unwanted things, keep a folder or two on your desktop or otherwise to keep most of your working files.
    If you drop an unwanted APP to the trash and delete same, its gone unless is a sys. modification application.
    Keep your pictures in a known file or two. Same goes for documents, music, and videos.
    frequently clear out your browswer of cookies, cache.
    Buy a APP on the APP STORE that locates all duplicate files.  It lets you choose to delete them or not.
    such as:
    http://macpaw.com/gemini
    there are many such apps.

  • Might seem like a silly question but why don't pages automatically load when I type the URL in?

    Sometimes they immediately open other times I have to hit enter for it to load. Why does this happen?

    That issue can be caused by an extension that isn't working properly.
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • I just purchased iPhone 5S and I am unable to record my custom greeting.  It seems like it is recording but when I play it cuts off after "hello"

    I just purchased iPhone 5S and I am unable to record my custom greeting.  It seems like it is recording but when I tried to play it back it just plays "hello" and that is it.

    Hacking an iPhone is against's Apple license agreement for the iPhone and is not supported by Apple directly or indirectly via these discussions not to mention removes the built-in security included with iOS and has likely bricked your iPhone now.
    Contact whoever you downloaded that hacking garbage from for help with this.

  • This may sound like a stupid question,,,but can i downlaod other programmes to my ipad, and use them like i would on a pc/net book ?

    this may sound like a stupid question,,,but can i downlaod other programmes to my ipad, and use them like i would on a pc/net book ?

    No.
    It is not a replacement for a computer.
    It mirrors the selected content of your computer.
    The only programs that can be loaded on an ipad are those found in the app store.

  • Easy questions, but still need help!

    The first question is how do I change a ring tone? I have been able to change the ring tone before, but sometimes the ring tone doesn't even play. Instead of a ring tone playing, I get the phone vibrating. Is there something I must disable for the ring tone to play? Also, is there a way to change text messages alert as well? I also get vibrate on that one.
    The 2nd question is about the camera. When I take a photo on the camera, the image comes out distorted. Not the real image, but the preview of it. It seems stretched out. I think that's actually how it's suppose to be, but is there a way to change that?
    3rd question: is there a way I can add an e-mail to the address book? To text images to my e-mail mostly. If so, would they charge me for that (am thinking if texting to your e-mail is considered using internet or something like that).

    1st question, go to "profiles" it should look like a speaker.  Select which one you want.  If you choose loud it will vibrate for a second and then ring.
    2nd question, my camera sucks so I have never even really used it.  As much as I love my phone, the camera is the worst.  Sorry, can't help you there.
    3rd question, click on the contact you want to add the additional email to, select menu, edit, then menu again, choose "add email address" and type it in.
    I hope this helps. 

  • Might sound like a newbie question but please help! (WRT610N)

    I purchased the WRT610N to replace my old WRT54G. I like the router overall, but I am running into glich after glich. I figured out most of them up to this point, but now I'm running out of ideas. Before the firmware upgrade release on 1-21-09 I was able to access my USB storage drive via hostname on my local network. For example any shares on my local network show up under my workgroup in windows Vista/XP (mixed enviornment). Now after the firmware update no matter what I do if I want to access my shares I have to type \\myroutersip\myshare. I have gotten so used to just going to my network places and and selecting WRT610N (which was the hostname) entering my predefined password,and accessing my share. How do I fix this? I thought about enabling/editing the hostfile, but I should not have to do that (at least I didn't before). If anyone knows how to accomplish this please reply. TIA  

    There is no such settings your router, which will disable your access to the Drive by the Host name.If you have any Firewall or Antivirus you can disable it and try accessing your Drive with the Host name.May be you can try one settings on your router, Login to your router setup page, click on the Storage Tab and Below you need to click on the Sub tab "Media Server" and Enable "UPnP Media Server" and click on Save Settings. I think this might solve your problem.

  • Can I get two questions answered? Seems like Veriozon answers question number 1 but evades answering question number 2.

    1. Can I buy a new 2014 Moto X at full price?
    2. Can I retain my unlimited data plan?
    This is all I want to do. Why do they make it so difficult.

    I am going to guess here that Best Buy can do it because they are Verizon Wireless premium partner.
    However I have read here and online that when Best Buy places a click in the "Retain unlimited data" radio button that sometimes it works and other times it doesn't.
    But even corporate stores are removing it from what I have read. They claim the code to retain unlimited is no longer available due to the unlimited plan no longer being offered.
    However 8 months ago when I bought my second iPhone it was able to retain it.
    Just a guess on my part.

  • EASY Question - But Hard for the Actioscript inept

    Ok,
    So this is my first attempt at making a web page...
    I am trying to simply make my little button display my movie
    labeled "Content", I don't think I am doing somthing right...
    Doh....
    I have diffrent movies (p1 & p2) for button rollover
    effects... and I have a seperate clip named content with labels for
    "start1" and "start2" that I want to display when I click the
    buttons
    Anywho if you would like to take a look see I would be very
    thankful:
    http://www.itamidesign.com/test.fla
    Thanks for your help...
    -Todd

    Something went wrong when I tried your link.
    Is your movie inside your flash program or is it an external
    movie?
    If you have named your button something like myBtn, then you
    can put in some actionscript to load an external movie such as:
    myBtn.onRelease = function():Void
    movieHolder.loadMovie("content");
    where movieHolder is the name of an empty movie clip that you
    place on the stage to hold external movies.
    Alternately, you can add the code to the button itself. In
    this case you don't need to give the button an instance name:
    on (release)
    movieHolder.loadMovie("content");
    If your movie is already part of your Flash program, instead
    of an external file, then you will need to go into the linkage
    properties of the movie and check: "Export for ActionScript". You
    do this by right clicking on the movie in the library. You must
    give the movie a name when you do this. You can still call it
    "Content". Next you use one of the formats listed above except
    change loadMovie to attachMovie. (Actually they might both still
    work, but I have been in the habit of using loadMovie for external
    content and attachMovie for internal content. Don't ask me why, I
    just try things and when they work, I tend to repeat that method of
    doing things.)
    For attachMovie, you will need to give your clip a level
    number. You can hard code in a number if you want any movie you
    attach to replace the prior movie or you can use:
    movieHolder.getNextHighestDepth() if you want your movie to be
    placed on top of anything else that you already have in the movie
    holder without replacing it.
    You can type loadMovie or attachMovie in the search bar of
    the built in help menu to see more examples. If you have further
    questions such as how to make the movie holder, be sure to ask a
    follow up question.

  • Hi.  This may seem like a stupid question.  It's about email on the ipad2

    The ipad was set up before I left the apple store, and since this is the first apple device I own, (okay, many years ago I had an applie IIe), I don't know how to move emails from my trash folder back to the inbox.  I know to click edit, select the email, and then select move, but I can't seem to bring up the trash folder.  When I tap on an icon, and tap trash, it's just moving more emails to trash.  What am I doing wrong?

    When you are using the mail app, tap on the name of your mail account on the left side. The heading at the top should say Mailboxes with two sub headings - InBoxes and Accounts. Tap on the name of the account under the Accounts sub heading. Then tap the trash folder to get to the emails that you have deleted.
    I think - from what you are saying - you see the two email messages on the left side - not the email addresses. If that is what you are seeing - tap on the name of the mail account in the top left corner (an icon the that looks like an arrow pointing to the left with your mail account name in it) to take you back to where your mailbox folders are listed. If you keep tapping the icons in the upper left corner, eventually you will be back to the main mail window that I described above.
    EDIT: My response was a bit poorly worded. I apologize. Chris has posted a helpful screenshot
    Message was edited by: Demo

  • Easy question but I cannot find the answer, HELP!

    This particular FLA files is a flash site that has about ten
    different pop-ups for several links (more testimonials, more
    services, more information, etc.). I've tried for the past ten days
    (about 3 hours per day) to find the exact location of the popups to
    go ahead and modify the text in them to suit what I need them to
    say but I have not been able to find them. The only pop-up that I
    have found is located on the left side of the work space, I tried
    toggling to practically every single option and frame, but whatever
    I modify changes every other pop-up and I need to work on the
    pop-ups individually. Anyone who can put me out of this misery,
    would be rewarded with not having to see my question on this forum
    again. I can email the FLA file, (about 400 kb) to anyone with a
    heart to help or is there a way to upload it here? Thank
    you!

    wow, this things a mess LOL!!!! well I found that the text is
    actually IN the fields on the Stage, or several levels deep in the
    many many movieclips and layers used to construct this. NONE of the
    'dynamic' textFields have instance names, big no no. there's no way
    that you can target them (well you could but ...) to assign text to
    them ... so the only thing to do is go to each field and enter your
    own text (which defeats the purpose of making them dynamic fields),
    you'll find that in most cases, the color of the text in the field
    has been set to an 'alpha' value of 0, which is why you cant see
    it. although I haven't gone through the whole doc, i see no code
    anywhere that is assigning any text( not to mention that you can't
    because the field are not named). If you bought this as a template,
    there should be documentation that came with it, instructing you on
    the methods to assign text to the various categories. if not ...
    you got taken, although it looks nice, it will be an incredible
    pain to go through and edit it to be what you want it to be, due to
    the nature of it's construction, and the fact that there seems to
    be absolutely no user interface what-so-ever. I would contact the
    company that made the product. And I could be missing something
    too, more that possible, lol!!
    good luck :)

  • HT1208 After updating my iphone 5C, the screen was black but had the itune logo in the center, a white arrow pointing to the logo, and what seemed like a white lock, but it had a long white line leading to the bottom of phone.  Phone is now frozen.  What

    After adding the latest update to my 5c iphone, the screen was black, with the itune logo in the center, a white arrow below it point to the logo, and below that, what seemed to be a white lock, but it had a long white line reaching the bottom of the screen.  I can't get the phone to start.  The white apple appears and then I get the same logo, arrow, etc.  What can I do to fix this?  Thanks for any assistance.

    i m also put passcode in my iphone...but i dont know that how i know that my passcode is crack by someone???and same as police is not interested to find out it..
    i want ma iphone backkk...........

Maybe you are looking for

  • Installer Package error?

    Is anyone getting an error with iTunes 7 and 8 regarding something unable to install? I keep getting a message on the installs that an installer package was unable to do so and rollbacks on that particular part.

  • Write iso to USB drive?

    Hello, Recently I have been wondering about booting from a USB stick, and was wondering if anyone here could help. Is there any program in OS X (either pre-installed or otherwise) that would allow for the writing of an iso file to a USB stick? I apol

  • Can Front Row be set to use VLC?

    I'd like to be able to play my .avi movies using front row, but it seems to default to using Quick Time, which doesn't play all of my movies. VLC works wonderfully, is there a way to make Front Row use VLC? Any help with this is appreciated, thanks.

  • Executing Method on pageload

    Hello, I'm looking for a solution to execute a method on a backing bean, when a view is loaded. Well I could workaround that with using a commandButton to link to the page and execute the method as an action handler, but that's not really an elegant

  • Test section not appearing

    Hi, I created a questionaire on OLM with multiple test sections. It displays all questions from all Test Sections when I preview it from Oracle Learning Management Administrator. However, when I play it from Employee Self Service, it does not display