Can I right-justify a JFrame's title?

My client wants to display a JFrame's title on the right instead of on the left because we display Hebrew. I think he's wrong, but the customer is alw...
In the worst case, I can prepend spaces to the title before calling setTitle.
In the next worst case, I'd have to find the JFrame's UI and render it myself (yuk).
Is there a cleaner way to right-justify a JFrame's title?
Thanks,
Matt

What look-and-feel are you running under? If that LAF supports custom decoration mode, it should paint the title right-aligned under RTL component orientation.

Similar Messages

  • How can the numbers in numbered lists be right-justified?

    In numbered lists, the numbers are by default left-justified. Is there a way to make the numbers in a given list right-justified, so the periods line up? Is there a way to change the default?

    As a writer, I also need to be able to have the numbers in a list line up in an acceptable word processing way, so that the decimal points line up when you get to 2 digits.
    8.
    9.
    10.
    I do not want it to look like this.  I have had to work around by numbering a long list with alphabet letters.
    On another occasion, I created my list using 2 columns in numbers, where the numbers automatically right justify.  Then pasted it into my pages document.
    I don't want to have to do that.  AND I don't want to have to deal with tabs.  I should be able to handle this in Preferences, or Inspector, where I handle most everything else.    If I can, I can't figure it out, and there doesn't seem to be a help in the manual or Help menu.
    Perhaps I'm out of date and it is now proper to not have the decimal point line up????  Don't think so.
    Message was edited by: suzannefrombrooksville

  • Left- and right-justifying with dot leaders in JLabel and JButton

    Hi,
    I am developing checklists using JLabel and JButton components and want to finish up with the text in each component looking something like the following (each line is a separate button/label):
    ACTION No1............................RESPONSE No1
    ACTION No2............................RESPONSE No2
    ACTION No3............................RESPONSE No3
    The idea is to have the �Action� text left-justified and the �Response� text right-justified with dot-leaders as shown.
    Each text line will be put into its own fixed length label or button.
    I plan to construct a string from text blocks �ACTION No1� and �RESPONSE No1� and add the calculated, exact no of dots in between to fill the space.
    The text font can be fixed (e.g. Courier) or proportional (e.g. Arial).
    My question is how to calculate the number of dots to add to fill the space for different fonts and font sizes.
    I think that using FontMetrics could provide some help but am not sure how this would work.
    Can anyone help.
    Many tks
    John

    Hi,
    I've developed your suggested code further to enable selected JLabels to be toggled visible(true/false) by pressing a JButton.
    I'd like however that when a label is made invisible that the rest of the labels/buttons move up to fill the space left by the now invisible label and vice versa.
    How do I do this, can you enlighten me on a solution?
    Modified code included below. Not very elegant but serves to illustrate the point in question and only makes the label invisible.
    Many tks
    John
    package componentwierd;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class ComponentWierd extends JFrame implements ComponentListener, ActionListener {
        boolean isVisible = true;
        JLabel label2 = new JLabel();
        public ComponentWierd() {
            getContentPane().setLayout( new GridLayout(0, 1) );
            // Using my original suggestion
            JLabel label = new JLabel();
            label.setLayout(new BorderLayout());
            label.add(createWierdComponent());
            getContentPane().add(label);
            JButton button = new JButton();
            button.setLayout(new BorderLayout());
            button.add(createWierdComponent());
            button.addActionListener(this);
            getContentPane().add(button);
            // Using Font Metrics
            // JLabel label2 = new JLabel("Label2 West...Label2 East");
            label2.setText("Label2 West...Label2 East");
            label2.addComponentListener( this );
            getContentPane().add(label2);
            JButton button2 = new JButton("Button2 West...Button2 East");
            System.out.println(button2.getIconTextGap());
            button2.addComponentListener( this );
            button2.setVisible(true);
            getContentPane().add(button2);
        public void actionPerformed(ActionEvent e) {
            if (isVisible == true) {
                isVisible = false;
                label2.setVisible(false);
            } else if (isVisible == false) {
                isVisible = true;
                label2.setVisible(true);
        private JComponent createWierdComponent() {
            JPanel panel = new JPanel(new BorderLayout());
            panel.setOpaque( false );
            panel.add(new JLabel("Label WEST"), BorderLayout.WEST);
            panel.add(new JLabel("..............................................."));
            panel.add(new JLabel("Label EAST"), BorderLayout.EAST);
            return panel;
        public void componentResized(ComponentEvent e) {
            if (e.getComponent() instanceof JLabel) {
                JLabel component = (JLabel)e.getComponent();
                String text = component.getText();
                String fitText = fitText(component, text);
                component.setText( fitText );
            if (e.getComponent() instanceof JButton) {
                JButton component = (JButton)e.getComponent();
                String text = component.getText();
                String fitText = fitText(component, text);
                component.setText( fitText );
        private String fitText(JComponent component, String text) {
            // Calculate the total width for painting the text
            // (Not sure why I need the -8)
            Insets insets = component.getInsets();
            int availableWidth = getWidth() - insets.left - insets.right - 8;
            // Calculate the minimum width our text will take
            String start = text.substring(0, text.indexOf("."));
            String middle = "...";
            String end = text.substring(text.lastIndexOf(".") + 1);
            FontMetrics fm = getFontMetrics( component.getFont() );
            int startWidth = fm.stringWidth( start );
            int middleWidth = fm.stringWidth( middle );
            int endWidth = fm.stringWidth( end );
            int minimumWidth = startWidth + middleWidth + endWidth;
            // Add dots to fill out the extra space
            StringBuffer buffer = new StringBuffer(start);
            buffer.append(middle);
            if (minimumWidth < availableWidth) {
                String dot = ".";
                int dotWidth = fm.stringWidth( dot );
                int dots = (availableWidth - minimumWidth) / dotWidth;
                for (int i = 0; i < dots; i++) {
                    buffer.append( dot );
            buffer.append(end);
            String result = buffer.toString();
            return result;
        public void componentHidden(ComponentEvent e) {}
        public void componentMoved(ComponentEvent e) {}
        public void componentShown(ComponentEvent e) {}
        public static void main(String[] args) {
            ComponentWierd frame = new ComponentWierd();
            frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
            frame.setSize(200, 200);
            frame.setLocationRelativeTo( null );
            frame.setVisible(true);
    }

  • Cursor Doesn't display in numeric right justified fields

    We have an aplication that we deployed at a client. Normally the cursor blinks in the field that has focus. However, at this particular client the cursor doesn't show on numeric fields that are right justified. The user can type in the values though. Please help.
    Alok

    Hello,
    Maybe you can increase the width of field.
    Regards,
    George
    We have an aplication that we deployed at a client. Normally the cursor blinks in the field that has focus. However, at this particular client the cursor doesn't show on numeric fields that are right justified. The user can type in the values though. Please help.
    Alok

  • Unicode String in JFrame's Title Bar / why is java a non-Unicode pgm in XP?

    My big question:
    Why is Java detected as a non-Unicode program by Windows XP?
    I need to do the following before I can write Japanese characters on the JFrame's title bar on Window XP:
    From the Control Panel -> Regional Settings and Languages -> Set the Language for non-Unicode Program to Japanese
    Thanks in advance,
    Noel

    Hi Noel,
    I'm only guessing here, but I suspect this is still the case...
    Under JDK1.3, the title bar produced by a JFrame is provided by the Windows OS, rather than Java itself. You'll find that trying to display foreign characters in a JFrame's title bar on an English Windows system nigh on impossible (you're left with everyone's favourite little rectangles instead). AFAIK, Sun were looking to change this in the future, but I've no idea if they've got there yet.
    Windows XP likely refers to Java as a non-Unicode program because it's looking at the main frame. Because the frame is produced by Windows itself (which last I checked was about as Unicode-compliant as my car is), it holds a different encoding to anything else within Java.
    At least that's my stab in the dark. ;-)
    Ta,
    Martin Hughes

  • How to Right Justify text on Ipod

    My ipod has been through some wear and tear, long story short, the screen is "cracked" so to speak down the middle and from the middle of the screen to the left side i cannot see anything. I'm trying to figure out how to right justify all of the text so that i can actually use my ipod and search songs

    You can't change the layout of any part of the iPod OS. Sorry. You might want to consider getting the screen replaced. There are lots of third party repair outfits that charge less than Apple to so the job.

  • Sort options right justified in list view

    New to Maverick's, but I can't get my finder window to "stick" with the layout of the "sort options". My biggest beef is that I have the "Name" sort far left followed by "Date modified", etc.. yet every day in every new finder window, the 2nd sort jumps to right justified. I want this sort option to stick to the left alongside name. I use large monitors and scrolling over everytime to drag the sort modifier to the left is frustrating. Is there a solution?

    My guess would be the Images folder (Pictures in English) is designed to have the special, contextual grouping types.
    I don't know why they couldn't make them available in the dropdown menu, also, but they're not.
    I did a little testing and found if I called it Pictures unsorted, the options were available, but if I called the folder unsorted Pictures, they weren't.
    Try naming the folder starting with Images
    Edit: If I select the dimension and resolution column headers in the folder, then change the name of the folder, the columns are retained.

  • Tab delimited and Right justified fields

    Hi
    My requirement is to produce an output file where the line items consists of 5 fields of variable lengths and all of them are tab delimited and right justified at the same time
    for eg.
    ABC       123456ghtje  4567.45678   67.45678  pqr
    where all the values in the first field 'ABC' and 2nd field '123456ghtje' are right justified and are tab delimited and asme is the case for '4567.45678' , '67.45678' and 'pqr'
    they are all separated from each other by a tab but are not fixed lengths
    How can i achieve that ? i am using File Receiver Adapter ??
    Can it be done without Adapter Module ?
    Thanks
    Dev
    Edited by: sd on Feb 22, 2010 2:25 PM
    Edited by: sd on Feb 22, 2010 2:26 PM

    > they are all separated from each other by a tab but are not fixed lengths
    When thay are not fixed length fields, why do you have to worry about left or right justification? In delimetted files, you would only have the delimitter between the fields. You do not need to fill spaces for justifying them.
    VJ

  • How to get search help results in RIGHT-JUSTIFIED column

    I am writing a search help with search help exit. Therefore, I use a table lets say tabA. I don't need all fields of tabA but need some further fields which I fill during exit.
    tabA does not have currency or number fields.
    I need a currency field and use a char20 field of tabA instead. filling of this field and showing results is o.k., but of-course it is shown left-justified.
    I did not find any fields of shlp-fielddescr which sounds like left/centered/right-alignment. Another try was to fill char20 field with leading '_' signs - that looked terrible and was not right-justified either, because of not fixed-size font.
    Let's resume: there is no number or currency field which I can use. The shown results appear in a column of not fixed-size font.
    Any other idea?

    Hi, I have the same problem. Did you get to resolve it? . Thanks

  • Images in smart build open right justified

    Has anyone else seen this.
    I've just opened an existing Keynote08 file in 09. And all my smart build push images have become right justified and off center. I can't find anyway of putting them back into the center. Can anyone help?

    Have a look here. Only workaround I have found is to re-do the build. Send feedback to Apple via the Keynote Menu.

  • How to align Hgrid column(messagestyledtext) header text to right justified

    Hi All,
    I have a Hgrid table and i am using five columns in hgrid table.. I need to display column header text right justified. but by default it is left justified.
    Can any one tell me how to do it..
    Its very urgent.. Please help me out..
    Regards,
    Babu

    Use
    OAHGridBean GeneralHgrid=(OAHGridBean)webBean.findChildRecursive("<hgrid item name>");
    GeneralHgrid.prepareForRendering(pageContext);
    DataObjectList tableColumnFormats =GeneralHgrid.getColumnFormats();
    DictionaryData tableColumnFormat = (oracle.cabo.ui.data.DictionaryData)tableColumnFormats.getItem(pageContext.findChildIndex(GeneralHgrid, "<item id of item attached in hgrid column>"));
    tableColumnFormat.put(COLUMN_DATA_FORMAT_KEY, <enter format>);
    see below:
    �� TEXT_FORMAT (textFormat)- column content is Start justified.
    �� NUMBER_FORMAT (numberFormat)- column content is Right justified.
    �� ICON_BUTTON_FORMAT (iconButtonFormat)- column content is center justified.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • DW Right-justifying the index for one site only

    Dreamweaver has suddenly started showing the directory for one of my sites as right-justified:
    Does anyone know how I can get this back to left-justified?
    Thanks
    Steve

    toonbone23 wrote:
    ...Adobe who know exactly what causes this. Don't they ever visit the forum?.
    Steve
    I'm not sure they do!
    This is a user forum.  I htink if you want an answer to your question, you might like to consder raising a support ticket.  I come here quite a bit, and I have never noticed anyone ever having the same thing happen to them.
    Martin

  • Wrting data right justified column

    Hi
    In my application I am using producer consumer loop architechture. In the consumer loop i am writn data from a queue to a file. I want to write data in a certain format to analyze in another program.   Now when i write dat to a file it writes left justified in six columns. I want it to write to file like the one i have attached. Can somebody tell me how?
    Attachments:
    data.PNG ‏53 KB

    Ideally, you would just use a tab as delimiter and change the justification in the other program as needed. For example in MS word you can define how the tabs are justified.
    If you want the data right justified in simple text displays (wordpad, notepad), you just need to ensure that the field width is sufficient for the widest data.
    Try e.g. a format specifier of "%#15_6f' (and make sure that you use a fixed width font for display!)
    Message Edited by altenbach on 10-08-2008 09:53 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    formatRight.png ‏15 KB

  • Right-justify number columns in BC4J

    I have several JSP pages that I am using BC4J tags in. I want to right justify all dollar columns. In addition, I want some columns to have a default width regardless of the data in them. For instance, even if a column has 'Test' in it, I want it to have a display width of 50.
    How can I accomplish these two things?
    Thanks,
    Brett

    Sounds like you might want to add properties to the attributes in your VO. If you set up some properties to hold values for alignment and width for each column, you can just interogate these values when you render the JSP and writre them into the HTML.
    Matt

  • Lpad .. correct use to right justify a char field?

    Hi all,
    I have a column that's a char type, and I'm trying to manipulate justification within it.
    SQL> create table test (test char(14));
    Table created.
    SQL> insert into test values (' 001234567890');
    1 row created.
    SQL> select * from test;
    TEST
    001234567890
    ..I have no probs making it left justified using ltrim
    SQL> update test set test=ltrim(test);
    1 row updated.
    SQL> select * from test;
    TEST
    001234567890
    ...but when I try to right justify using lpad I can't get it to work:
    SQL> update test set test=lpad(test,14,' ');
    1 row updated.
    SQL> select * from test;
    TEST
    001234567890
    ..this should pad the column with blanks to make the string 14 in length right?
    What am I doing wrong?
    Thanks !
    Adam

    Hi, Adam,
    A CHAR (14) column is always 14 characters long. If you insert a shorter string, it is automatically RPADded.
    If LENGTH (test) = 14, then
    lpad(test,14,' ')
    simply returns test. So your UPDATE statement is equivalent to
    update test set test= test;
    Every row will get UPDATEd, but nothing will get changed.
    To have the strings left-padded, use LPAD before INSERTing, or use UPDATE wtih LPAD and TRIM, like this:
    UPDATE  test
    SET     test = LPAD ( RTRIM (test)
                        , 14
                        );

Maybe you are looking for

  • Oracle 9i Installation on SuSE Linux 9.0

    I am trying to install Oracle 9iR2 on SuSE 9.0 All pre-Installation Setup was done like i saw on Suse web pages (create Oracle-User, oinstall-usergroup etc.) I login as root-user on the system and open a shell session (localy) as oracle user with ::

  • For server the Node Manager associated with machine is not reachable

    Hello all, I am getting this error, when i start my Managed Server which is in shutdown state For server SAA-Dev-1, the Node Manager associated with machine vm-bea-dev is not reachable. All of the servers selected are currently in a state which is in

  • Installation error when installing BO XI 3.0

    Hi Everyone, I am getting an error when trying to install BO integration Kit XI 3.0. The error is "Module C:\Program Filed\Business Objects\BusinessObjects Enterprise 12.0\win32_x86\CrystalExtension.dll". Any idea about this?? Crystal Objects Version

  • Photos dont sync in order...why?

    i have an iphone 3gs 32g... i did the software update in June 22 to iOS 4... now when i sync my cell my photos don't sync in order. all the albums are there, but all the pictures in the albums are in random order... is there something i can do to fix

  • HELP!! Application Component Export Failing!

    We're running 3.0.9 on Sun Solaris 5.8. There is an application component (Form On Table) that will not export. The oddest part is, while on a Windows platform (win2k, running IE 5.5, 6.0, NS4.5, 4.7 and 6), the form fails to completely display when