Why the JTable do not display in the JFrame? Thanks!

Why the JTable do not display in the JFrame?
Thanks for your help.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class test extends JFrame implements ActionListener {
     JButton button=new JButton("Click");
     public test(){
          JFrame frame=new JFrame("abc");
     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.getContentPane().add(button, BorderLayout.NORTH);
          button.addActionListener(this);
          frame.setVisible(true);
     public void actionPerformed(ActionEvent event) {
          String[] columnNames = {"First Name","Last Name","Sport","# of Years","Vegetarian"};
          Object[][] data = {{"Mary", "Campione","Snowboarding", new Integer(5), new Boolean(false)}};
          JTable table = new JTable(data, columnNames);
          table.setPreferredScrollableViewportSize(new Dimension(500, 70));
          JScrollPane scrollPane = new JScrollPane(table);
     getContentPane().add(scrollPane, BorderLayout.NORTH);
     public static void main(String args[]){
          test t=new test();
}

Problem solved.
Thanks!

Similar Messages

  • Why are animated gifs not displaying animations in the preview?

    Why are animated gifs not displaying animations in the preview?
    My coworkers and I are not seeing a animation in the preview pane in Adobe Bridge CS6 even when clicking the play button in the preview window. However, we do see a graphic of the first frame and one person sees 1 frame when clicking play and one other frame and then the animation stops, however, that is not the complete animation.
    I'm using Windows 7 32 bit
    My coworkers are using a mac.
    One coworker has apple OS Mountain Lion with a Intel Quad-Core Xeon – 64 bit system.
    Is this fixable or in the works as a patch? Otherwise we have to open these docs in a browser in order to view them properly.

    I've just come to the realization that some animated gifs do play fine and others do not. A coworker of mine suggests that if it's an animation made via Adobe Photoshop, it'll work in bridge but will not if it's made using something else.

  • Why exchange rate is not displayed correctly when I create the PO in SRM?

    Hi Gurus,
    Yesterday I insert a new row at OB08 tx. at backend system (R/3) for exchange rate of May 17,2010, the value was 10.00. Then I run the BBP_GET_EXRATE program to replicate the info to SRM.
    But when I created a purchase order (PO) the value was 12.24 for exchange rate (this value 12.24 is the value for the previous day May 16, 2010).
    Today morning (May 18, 2010), I inserted another row at R/3 and replicated to SRM, the new value for May 18 was 11. I create another PO and the value was 10 for exchange rate (the value for yesterday).
    But when the PO is transmitted to R/3, the exchange rate is the correct.
    My question is: Why exchange rate is not displayed correctly when I create the PO in SRM? Exists an aspect of memory in SRM that it has to be refreshed? Why SRM is getting the exchange rate for yesterday? Is an issue for time zone?

    Hi Muthu,
    I'm in Extended classic.
    I already discovered what is happening. At the time of being creating the purchase order (PO), it takes the exchange rate of the delivery date of the shopping cart (SC). But when the order is authorized and tries to transmit it to R/3, it takes the exchange rate of the date of creation of the PO.
    Two checks of budget exist:
    1.- When creating PO (exchange rate date of delivery date of the SC's item)
    2.- When authorized and tries to transmit it to R/3 (exchange rate date of creation date of the PO)
    If exchange rate of delivery date of the SC is lower than exchange rate date of creation of the PO, there are cases in which it is marking budget error.
    Now my question is: It is a standard behavior? (to take different exchange rate)

  • TS1398 Why does my iPad2 not display the WiFi icon?

    Why does my iPad2 not display the WiFi icon? I have implemented ALL of the troubleshooting tips, but my WiFi icon is still missing, and it will NOT recognize the internet connection that I know to work on my computer and iPhone.

    Try the following:
    1. Reset the AirPlay devices
    2. Reboot the router
    3. Reboot the iPad
    Note: The AirPlay icon is now in the Control Center

  • Why does Email text not display, only the header?

    When opening an email message, the text or graphics if applicable does not display.  The messages display in my Inbox along with the Preview Pane, but when opened the text box is blank.  Why?

    Close out of the mail app, then double tap the home button and completely close out of the app.
    Then do a reset, no data loss.  Hold down the home/sleep button together until you see the apple logo and then release, then wait for the phone to boot back up.

  • Why portal content is not displayed when we give the server IP in the url

    Hi all,
    I have small doubt in portals.
    When we give the portal url in the browser with server alias(Eg: http://rajportal:50000/irj/portal ) it will display the portal roles and the content,
                           but when we give the Portal server IP instead of server alias (eg: http://10.10.30.30:50000/irj/portal)  it will display only portal roles but not the portal content.
    please can any one explain the reason
    thanks
    Rajeev

    Hi,
    Please the URL is fully Qualified Domain based one or not.
    Please check out the links-
    Fully qualified name of the portal service application
    Regards
    Lekha

  • Why key figures are not displaying

    Dear Experts,
    I am faced with a problem not encountered before. My report has multiple key figures all of which are not displayed when I run the query. However if I change the view to Tabular format (from query properties) the key figures become visible.
    Request your help in resolving the issue.

    Hi,
    are you hidden the some key figures? please check.
    select the KF -> go to properties -> check the display tab - hide/show/hide can be shown.
    if not close and open one more time in query designer.
    Thanks,
    Phani.

  • Why is Mavericks Calendar not displaying numbers correctly?

    My Calendar application is not displaying numbers correctly, I have tried validating my fonts and found nothing there, so not sure what the problem is...

    Have yopu gone to Font Book
    Font Book is located in the Applications folder (in the Finder, choose Go > Applications). To manage or view fonts, open Font Book, or double-click a font file.
    High Light all the fonts    ( Shift and click 1st one  Shift and click last one) and
    then select File/Falidate Fonts
    Then making sure all the fonts get a green tick box.

  • Why JTRee icon did not display??

    Hello sir:
    I can use a panel to display JTree's all nodes and their icons independently in a independent JtreeIcon.java;
    but when I put this JTree into another panel, I can see only tree's all nodes and their text strings, but cannot see their icons, if I use Drag and Drop to move these nodes, the icon moved displays its icon, other ones still not display their icon,
    I think I am short of some methiods, can any guru advice??
    Thanks

    Inside every "big" problem, there's a small one trying to escape.
    If you work at it, you will be able to reproduce you error in a small
    example program.

  • Since updating to Firefox 4, why is my website not displaying properly?

    Sine updating to Firefox 4, one of my websites - www.fonografiacollective.com - is not displaying the home page properly. For some reason, it is showing our logo twice. This site has a WordPress CMS, and I am not technically savvy enough to know what is not compatible with the new version of Firefox. Please help as soon as possible.
    Thanks so much-
    Bear Guerra

    I think that is is caused because you place a block element (DIV) in an inline element (A)<br />
    You can't do that.<br />
    It works if I disable the HTML5 parser, but with HTML5 enabled I see an extra A tag and all A tags are closed and reopened.
    <pre><nowiki><a title="Fonografia Collective" href="http://fonografiacollective.com"> /* inline */
    <div class="logo"> /* block */
    <h1 class="hometitle">
    <a href="http://fonografiacollective.com/" title="fonografia collective">fonografia collective</a> /* block */
    </h1>
    </div></nowiki></pre>
    Generated source from the DOM with HTML5 enabled:
    <pre><nowiki><a title="Fonografia Collective" href="http://fonografiacollective.com"></a>
    <div class="logo">
    <a title="Fonografia Collective" href="http://fonografiacollective.com"></a>
    <h1 class="hometitle"><a title="Fonografia Collective" href="http://fonografiacollective.com"></a>
    <a href="http://fonografiacollective.com/" title="fonografia collective">fonografia collective</a>
    </h1>
    </div>
    </nowiki></pre>

  • Why do IMAP accounts not display new messages in viewer?

    I have been having persistent problems with Mail not displaying new IMAP messages in the viewer. I know the messages are on the server because I can see them on my iPhone. Sometimes they will appear if I quit Mail, then relaunch it. Other times it is necessary to restart to make them appear. I have deleted and recreated the accounts (MobileMe and Gmail), reinstalled the 10.5.7 update and applied the latest Java update.
    The Console messages make it seem like in might be a conflict with Safari 4.02. Upon starting Mail I get messages like this:
    07/27/2009 3:01:35 PM Mail[302] WebKit Threading Violation - NSData* -[WebArchive data](WebArchive*, objc_selector*) called from secondary thread.
    I've seen similar complaints elsewhere in forums, but have found no solutions. Is there one?

    Can you refrain from viewing the messages on the iPhone, and only check via webmail to see if new ones are then failing to be noted?
    Btw, in Mail Preferences/Accounts/Advanced is use IDLE selected for either account -- I select it for MobileMe, but not for Gmail? When selected for MobileMe, the mail is "pushed" to eligible devices, and in Mail, results in the new message chime not sounding for that one account.
    Ernie

  • Why does icloud mail not display clearly?

    Why does my ipad 2 with icloud mail not clearly display my mail?

    Depends on what "not display clearly" means.

  • Image will not display in a jFrame

    So, I had this working, but then I resized the jFrame and the image, and now it doesn't work. I even tried setting it back to the original size and it still doesn't work. I changed nothing else in the code.
    I'm using Netbeans IDE and this is a java desktop application so maybe it changed something without telling me. Any advice would be appreciated.
    ImageIcon bgmap = new ImageIcon("C:\\Users\\1\\Documents\\NetBeansProjects\\Timekeeper\\src\\timekeeper\\resources\\Sunlight.png");
    Image i = bgmap.getImage();
    ImageObserver Iob = null;
    //Al.setBackground(Color.black);
    //Al.setForeground(Color.black);
    jPanel3.getGraphics().drawImage(i, 0, 0, Iob);
    jPanel3.getGraphics().setPaintMode();

    pbrockway2 wrote:
    Make sure the image i is not null. Paint in a component's paintComponent() method (and unless there is some reason for doing so, don't keep recreating the image.)Added to that:
    1) If you mean JFrame, spell it correctly (with correct capitalisation) so we can be sure you are dealing with a JFrame as opposed to some 3rd party class that nobody here knows about, nor supports.
    2)
    ImageIcon bgmap = new ImageIcon("C:\\Users\\1\\Documents\\NetBeansProjects\\Timekeeper\\src\\timekeeper\\resources\\Sunlight.png");
    Image i = bgmap.getImage();
    ImageObserver Iob = null;
    //Al.setBackground(Color.black);
    //Al.setForeground(Color.black);
    jPanel3.getGraphics().drawImage(i, 0, 0, Iob);
    jPanel3.getGraphics().setPaintMode();How can you jam so much crap into so few lines?
    a) Try not to post code with lines that are commented out. That is just a waste of bandwidth.
    b) Declaring an ImageObserver and setting it to null before passing the null variable to the drawImage() method is a waste of a line, since you could directly pass 'null'. But..
    c) JPanels as well as many other components, implement an ImageObserver, so why the heck not pass the JPanel is ImageObserver, rather than 'null'?
    d) If you do not pass an image to something that is an ImageObserver, ensure it is loaded by using a MediaTracker.
    e) Never call getGraphics().
    f) Your call to setPaintMode() at the end of the lines. What did you expect that to do? Did you read the JavaDocs for the method, or did you just throw it in there for 'good luck'?
    In future, please consider posting code in the form of an SSCCE. For image based SSCCEs, you can hot-link to any of the [images at my site|http://pscode.org/media/#image].

  • Why will Firefox will not display content when it has loaded the Face Book page?

    Firefox (FF) loads the Facebook page but only displays the menu of Facebook. Clicking on menu items does produce results but not the main Facebook page.

    *"Clear the Cache": Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    *"Remove the Cookies" from sites causing problems: Tools > Options > Privacy > Cookies: "Show Cookies"

  • Why is Verizon Cloud not displaying all the files I've backed up?

    I've gone through the backup procedure using Verizon Cloud on my iMac and this appeared to go well, at least in monitoring the backup process stage.  About 40GB of files were backed up.  However, Cloud is only showing about 9GB of my backed up files (e.g., about 600 songs of 4000 and some pictures appear to be missing as well).  I don't know how to correct this.  Thanks for any help.

    Try using Applications/Utilities/Disk Utility to verify/repair the drive.

Maybe you are looking for

  • Error while trying to access shopping cart

    When trying to add songs to my cart, I keep receiving this message: We could not complete your iTunes request. There is not enough memoryavailable. What does this mean? How do I correct this? Thanks.

  • HELP! Live or death question :(

    Hello guys im in the final week of a college project and i need to do some things in labview. I am receving from a FPGA trhough serial communication. The transmission is working OK as i receive the data im sending from the FPGA. With this, my fpga is

  • Where are my Event logger's logs of Info level severity?

    Hi, How can I get my logs reflected in NWA log viewer of INFO level severity which were generated by EVENT LOGGER action block in one of my transactions. Currently I am able to view logs of severity ERROR and above in Log Viewer. But I am not able to

  • InDesign CS3 - Detect Edges does not work with transparency

    I have three machines running at home. One is a PowerMac G5 running OS X Tiger and Adobe CS3 Master Collection. The other two are new Intel iMacs running OS X Leopard, also with the CS3 Master Collection. My problem is this: On the PowerMac G5, I can

  • HT204088 my entire purchase history has vanished.

    my entire purchase history has vanished. I still have a few of the confirmation emails with the order numbers. How can I search for a purchase by order number, or otherwise retrieve my stuff!!!!