Cell Align problem

Hi guys,
Does anyone know why this wouldn't work:
         ((JLabel)this.objDataGrid.getColumn(1).getCellRenderer()).setHorizontalAlignment(SwingConstants.RIGHT);Basically When I add that line the program blocks without rasing any exception.
Thanks,
MeTitus

No no...
Because I was adding it to a contructor which in result is only created once since I am using a singleton....
But here it is how I solved it...
         class CellRenderer extends DefaultTableCellRenderer
               public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
                  if(column == 1)
                       super.setHorizontalAlignment(SwingConstants.RIGHT);
                  else if(column == 2 || column == 3 || column == 4)
                       super.setHorizontalAlignment(SwingConstants.CENTER);
                  else
                       super.setHorizontalAlignment(SwingConstants.LEFT);
                  return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
         }Thanks itchyscratchy for the reply though.
MeTitus

Similar Messages

  • Cell alignment problems

    hi, im currently working on a website with dreamweaver, its
    only the 2nd html site ive ever made.
    both sites have been photography portfolios, so involve
    thumbnailed galleries. i figured it would be easiest to use tables
    to create the pages, as the the images are different sizes (some
    landscape, some portrait etc). i used css for properties of cells.
    problem is, when i move from one page to another in the
    browser (seems to be every browser, but some are worse than
    others), the cells appear to move. some of them have borders so
    this is quite obvious.
    am i missing something glaringly obvious? i find it so
    frustrating, i have tried adjusted the cell widths through css and
    single cell properties but neither seem to make the slightest
    difference. it appears the content that is in each cell determines
    the width of it in the browser, how can i control this so i can
    maintain uniform alignment throughout the site?
    many thanks in advance for any advice whatsoever

    With a single table like that, you'll experience the size
    shifts. You
    may want to use a single nested table for the content.
    Outer table - 3 rows
    top row, colspan 2
    middle row, thin left cell for navbar, wide right cell to
    hold nested table
    bottom row, colspan 2
    Set explicit widths for the middle row cells.
    In the middle row right cell, place a nested table with the
    page content.
    Another option is to go "tableless" and just use CSS for the
    layout.
    (PS - I didn't even notice the buttons on the left for a
    while. I stared
    dumbly at the page wondering how to get to the next page. The
    buttons
    are so dim they are difficult to see against the black
    background.
    Depending on the angle of my LCD screen, sometimes they
    disappear entirely.)
    Alec
    Adobe Community Expert

  • Table cell align problem

    I am using checkbox in my table using tablecellrenderer.i am able to align the checkbox to left.but it's showing center position when u click & hold.how to do that?
    thanka in advance

    You would have to provide your own cell editor that is left-aligned, as well as the renderer.

  • Alignment problems in JSF datatable

    Hi,
    In my JSF data-table, i have few alignment problems.
    For Example, I have 4 columns, Emp-Id, First-Name,Last-name and Age.
    What happens is, sometimes, the value in the First-Name cell moves into the Last-Name cell, leadiing to alignment problems. But this is not happening always. Occasionlly this happens.
    I tried with iFrames and also by having fixed width for each cell, then also this problem is persisting.
    Is it something to do with the datatable display in JSF?
    Any suggestions/ideas on how to resolve this problem would be of immense help.
    Thanks

    Hi
    What happens if you delete the text and retype in and change alignment ?
    Does the same issue happens with all sub menu items ?
    Please provide the site url.
    Thanks,
    Sanjit

  • Alignment problem in converting smartform printpreview into PDF

    Hi all,
    I am getting some alignment problem in converting smartform printpreview into PDF format, i.e the format of PDF is different from printpreviw of smartform.
    kindly suggest something so that alignment is not changed while converting to PDF.
    Regards,
    Sumalatha

    use below f.m to convert it into 255 characters....
         CALL FUNCTION 'QCE1_CONVERT'
            TABLES
              t_source_tab         = i_tline
              t_target_tab         = so_ali[]
            EXCEPTIONS
              convert_not_possible = 1
              OTHERS               = 2.

  • J Table - Single Cell Alignment

    Hello everyone,
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.util.Random;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumnModel;
    public class RowColorTest
        private JTable table;
        public static void main(String[] args)
            new RowColorTest();
        public RowColorTest()
            javax.swing.SwingUtilities.invokeLater(new Runnable()
                public void run()
                    createGUI();
        public void createGUI()
            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            String[] columnNames = new String[4];
            columnNames[0] = "Name";
            columnNames[1] = "Age";
            columnNames[2] = "Value";
            columnNames[3] = "Extra";
            Object[][] data = new Object[20][4];
            Random r = new Random();
            for(int a=0; a < 4; a++)
                for(int i=0; i < 20; i++)
                    if(i == 0 || i == 5 || i == 10 || i == 15)
                        data[i][a] = 23;
                    else
                        data[i][a] = r.nextInt(50);
            DefaultTableModel model = new DefaultTableModel(data, columnNames);
            table = new JTable(model)
                public boolean isCellEditable(int rowIndex, int vColIndex)
                    return false;
                public Class getColumnClass(int column)
                    return getValueAt(0, column).getClass();
                public Component prepareRenderer(TableCellRenderer renderer, int row, int column)
                    Component c = super.prepareRenderer(renderer, row, column);
                    TableColumnModel tcm = table.getColumnModel();
                    Object result = getValueAt(row, tcm.getColumnIndex("Value"));
                    if(result instanceof Integer)
                        if(((Integer) result) == 23)
                            c.setBackground(new Color(0, 255, 153));
                            c.setForeground(Color.BLACK);
                            if(column == 0)
                                    // I would like to do a CELL ALIGNMENT for this particular condition.
                                    // setHorizontalAlignment() does not exist for the object c (Component).
                        else
                            c.setBackground(Color.WHITE);
                            c.setForeground(Color.BLACK);
                            if(column == 0)
                                    // I would like to do a CELL ALIGNMENT for this particular condition.
                                    // setHorizontalAlignment() does not exist for the object c (Component).
                    if(table.isRowSelected(row))
                        c.setBackground(Color.BLUE);
                        c.setForeground(Color.WHITE);
                    return c;
            JPanel panel = new JPanel();
            JScrollPane sp = new JScrollPane(table);
            panel.add(sp, BorderLayout.CENTER);
            frame.setContentPane(panel);
            frame.pack();
            frame.setVisible(true);
    }Sorry for bringing this up again, but I am having a hard time trying to "align" a single "cell". In the code that I have provided, I tried to find a method from the Component object for setHorizontalAlignment() hoping to make this call:
    c.setHorizontalAlignment(SwingConstants.RIGHT);
    However, it does not exist. How would I go about setting the alignment for an individual cell? I've searched the forum for "cell alignment" and found some information about using a DefaultTableCellRenderer, but I'm not sure how to merge that with the existing code that I currently have.
    In this thread: http://forums.sun.com/thread.jspa?forumID=57&threadID=659910 , camickr pointed out that I can use the row and column variables to find which cell to align, however once I've found the particular cell that I'd like to align, what do I do next? The component c does not have a method to set alignment in this scenario.
    Thanks again,
    Brianiak

    You - the programmer - know that the component in question will be a label of some kind. The compiler, however, does not. As far as javac is concerned, the component could be, say, a 3D animation, in which case setHorizontalAlignement would be illegal.
    In order to share our runtime knowledge with the compiler, we have to use some explicit casting:
    (JLabel)c.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);Note that this will lead to runtime errors if our component is not an instance of JLabel, so it's a good idea to surround the code with:
    if (c instanceof JLabel){
    }

  • ALV cell alignment

    Hi,
    I want to make cell alignment in ALV.
    I could able to do left and center alignment but not right alignment.
    How to do the right alignment??
    I'm using the below code:
    data lr_salv_column      type ref to cl_salv_wd_column.
    lr_salv_column->SET_H_ALIGN( value = 1 ). "0 - right/ 1- center
    Thankx,
    Suba

    Jatra Riwayanto wrote:>
    > Hi,
    >
    > .....
    > * set h.alignment
    >   LR_COL->SET_H_ALIGN( '06' ).
    >  
    >    
    >
    > Notes:
    > '06' = FORCED RIGHT
    > '05' = END OF LINE
    >
    > Regards,{quote}
    Just a word of warning.  You should avoid coding the values directly.  SAP can change these values at any time and we won't applogize if that breaks your application. :)  You should always use the class constants.  This also makes your coding much more readable and maintainable.  It also makes it easy to forward navigate and find all the possible values.  For this example the class constants are CL_WD_TABLE_COLUMN=>E_H_ALIGN
    Type defintion from CL_WD_TABLE_COLUMN:
    begin of e_h_align,
          auto type wdy_uie_library_enum_type value '00', " TableColumnHAlign.auto
          center type wdy_uie_library_enum_type value '01', " TableColumnHAlign.center
          forced_left type wdy_uie_library_enum_type value '04', " TableColumnHAlign.forcedLeft
          end_of_line type wdy_uie_library_enum_type value '05', " TableColumnHAlign.endOfLine
          forced_right type wdy_uie_library_enum_type value '06', " TableColumnHAlign.forcedRight
          begin_of_line type wdy_uie_library_enum_type value '07', " TableColumnHAlign.beginOfLine
        end of e_h_align .
    So your coding should be:
    LR_COL->SET_H_ALIGN( CL_WD_TABLE_COLUMN=>E_H_ALIGN-FORCED_RIGHT ).

  • Alignment problem on abap report after Unicode conversion

    Hi,
    I've recently convert my system to unicode. Now my user is complaining the aged debtor report (ABAP) is having a column alignment problem when displaying the Japanese character.
    I'm not sure what to do now. Have anyone experience this and let me know how can I sove the problem?
    /Eida

    Hi,
    you need to regenerate the data
    For this regeneration, you start the program RKETREGP with the parameter
    application class 'KK', subclass '01' and table name 'KKROBJ'.
    br, Guido

  • Having a image alignment problem using clearbox

    Hi,
    I'm having an image alignment problem. I cannot figure it out. I'm using the clearbox - lightbox dreamweaver widget. Using Dreamweaver CS6.
    Actual page located here. Any help would be appreciated.
    http://dirtysouthink.com/gallery/dustin2.html

    This has very little to do with Dreamweaver. DW is merely a tool to assist you in building a web site. It is purely a matter of styling (CSS).
    When I look at the structure, I see
    BODY-CONTENT (width: 490px)
         GALLERY (width: 452px)
              CONTAINER (width: 500px)
                   ITEM (width: 150px)
    From this I can deduce that:
    GALLERY will fit inside BODY-CONTENT
    CONTAINER will NOT fit inside GALLERY or BODY-CONTENT
    ITEM will fit three times into CONTAINER
    To start with, I would reduce the size of the CONTAINER so that it fits inside of its parent. Then I would adjust the width of the ITEM so that only two of them fit inside of the CONTAINER.

  • Same alignment problem! can ANYONE help??

    Hi guys i still need help with my alignment problem! My nav
    bar lokos good in the preview window of fireworks
    CLICK
    HERE TO VIEW THE NAV BAR IN FIREWORKS
    but when previewed in a browser or exported into dreamweaver,
    the navbar is all out of order
    CLICK
    HERE TO VIEW THE NAV BAR IN DREAMWEAVER
    Can anyone tell me what is going on?? i really need to launch
    the website ASAP.
    Thankyou!

    10totti wrote:
    > Hi guys i still need help with my alignment problem! My
    nav bar lokos good in
    > the preview window of fireworks
    >
    >
    http://img97.imageshack.us/my.php?image=nav1yp1.jpg
    I hate being harassed by ads and will not review images on
    the image
    shack site any longer. Post the screen shot or original file
    to your
    personal site.
    Linda Rathgeber [PVII] *Adobe Community Expert-Fireworks*
    http://www.projectseven.com
    Fireworks Newsgroup:
    news://forums.projectseven.com/fireworks/
    CSS Newsgroup: news://forums.projectseven.com/css/
    Design Aid Kits:
    http://www.webdevbiz.com/pwf/index.cfm

  • Banner Alignment Problem

    I am having an alignment issue with a website that I recently built using dreamweaver.
    http://bacs.myweb.uga.edu
    There is not an alignment problem on the front page (index.html), but subsequent pages (http://bacs.myweb.uga.edu/currentstudents.html) change the alignment of the banners below the tabs for each section.  Screen resolutions of 1280X800 do not have any alignment issues, but pretty much any other resolution changes the alignment.  Is there a solution to this problem?  Rather than posting all the code, you should be able to get it from the links above.  Thanks in advance.
    Frustrated in Athens,
    Aldo

    html
    <body>
    <div id="wrapper">
    </div>
    </body>
    css
    #wrapper {
    width: /*the width of your content */
    margin:0 auto; /*this will centre align it*/
    padding:0;

  • Paper Alignment problems!

    I have a HP F4280 all in one printer, just recently when doing any type of printing, everything is printed but comes off alignment, that is not straight on the page. How can I fix this paper alignment problem? I've had this printer for 2 years now and just recently the alignment is off, I haven't done anything different!

    The troubleshooting page here may help.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • Spot healing brush alignment problem

    Using Photoshop CS4 (11.0) on a Mac with 10.5.6. Sometimes the spot healing brush works as expected. However, after working for a while, the alignment seems to be off--I hover the cursor over the spot I want to retouch, but when I click the mouse the area retouched is a bit (1/4" or so) below the spot healing brush cursor. If I quite and restart Pshop the problem goes away. This is with the spot healing brush--not the one where you need to select where to clone from. Is something wrong, or is there a new feature I don't know about that's causing this? I've used the spot healing brush quite a bit with CS3.
    If anyone has any thoughts, I'd appreciate hearing them. This is getting frustrating.

    I think you are talking about a different issue here. This problem is not specific to the spot healing brush.
    @ OP: The brush alignment problem is very real and I have it frequently when working with larger files (approximately >500MB in memory). I have two macs, a macbook (GMA X3100) and a mac pro (ATI Radeon HD 2600 XT). So two completely different hardware arrangements that have the exact same problem.This is clearly not a problem with graphics cards.
    Drawing with any tool like: brush (any brush - dodge/burn, blur, eraser etc.), lasso (any lasso), line, crop tool etc. will result in a misalignment of about 0,5 cm directly downward. However, clicking on menus and dialogue boxes works as expected. Switching off OpenGL features in PS WILL NOT PREVENT THE PROBLEM (if I shout, maybe Adobe will hear...). The same problem appears whether I'm using a Wacom tablet or a mouse. It even appears when the Wacom driver is uninstalled.
    So, if Adobe is not acknowledging the problem it's safe to assume it will be featured in CS5 as well.
    @ Jim: Sorry, I would have posted in the other thread but your link does not work anymore.

  • Can I fix the alignment problems my Color LaserJet CP1518ni is having? The red does not line up.

    Can I fix the alignment problems my Color LaserJet CP1518ni is having?  The red does not line up.  I have installed the latest updates, etc.  Calibrating does not help.  The printer is only a few years old.  What gives?
    This question was solved.
    View Solution.

    Please be aware that this forum is a peer to peer support forum, it is not a direct link to HP support.
    I have a similar issue with a Laserjet cp1525nw, it was mostly corrected by removing and reseating the toner cartridges.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • Keynote 9 and objects alignment problems

    Why keynote does not align object using the first one selected as stated in the user guide?
    It will rather use the highest one for top, the lowest one for bottom and a ponderate value for all objects for middle.
    Same problem for left center right.
    If I do align top with an order like (1 being the 1st selected, 2 the 2nd and 3 the 3rd).
         2                                             1     2          3
    1                       I end up with                              Rather than 1     2          3
                   3
    If I do align top with
         3                                             2     3          1
    2                      I end up with                               Rather than
                   1                                                                                      2     3          1
    Can this be changed somewhere?
    This is just not logical at all. The first object should be the reference for the alignment.
    There also is a problem with distribution, it uses the farthest left and the farthest right in Horizontal distribution rather
    than first and last selected.
    This is against the documentation.
    Cheers.
    Joffrey.

    Hello.
    Thanks for your reply. Indeed, these alignment guides are a powerful and great tool that I use all the time.
    Nevertheless when it comes to aligning a big amount of shapes, I can't be bothered doing it one by one.
    In the manual of Keynote 09' it is written page 89 and 90:
    Quickly Aligning Objects Relative to One Another
    You can use menu commands to quickly move objects on the same slide in alignment or space them equally apart. First, you must select all the objects you want to align (hold down the Shift or Command key as you click each object to select it).
    To align selected objects:
    m    To align the objects with each other, choose Arrange > Align Objects and then choose one of the alignment options in the submenu.
    Left:  Positions objects so that their left edges align vertically to the first object you select.
    Center:  Positions objects so that their centers align vertically to the first object you select.
    Right:  Positions objects so that their right edges align vertically to the first object you select.
    Top:  Positions objects so that their top edges align horizontally to the first object you select.
    Middle:  Moves objects vertically so that their centers align horizontally to the first object you select.
    Bottom:  Positions objects so that their bottom edges align horizontally to the first object you select.
    There is a discrepency between the manual and what Keynote actually does.
    I know there are lots of way to circumvent this alignment problem, I would just want to know if there is a place, in a config file, may be where this can be switch from topper to first one for example in case of an align top.
    Any other tools such as Omnigrafle, Axure, Visio, Adobe suites, you name it, do it using the first selected object. I whish Keynote would act as expected.

Maybe you are looking for