Can't get a class to display properly (TabPanel awt)

Hi, thank you checking this out.
I have renewed my interest for Java but need to start at the very beginning again. I have actuallu read up on AWT. Yes yes, I will follow up with Swing but for now I am just testing the waters again.
However, I cant manage even the simplest of tasks. I want to display a TabPanel and do see something in the created Frame but something is not correct (it certainly is not a TabPanel). Would you have a clue as to what I am doing wrong? The TabPanel is an OpenSource example and I actually do not expect anything wrong with it. It does work with getMinimumSize so I might skip a beat there. Any comment is appreciated.
This is what I build:
import java.awt.Frame;
import java.util.*;
public class TabPaneltest {
    public static void main (String args[]) {
          Frame f = new Frame();
          f.reshape(176,10,800,600);
        TabPanel T = new TabPanel();
          f.add(T);
          T.setVisible(true);
          f.show();
//                  (Still have to exit properly etc)// This is the TabPanel class as I found it, I am sure this is a usable error free component:
// Free to use, can't redistribute for profit
// Original by Pete Yared.
// Modified by Jean-Guy Speton ([email protected]).
//   Version 1.0.
//   * Changed name to TabPanel to differentiate modification tree
//     from original.
//   * JDK 1.1 API compliant.
//   * CardLayout used to simplify implementation.
//   * Added getMinimumSize() and getPreferredSize().
//   * Tab Font stored in state and created only once.
//   * Tab in index 0 now default selected.
//   * No longer repaints when user reselects selected tab.
// Still free to use, still can't redistribute for profit.
import java.awt.*;
import java.awt.event.*;
import java.util.Vector;
public class TabPanel extends Panel implements MouseListener
     protected Vector labels = new Vector();
     protected Vector panels = new Vector();
     protected Panel cardPanel = new Panel();
     protected int[] tabWidths;
     protected String selectedPanel;
     protected Font tabFont = new Font("Dialog", 12, Font.PLAIN);
     protected Insets insets;
     protected int tabHeight = 21;
     protected int tabWidthBuffer = 13;
     protected int insetPadding = 14;
     public TabPanel()
          insets = new Insets(insetPadding + tabHeight, insetPadding,
                                   insetPadding, insetPadding);
          setLayout(null);
          addMouseListener(this);
          cardPanel.setLayout(new CardLayout());
          add(cardPanel);
//  Sorry, can't put in full class because of a limit on the characters in the message.
//  Full code at: http://www2.blaze.ca/~jspeton/java/tabpanel/TabPanel.java     // As said, I'd love to have this thing working as to (start) give me back some 'feel' for java. (It would // look so much better than 'Hello World':) Your remarks are appreciated.
// Wim

EsbachW wrote:
Hi, thank you checking this out.
I have renewed my interest for Java but need to start at the very beginning again. I have actuallu read up on AWT. Yes yes, I will follow up with Swing but for now I am just testing the waters again.It is a bad idea, in this day and age, to ask AWT questions. The reason is that AWT coding is so distant (in time) for GUI programmers of this millennium, that they forget the details!
Besides that..
However, I cant manage even the simplest of tasks. ...Using an Open Source class is not 'the simplest of tasks'. Note also that:
a) We generally don't support 3rd party APIs on the forums. ..and..
b) Most people will absolutely refuse to..
... // Sorry, can't put in full class because of a limit on the characters in the message.
// Full code at: http://www2.blaze.ca/~jspeton/java/tabpanel/TabPanel.java
.....follow a link to 'other code'. It is generally considered that if code is short enough to constitute 'an SSCCE' *(<- link),* then it is something short enough for them to look at. Any longer, and you've lost them.
An SSCCE is not only a short form of code, but very specific. I recommend you read up on the SSCCE, and post code in that specific form.
If you want some beginner projects to get you going again in Java, I recommend you put GUIs aside for a while do stuff intended to run from the command line. Use the Scanner class if you need interaction. When you get back to GUIs, launch directly into Swing, because that is the toolkit about which best help is to be had (and also includes a JTabbedPane supported by Sun!).

Similar Messages

  • I'm generating an actionsript app with Flash, but I can't get the effects to display properly

    When I publish the app as CPU, the effects display, but the video runs choppy. When I generate it as GPU, the video runs fine, but no of the effects display.

    Sorry, I'm mixing to different programs terminologies. I have numerous symbols with the "drop shadow" filter applied. When I publish the app, to have the filters show I have to publish as CPU, but that makes the app run very choppy. When I publish as GPU, the app works fine, but none of the filters will display.

  • How do I get PowerPoint presentation to display properly without having PowerPoint?

    Suggestions on how to get PowerPoint presentation to display properly aligned on MacBookPro? These are available for download as ppt, pps & pdf
    Our co just came out with new presentations in PowerPoint. They are going toward iPad2, & suggest using Documents to Go on an iPad. But I'm trying to play the presentation on my MacBookPro 13" (April 2010), Snow Leopard. I have iWork & so it opens in Keynote which does not display it quite right. The alignment is off--it appears that the relationships between text boxes isn't quite the same. So there is a long table with arrows pointing to the totals at the bottom but the arrows are over the text.
    I tried looking at it in Parallels 5 (Win 7) & it opened in Open Office. That looked better, but several slides aren't aligned right. They have horizontal lines between bullet points & the lines "creep" so that as it goes down the page the lines move up closer to the text & then on top of the text.
    Not real up on PowerPoint or Keynote, but I'm guessing maybe the resolution or something is different that throws the alignment off. I am learning Keynote but had just dabbled with PowerPoint & of course had played slide shows created in PowerPoint that had been sent to me which usually didn't have as much text. Also if its just me looking at it, I can manage if it isn't lined up right, but to show to others, it needs to look
    I need these to display properly since this is something to use with prospective clients. Also the presentation is designed so that different offices can select which slides they want to use. Our office is not using all of them. So I need to be able to select the slides as well as have them display properly.
    Wondering if I could choose a power point reader with the pps to play it rather than having Keynote if that would work, but not sure how to do that.
    I think the pdf displayed properly, but don't think I can select slides with that.
    So how can I be able to select PowerPoint slides, & get them to display properly?  At 1st I thought it might be that I didn't have the font used, but it shows as Trebuchet MS which also shows in my font list on the mac side.
    I would prefer not to have to buy PowerPoint & would prefer to not have to use Parallels or Bootcamp, although I can if needed. I purchased Outlook 2007 for Windows which I used to use to sync with my old Win mobile phone. thankfully I was able to get rid of that & get an iPhone & now use the iLife aps rather than needing Outlook.
    Also related to this presentation are related files that can be downloaded in either mp3 or mp4.  I really don't know what the difference is or why choose one or the other.
    Message was edited by: KathiMR

    OK, I found what seems to work. That is to open the actual ppt version of the download (not the one that had already been opened & saved in Keynote) in Open Office. So I had to open Open Office & then navigate to the file to open it so that it didn't open in Keynote.
    At a One to One training on Keynote where I asked for help with this today he noted that it showed that the presentation had been created in an older version of PowerPoint--apparently 2003 for Windows which could explain some of the issues.
    Opening it in Open office it displayed mostly ok.  There were 2 or 3 or so slides where I had to tweak horizontal lines between bullet points that had crept up so some where through the text rather than under it. So I just selected the lines & nudged them into position.
    Its not perfect & for some reason, some of the lines seem a hair thicker than others (which I guess I could go back & figure out how to use the line thickness tool to adjust, but think I will leave well enough alone for now).
    As near as I can tell, this seems to work about equally well doing this on the Mac side or in Parallels in Windows 7. So will stick with the Mac side.
    This allows me to run the slide show with me controlling when the different bullet points, etc display. It didn't have any exotic animations or transitions--just rather plain vanilla ones.

  • HT5219 How can i get the Apple Thunderolt display to show Windows 7 i run on my system using Paralells desktop..

    How can i get the Apple Thunderolt display to show Windows 7 i run on my system using Paralells desktop..

    You may need to set the slider at the upper-right corner of the Control window to something other than the extreme left-most position:
    Hope this helps.

  • I have an ipod touch 2 and rebuilt my laptop.  Reinstalled ITUNES and can't find my applications on ITunes after login.  I tried to activate Itunes again but it didn't.  How can I get my applications to display on ITUNEs?

    I have an Ipod Touch 2 and rebuilt my laptop.  Reinstalled ITUNES and can't find my applications on ITunes after login.  I tried to activate Itunes again but it didn't.  How can I get my applications to display on ITUNEs?

    It sounds like you essentially have a new computer and unless you restored from a backup your iTunes library would be empty.  You can transfer your iTunes purchases from your iPod to the computer by:
    iTunes Store: Transferring purchases from your iPhone, iPad, or iPod to a computer
    SInce you changed syncing computers. after you move the stuff you need to restore the iPod to factory defaults and sync the stuff back to your iPod.  If you had the iPod backup file you could restore from backup.
    If you have non-iTunes pruchases you can copy them to your computer by using one of the third-party programs discussed in this previous discussion:
    Best iPod to PC

  • Than how can i get java class by using it's class file?

    Hi
    After compilation of a java program, it creates a class file.
    After getting class file suppose class file has been deleted.
    Than how can i get java class by using it's class file?
    Thanks in advance.

    get a decompiler and run your class file through it--I'll assume you want the source code back and that you are not trying to recover a missing class file by attempting to use the class file that is missing--if it's missing, then I've not a clue on how to get it back by using what is already missing.
    BTW: many of your compilers have source control--if it does, just restore your missing file.

  • How can I get rid of the display of the last played music-title

    How can I get rid of the display of the last played music-title
    When playing a music-title the name of the title and it's progress is displayed in the box at the top of iTunes, even if the music is already stopped or ended. This display is impeding f.i. when copying music-albums to iPhones and watching the progress. Can anyone tell me please how to make the display of the last played music-title disappear?
    Thank you very much in advance.
    Hans M

    OK, thank you very much, fiend.
    However: Since yesterday afternoon my e-mail-acount is being flooded with 50+ e-mails every few hours which are not at all related to my question. I'm copying the properties of one e-mail as a sample. Could you please organize this flood to stop or tell me what to do?
    Thank you very much!
    Hans M
    Return-Path: <[email protected]>
    Delivered-To: [email protected]
    Received: (qmail 11232 invoked from network); 2 Jan 2014 21:38:42 -0000
    Received: from unknown ([172.18.1.109])
              by mailbox11.aon.at (qmail-ldap-1.03) with QMQP; 2 Jan 2014 21:38:42 -0000
    Delivered-To: CLUSTERHOST smarthub76.res.a1.net [email protected]
    Received: (qmail 9065 invoked from network); 2 Jan 2014 21:38:41 -0000
    X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on
    WARSBL504.highway.telekom.at
    X-Spam-Level:
    Received: from redstreak.apple.com (HELO bz.apple.com) ([17.151.62.54])
              (envelope-sender <[email protected]>)
              by smarthub76.res.a1.net (qmail-ldap-1.03) with RC4-MD5 encrypted SMTP
              for <[email protected]>; 2 Jan 2014 21:38:41 -0000
    X-A1Mail-Track-Id: 1388698720:8973:smarthub76:17.151.62.54:1
    Received: from nwk-jivep-lapp04.corp.apple.com ([17.34.26.3])
    by bz.apple.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0)
    64bit (built Aug 10 2011)) with ESMTP id <[email protected]> for
    [email protected]; Thu, 02 Jan 2014 13:38:40 -0800 (PST)
    Date: Thu, 02 Jan 2014 13:38:39 -0800
    From: Apple Support Communities Updates <[email protected]>
    Reply-to: discussions-replies <[email protected]>
    To: Hans M <[email protected]>
    In-reply-to:
    <2-24330225-3-6714313-1388532858380-2-24354104-3-1039882-1388697859204.jivesbs.ji vemailuser@https://discussions.apple.com/>
    References:
    <2-24330225-3-6714313-1388532858380.jivesbs.jivemailuser@https://discussions.appl e.com/>
    <2-24330225-3-6714313-1388532858380-2-24353958-3-6714313-1388696827692.jivesbs.ji vemailuser@https://discussions.apple.com/>
    <2-24330225-3-6714313-1388532858380-2-24354104-3-1039882-1388697859204.jivesbs.ji vemailuser@https://discussions.apple.com/>
    Subject: [iTunes for Windows] - Re: Cannot follow these instructions
    "Where are my iTunes files located?" [7h40p2-20wvf-ehzw3]
    MIME-version: 1.0
    Content-type: multipart/mixed;
    boundary="----=_Part_577492_1482299802.1388698719437"
    Auto-submitted: yes
    Content-disposition: inline

  • How can i get the speakers to work properly? they have a lot of static and scratchiness from them

    how can i get the speakers to work properly, they have a lot of static and scratchiness coming from them?

    I found my answer in this thread:
    https://discussions.apple.com/message/16646999#16646999

  • How can I get iTUNES library to display renamed files and folders (renamed with Windows Explorer)?

    How can I get iTunes library to display the new names and organisation of tracks and albums (ie files and folders) that I have renamed and reorganised (using Windows Explorer) having previously imported them using iTunes?
    (Even when I relocate "lost" tracks in iTunes (using the drop down menu facility to view in Windows explorer), although iTunes will then play the track, and knows where to find it, it refuses to display the track with its correct (new) name, or show it the correct (new) album.  That means I have lots of things called "Untitled" and "Track 01" etc, all of which have actually been renamed, but iTunes does not seem to have the capability to recognise the changes and update its library listing.  Another example - a Tchaikovsky CD with 3 major works in 13 tracks insists on displaying in iTunes as 13 tracks in one album, despite the fact that I have reorganised the tracks into 3 albums - two being Swan Lake and The Nutcracker - and renamed the individual tracks to a more useable format.)

    Thanks for your replies ckuan
    I agree with Tgod that your first solution does not work.  It appears unpredictable whether the old or new file names are listed when you drag the folders into iTunes from Windows Explorer.  The folder structure is completely missing.  I reckon if you have to muck around spending days/weeks/months finding out how to fix links to a secret meta-file (obviously designed by some deep-cover microsoft worm working in the Apple!), then it's pretty obvious that almost any alternate way of doing this would be better.   Bye bye iTunes!!
    Incidentally, I tried several other things that (if the software was designed intuitively) should work, but give disastrous results:
    1) when deleting the library listing in iTunes, it gives you two options - one is to remove the listings to the Recycler.  Be aware that IF you select that option, it removes not only your library listing, but also your ACTUAL MUSIC FILES to the Recycler.  Moreover, it does NOT remove the insidious secret meta-file that is what apparently keeps rewriting old names over your carefully renamed file names, and keeps totally ignoring your carefully designed folder (album) structure.  OK - not a complete disaster, as I realised and went hunting through the chaos in the Recycler to recover all my files.  No thanks to the genius who designed this brilliant feature!
    2) after deleting the library listing in iTunes, I attempted to import just the folders that I wanted.  iTunes refused to allow me to do that, and proceeded to try to import every frigging music file it could find on my whole hard drive, in apparently random fashion into the library.  Whoever thought up that doozy either never ever tried to use or market test it, or has modified their mind rather too many times with artificial substances so their brain is like muesli chop suey.
    3) oh why go on, it's too depressing ...

  • In wich jar can i get this class org.apache.batik.dom.util.DOMUtilities

    please let me know in which jar file can i get this class and tell me the location for downloading
    org.apache.batik.dom.util.DOMUtilities;
    import org.w3c.dom.Document;

    Hai,
    I think you have to use the xml-apis.jar file from the batik project, which has the class org.apache.batik.dom.util.DOMUtilities.
    Yogesh.

  • I can't get bookmarks toolbar to display

    I can't get bookmarks toolbar to display. I've checked it to display, unchecked, rechecked restarted FF with and without BM toolbar set to display...
    I've tried to follow instructions I found on the web but no Joy.
    What's up!

    Maybe your localstore.rdf are corrupted, try rename or delete it, first go to your profile, close Firefox, delete or rename the localstore.rdf file then restart Firefox, maybe you need unhide the hidden files and folders!
    *[http://kb.mozillazine.org/Show_hidden_files_and_folders]
    *[https://support.mozilla.org/kb/profiles-where-firefox-stores-user-data Profiles]
    Also try go to '''View''' >> '''Toolbars''' >> '''Customize''' in this window look to your bookmark toolbar, if you find it just drag and drop it and put where you want.
    *[https://support.mozilla.org/kb/customize-firefox-controls-buttons-and-toolbars Customize toolbars]
    Also:
    *[http://kb.mozillazine.org/Preferences_not_saved]
    *[https://support.mozilla.org/kb/how-to-fix-preferences-wont-save Preferences won’t save]
    *[https://support.mozilla.org/kb/reset-firefox-easily-fix-most-problems Reset Firefox]

  • How can I get pubished parameters to display the available settings

    how can I get pubished parameters to display the available settings?

    according to the online help, I'm supposed to click on Title to get to the titles settings as follows
    "Adjust a title’s settings
    You can modify a title’s default settings in the Title inspector.
    Select a title in the Timeline.
    Choose Window > Show Inspector (or press Command-4), and click the Title button at the top of the pane that appears.
    Adjust the available settings as needed.
    Note:  You can also keyframe many of the settings in both the Title and Text inspectors."
    Gsoing to the Text inspector, there does not seem to be anything in the menu where I can change the color of the text.   Based on the photo that appears with the above instructions --it appears the ability to change ink color is under the Published Parameters that is the menu I cannot get to 'drop'

  • Can't get my class's getter method to work properly.

    Hello, I am new to Java programming, although I come from C and C++. This is my first post. I am working on a basic Library application that can Checkout and Return books. Eventually I would like to add the ability to read from and write to an XML file containing data for every book.
    My problem right now is that I cannot get my getter method within my Book class to work properly. When I call getData() from within main, and pass the appropriate arguments, instead of filling the variables with that object's data, it leaves them blank! Please help me.
    Here is my method within the Book class, the person and id_num are private.
    /* Gets general Book Instance Data and fills parameters with it */
         public void getData(String n, int num, String c, String d)
              n = this.person;
              num = this.id_num;
              c = this.checkout_date_string;
              d = this.due_date_string;
         }Here is how I am attempting to use it in main:
    String name = "";
    int number = 0;
    String checkout = "";
    String due = "";
    Book book1;
    /*Sets person = John Smith and id_num = 10763*/
    book1 = new Book("John Smith", 10763);
    /*Gets Checkout (todays) date and sets a due date in 2 weeks*/
    book1.Checkout();
    book1.getData(name, number, checkout, due);
    System.out.println("Book1:\n Checkout Date: " + checkout +
                             "\n Due Date: " + due + "\n Is it late: " + book1.isLate() +
                             "\n Person who checked it out: " + name + "\n ID number: " + number +
                             "\n ");Then, Here is the Output:
    Book1:
    Checkout Date:
    Due Date:
    Is it late: false
    Person who checked it out:
    ID number: 0
    Edited by: 987158 on Feb 9, 2013 11:52 AM

    >
    Well I went ahead and made separate methods to return each value. I suppose that will work just as well, especially since now I don't have to declare a bunch of strings and int's to hold the data and pass to the method.
    >
    Well this would never work anyway
    public void getData(String n, int num, String c, String d)None of those can be changed within the method. Strings are immutable and 'int' is passed by value. Each of those parameters will have the same value after the method exits as they did before it was called.
    Your book class should be using 'setters' to set the value of its instance variables.

  • Can't get Parent class

    I have created three classes.
    JMainFrame : JFrame
    JMainFramesDlg: JDialog
    JMainFramesDlg1:JDialogJMainFrame opens JMainFramesDlg, after that I press a "Edit" button on the JMainFramesDlg and it opens JMainFramesDlg1
    if (jdlgEdit == null) {
    jdlgEdit = new JMainFramesDlg1(); }
    jdlgEdit.setVisible(true);Now, I am in this child Dialog (Edit) and made some edition, changes and press OK, how can I from JMainFramesDlg1 get the instance of JMainFramesDlg and JMainFrame, I want to make some changes in this windows, if some changes in Edit Dialog took place.

    Do you have a small sample for that? How can I get the feedback from the Dialog window?
    Well, you're extending Dialog, so you can do it any way you like.
    I'd quite often use one of three techniques:
    1. for simple data, use a getter (eg "public String getPassword()") which shows the dialog modally, and then returns the value stored in a text field in it
    2. for more complex data, use a method like "public void requestInput()" which shows the dialog modally then populates fields with the input data, which can be retrieved via methods like "public String getItemName()" or "public int getQuantity()"
    3. pass in an object to the dialog, and have the dialog display and operate on it directly - eg pass it a "User" object and have the dialog present text fields which allow direct editing of "name" or "password" or whatever - then all you need is "new UserEditorDialog(myUser).show()" and you're done

  • How can I get Firefox 4 to display the URL of active tabs in the location bar so I can see and copy it?

    The only URL that I ever see in the location bar is the last one I typed there. No matter which tab I activate, the last typed URL is displayed. When I need to copy the URL of an active tab to paste into an email or something I can't see it.
    The location bar used to display the URL of each active tab and you could simply click in the address field and the URL would be highlighted so you could edit/copy it or jump to the end of a very long URL to see the final file name.
    I can't get this feature to work and I really need this feature as I need to copy URL's quite often. When I have multiple tabs active I sometimes forget which one is for which domain and need to see the URL. It is very annoying to surf blind.
    Please help me with this issue as quickly as possible so I can once again do my work easily and with the firefox browser instead of chrome. :(

    A couple of possible causes.
    The first is the file that stores details of browsing history and bookmarks is corrupt. For details on how to fix that see http://kb.mozillazine.org/Locked_or_damaged_places.sqlite
    Another possible cause is an add-on interfering with the location bar. To test this, use the procedure in this link - https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

Maybe you are looking for