Reading HashTable into JPanel. Help Needed,

Folks,
I need to display from a Hashtable into a JPanel.
Example:
Monday Weather [More Info Button]
Tuesday Weather [More Info Button]
If you click on the Button,you get a display for Monday Weather..etc
But this is not working.!!!
Can anyone please alter this code so I can get the correct output??
Is this a correct way or is this possible??
My code is :
public class JPanelDemo extends JFrame {
private JPanel JButtonPanel;
private Hashtable ht = new Hashtable();
Enumeration enum;
public JPanelDemo() {
super("JPanel Demo");
JButtonPanel = new JPanel();
Container c = getContentPane();
// Put Data into Table.
ht.put("Monday Weather", new JButton("More Info"));
ht.put("Tuesday Weather", new JButton("More Info"));
enum = ht.keys();
while(enum.hasMoreElements()){
String str = (String) enum.nextElement();
JButtonPanel.add(str,ht.get(str));
c.add(JButtonPanel);
show();
public static void main(String[] args) {
JPanelDemo JPanelDemo1 = new JPanelDemo();
}

Hi,
No luck.Just 'More Info' being displayed at the Center of the Screen.
I have added the JPanel in this code,and this works all right.
Do we need to have a JPanel to display buttons??
Also,I need to get the Label and Button below each other?
What can I do for this?
This is my code:
public class JPanelDemo extends JFrame{
private JPanel JButtonPanel;
private Hashtable ht = new Hashtable();
Enumeration enum;
public JPanelDemo() {
super("JPanel Demo");
JButtonPanel = new JPanel();
Container c = getContentPane();
// Put Data into Table.
ht.put("Monday Weather", new JButton("More Info"));
ht.put("Tuesday Weather", new JButton("More Info"));
ht.put("Wednesday Weather", new JButton("More Info"));
// Enumerate thru Keys.
enum = ht.keys();
while(enum.hasMoreElements()){
String str = (String) enum.nextElement();
JButtonPanel.add(new JLabel(str));
JButtonPanel.add((JButton)ht.get(str));
c.add(JButtonPanel);
show();

Similar Messages

  • Putting images into videos, help needed

    hi, im new to adobe after effects..i would be happy for quick help...
    i have 3 videoclips (commercials)...and in each, there are several characters...i need to take heads from pictures of people i have (i photographed people with white background)..and insert them into the video...so that the head would match and move with the original face...
    any tutorial or advice on this (if you understood what i need) ??
    please, thanks alot !!

    Not sure how good the result will be, but the outline of one way would be:
    1. Since you said 'photographed' I assume you have still images, so use PhotoShop to cut out the still images of the heads.
    2. Import the head image into AE.
    3. Use Motion Tracking to generate keyframes for following the heads in the original movie.
    4. Use this data to make the photo heads follow the motion track.
    5. Use keyframes for scale, position and rotation to orientate/size the new head to match the old one. May need to make new > old to avoid edge artifacts.
    Use Google to find tutorials on Motion Tracking.
    It is not as easy to get good results as it might sound above, especially if you are very new to AE.
    Not at all sure how realistic it will look if the new heads are static on moving bodies.
    Good luck!

  • Help needed to loadjava apache poi jars into oracle database.

    Help needed to loadjava apache poi jars into oracle database. Many classes left unresolved. (Poi 3.7, database 11.1.0.7). Please share your experience!

    Hi,
    The first 3 steps are just perfect.
    But with
    loadjava.bat -user=user/pw@connstr -force -resolve geronimo-stax-api_1.0_spec-1.0.jar
    the results are rather unexpected. Here is a part of the log file:
    arguments: '-user' 'ccc/***@bisera7-db.dev.srv' '-fileout' 'c:\temp\load4.log' '-force' '-resolve' '-jarsasdbobjects' '-v' 'geronimo-stax-api_1.0_spec-1.0.jar'
    The following operations failed
    resource META-INF/MANIFEST.MF: creation (createFailed)
    class javax/xml/stream/EventFilter: resolution
    class javax/xml/stream/events/Attribute: resolution
    class javax/xml/stream/events/Characters: resolution
    class javax/xml/stream/events/Comment: resolution
    class javax/xml/stream/events/DTD: resolution
    class javax/xml/stream/events/EndDocument: resolution
    class javax/xml/stream/events/EndElement: resolution
    class javax/xml/stream/events/EntityDeclaration: resolution
    class javax/xml/stream/events/EntityReference: resolution
    class javax/xml/stream/events/Namespace: resolution
    class javax/xml/stream/events/NotationDeclaration: resolution
    class javax/xml/stream/events/ProcessingInstruction: resolution
    class javax/xml/stream/events/StartDocument: resolution
    class javax/xml/stream/events/StartElement: resolution
    class javax/xml/stream/events/XMLEvent: resolution
    class javax/xml/stream/StreamFilter: resolution
    class javax/xml/stream/util/EventReaderDelegate: resolution
    class javax/xml/stream/util/StreamReaderDelegate: resolution
    class javax/xml/stream/util/XMLEventAllocator: resolution
    class javax/xml/stream/util/XMLEventConsumer: resolution
    class javax/xml/stream/XMLEventFactory: resolution
    class javax/xml/stream/XMLEventReader: resolution
    class javax/xml/stream/XMLEventWriter: resolution
    class javax/xml/stream/XMLInputFactory: resolution
    class javax/xml/stream/XMLOutputFactory: resolution
    class javax/xml/stream/XMLStreamReader: resolution
    resource META-INF/LICENSE.txt: creation (createFailed)
    resource META-INF/NOTICE.txt: creation (createFailed)
    It seems to me that the root of the problem is the error:
    ORA-29521: referenced name javax/xml/namespace/QName could not be found
    This class exists in the SYS schema though and is valid. If SYS should be included as a resolver? How to solve this problem?

  • Help needed. I have a 3TB external hard drive partitioned into 1TB's. I used one partition as backup for the main computer hard drive. But now it is greyed out as shown in the disk utility and its name changed, i dont know how that happened, i tried verif

    Help needed. I have a 3TB external hard drive partitioned into 1TB's. I used one partition as backup for the main computer hard drive. But now it is greyed out as shown in the disk utility and its name changed, i dont know how that happened, i tried verifying and repairing it but had no luck. I also tried mounting and unmounting it but still no solution. Anyone to help please?

    Looks bad. I would strongly advise backing up the stuff on the other two partitions as soon as possible in case the rest of the drive goes wrong.
    Beyond that, Disk Utility has limited abilities to repair disks, DiskWarrior uses a different approach and might, emphasis might be more successful. It has certainly done the job for me in the past when Disk Utility could not.
    See http://www.alsoft.com/diskwarrior/

  • Help needed with 'Conditions' for field with read only on demand

    Hy guys,
    I really need your help now, i have two items named P22_LOGIN_TYPE (..wich can be 'Default' or 'Special') and P22_PASSWORD, i need to turn to 'read only' the second item when the first item is 'Default', i'v tryied the conditional option but with no success, i know is managed from there but it's not working for me, it seems that i don't know exactly how to do it. By the way, i have APEX 2.2.
    I need an exact guide (explanation) on how to do it, thank you very much.
    Best regards,
    Victor

    Firstly you could set your First item to be a select list with submit. Make the branch go to the same page.
    Secondly, on the read-only conditions for your second item, use the condition when item in expression 1 = value in expression 2, and set that to 'Default' in expression 2.
    Essentially this will re-submit your page when you make a selection either 'Default' or 'Special'. If 'Default' is selected, then the PASSWORD item will be rendered as read-only. If you don't want to display the PASSWORD item at all, you can put the above condition for the read-only, into the conditions section of the item.
    Hope this helps and is not too confusing. It reads a lot worse than it actually is ;)
    Cj

  • Urgent help on reading data into ByteBuffer

    Hi,
    I am trying to read data into ByteBuffer using SocketChannel.
    The following code working fine but the problem is with ByteBuffer size.
    The data varies from request to request .
    How do I read data into ByteBuffer with out specifing size .
    The problem with size is some records has more than 500 bytes and some are less than 500 bytes.
    I want to read all the data .. ( even if it has more than 500 bytes ..)
    How do i solve this problem ..
    Is there any way to read data dynamically from socket channel ...
    Any help on this please ...
    The data I have to read is in the following format ..
    XXX ... yyyyy
    AAA
    BBBBBBBBBBBBBBBBBBBBBB
    CCCCCCCCCCCCCCCCCCCC
    DDDDDDDDDDDDDDDDDDDDDDd
    etc ...
    Here is my Code:
    public ByteBuffer getResponse(byte[] request) throws Exception {
    int lenth = 500;
    InetSocketAddress isa = new InetSocketAddress("ip", port);
    SocketChannel channel = SocketChannel.open(isa);
    ByteBuffer requestBuffer = ByteBuffer.wrap(request);
    channel.write(requestBuffer);
    ByteBuffer responseByteBuffer = ByteBuffer.allocate(length);
    int num = 0;
    while (num == 0 ) {
    responseByteBuffer.rewind();
    num = channel.read(responseByteBuffer);
    channel.close();
    return responseByteBuffer;
    Thanks.

    Two possible solutions
    1. Read in as many bytes as you can until you hit the EOS OR you fill the byte buffer. If you fill the buffer (try checking for BufferUnderFlowException), you could move the read bytes into a dynamically allocated memory Collection such as an ArrayList. When you hit the EOF, you could then do whatever else you need to do from then on.
    2. I use this option: Implement a site local protocol for transmitting data. Provide a header first containing 2 ints (compressed size, uncompressed size - so you can also use compression when sending), and send the remainder as a payload.
    Therefore
    Read in the header first (always 8 bytes)
    Then extract those integer values. They will tell you how much is being sent. Set you byte buffer for the payload to be the correct size for this transmission.
    Reset and wait for next connection

  • I have just enrolled to study and my course is online. in order to view any of the course content, i need macromedia adobe flash paper to be able to read anything. Please help....

    I have just enrolled to study and my course is online. in order to view any of the course content, i need macromedia adobe flash paper to be able to read anything. Please help....

    Use a different device.
    Adobe did not develop Flash for iOS devices and has ended all Flash development for all mobile devices.
    You could try a different browser from the App store such as Skyfire or iSwifter.

  • Help needed with Reader Integrated Key

    Hi,
    I have develop a plug-in and apply for Reader Integrated Key License. This plug-in have been tested with acrobat and reader professional and it is working.
    I follow the advice from the above website and use RIKLATools.zip to created the pair.
    i have just receive the Reader Integrated Key from Adobe,I tried all method but the key  does not work with the plug-in. What is the fool proof way to integrate my Reader Integrated Key with the plug-in to get a digtally signed plug-in?
    Urgent help needed as we are submitting the plug-in to client.
    many Thanks in advance
    Regards
    Jia hao

    Thank you lrosenth, i will email them

  • HT4489 Hi all, I have .vcf contact file exported from yahoo and need to import it to cloud. When I try to import it I get an eror "53 contacts not imported, eror reading vCards". Pls help ty

    Hi all, I have .vcf contact file exported from yahoo and need to import it to cloud. When I try to import it I get an eror "53 contacts not imported, eror reading vCards". Pls help ty

    1 - Select  the thumbnail of one of the problem photos and use the File ➙ Reveal in Finder ➙ Original menu option.  This will take you to the folder containing the original file with that file selected by the Finder. 
    You can also use Find Any File to search for that file (get the file name from the Info pane in iPhoto). You will find the thumbnail version and maybe an edited version also.  Made sure what is found is the large, original version and note were it's located.  Search all of your drives with FAF just in case.
    If you don't fine the full sized version then the only recourse is to use a file recovery application like   SubrosaSoft FileSalvage on your drives to see if any of your full sized photos can be recovered.   If you find enough files to make the purchase of the software worthwhile buy it and recover the files.  However, since it may have been quite a while since you discovered the missing originals it seems unlikely you'll be able to recover any due to being overwritten.
    2 - book projects are just entries in the library databases and can't be exported to another library. 

  • Troubleshoting help needed:  My iMac keeps crashing and restarting with a report detail: "spinlock application timed out"  What can I do to fix this?timed out"

    Troubleshooting help needed:  My iMac keeps crashing and restarting with a notice: "Spinlock application timed out"  What can I do?

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the page that opens.
    Select the most recent panic log under System Diagnostic Reports. Post the contents — the text, please, not a screenshot. In the interest of privacy, I suggest you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header and body of the report, if it’s present (it may not be.) Please don't post shutdownStall, spin, or hang reports.

  • HELP NEEDED!! (please) CS6

    HELP NEEDED!  I have been working for 3 days in a "new doc". Of course i have saved several times (control+s)
    but i do not remember it asking me about file name or folder. Today my comp crashed and i do not find the file. Just found 2 files (a tmp and one with no extension)
    : one with 174 mg and another one with almost 2 gb. Is there any possibility to recover my work? Photoshop did not oppened a thing when i restarted comp
    Thanks in advance

    The TMP file is your Scratch Disk file, and cannot be "recovered" to an Image file.
    Your second file might be almost anything. Though designed more for video files, both G-Spot and MediaInfo (both free file info utilities), CAN read several Still Image file types, and might help point out what that file (the one with no extension) really is. OTOH, as it could be almost anything, it could be that there is no header info in the file, for either to read.
    Good luck,
    Hunt
    PS - Before I did much additional work, I would investigate WHY your computer shut down. If you are on a PC, I would go into Event Viewer, at the time of the shutdown, and see if you can track down any warning, or error messages, in both the System and Applications Tabs. I am pretty sure that a Mac has similar, but have not a clue where, or even what it would be called.

  • Help needed with itunes

    help needed with itunes please tryed to move my itunes libary to my external hard drive itunes move ok and runs fin but i have none of my music or apps or anything all my stuff is in the itunes folder on my external hard drive but there is nothing on ituns how do i get it back help,please

    (Make sure the Music (top left) library is selected before beginning this.)
    If you have bad song links in your library, hilite them and hit the delete button. Then locate the folder(s) where your music is located and drag and drop into the large library window in iTunes ( where your tracks show up). This will force the tunes into iTunes. Before you start, check your preferences in iTunes specifically under the"Advanced" tab, general settings. I prefer that the 1st 2 boxes are unchecked. (Keep iTunes Music folder organized & Copy files to iTunes Music folder when adding to library). They are designed to let iTunes manage your library. I prefer to manage it myself. Suit yourself. If there is a way for iTunes to restore broken links other than locating one song at a time I haven't found it yet. (I wish Apple would fix this, as I have used that feature in other apps.) This is the way I do it and I have approx. 25,000 songs and podcasts and videos at present. Hope this helps.

  • Urgent help needed on deployment facts

    Hi
    I had completed a Java Web based application using JApplet, which in turn uses Java Media Framework and Java Communications APIs. So when i deploy this application and let the clients use this application. I need to dump some jar files and properties files into the clients JRE so that all the APIs will work properly. Without any installations. I tried doing this manually by copying these files into client machines So is there a direct method for performing the task. Or i need to add some additional code to my applet so as to find the clients current JRE version and place the required files under using FTP? Can i write a setup routine or something which does all these operations once the client access the applet?
    Help needed in the above issues
    Thanks in advance
    Swaraj

    What you will want to do is look into JNLP and Java WebStart. They allow you to write a setup for your product that makes installation as easy as InstallShield™ does for the Windows™ platform (ie: it allows customers who cannot tell Java from Perl to install your product).

  • URGENT HELP NEEDED ... Tomcat Realm and JRE1.4 plug-in problem

    I have tried the Security Realm of Tomcat. Since I do not have
    an LDAP server, I decided to use the Tomcat-users.xml file in
    Tomcat\conf directory.
    I added the following lines of code in the web.xml file.
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>Entire Application</web-resource-name>
    <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <!-- NOTE: This role is not present in the default users file -->
    <role-name>webviewer</role-name>
    </auth-constraint>
    </security-constraint>
    <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>Tomcat Manager Application</realm-name>
    </login-config>
    The <role-name> "webviewer" is added into "Tomcat-Users.xml" as the following:
    <tomcat-users>
    <user name="test" password="password" roles="webviewer" />
    </tomcat-users>
    So, now when we type the url: http://localhost:8080/adbpdbre/default.htm, TOMCAT shows a dialog box asking for UserName: and Password:Now, only when we give the username and password, it shows the page. This is exactly what we want.
    But the problem now is, this default.htm page, has 5 links to 5 applets. The first time that I click on one of these links, the JRE plug of 1.4 shows a dialog again asking for the username and password. Till I dont provide the username and password the system doesnt go ahead and applet doesnt load. I do not want the JRE to ask me for the username/passwords again..How to avoid this ?
    Can you give me some more information on this. Ultimately in the production usage, we will be using LDAP and not Tomcat's memory realm.
    URGENT HELP NEEDED ... I need to get back to my client on this.
    Help would be v. much appreciated.

    In the config file, you 're essentially saying that you want Tomcat to prompt for usr/passw on every request (url-pattern = /*) made by a 'webviewer', and that's exactly what Tomcat is doing.
    Consider using specific url-patterns & roles for resources to be protected. If for now, all you need is to protect the first page, use a more specific url-pattern.
    Just an advice : if you'll be using LDAP in production, do not waste time with Tomcat's Security Realm and the BASIC authentication type, since the two have not much in common. Start reading doc on LDAP, and code a prototype, or even better, a vertical slice of the app (i.e a proof of concept).

  • URGENT HELP NEEDED - iPhone 3Gs no longer detected or charged by MacBook

    My iPhone 3Gs (3.1) has been running fine, until several hours ago today, when I plugged it to my MacBook, the iPhone is no longer detected - it doesn't show up in iTunes, nor it is charged. I tried opening iPhoto, and it wasn't there too. Not with Image Capture too. I tried charging it using the out-of-box wall charger using the same out-of-box USB cable I use for MacBook, and it can be charged without any problem. Then I put it into Recovery mode, and there iTunes can see it. I don't want to restore it before I figure out exactly what went wrong, as I don't want the restore process somehow gets stuck in the middle that the connection is lost again.
    I've tried reinstalled iTunes, including completely removal of Apple Mobile Device Support, as instructed by Apple. But still no luck.
    I've tried switching to another USB port of my MacBook. No luck.
    My iTunes is the latest 9.0.1, and my Mac OSX is 10.6.1. My iPhone is on 3.1, upgraded from 3.0.
    I've read from web that it seems I'm not the only one out there having this problem. But none of them seem having any real working solution.
    Urgent help needed & appreciated. Millions of thanks in advance.
    Gary

    1. I used both cables - theirs & mine ... and on several macs
    2. yes, same cable for wall & mac
    3. as said, i did completely remove & install itunes (incl. apple mobile device support), as instructed on the apple webpage
    anyway, did a restore just now. it seems okay now. but the problem is i have no idea what cause this, and i can't replicate the problem. so i don't know when it will happen again ... maybe a bug with os 3.1 ... others on web said os 3.1 is quite buggy ...

Maybe you are looking for