Why this tree can not show on the Applet?

hi, all, I try to create a java Applet show a tree, this following code has no error, but the tree can not show on the Applet, can any one tell me why? thanks!
<code>
import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.tree.*;
import java.awt.dnd.*;
public class AppletApp extends Applet {
     Date myDate;
     protected JTree m_tree = null;
     protected DefaultTreeModel m_model = null;
     protected JTextField m_display;
     public void init() {
     public void paint(Graphics g) {
          DefaultMutableTreeNode root = new DefaultMutableTreeNode("root");          
          DefaultMutableTreeNode node1 = new DefaultMutableTreeNode("node1");          
          root.add(node1);                    
          node1.add(new DefaultMutableTreeNode("sub1_1"));                         
          node1.add(new DefaultMutableTreeNode("sub1_2"));                                        
     public static void main(String arg[]) {
          JFrame myFrame = new JFrame();          
          Container contentPane = myFrame.getContentPane();
          contentPane.setLayout(new GridLayout(1,2));          
          AppletApp app = new AppletApp();          
          contentPane.add(new JScrollPane(app), BorderLayout.CENTER);     
          myFrame.addWindowListener (new WindowAdapter() {
               public void windowClosing(WindowEvent e) {
                    System.exit(0);
          app.init();
          app.start();
          myFrame.setSize (400,400);                              
          myFrame.setVisible(true);          
</code>

Not quite sure what you are trying to do, but if you move the code from the paint() method into the init() method (then delete your paint() method), then add one new line to the init() method (after the code you just inserted) that reads:
getContentPane().add(new JTree(root));
- You should at least see a tree!

Similar Messages

  • I want to backup my iphone to my macbook. This option is not showing in the control click list

    I want to backup my iphone to my macbook. This option is not showing in the control click list

    You mean with the same iCloud account?
    If so, yes this is possible by accessing the iCloud account with the Mail.app on your Mac and with the iPad and iPhone Mail app. This allows for keeping server stored email account mailboxes synced between all three, syncing contacts, calendar events, notes, and Reminders synced between all three, and the same with the iCloud Photo Stream. In addition, you can have music, books, and apps purchased/downloaded from the iTunes store with one device automatically downloaded on the other devices.

  • G580 Lenovo Solution Centre can not show me the warranty period

    For some reason, the program Lenovo Solution Centre can not show me the warranty period, as the model of the motheboard is not detected ... On the site of Lenovo - product registered as a detective in the Netherlands.
    How do I register my laptop and what could be the problem?
    ps:
    BIOS - 5ECN96WW
    Product number: 2189

    hi musto,
    Welcome to the Forums.
    The Lenovo Solutions Centre Requires the serial number to show the warranty information. If the software is not able to read it, this may be the problem.
    You may get the latest version below and you may register the product using this link.
    Lenovo Solution Center for Windows 8 (64-bit), 7 (64-bit)
    lscsetup_x64_22002.exe
    Released: 15 Aug 2013
    Version: 2.2.002
    32.4 MB
    Regards
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.
    Follow @LenovoForums on Twitter!

  • TS3988 This product can not proceed with the activation process, service errors go I want you entered will appear this error I am a Korean. Failed to resolve service center in South Korea  Please e-mail response  iPad2 32GB Cellular Version

    This product can not proceed with the activation process, service errors go I want you entered will appear this error
    I am a Korean.
    Failed to resolve service center in South Korea
    Please e-mail response
    iPad2 32GB Cellular Version
    <Email Edited by Host>

    I'm same. Any Update or News?
    Message was edited by: koreasaram

  • I do not know why, but I can not go to the App Store! before I went there without any problems but now I can not connect with App Store

    I do not know why, but I can not go to the App Store! before I went there without any problems but now I can not connect with App Store

    Open the Finder. From the Finder menu bar click Finder > Go > Go to Folder
    Type or copy/paste:   ~/Library/Cookies
    Click Go then move the com.apple.appstore.plist file from the Cookies folder to the Trash.
    Try the App Store.

  • I can´t set the control panel iCloud. PC writes this: you can not connect because the server error occurred. What´s matters?

    I can´t set the control panel iCloud. PC writes this: you can not connect because the server error occurred. What´s matters?

    Whenever I log into icloud.com
    Using what version of which browser?
    iCloud.com requires Safari 6 or later, Firefox 22 or later, or Google Chrome 28 or later. Have you tried all of those?
    If you have, have you tried clearing your browser cache and cookies?
    For the first tine since 1989 I'm thinking about buying a PC.
    You'd have exactly the same problems on an 8 year old PC too. It's a bit unreasonable to expect such an old Mac to continue to be compatible as software is constantly updated.
    Saying that, I'm still able to access iCloud.com successfully in Safari v5.0.6 on a PowerPC Mac running Mac OS X 10.5.8, so the problem you're having is likely to be a browser issue, not something inherently wrong with the computer.
    Since all this crap started, Mail won't download my Mac.com or me.com email.
    The iCloud.com website is totally unconnected to Mail's ability to download email via IMAP. Have you checked the mail server settings are correctly setup and up-to-date?

  • Why this query does not show the result?

    Why the query with the schema prefixed does not show the result and the query without schema display the correct results?
    SQL> select data_object_id,object_type from dba_objects where object_name='HR'.'JOBS';
    select data_object_id,object_type from dba_objects where object_name='HR'.'JOBS'
    ERROR at line 1:
    ORA-00933: SQL command not properly ended
    SQL> select data_object_id,object_type from dba_objects where object_name='HR.JOBS';
    no rows selected
    SQL> select data_object_id, OWNER, object_type from dba_objects where object_name='JOBS';
    DATA_OBJECT_ID     OWNER                          OBJECT_TYPE
    69662              HR                                 TABLE
                       OE                                 SYNONYM
    SQL> SELECT USER FROM DUAL;
    USER
    SYS

    Hi,
    the column object_name refers to a object_name which is 'JOBS', the column owner refers to the owner 'HR', the value isn't stored together, so you have to select the two columns. It is the same behaviour as every other table/view. Have a look at the values in the view DBA_OBJECTS.
    Herald ten Dam
    Superconsult.nl

  • Why this program can not update the datatbase?

    The database I used is MS SQL Server 2000.
    The program can run normally,but the table is not updated.
    import java.sql.*;
    public class BatchUpdate {
    public static void main(String args[]) {
    String url = "jdbc:mySubprotocol:myDataSource";
    Connection con;
    Statement stmt;
    try {
    Class.forName("myDriver.ClassName");
    } catch(java.lang.ClassNotFoundException e) {
    System.err.print("ClassNotFoundException: ");
    System.err.println(e.getMessage());
    try {
    con = DriverManager.getConnection(url, "myLogin", "myPassword");
    stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
    con.setAutoCommit(false);
    stmt.addBatch("INSERT INTO COFFEES " + "VALUES('Amaretto', 49, 9.99, 0, 0)");
    stmt.addBatch("INSERT INTO COFFEES " + "VALUES('Hazelnut', 49, 9.99, 0, 0)");
    stmt.addBatch("INSERT INTO COFFEES " + "VALUES('Amaretto_decaf', 49, 10.99, 0, 0)");
    stmt.addBatch("INSERT INTO COFFEES " + "VALUES('Hazelnut_decaf', 49, 10.99, 0, 0)");
    int [] updateCounts = stmt.executeBatch();
    ResultSet uprs = stmt.executeQuery("SELECT * FROM COFFEES");
    System.out.println("Table COFFEES after insertion:");
    while (uprs.next()) {
    String name = uprs.getString("COF_NAME");
    int id = uprs.getInt("SUP_ID");
    float price = uprs.getFloat("PRICE");
    int sales = uprs.getInt("SALES");
    int total = uprs.getInt("TOTAL");
    System.out.print(name + " " + id + " " + price);
    System.out.println(" " + sales + " " + total);
    uprs.close();
    stmt.close();
    con.close();
    } catch(BatchUpdateException b) {
    System.err.println("SQLException: " + b.getMessage());
    System.err.println("SQLState: " + b.getSQLState());
    System.err.println("Message: " + b.getMessage());
    System.err.println("Vendor: " + b.getErrorCode());
    System.err.print("Update counts: ");
    int [] updateCounts = b.getUpdateCounts();
    for (int i = 0; i < updateCounts.length; i++) {
    System.err.print(updateCounts[i] + " ");
    } catch(SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    System.err.println("SQLState: " + ex.getSQLState());
    System.err.println("Message: " + ex.getMessage());
    System.err.println("Vendor: " + ex.getErrorCode());

    con.setAutoCommit(false);The changes are not comitted to the DB when you set autocommit to false.
    commit with
    con.commit();
    or dont set autocommit to false
    rgds

  • Why an email address not show in the Bcc field in Send Items folder?

    Hi,
    My user use Office 2007 and Exchange 2008. She sent an email which Bcced to 4 people for example A, B, C and D. However when she opens this email in her Send Items folder within Outlook, it only shows A, B and C in the Bcc field, but if she opens this email
    in OWA, she can see 4 people in the Bcc field. It is the exact the same email. Outlook is in online mode (not cashed mode). I don't understand what could be the problem. Why D isn't shown in the Bcc field within Outlook?
    Please advise!
    Thanks in advance!
    Grace

    Hi,
    Since it's a Client-only issue, we can try starting Outlook in Safe Mode to determine if it's 3rd-party add-ins related:
    Press Win + R and type “outlook.exe /safe” in the blank box, then press Enter.
    If there’s no problem in Safe Mode, disable the suspicious add-ins to verify which add-ins caused this issue.
    I suppose the recipient D is not listed in the mail Filter lists?
    http://office.microsoft.com/en-001/outlook-help/add-names-to-the-junk-e-mail-filter-lists-HA001230163.aspx
    You can also test if this problem exists when you switch to Exchange Cached mode.
    Regards,
    Melon Chen
    TechNet Community Support

  • Why does Premiere Pro not show in the Creative Cloud

    I just bought the montly membership, paid, got the confirmation, but still Premiere Pro does not show in my Creative Cloud options - under audio/video it only shows  and Photoshop, Prelude and Audition.
    When I use the link in the email confirmation that I received I can press 'getting started'.
    This leads me to the online Creative Cload Download - when I scroll to Premiere Pro, click on download I go to the next page, but still the program does not show?
    What should I do differently? I am logged in already.
    Please help me!

    Do you have a 64-bit machine?  Normally the listing will only include programs that your machine is capable of running.  Check your machine capabilities against the requirements for Premiere Pro and see if it comes up short.
    http://www.adobe.com/products/premiere/tech-specs.html

  • Why do some images not show on the mobile browser but do on the normal Firefox

    I have an HTC desire hd. I have had a site built.
    the images don't show on the mobile browser. when using the standard browser which came with the phone 'internet' it works fine. is there a reason for this?

    I get a content encoding error when trying to load one of the problem images.
    http://www.signapedia.com/gethumb.php?path=userfiles/31_prodimg_55856_img04.jpg&size=85
    Why this happens will take some additional research.

  • HT1386 my windows 764 bit says this iphone can not be used the required software is not installed reinstall 64 bit version which i already have

    this i phone cannot be used please reinstall 64 bit version
    which i have allready i have reinstalled i tunes 6 times and it still does not sync or even recognice or connect my device

    smittycdm wrote:
    Did you turn off all Windows & other pc-related firewalls, virus and "real-time scanning"?  If necessary, d/l all software you need to the desktop and disconnect to prevent any visitors, if you are Level 6 you know all that.  But I've found all the problems w/pcs & iphones/itunes have been related to defender, mcafee, etc.  And your error message was one I used to get, the other was something about not being authorized even though I was signed in as administrator.  Hope that helps, it worked for me.
    Thanks for your input.
    iTunes has to contact Apple during the sync process, but iTunes can only sync the phone, if you can launch iTunes, which seems not to be the case, as "...the required software is not installed.."
    And, even if I have reached level 6, please remember, that not everybody is used to phrases like "d/l" or "w/pcs", especially if your post can have more than 160 letters

  • Why do my mails not show in the inbox?

    All e-mails used to show on the first page of the inbox, and I could browse downwards to see which ones I wanted to read. Now, suddenly I have to doubleclick. This is irritating - I´ve tried to look it up in preferences, but cannot find any solution. Please help!

    Could it be that you now have only a single window, instead of a slpit window view? If that's the case, doubleclick on the dimple in the middle of the splitter bar at the bottom of your Mail window.
    -mj
    [email protected]

  • Why is Refresh Sheet not showing me the parameters for report?

    I have a really large amount of data showing up in my report. It is taking forever (times out after 30 minutes) for my data to display. In the past, I have cancelled and then used the refresh sheet to constrict my report parameters and then rerun the report. However, today, after I select cancel, and then Refresh Sheet, the report just kicks off again and times out again without showing me my parameter list and without allowing me to specify my running parameters?
    Why is this happening and how can I get my Refresh Sheet to allow me to specify values for my execution parameters.
    Thanks,
    Cherie Machler

    Hi Cherie,
    Is this problem happening in Viewer?
    If yes, I had a SR open with oracle for this problem. It was recently closed without resolution. It is a problem that they are not willing to fix. My scenario is that I open a report with multiple worksheets that are long running and with multiple input parameters. I run the report with the default parameters. Realize I didn't input the correct thing, so I cancel the report. If I cancel at 3 seconds or less, my session hangs and I have to start a new internet session. If I cancel beyond 13 seconds, the cancel takes me back to the select worksheets screen but only allows me to run the report - no changing of parameters allowed.
    Message I received from Oracle:
    "I have received a response on Bug 5576575 - CANNOT CHANGE THE PARAMETER VALUES AFTER CANCELLING A
    REPORT IN VIEWER and internal enhancement request Bug 6007588 - NEED TO CHANGE THE PARAMETER
    VALUES AFTER CANCELLING A REPORT IN VIEWER.
    The bug applies to 10.1.2.54.25 also. Regarding allowing the parameters to be changed bug 6007588 the
    response " in order to fix this,it would need a change in architecture on how we capture and save state
    information. This is unlikely ".
    It will not be possible at this time to change the parameters when cancelling a query in Viewer."
    NOTE: If you read the bugs, they were logged against versions prior to 10.1.2.54 which means they should also apply to 10.1.2.50.
    Regards,
    Nancy

  • Why Firefox 4 can not plug in the NoDoFollow from SEO Rapid Profit Formula It said Not Compatible, what to do now ?

    I am installing new program of Rapid Profit Formula called the SEO Quake but Firefox rejected it because it is not compatible with Firefox 4 (I have installed Firefox 4 currently). how to continue installed the "NoDoFollow" from Rapid Profit Formula ?

    The author has not yet updated NoDoFollow, and I do not see any note here about when it might be updated:
    https://addons.mozilla.org/en-US/firefox/addon/nodofollow/
    If you trust '''unofficial''' versions, you can get an updated version from this blog. I don't think anyone has verified it, but you can read comments to see whether you trust it:
    '''unofficial''': http://www.jayceooi.com/2011/03/22/download-nodofollow-1-3-add-on-for-firefox-4/
    I also saw a recommendation on a different site to use a Greasemonkey userscript instead. If you have the Greasemonkey add-on, you can install the script here:
    http://userscripts.org/scripts/show/26418
    I haven't tried it myself.

Maybe you are looking for

  • Sale order before the regeneration of ABAP report: RSM13000

    Hi there, I am just wondering about something. After we installed support packages, users could not get any sales order without to get any error message and I we could only see  an error message via SM21 which says: Run-time error "LOAD_TYPEPOOL_VERS

  • N79 or N82

    Hello all, i am gonna be getting one of these two and i had a few questions 1. Which is better for texting? 2. Which has the better audio quality through the 3.5mm jack? 3. How reliable are they? Are there any current firmware crashes,lock ups, reset

  • PDF file as code in email message

    Hi, I received an email with a PDF file attached. This file I can open on a Windows pc or via webmail perfectly, but in Mail the attachment is part of the message (in code): <---start message---> "Dear ..., Hereby you receive the pdf file... %PDF-1.4

  • TS1368 Can't sign-in to my own account. I'm very sure my user id and password are correct. Is it temporary problem? What should I do?

    I've tried to connect to iTune store and my account from both iPhone4 and MacBook Air but it's unsuccessful. I'm very sure my user id and password are correct. Is there ny temporary server problem? Please advise what should I do?

  • LONGPOST.LOG Errors during Upgrade from 4.6C to ECC 6.0

    Dear all, We have received the below errors during our upgrade from 4.6C to ECC 6.0. Basically we have received three types of errors: 1. 4PETG065 RSUPGDEC: Table/structure "BAPE_VBAK" (component "SD-SLS" ) enhanced illegally: Error "2" 2. A2PESEEF_B