JTable JComboBox appears a few bits left than the cell

Hi,
I 'm using the following code to display a JComboBox in the 4th column of my JTable.
TableColumn tableColumn = table.getColumnModel().getColumn(3);
String[] values = {"", "ASC", "DESC"};
tableColumn.setCellEditor(new DefaultCellEditor(new JComboBox(values)));
JScrollPane scrollPane = new JScrollPane(table);
mainContainer.setLayout(new BorderLayout());
mainContainer.add(BorderLayout.CENTER, scrollPane);
The strange thing is that when I click on the combo box to select a value, the combo box appears a few pixels on the left of the cell that I edit, and not exaclty under it. Has anybody else encountered such a problem?
| ASC | <---------- table cell
| |
| ASC | <---------- combo box
| DESC |
Thanks in advance.
John.

Hi,
I 'm using the following code to display a JComboBox in the 4th column of my JTable.
TableColumn tableColumn = table.getColumnModel().getColumn(3);
String[] values = {"", "ASC", "DESC"};
tableColumn.setCellEditor(new DefaultCellEditor(new JComboBox(values)));
JScrollPane scrollPane = new JScrollPane(table);
mainContainer.setLayout(new BorderLayout());
mainContainer.add(BorderLayout.CENTER, scrollPane);
[/code/
The strange thing is that when I click on the combo box to select a value, the combo box appears a few pixels on the left of the cell that I edit, and not exaclty under it. Has anybody else encountered such a problem?
| ASC | <---------- table cell
| |
| ASC | <---------- combo box
| DESC |
Thanks in advance.
John.

Similar Messages

  • Hi from few days onwards i found one abnormality in my iphone4s .That is if i observe my phone settings screen from right side of the device top navigation appearing rightside height is more than the left side. In reverse manner from the left side.

    Hi from few days onwards i found one abnormality in my iphone4s .That is if i observe my phone settings screen from right side of the device top navigation bar appearing rightside height is more than the left side. In reverse manner from the left side. I dnt know whether it is default feature of iphone or not but i am really disappointed due to this. So please anyone help me in this issue and let me clear my doubt and make me happy. Thanks in advance.

    I believe what you are seeing is an optical illusion when viewing the screen from the side. Try to align one of the one of the options in Settings, like General, with the navigation bar you'll see it does the same thing.
    Hope that helps

  • I just upgraded my Internet service to 12 MPS. It doesn't appear to work any faster than the 3MPS I had before. The AT

    I just upgraded my Internet service to 12 MPS. It doesn't appear to work any faster than the 3MPS I had before. The AT&amp;T guy said it may be the computer rather than the connection. I have an iMac intel core 2 duo, running OS 10.5.8. It has 1 GB of memory. I have plenty of memory left. Is there something I can check on the computer to see if it's capable of running faster with this new Internet upgrade?

    You certainly are going to see improvements if you download big files, i.e. Apple updates, or watching trailers also at higher resolution.
    You won't see much difference if you use peer to peer download.

  • I downloaded Adobe immigration software for Aperture, opened Lightroom, but the Aperture library was grayed out so it couldn't be selected to import. How do I get it to work? I only have a few days left on the test version of Lightroom to see how it works

    I downloaded Adobe immigration software for Aperture, opened Lightroom, but the Aperture library was grayed out so it couldn't be selected to import. How do I get it to work? I only have a few days left on the test version of Lightroom to see how it works with my Aperture library.

    Gracias photo-enthusiast por tu respuesta pero hay docenas de de usuarios que tienen esta mismo problema, me da la sensación que nos tomas por gagas que no tenemos ni idea de lo que tenemos entre manos.
    Me alegro enormemente que no hayas tenido tu este problema.

  • How to use Internet Explorer 11 64 bits rather than the 32 bit version, on Windows 7 familial premium 64 bit

    Hi,
    my system : up to date computer, W7 familial premium (64 bit), Internet Explorer 11 (32 bit)
    I use this computer on the web to visit just one website, always the same and several hours a day ; this site advocate the use of Internet Explorer 64 bits for more efficiency.
    How can I get to install, or switch to the 64 bit version of Internet Explorer, as presently when I try to install a downloaded version, I get as an answer something like "installation not possible because the more up to date version of Internet Explorer
    is already installed on your computer". Thanks

    Hi,
    On a 64-bit version of Windows, please click system drive, there should be a “Program Files” and “program Files x86”,
     the "Program Files" folder is for 64-bit programs and the "Program Files (x86)" folder is for 32-bit programs, you will find IE11 64 bit has already installed in you system in “Program Files”>”Internet explorer”.
    Regards,
    Yolanda
    Yolanda
    TechNet Community Support

  • I am close to initalizing my ipad and its says I have a few steps left on the ipad. The ipad is asking me to choose a network. What do I do?        .

    Ithe ipad is asking me to choose a network. What do I do?

    Simple; you should choose your network. However, you don't have to. Do it later.

  • Why when surfing on iPads safari and reading an article and I go back it brings me back a few days rather than the current place I was at?

    Help

    Dragon4486 wrote:
    Yes on a apple laptop or desktop.
    As this is an iPad forum, directions for solving a problem on a desktop or laptop probably aren't what the OP is looking for.
    The ipad 2 has a mobile version of safari, really? That will be the first to go when i get my Ipad2 friday, i cant stand mobile versions of browsers.
    The version of Safari on the iPad is the iOS version as, of course, the MacOS version doesn't run on the iPad. If you don't like, there are many other browsers available in the App Store. I'm fond of iCab Mobile.
    You may also be confusing mobile browsers with the mobile version of websites. Whether or not you see the mobile version of a website is controlled by the website.
    Best of luck.

  • Just got a new ipad2 , the usb cable  to connect wont fit into the charger port` it looks a bit smaller than the ipad1?

    just got a new ipad2, the charger cable ( the same cable as ipad1 ) doesnt seem to fit ? i have loads of apple products and the charger is the same on them all ,so whats different? the charge port under the home button looks slightly differant?

    I got the same issue with my iPad 2, when I got it on opening day. For some reason, it just didn't accommodate any of my other cords (ipod touch, ipod nano, etc.). Now, though, every one of my cables except for the ipod nano one can fit in it.  I think that the iPad needs time to "stretch out" its parts to fit the other cables.

  • My 21" display on iMac (mid 2010) is overheating so much I can't sit at my computer for more than an hour or so.  Also, some shadowy shapes appear in the background on the upper left of the screen.

    Processor  3.06 GHz Intel Core i3
    Memory  12 GB 1333 MHz DDR3
    Software  Mac OS X Lion 10.7.5 (11G63)
    iMac 21" display
    My 21" display on iMac (mid 2010) is overheating so much I can't sit at my computer for more than an hour or so.  Very hot.  Also, some shadowy shapes appear in the background on the upper left of the screen. Any thoughts?

    Thanks for the swift reply, I have been looking online and a loose plug seems to be somewhat of an issue with many, I hope mine is actually a problem and not what others are experiencing. It's taken me this long to even reach out for the simple fact I HATE being a complainer but this is just horrible.
    Do you have an iPad 3 as well? And is yours not experiencing any issues close to mine?
    Thanks again!

  • I bought my iphone 5 a bit more than a month ago. Few days ago it is broken (not my fault). Is it possible to completely return it and get money back?

    I bought my iphone 5 a bit more than a month ago. Few days ago it is broken (not my fault). Is it possible to completely return it and get money back?

    No, you cannot get your money back.
    If you have tried the basics restart, reset, restore, then make an appointment at the genius bar.  If the iphone is defective then they will replace it.

  • The pitcure on the play screen front left is larger 50% more than the edit screen right side is zoomed in.

    Hello Whats up with cs6??Is it me or is it the cs6.. QUESTION On the front right screen the recorded picture that I want to send over to the right edit side is just what I want but when I send it over it gets zoomed in50% closer than the original. WHY? and HOW DO I CHANGE THIS? 

    First of all, let's get some terminology straight. That may actually help you understand what's going on. The monitor on the left that you refer to as the "play side" is called the Source Monitor because it  shows source clip. It always shows clips at their native resolution (e.g., 1920 x 1080 or 720 x 480). And unless you have applied master clip effects, it shows them exactly as they came off of the camera or out of whatever app wrote them.
    The monitor on the right that you refer to as the "transfer side" is the Program Monitor. It shows a composite of whatever is under the playhead in the sequence that's loaded in the active Timeline panel. If a source clip's resolution does not match the height & width of the sequence settings, then it will appear either zoomed in, where you can see only the center of the image, or zoomed out, where the frame is surrounded by black (or the layer underneath it).
    From the way you describe the problem, I'm not sure whether the Program Monitor is zoomed in our out, which means it's not clear whether a) the sequence is SD and isn't showing the full HD clip, or b) the sequence is HD and the SD clip is small within the frame. Note that Arjun asked you specifically "what are your sequence settings," and you have not yet answered that key question.
    Because you are working with content in two very different resolutions, if you want to edit the clips together in the same sequence, you'll first have to decide whether to work in an SD or HD sequence. Since you mention that you intend to burn a DVD, which by definition is standard definition (you have to use Blu-ray to burn a disc that is HD), I'll assume you want the sequence to be SD. Incidentally, in cases of mixed resolution like yours, that's what is generally advised because scaling the HD content down generally yields much better results than scaling the SD content up.
    As Shooter has advised (twice), in order to get the sequence to match your source content, drag the clip that you want to match to the New button in the bottom right corner of the Project panel. If you scaled the SD content up, that would explain why the focus is not as good in the Program Monitor...
    Now, when you drag your HD clip to the Timeline, it will be zoomed in (unless you have enabled the preference "Default Scale to Frame Size). You can correct that by right clicking the clip in the Timeline and selecting either "Scale to Frame Size" or "Set to Frame Size." Another detail you left out is whether your SD content is 4:3 or 16:9, which is controlled by the pixel aspect ratio. If it's 4:3, then Scale to Frame Size and Set to Frame Size will leave the HD content letterboxed, in which case you'll probably want to adjust the scale setting under Motion in the Effect Controls panel.
    Based on the nature of your questions and the terminology you use, you have not yet taken the time to learn about Premiere Pro. You might want to do so before asking questions like whether it is "a good program to do top quality editing." Premiere Pro is used daily by thousands of professional editors. It's been used to edit some feature films released by major studio as well as many movies and documentaries that have graced the likes of the Sundance and Toronto Film Festivals and quite a few television programs. So if you're using it for the first time and having some problems, that's perfectly natural and understandable, and we're happy to help you up the learning curve. But the odds are pretty good that the problems are user error, not shortcomings in the program.
    Here's a video tutorial that might help get you up to speed: How to create a video story with Premiere Pro | Adobe Premiere Pro CC tutorials

  • HT4863 I sent an email from my iPhone 3GS (via iCloud account) with around 16GB of attachment. It slowed down the phone for a few seconds, then appeared to be sent. However, the message is now not in the sent box, and I can't see an outbox at all. Any ide

    I sent an email from my iPhone 3GS (via iCloud account) with around 16GB of attachment. It slowed down the phone for a few seconds, then appeared to be sent. However, the message is now not in the sent box, and I can't see an outbox at all. Any ideas?

    That changes things a little bit , login to icloud.com and see if you can find it in your sent folder.
    If it is there you did send, just need to wait until you phone syncs "sent folder" perhaps on wifi.
    If it is not, then I would say it is lost and you may have to send again. They have 20 megs limit, so make sure that message plus attachment is under that limit.

  • Combo Box in a JTable not appearing

    Hi Swing,
    I have a snippet of code that I took from the Swing guide for JTables that adds a JComboBox into the 3rd column in the table. However, the ComboBox doesnt appear?
    Can anyone see what is going wrong? Code is below:- I can post more if needed:-
         public void addTable() {
              tableModel = new MyTableModel(rows,columns);
              relationTable = new JTable(tableModel);
           //Set up the editor for the sport cells.
            TableColumn sportColumn = table.getColumnModel().getColumn(2);                                              
            JComboBox allStaff = new JComboBox();
            allStaff.addItem("Snowboarding");
            allStaff.addItem("Rowing");
            allStaff.addItem("Knitting");
            allStaff.addItem("Speed reading");
            allStaff.addItem("Pool");
            allStaff.addItem("None of the above");
            sportColumn.setCellEditor(new DefaultCellEditor(allStaff));
              // set so only one row can be selected at once
              relationTable.setAutoResizeMode( JTable.AUTO_RESIZE_OFF );
              relationTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
              // add to pane:-
              JScrollPane scrollPane3 = new JScrollPane(relationTable);
              scrollPane3.setBounds(X,Y,Z,W);
              getContentPane().add(scrollPane3 );
         }Cheers

    hi
    look I will give u a simple code I created based on your combo box
    enjoy (:
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    public class TablCo extends JPanel {
    static JFrame frame;
    JTable table;
    DefaultTableModel tm;
    public TablCo() {
    super(new BorderLayout());
    JPanel leftPanel = createVerticalBoxPanel();
    //Create a table model.
    tm = new DefaultTableModel();
    tm.addColumn("Column 0");
    tm.addColumn("Column 1");
    tm.addColumn("Column 2");
    tm.addColumn("Column 3");
    tm.addRow(new String[]{"01", "02", "03", "Snowboarding"});
    tm.addRow(new String[]{"04 ", "05", "06", "Snowboarding"});
    tm.addRow(new String[]{"07", "08", "09", "Snowboarding"});
    tm.addRow(new String[]{"10", "11", "12", "Snowboarding"});
    //Use the table model to create a table.
    table = new JTable(tm);
              //insert a combo box in table
              TableColumn sportColumn = table.getColumnModel().getColumn(3);
              JComboBox allStaff = new JComboBox();
                   allStaff.addItem("Snowboarding");
                   allStaff.addItem("Rowing");
                   allStaff.addItem("Knitting");
                   allStaff.addItem("Speed reading");
                   allStaff.addItem("Pool");
                   allStaff.addItem("None of the above");
              //DefaultCellEditor dce = new DefaultCellEditor(allStaff);
              sportColumn.setCellEditor(new DefaultCellEditor(allStaff));
              JScrollPane tableView = new JScrollPane(table);
    tableView.setPreferredSize(new Dimension(300, 100));
              leftPanel.add(createPanelForComponent(tableView, "JTable"));
              JFrame.setDefaultLookAndFeelDecorated(true);
              //Create and set up the window.
              frame = new JFrame("BasicDnD");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              //Create and set up the content pane.
              frame.setContentPane(leftPanel);
              //Display the window.
              frame.pack();
              frame.setVisible(true);
              protected JPanel createVerticalBoxPanel() {
              JPanel p = new JPanel();
              p.setLayout(new BoxLayout(p, BoxLayout.PAGE_AXIS));
              p.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
              return p;
              public JPanel createPanelForComponent(JComponent comp,
              String title) {
              JPanel panel = new JPanel(new BorderLayout());
              panel.add(comp, BorderLayout.CENTER);
              if (title != null) {
              panel.setBorder(BorderFactory.createTitledBorder(title));
              return panel;
    public static void main(String[] args) {
         new TablCo();
    }

  • Why is the left side of my iMac screen darker than the other, and why does the display randomly go black?

    My family has a late 2010 27" Imac. A few months ago, we noticed that the left side of the screen was somewhat darker than the right. As time went on, it continued to get worse and worse. When you turn the computer off for an hour or so, it helps the display out somewhat, but it eventually goes back to being darker on the left. About two months ago, the display started to go completely black. When the screen is black, everything still runs. My itunes library will still play, everything is functioning even though the screen is out. It has started to become more frequent. It is extremely annoying, almost unbearable. Since the one year warranty went out in November, what are we supposed to do about this?

    Contact Apple Service, iMac Service or Apple's Express Lane. It's a known issue with 27" iMacs and you might be eligible for replacement. I had mine replaced shortly after buying it. BTW, AppleCare's extended warranty is the cheapest insurance policy one can have for desktop machines. Too bad you missed the deadline.

  • Is a binary on 32 bit faster than a 64 bit binary in solaris ?

    I timed a program for both 64 bit and 32 bit . The code is something like this --
    #include<stdio.h>
    #include<string.h>
    #include<stdlib.h>
    int main (int argc,char **argv)
    int count=0;
    int count2=0;
    int u=0;
    int count3=0;
    int sizeoffile=0;
    int sizefile[5];
    for(u=0;u<5;u++)
    sizefile=1;
    printf("%d\n",sizefile[u]);
    char a='a';
    char *b ;
    FILE *file ;
    b = (char *)malloc(512*sizeof(char));
    while(count <512)
    strncpy(b+count,&a,1);
    count++;
    for(u=0;u<2;u++)
    sizeoffile=0;
    if(u==0)
    file=fopen("./writesize1","a");
    else if (u==1)
    file=fopen("./writesize2","a");
    else if (u==2)
    file=fopen("./writesize3","a");
    else if (u==3)
    file=fopen("./writesize4","a");
    else if (u==4)
    file=fopen("./writesize5","a");
    while(sizeoffile<sizefile[u])
    while(count2<(1024*1024))
    count3=0;
    while(count3 < 2)
    fprintf(file,"%s",b);
    fprintf(file,"\n");
    fflush(file);
    count3++;
    count2++;
    count2=0;
    // count3++;
    count3=0;
    sizeoffile++;
    fclose(file);
    return 0;
    The above code is crude code to write files of 1 GB.
    I timed the above code binaries for 32 and 64 bit on a solaris 10 box . I got the following times :
    for 32 bit : 2.16796for 64 bit : 2.5039466
    Is this the expected behaviour or something I am missing ?
    Edited by: rarpit on Mar 18, 2009 9:59 PM

    Reasons a 64-bit program might be better:
    * Can directly access more than 4GB of VM
    * Has direct access to 64-bit math routines
    * On x86, has access to more registers (big win for some code/compiler combinations) Shouldn't affect SPARC much.
    Reasons a 32-bit program might be better:
    * Can run on both 32-bit and 64-bit kernels
    * Pointers are smaller. More code can fit in CPU cache, may run faster
    * Memory footprint slightly smaller due to smaller pointers
    So the general case is that unless you need the extra VM space, 64-bit math, have a special need to access 64-bit libraries, or your compiler is doing a great job of using the extra registers on x86, there's not much benefit to creating a 64-bit binary.
    All that said, your program appears to be writing large files to disk. That task should be completely dominated by your I/O times. Did you run them more than once? I would imagine both versions to be identical because anything other than the disk writes will be in the noise.
    Darren

Maybe you are looking for

  • Podcast episodes download to wrong folder. How can I move them?

    Some of my downloaded podcast episodes seem to be going to incorrect folders. For example, I subscribe to the Photoshop TV podcast. Some of the downloaded episodes go into the iTunes Music folder>Podcasts>Photoshop TV folder. This seems to me to be t

  • 10.6.7 Update and Quadro 4000

    Heads-up - the OSX 10.6.7 update contains bad graphics drivers for the nVidia Quadro 4000 GPU. After using either Software Update or the Combo Updater, Quadro 4000 users will find that they're no longer able to use the 2nd display output on the card,

  • Upgrading BOE XI R2 into XI 3.1

    Dear all, I have this scenario for upgrading from boe xi r2 to xi 3.1 1. Report just using Desktop Intelligence and about 400 reports 2. there are 4 universe 3. total about 200 users. 4. Using SSO with AD authentification for authorization There are

  • Selecting in Non-Editable JTextField in JDK 1.4

    Hi. Posting as new thread - maybe somebody can help. I want a formatted non-editable (!) display component (for incoming Instant Messages, if anyone cares), which allows selecting with the mouse (including selection highlighting) and then copying FRO

  • How can I publish sites separately ?

    I have 3 different sites stored on IWeb and only one of them is ready for publishing. Can someone tell me how I can do to differenciate publishings... Can I open a new session of IWeb, (that is without my saved sites) without having to erase the "old