Can anyone help me with this JList........?
Well have a look at this simple code
I just want to get the item selected in the JList selected to be written in the JTextArea....It compiles ok but when it runs this is the error in the actually JText area......"[Ljava.lang.object,@2611a7]"
What ever that means...I think you'll see from this code........
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class CoffeeMachine extends JFrame {
private JLabel promptLabel;
private JList drinkList;
private JTextArea outputArea;
private Container container;
private JButton button1;
private String drinkNames[] = {"Black Coffee", "White Coffee", "Extra Strong Coffee"};
public CoffeeMachine()
super( ":: Please Select a drink ::");
Container container = getContentPane();
container.setLayout( new FlowLayout());
drinkList = new JList( drinkNames );
promptLabel = new JLabel( "Select a drink from the drop menu (below) ");
container.add(promptLabel);
drinkList.setSelectionMode(
ListSelectionModel. SINGLE_INTERVAL_SELECTION);
container.add( new JScrollPane( drinkList));
button1 = new JButton( "OK");
button1.addActionListener(
new ActionListener(){
public void actionPerformed ( ActionEvent event)
outputArea.setText("Water is boiling your " + drinkList.getSelectedValues() + "please wait");
container.add( button1 );
outputArea = new JTextArea (10,20);
outputArea.setEditable (false);
container.add(new JScrollPane(outputArea));
setSize(275, 260 );
show();
public static void main( String args[])
CoffeeMachine application = new CoffeeMachine();
application.setDefaultCloseOperation(
JFrame.EXIT_ON_CLOSE);
Sounds like a use for java.util.HashMap.
A HashMap stores key-value -pairs and gives you methods to get and set the value knowing the key. In this case you would have the name of coffee as a key and the object representing the type of the coffee in detail as a value.
Bit like this: import java.util.HashMap;
HashMap coffeeTypes = new HashMap();
CoffeeType blackCoffee = new CoffeeType(NO_MILK);
coffeeTypes.put("Black Coffee", blackCoffee);
CoffeeeType selectedCoffee = (CoffeeeType) coffeeTypes.get("Black Coffee"); Of course instead of literal strings in the example you would use the values you from the list for keys - and you need to define a class that represents a coffee type with the amounts of milk, coffee (different coffee blends..) and water.
Similar Messages
-
"It is formatted incorrectly, or is not a format that iBooks can open". Can anyone help me with this message of a book that I purchased on iBooks, read, highlighted in the book and now I can't open it anymore. Please help!!!
Mine does the same thing occasionally, is your phone jailbroken? Sometimes it will work if you delete the book and reinstall it or put your phone into airplane mode then turn it back off.
-
I can't find the 2G, 3G and LTE options after updating to iOS8.1, can anyone help me with this? I'm using iPhone5s
I have check on my service provider about the correct APN settings, but unfortunately doesnt work still..
-
I need to reinstall my operating system for 10.5 after seeing a file folder and question mark flashing on my start up screen. Can anyone help me with this?
Hello,
That means it can find the Hard Drive, or can't find the things needed for booting.
See if DU even sees it.
"Try Disk Utility
1. Insert the Mac OS X Install disc, then restart the computer while holding the C key.
2. When your computer finishes starting up from the disc, choose Disk Utility from the Installer menu at top of the screen. (In Mac OS X 10.4 or later, you must select your language first.)
*Important: Do not click Continue in the first screen of the Installer. If you do, you must restart from the disc again to access Disk Utility.*
3. Click the First Aid tab.
4. Select your Mac OS X volume.
5. Click Repair Disk, (not Repair Permissions). Disk Utility checks and repairs the disk."
http://docs.info.apple.com/article.html?artnum=106214
Then try a Safe Boot, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, reboot when it completes.
(Safe boot may stay on the gray radian for a long time, let it go, it's trying to repair the Hard Drive.) -
Hi can anyone help with this issue regarding my wireless magic mouse? When im on google chrome and scrolling down the page i always have youtube running in the background but the audio cuts/spits/pops can anyone help me with this?
The figures you mention only make sense on your intranet. Are you still using the same wireless router. The verizon one is somewhat limited as far as max wireless-n performace. For one thing it only has a 2.4 radio. I like many people who wanted wireless-n performance before they even added a wireless-n gigabit router, have my own handling my wireless-n network.
-
When my screen saver has been on a while, I have to use the cursor to "rub out" part of the screen saver to see my login section. Can anyone help me with this?
I don't have a solution for you, but just wanted to let you know I used to have the exact same problem. I resolved it (for the most part....about 90% of the time, anyway) by adjusting the screensaver and power settings to never let the computer go to sleep.
-
(The iPhone "Named" cannot be restored at this time because the iPhone software update server could not be contacted or is temporarily unavailable.)
can anyone help me with this issue, every time i try to restore it will come up like this error message.Restore the iPhone when connected to iTunes by cable.
Still the same TS1275?
Is your iPhone jailbroken?
Or
Has your computer ever been used to jailbrake or downgrade (Tinyumbrella) any iPhone? -
When typing the name of the contact I want to send a text message to, names from my contact list no longer pop up as suggestions. Can anyone help me with this?
There's always a way to reset the device jmn33! Thanks for keeping us in the loop. To process a full reset/restore on the device please visit http://vz.to/12TLCsR. Please keep us posted once this is completed, thanks!
MatthewS_VZW
Follow us on Twitter @VZWSUPPORT -
My search bar for my iTunes library no longer works. Also, the menu bar is no longer visible. Noticed this problem last Saturday. This might be an issue with my desktop, and not iTunes itself Can anyone help me with this?
Press Ctrl-B to toggle the menu bar on and off.
When you say that the "search bar for my iTunes library no longer works" can you be more specific? The operation of the search function has changed in iTunes 12, essentially having two very distinct modes:
when Search Entire Library is checked, entering a search string will generate a dropdown of all matching items within your whole library, from which multiple operations are available via context menus
when Search Entire Library is unchecked, entering a search string creates a filtered view of whatever your current focus is (e.g., if you're looking at a playlist the filter applies only to items in that playlist) with none of the dropdown options as in the first case -
I have updated to the latest version of iPhoto. But now iPhoto will not let me amend the preset text in the text boxes.
the text is highlighted for a nano second but it will not stay highlighted so that I can add my own text.
can anyone help me with this issue.
Many thanksYou might try using the add-on 'NoSquint' which allows numerous zoom options specific to each page you visit & keeps your settings - https://addons.mozilla.org/en-US/firefox/addon/nosquint/
If you want to go back to 3.6x, you will find it here:
http://www.mozilla.com/en-US/firefox/all-older.html
In most cases you can simply "upgrade" (meaning downgrade) directly from the installation. It would be a good idea to save your passwords & bookmarks just to be on the safe side. -
Mail on my Mac computer does not update when I update my mail on my iPhone and iPad. Can anyone help me with this? Is there a setting that I need to check?
All that you had to do was to sign into the old account in order to update those apps. What I mean is that you just needed to sign into that account in the store settings like I described and that should have worked. You didnt need to enter the credit card information again - you justed needed to use the old ID and password.
Anyway, I think the good news is that if everything else is OK with the new account, just download iBooks with the new ID - it's a free app so its not like you have to pay for it again. I'm not sure what the other App is that you are talking about - but if it is the Apple Store App - that is free as well.
Try this anyway, when you try to update iBooks, just use the old password if the old ID still pops up.
Did you try signing into the store settings with your new ID and see what happens with the updates then? -
I Want to buy diamonds for my tos game but it come out a message ask me to contact itune support. Can anyone help me with this? What should I do so that I can buy my diamonds?
You can contact iTunes support via this page and ask them why the message is appearing (on these forums we won't know why) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then try selecting Purchases, Billing & Redemption
-
I can't download iOS 7 on my iPad 3. I says my software is up to date (6.1.3). Can anyone help me with this?
May just be the update server acting glitchy due all the people slamming it right now. I'd give it 24 hrs, and if it's still doing it, check back in here and we'll see if we can't figure it out.
= L.I. -
I am not able to Mobile Me email account to connect with iCloud or my Apple Mail program. Don't know if my settings are correct or not. Can anyone help me with this please?
http://support.apple.com/kb/HT5922
If you want to mirror your desktop, see:
http://support.apple.com/kb/HT5404
Regards. -
I just received photoshop elements 10 that I bought used thru Ebay, for my OSX Mac 10.5.8. I put the discs in my computer and nothing happens to help me download it. Can anyone help me with this instillation challenge?
Does your mac have an intel processor or PowerPC processor?
System requirements | Adobe Photoshop Elements
Did you insert the disk that is labeled mac os?
After you insert the disk, it should show on your desktop.
If you double click on the the disk icon on the desktop, does anything happen?
more info about the included disks:
FAQ: Installing Elements 10, or What do all these disks do?
Maybe you are looking for
-
Hi Friends, I have developed a abap program that download a excel file to a application server. i need to send the file to a shared folder or share point using FTP. How can i send the file which is in Application server thru FTP? Can anybody guide me
-
Maintaining Item Stock Project wise.
Hi All, I am implementing SBO 2005 B for the Project base company. They get the order & each order is treated as a Project. Now the question is material tracking is required Project wise i.e. which item is available & under which Project. Scenarios a
-
Is it advisable to download platform updates over wireless macbook pro ret?
Will be downloading update on my brand new....(but, made in mid 2012)....MacBook Pro 15" Retina Display with 10.8.2 version Mountain Lion. Will be only downloading up to 10.8.5....as the new Maverick is conflicting currently with the new ProTools 11
-
WebLogic 12c and OSGi bundles ClassCastException error
When I deploy an OSGi bundle to WebLogic 12c there are no errors. However, when I try and access my application I get the following error: java.lang.ClassCastException: com.sun.faces.taglib.jsf_core.ViewTag cannot be cast to javax.servlet.jsp.tagext.
-
A (slightly?) DIFFERENT question about the new ActiveX stuff
http://tinyurl.com/q63d2 Why do you suppose the QuickTime movie here doesn't play even after the click? Works fine in FireFox.