How do I get these windos to communicate? I am lost...
I am a computer science student who was not happy with the scope of entry level programming classes. I am taking it on my self to learn the nuts and bolts of Java. Right now, I am working with GUIs for the first time and I am lost with this (probably simple) concept.
I have a class Main Menu which creates a window with several options; one of these options is to open a second window which allows a user to make a selection. I want for this selection to be imported back into the main menu.
The following code is from the Main Menu class, it launches the window and imports selected information
if ( action == "Food Facts"){
FoodFacts food = new FoodFacts();
food.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
food.setSize(300,300);
food.setVisible(true);
/*This opens the next window. It works fine; however,
the code below, which sets the information, executes
immediately after the window opens. This results in
the return of null values. */
name.setText(food.name());
calsPerServing.setText(food.cals());
servingSize.setText(food.Serving());
convertList.setSelectedIndex(food.indexOut());}This is from the other class (Food Facts). It determines selection and prepares the selection to be passed on:
if ( action == "Import"){
format = que.toCharArray();
toNumber = Character.getNumericValue(format[1]) - 1;
switch(format[0]){
case 'M':
nameOut = MeatTypes[toNumber];
calsOut = MeatCals[toNumber];
servOut = MeatMeasure[toNumber];
sizeOut = index[toNumber];
break;
case 'L':
nameOut = LiquidTypes[toNumber];
calsOut = LiquidCals[toNumber];
servOut = LiquidMeasure[toNumber];
sizeOut = index4[toNumber];
break;
case 'S':
nameOut = SpiceTypes[toNumber];
calsOut = SpiceCals[toNumber];
servOut = SpiceMeasure[toNumber];
sizeOut = index5[toNumber];
break;
case 'P':
nameOut = PlantCals[toNumber];
calsOut = PlantCals[toNumber];
servOut = PlantMeasure[toNumber];
sizeOut = index2[toNumber];
break;
default:
JOptionPane.showMessageDialog(null,"Please make a selection or click cancel.",
"No Selection Found",JOptionPane.ERROR_MESSAGE);
break;};
if(format[0] != 'N')
dispose();}
public String name(){
return nameOut;}
public String cals(){
return calsOut;}
public String Serving(){
return servOut;}
public int indexOut(){
return sizeOut;}}If anyone has any suggestions on how I can get these values set it would be greatly appreciated.
Thanks
Joseph
Well, considering that the posts are 3 weeks apart and that your earlier post (on 18 April) didn't include any code, it's not, strictly speaking, a cross post. But I don't blame morgalr for being peeved that you didn't respond to the advice given on your [earlier post|http://forum.java.sun.com/thread.jspa?threadID=5287276].
Around here, that's a very good way not to get help.
db
Similar Messages
-
My phone has been smashed I need to get records of all my iMessages and texts from the last month. How do I get these?
Do you have a backup of your iPhone which contains these messages?
If so, you can restore a new iPhone from that backup during setup.
If not, the messages are gone. -
I have installed Adobe Creative Cloud for teams CC Packages which says that Acrobat XI Pro is installed. Your support page says it does not install Acrobat and I have to look in the Extensions folder for an MSI file. I have run a number of searches and cannot find the Acrobat extension folder please advise how can I get these applications to load onto my computer?
Also I now administer the teams and have accepted the invitation to I received to be a team member and download the apps. The admin page shows that I have been sent an invitation but does not show my account as "ACtive" unlike my other team members. I tried to use the link in the invite to accept it become active but the link displayed an error saying I had already accepted the invite... why is no account not active?
Finally what other product downloads in Creative Cloud do not actually download as part of the Creative cloud Packager for downloading the apps? e.g. acrobat and what else?My apologies Eadeszoo I believe our support agents are unavailable on January 1.
Are you able to copy the contents of the DVD to your computer? Are you receiving any particular error messages when you are trying to install? Finally which operating system are you using? -
On iTunes, my library says that I have a lot of songs on my device that do not show up on my actual iPod touch. These songs disappeared from my iPod when I plugged it in, then they showed back up, but with a red square and circle, and now, after syncing and autofilling, they are gone again. How do I get these songs from my iTunes "ON MY DEVICE" library to my actual device?
SOLUTION: Some Music Won't Play After Upgrading Your iPhone To iOS7
Red square in red circle cannot play songs
My iPod isn't playing certain songs. Help? -
I have garage band ver 10.0.2 and am trying to add effects to an audio track but i have no info button or track info under the track tab. How do i get these things to show up on my program?
In GarageBand 10.0.2 you can no longer add all kinds of effects freely; this GarageBand '11 feature has been discontinued. Pick one of the predefined patches that already has the effects you want.
However, you can add effects from the predefined audio units.
You'll see the predefined effects on the track, when you open the Smart Controls. To add audio units, click the button and enlarge the the smart controls pane by dragging the dividing line to the Track Area upwards. -
I have two excel files I cannot open or delete from my desktop. One is titled 6ACAD200 and the other file is titled 8D73A700. How can I get these off of my computer?
From the names I'd guess they are temporary files. If excel is running, quit and try again. If they still won't move or delete reboot. If they still won't move or delete...kill a chicken at midnight under an oak tree?
-
We don"t use itunes very often, but when we do there alwys seems to be a new version to down load. We just get used to the old one. Now with the new computer we wanted to download the new version and transfer our old songs. I'm missing all the old albums I purchased last year and the year befor. How can I get these valuable products back?
You can redownload most iTunes purchases by:
Downloading past purchases from the App Store, iBookstore, and iTunes Store -
When initiating an e mail to someone with several addresses used in the past the one I use most often does not come up in the first position. How can I get these multiple e mails prioritized?
We are talking about the Mail app, right? In the Mail menubar, click on Window and then Previous Recipients:
That eliminates the previous recipients. If you are talking about the suggestions because there are 10 people with the name 'Steve' in your Contacts, then I do not know how to eliminate those unless you change the name slightly or wait until you type the last name or some other differentiator. -
how do I recover photos from my AppleTV photo stream? when I reset my iPhone, I did not get all of my photos back. How do I get these photos off of my Apple TV?
Hi MrRhea,
Welcome to the Apple Support Communities!
It sounds like you have photos in your Photo Stream that you would like to download. The photos are not actually stored on your Apple TV, it sounds like they are being displayed from your Photo Stream. Please read over the attached article for information on your Photo Stream and how to download these photos.
My Photo Stream FAQ - Apple Support
Because your Mac and PC have more storage than your iOS devices, you can choose to download all of your My Photo Stream photos automatically.
In iPhoto or Aperture preferences on your Mac, select Photos (or Photo Stream) > My Photo Stream > Automatic Import. All of your photo stream photos will import into your Events, Projects, Photos, Faces, and Places folders in iPhoto or Aperture.
On your PC with My Photo Stream on in the Control Panel, all of your photos will import intoC:\\Users\<user name>\Pictures\iCloud Photos\My Photo Stream
Best regards,
Joe -
I bought a few songs on itunes but the songs appear in grey letters and I cannot transfer them to my iphone. I've bought/rented TV shows/movies since so there isn't an issue with my account. How can I get these newly purchased songs onto my iphone?
You made a purchase and exhausted the credit on your card before it processed. All purchases are final. Contact iTunes Store support. You need to settle up before you can purchase or download anything else.
-
I was downloading pictures from my phone to my itunes. I was prompted to update and sync my iphone to my itunes, so I did so. Now all of my music, games, etc. that I purchased with my iphone are gone and I can't find them in my itunes either. How do I get these back. If I lost them for good, I will be ****** because I paid for all of them.
If for some reason you failed to import any purchases made on your iphone to your computer, not good, then
you can redownload some itunes purchases in some countries:
Downloading past purchases from the App Store, iBookstore, and iTunes Store -
i put my new iPhone into iTunes for the first time, and chose to back it up to the iTunes i had on my iPod, but that made all my contacts on my sim card disappear, how can i get these contacts back?
Have a read here...
https://discussions.apple.com/message/18409815?ac_cid=ha
And See Here...
How to Use Multiple iDevices with One Computer -
I am adding new photos to my PC windows 7 desktop but they are not syncing to my ipad when I sync the Ipad. How can I get these photos into my Ipad?
Skydiver.
you and I know that your answer works because that is how I sync my ipad. I don't have a mac, just a PC with itunes. Now this guy might not even have itunes and is using Windows Media Player or something like that.
Or maybe he just do not want his problem fixed. I read these forums and too many of the questions are just way beyond basic computer knowledge, but it seems to happen that they can never resolve a very simple problem. It makes me wonder if people just post bogus stuff.
I would like to see registration to the forums attached to the product serial number of the forum you are posting to. I bet you that the posts would drop dramatically. -
I purchased a macbook pro online this fall and had iWork and iLife apps pre-installed when I purchased it. How can I get these Apps onto my iPhone 4s without paying for it again?
On my iphone those apps still require me to purchase them.The MacBook versions run on a Different Operating System...
You will need to Purchase the iOS iPhone versions -
I connected my ipad to my computer to sync my photos and it deleted all my apps, they synced back on to my ipad but all my Noteshelf apps items were deleted, how can I get these back?
What do you mean " back up my photos or Apps"?
The photo sync is one way - computer to ipad.
You can transfer itunes purchases. Without syncing: File>Transfer Purchases
Copy everything from your backup copy of your old computer to your new one.
Maybe you are looking for
-
Facing problem to display the content in Android Emulator of my mobile app
Hi All, I have developed an adf mobile application as in the following and i successfully deployed my app in android emulator..... Link i have used to create basic mobile App ------------ http://docs.oracle.com/cd/E18941_01/tutorials/MobileTutorial/j
-
Please let us opt for column view - the new UI is so cumbersome. Change is not always good...
-
Hi, Can someone tell my why I can't see my table headers. I have placed the table inside the JScrollPane but it still doesn't work. package tablepractice; import javax.swing.*; import javax.swing.table.*; import java.awt.*; public class TableFrame
-
Updates and every thing fails to download of update but dos es web fine
tablet HP webOS don't update adobe so won't play or download games or movies
-
Getting to the OK prompt on a V250
History of the machine is unknown, someone prior to me installed solaris 9. I do not know any user/pass combos, and have tried several obvious root password. The server uses a USB SUN keyboard mouse combo. The keyboard does not recieve power (i.e. nu