I have a few compile errors. Can someone give me direction?

I have some compile areas in the following code and I am not really sure how to correct.
Can someone give guidance? Thanks
import java.io.*;
import java.util.*;
import java.awt.*;
import java.awt.Window.*;
import java.awt.event.*;
import javax.swing.*;
import java.applet.*;
import java.net.*;
public class FrontEnd_2 extends Applet{
     private static int appType = 0;
     private Frame FrontEnd_2 = null;
     private Choice nameList = new Choice();
     private Label PipeID = new Label("");
     private TextField pipelineName = new TextField();
     private TextField problem = new TextField();
     private TextField location = new TextField();
     private TextField repairCost = new TextField();
     private Button update = new Button("Update");
     private Button clear = new Button("Clear");
     private Button delete = new Button("Delete");
     private Button exit = new Button("Exit");
     private long idList[] = null;
     public static void main(String args[]){
     appType = 1;
     new FrontEnd_2();
     public FrontEnd_2(){
     Panel p = new Panel(new GridLayout(6,3));
     p.add(new Label());
     p.add(nameList);
     p.add(new Label());
     p.add(new Label("PipeId"));
     p.add(new Label());
     p.add(new Label());
     p.add(new Label("Pipeline Name"));
     p.add(pipelineName);
     p.add(update);
     p.add(new Label("Problem"));
     p.add(problem);
     p.add(clear);
     p.add(new Label("Location"));
     p.add(location);
     p.add(delete);
     p.add(new Label("Repair Cost"));
     p.add(repairCost);
     p.add(exit);
     String data = getData("L0");
          StringTokenizer st = new StringTokenizer(stRetVal, ",");
          nameList.add("[select a name]");
          int size = st.countTokens() / 2;
          idList = new long[size+1];
               for ( int i=1; i<=size; i++ ) {
                    idList[i] = Long.parseLong(st.nextToken());
                    nameList.add(st.nextToken());
     private String getData(String cmd)
     Socket s = null;
     BufferedReader reader = null;
     BufferedWriter writer = null;
     String sRetVal = " ";
     try{
     s = new Socket("66.24.174.32",1234);
     reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
     writer = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));
     writer.write(cmd);
     writer.newLine();
     writer.flush();
     writer.close();
     sRetVal = reader.readLine();
     catch(UnknownHostException ue){
     catch(IOException ioe){
finally
     writer = null;
     reader = null;
     return sRetVal;
     switch(appType){
     case 0:                                                                           // Applet extends panel
     FrontEnd.add(p);
     break;
     case 1:                                                                           // Application
     FrontEnd_2 = new Frame("Pipeline Inputs");
     FrontEnd_2.addWindowListener(this);
     nameList.addItemListener(this);
     exit.addActionListener(this);
     p.add(exit);
     FrontEnd.add(p);
     FrontEnd.setSize(30,60);
     FrontEnd.setVisible(true);
     break;
     public void actionPerformed(ActionEvent ae){
          if(ae.getSource() == exit){
          fileExit();
          else if (ae.getSource() == clear){
          fileClear();
     public void itemStateChanged(ItemEvent e) {
          int index = nameList.getSelectedIndexOf();
          long id = idList[index];
          String data = getData("R" + id);
          StringTokenizer st = StringTokenizer(data, ",");
          PipeID.setText(st.nextToken());
          problem.setText(st.nextToken());
          location.setText(st.nextToken());
          repairCost.setText(st.nextToken()):
     public void windowActivated(WindowEvent we){     }
     public void windowClosed(WindowEvent we){     }
     public void windowClosing(WindowEvent we){ fileExit();}
     public void windowDeactivated(WindowEvent we){     }
     public void windowDeiconified(WindowEvent we){     }
     public void windowIconified(WindowEvent we){     }
     public void windowOpened(WindowEvent we){     }
     private void fileExit(){
     FrontEnd_2.dispose();
     System.exit(0);

Some of the errors that I got while compiling your program were the following:
1) You need to declare your methods outside of your constructor
2) You are declaring sretval in a private method getData and passing it on to StringTokenizer. You should declare it as an instance variable cuz local variables won't go any farther than the method in which they were declared.
3) You did not implement WindowListener, ActionListener, ItemListener.
Some tips: Try to use adapters in an anonymous inner class to implement listeners such as WindowAdapter.
Use some white space between your code. It makes it a heck of a lot easier to read. Use indentation to show nested statements :)
Here is the fixed code.
import java.io.*;
import java.util.*;
import java.awt.*;
import java.awt.Window.*;
import java.awt.event.*;
import javax.swing.*;
import java.applet.*;
import java.net.*;
public class FrontEnd_2 extends Applet implements WindowListener, ActionListener, ItemListener{
private static int appType = 0;
private String sRetVal = " ";
private Frame FrontEnd_2 = null;
private Choice nameList = new Choice();
private Label PipeID = new Label("");
private TextField pipelineName = new TextField();
private TextField problem = new TextField();
private TextField location = new TextField();
private TextField repairCost = new TextField();
private Button update = new Button("Update");
private Button clear = new Button("Clear");
private Button delete = new Button("Delete");
private Button exit = new Button("Exit");
private long idList[] = null;
* mainline
public static void main(String args[]){
appType = 1;
new FrontEnd_2();
public FrontEnd_2(){
Panel p = new Panel(new GridLayout(6,3));
p.add(new Label());
p.add(nameList);
p.add(new Label());
p.add(new Label("PipeId"));
p.add(new Label());
p.add(new Label());
p.add(new Label("Pipeline Name"));
p.add(pipelineName);
p.add(update);
p.add(new Label("Problem"));
p.add(problem);
p.add(clear);
p.add(new Label("Location"));
p.add(location);
p.add(delete);
p.add(new Label("Repair Cost"));
p.add(repairCost);
p.add(exit);
String data = getData("L0");
StringTokenizer st = new StringTokenizer(sRetVal, ",");
nameList.add("[select a name]");
int size = st.countTokens() / 2;
long idList = size+1;
for ( int i=1; i<=size; i++ ) {
idList = Long.parseLong(st.nextToken());
nameList.add(st.nextToken());
switch(appType){
case 0: // Applet extends panel
FrontEnd_2.add(p);
break;
case 1: // Application
FrontEnd_2 = new Frame("Pipeline Inputs");
FrontEnd_2.addWindowListener(this);
nameList.addItemListener(this);
exit.addActionListener(this);
p.add(exit);
FrontEnd_2.add(p);
FrontEnd_2.setSize(300,300);
FrontEnd_2.setVisible(true);
break;
}//end constructor
public void actionPerformed(ActionEvent ae){
if(ae.getSource() == exit){
fileExit();
else if (ae.getSource() == clear){
fileClear();
public void itemStateChanged(ItemEvent e) {
int index = nameList.getSelectedIndex();
long id = idList[index];
String data = getData("R" + id);
StringTokenizer st = new StringTokenizer(data, ",");
PipeID.setText(st.nextToken());
problem.setText(st.nextToken());
location.setText(st.nextToken());
repairCost.setText(st.nextToken());
public void windowActivated(WindowEvent we){ }
public void windowClosed(WindowEvent we){ }
public void windowClosing(WindowEvent we){ fileExit();}
public void windowDeactivated(WindowEvent we){ }
public void windowDeiconified(WindowEvent we){ }
public void windowIconified(WindowEvent we){ }
public void windowOpened(WindowEvent we){ }
private void fileExit(){
FrontEnd_2.dispose();
System.exit(0);
private void fileClear(){
//do something here
//start of getData
private String getData(String cmd){
Socket s = null;
BufferedReader reader = null;
BufferedWriter writer = null;
try{
s = new Socket("66.24.174.32",1234);
reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
writer = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));
writer.write(cmd);
writer.newLine();
writer.flush();
writer.close();
sRetVal = reader.readLine();
}//end try
catch(UnknownHostException ue){
catch(IOException ioe){
finally{
writer = null;
reader = null;
return sRetVal;
}//end getData

Similar Messages

  • During CS5 master collection update, I get the error "There was an error downloading this update. Please quit and try again later." This has been happening for the past few days. Can someone help me getting my updates?

    During CS5 master collection update on Windows 7, 64-bit laptop, I get the error "There was an error downloading this update. Please quit and try again later." This has been happening for the past few days. Can someone help me getting my updates?

    Since CS5 is from 4+ years before the Cloud, this is not the right forum... but I don't really know a correct forum for that very old product
    Have you tried to manually update the individual programs?
    All updates start here and select product, read to see if you need to install updates in number order, or if the updates are cumulative for the individual product http://www.adobe.com/downloads/updates/

  • Everytime i go to watch a video on youtube, weather it be the mobile site, desktop version or the app, it always says 'video unavailable on this device' this only started happening in the last few weeks! Can someone help???

    Everytime i go to watch a video on youtube, weather it be the mobile site, desktop version or the app, it always says 'video unavailable on this device' this only started happening in the last few weeks! Can someone help???

    Most YouTube content requires the Flash plugin. Sometimes it's necessary to uninstall then reinstall that plugin.
    Uninstall the Flash plugin then reinstall new >  Troubleshoot Flash Player | Mac OS
    Very important to uninstall the currently installed plugin first.
    Now launch Safari and try a video.
    If you have the ClickToFlash extension installed, that can prevent Flash based video from streaming. It can also be installed as a plugin in /Library/Internet-Plug-Ins.
    And check to see if Safari is running in 32 bit mode. Right or control click the Safari icon in your Applications folder then click Get Info. If the box next to:  Open in 32 bit mode  is selected, deselect, quit then relaunch Safari.
    You may also need to delete the cache associated with Safari .
    Open the Finder. From the Finder menu bar click Go > Go to Folder
    Type or copy/paste:   ~/Library/Caches/com.apple.Safari
    Click Go the move the Cache.db file from the com.apple.Safari folder to the Trash.
    Quit and relaunch Safari. Try a video.

  • I'm not sure how to use this site....but here goes, I have a samsung galaxy and it's fully charged but it will not turn on, can someone give me some solutions as to how I can get it to work?

    I'm not sure how to use this site....but here goes, I have a samsung galaxy and it's fully charged but it won't turn on, can someone give me some solutions I can use to fix this problem???

    Try this website. Yes its sprint but it might help you. http://support.sprint.com/support/article/Troubleshoot_issues_related_to_your_Sa msung_Galaxy_S_II_not_turning_on_completely/WTroubleshootingGuide_542_GKB51165-T rend?INTNAV=SU:DP:OV:TSIS:SamsungGalaxySIi-AsYouGo:TroubleshootIssuesRelatedToYo urSamsungG

  • I purchased a one year subscription to Rolling Stone magazine . I got two issues and now it will not allow me to view the current issue, I have to pay again. Can someone help me, how do I get my purchase. I have the automatic download turned on.

    I purchased a one year subscription to Rolling Stone magazine . I got two issues and now it will not allow me to view the current issue, I have to pay again. Can someone help me, how do I get my purchase ? I have the automatic download turned on.

    Try contacting apple

  • I try to download an app, and it says that there is an error in the app , Ive tried to download other apps and i get the same error. can someone help?

    I try to download an app, and it says that there is an error in the app , Ive tried to download other apps and i get the same error. can someone help?

    You need to reinstall the App Store.
    Use Lion Recovery to do that.

  • I need a ringtone to alert me when i have a missed call?  can someone help?

    i need a ringtone to alert me when i have a missed call?  can someone help?

    THere's generally some type of default notification for a missed call - I'm not sure the point though, if you're not with your phone to hear it ring then how are you going to hear the missed call notification?

  • Attempts to cancel EXportPDF service have been unsuccessful online. Can someone at Adobe help?

    Attenpts to cancel ExportPDF service have been unsuccessful online. Can someone at Adobe help?

    Good day Joseph,
    My records show that a return for your ExportPDF subscription was initiated on November 20th.
    Please let us know if we can be of further assistance.
    David

  • I attempted to update OS X 10.8.5 today and it seems to be stuck. It won't even let me restart. I have a MacBook Pro.  Can someone help?

    I attempted to update OS X 10.8.5 today and it seems to be stuck. It won't even let me restart. I have a MacBook Pro.  Can someone help?

    Hold down the Power button for 5-10 seconds until the computer shuts down. Restart. Report what state the computer is in at that time.

  • I purchased standard XI but need the download - new laptop doesn't have a disk drive. Can someone please send me a link to download so I can activate with my serial #?

    I purchased standard XI but need the download - new laptop doesn't have a disk drive. Can someone please send me a link to download so I can activate with my serial #?

    Downloadable installation files available:
    Suites and Programs:  CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4, CS4 Web Standard | CS3
    Acrobat:  XI, X | 9,8 | 9 standard
    Premiere Elements:  13 |12 | 11, 10 | 9, 8, 7
    Photoshop Elements:  13 |12 | 11, 10 | 9,8,7
    Lightroom:  5.7.1| 5 | 4 | 3 | 2.7(win),2.7(mac)
    Captivate:  8 | 7 | 6 | 5
    Contribute:  CS5 | CS4, CS3
    Download and installation help for Adobe links
    Download and installation help for Prodesigntools links are listed on most linked pages.  They are critical; especially steps 1, 2 and 3.  If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'.window using the Lightroom 3 link to see those 'Important Instructions'.

  • My Macbook 4,1 came with 1 GB of memory. Only 512MB shows up in the activity monitor. I just upgraded the memory to 4 GB. Although 2GB shows up in DIMM0 and DIMM1 it still only says I have 512MB of memory. Can someone help?

    My Macbook 4,1 came with 1 GB of memory. Only 512MB shows up in the activity monitor. I just upgraded the memory to 4 GB. Although 2GB shows up in DIMM0 and DIMM1 it still only says I have 512MB of memory. Can someone help?

    So when you go to  > About This Mac - How it should say how much ram there. Click on More Info - And click on Memory - What is in those fields?

  • Can someone give me ABAP Dialog program /ALV Step by Step hands on examples

    Can someone give me a document for ABAP Dialog programming(module pool) and ALV - but i need Step by Step example ,with sreenshots and explanations.
    In general any ABAP, STEP BY STEP hands on examples - Smartform, Sapscrips, Report, BDC will be highly appreciated.
    I only need hands on examples please - regular Abap courses does not work because they dont have examples.
    Please help ASAP.
    Bob
    Welcome to SCN - but please read the rules of engagement before posting
    Edited by: Rob Burbank on Jun 14, 2009 4:28 PM

    What temporary files are you talking about?

  • KCLP - can someone give me the big picture?

    In a project I have to review I stumbled into some log files displayed with Tx KCLP. It's some "external data transfer" logs.
    Unfortunately I miss the big picture and I did not find much on KCLP. Can someone give me a hint what's the big picture, e.g. what kind of applications use the KCLP logs.
    Thanks Frank

    I know KCLP is used by CO-PA to import external data via KEFC.
    THe bigger picture is
    - provide an import structure
    - define some transfer rules
    - post the data
    Christian

  • Everything runs als Root, can someone give me a hand for the system rights?

    yeah I screwed up big times because of this neat unknow_user "Feature" in Leopard.
    First i installed a os 10.4 app under leopard which let the disk utility slow down and the finder crashes if i change the user rights, and then i changed globally the group and user of everything in the application folder and my documents folder with pathfinder for looking if i can solve the problem that way.
    -But now everything runs as Root and even the hd itself has a owner root and as group admin.
    i don't get the difference between system, root, admin, wheel, username for the owner and group. I googled but found nothing clear about this.
    And i also wonder what i should do about the group and the meaning of root, system, admin, wheel, username as a group for a single user system. Where should i give a read, read&write and execute permission for example?
    at the moment everything seems to run mostly root and every program runs on root and i think this is the worst think that can happen and causes some trouble for the programs.
    Can someone give me a short hand and for example tell me if i should set the hd owner to my username and the group to system or admin or whatever and this also for the application and documents/film and other stuff on my user folder?
    that would be great
    I think i have to reinstall leopard, but as long as this unknow_user problem still resist and no patch is available, i see the same thing happen again and again for me, so a little help would be great
    here the ls -l -a from the system and user directory
    drwxrwxr-t 26 root admin 1496 Nov 1 23:41 .
    drwxrwxr-t 26 root admin 1496 Nov 1 23:41 ..
    -rw-rw-r--@ 1 root admin 15364 Nov 5 22:42 .DS_Store
    drwxrwxr-x@ 3 root admin 102 Oct 30 18:40 .Spotlight-V100
    drwxrwxr-x@ 2 root admin 68 Aug 2 12:29 .Trashes
    -rw-r--r-- 1 root admin 0 Oct 30 17:09 .com.apple.timemachine.supported
    drwx------ 2 root admin 952 Nov 5 22:09 .fseventsd
    -rw-rw-r--@ 1 root admin 262144 Oct 10 11:42 .hotfiles.btree
    drwxr-xr-x@ 2 root wheel 68 Aug 2 12:30 .vol
    drwxrwxrwx+ 400 adrian admin 13872 Nov 5 22:00 Applications
    drwxr-xr-x 2 root admin 102 Nov 1 23:01 Data
    -rw-r--r--@ 1 root admin 10240 Oct 25 05:19 Desktop DB
    -rw-r--r--@ 1 root admin 37442 Oct 25 01:39 Desktop DF
    drwxrwxr-x@ 13 root admin 544 Oct 30 19:46 Developer
    drwxr-xr-x 5 adrian adrian 204 Sep 12 14:25 InputManagers
    -rw-r--r--@ 1 adrian adrian 1568128 Nov 1 23:45 Installer Log File
    drwxrwxr-t+ 60 root admin 2108 Nov 1 22:06 Library
    drwxr-xr-x@ 2 root wheel 68 Aug 2 10:08 Network
    drwxr-xr-x 3 root wheel 136 Oct 30 18:01 System
    drwxrwxrwx@ 3 root admin 102 Aug 2 17:21 TheVolumeSettingsFolder
    drwxr-xr-x 5 root admin 238 Nov 2 00:03 Users
    drwxrwxrwt@ 4 root admin 170 Nov 5 20:21 Volumes
    -rw-r--r-- 1 adrian admin 0 Oct 29 22:51 az.log
    drwxr-xr-x@ 2 root wheel 1360 Oct 30 17:57 bin
    drwxrwxr-t@ 2 root admin 68 Jan 13 2006 cores
    dr-xr-xr-x 2 root wheel 512 Nov 2 04:11 dev
    lrwxr-xr-x@ 1 root admin 11 Oct 30 17:57 etc -> private/etc
    dr-xr-xr-x 2 root wheel 1 Nov 2 04:11 home
    lrwxr-xr-x 1 root 502 11 Nov 1 22:40 mach -> mach_kernel
    -r--r--r--@ 1 root admin 615748 Oct 29 18:23 mach.sym
    -rw-r--r--@ 1 root wheel 10243756 Oct 10 06:38 mach_kernel
    -rw-r--r--@ 1 root wheel 10696809 Oct 10 06:38 mach_kernel.ctfsys
    dr-xr-xr-x 3 root wheel 2 Nov 2 04:11 net
    drwxr-xr-x@ 3 root admin 102 Sep 14 17:40 opt
    drwxr-xr-x@ 6 root wheel 204 Oct 29 18:23 private
    drwxr-xr-x@ 2 root wheel 2244 Oct 30 18:01 sbin
    drwxr-xr-x 11 root admin 374 Jun 9 2006 sw
    lrwxr-xr-x@ 1 root admin 11 Oct 30 17:57 tmp -> private/tmp
    drwxr-xr-x@ 13 root wheel 510 Oct 30 19:52 usr
    lrwxr-xr-x@ 1 root admin 11 Oct 30 17:57 var -> private/var
    and for the my user folder:
    drwxr-xr-x+ 22 adrian adrian 1156 Nov 3 02:30 .
    drwxr-xr-x 5 root admin 238 Nov 2 00:03 ..
    -rw-r--r-- 1 adrian adrian 3 Sep 13 22:41 .CFUserTextEncoding
    -rw-r--r--@ 1 adrian adrian 15364 Nov 5 21:50 .DS_Store
    -rw-r--r-- 1 adrian adrian 11 Oct 16 17:17 .PortAuthority2.4.rc
    drwx------ 2 adrian adrian 68 Nov 5 20:58 .Trash
    -rw-r--r-- 1 adrian adrian 0 Aug 16 04:37 .Xauthority
    -rw-r--r-- 1 adrian adrian 2552 Nov 5 22:43 .bash_history
    drwxr-xr-x 4 adrian adrian 136 Aug 17 21:11 .config
    drwxr-xr-x 8 adrian adrian 306 Aug 6 02:22 .dvdcss
    drwxr-xr-x 2 adrian adrian 578 Oct 21 19:32 .fontconfig
    -rw-r--r-- 1 adrian adrian 489724 Aug 30 17:49 .fonts.cache-1
    drwxr-xr-x 2 adrian adrian 68 Sep 14 17:40 .macports
    -rw-r--r-- 1 adrian adrian 1643 Aug 30 19:01 .mime.types
    -rw-r--r-- 1 adrian adrian 47 Oct 12 22:45 .parallels_settings
    -rw-r--r-- 1 adrian adrian 194 Sep 28 02:52 .profile
    drwxr-xr-x 3 adrian adrian 102 Sep 23 00:48 .stella
    drwxr-xr-x 2 adrian adrian 68 Aug 16 20:09 .wapi
    -rw-r--r-- 1 adrian adrian 467 Nov 5 04:21 .webaom
    -rw-r--r-- 1 adrian adrian 570 Aug 16 04:37 .xinitrc
    drwxr-xr-x 3 adrian adrian 170 Aug 5 08:10 Applications
    drwxr-xr-x+ 23 adrian adrian 1190 Nov 5 20:21 Desktop
    drwxrwxrwx+ 35 adrian adrian 2210 Nov 5 22:08 Documents
    drwxr-xr-x+ 14 adrian adrian 3332 Nov 5 20:02 Downloads
    drwxr-xr-x+ 48 adrian adrian 1836 Oct 30 19:11 Library
    drwxr-xr-x+ 9 adrian adrian 748 Nov 2 23:49 Movies
    drwxr-xr-x+ 8 adrian adrian 510 Sep 29 05:44 Music
    drwxr-xr-x 2 root adrian 68 Nov 3 02:30 New Folder
    drwxr-xr-x+ 6 adrian adrian 748 Oct 18 23:26 Pictures
    drwxrwxrwx+ 3 adrian adrian 238 Nov 4 20:34 Public
    drwxr-xr-x+ 3 adrian adrian 204 Aug 14 21:29 Sites
    drwxr-xr-x 3 adrian adrian 340 Oct 31 05:55 CompilationUnix
    -rw-r--r-- 1 adrian adrian 129 Oct 6 16:48 license.jai

    lllaass wrote:
    lizdance40, did you read the original post? The poster's problem is that when he connects the iPod to his computer the iPod does not appear in iTunes. He does not say he has a wifi problem with his iPod.
    lizdance40 wrote:
    You need to do an update on your router's firmware, or get a higher speed router..
    Or replace the router and or modem.  High demand can burn out a router in 2 years.  Typical life is about 4-5 at most.
    The new iPod is more advanced and if your router is slow or inconsistant signal your iPod will stop trying to connect to save your battery.
    of course he dose have a wifi problwm. read the last line of the original post

  • What exactly is balance in Oracle Payroll. Can someone give an example pls

    Hi
    I am a newbie to Oracle Payroll. Could some one xplain what exactly is balance in Oracle Payroll. Can someone give an example pls. Is there any link which would be useful to clearly explain this.

    Results of Payroll run get accumulated in the Balances. The accumulation happens according to the dimension like ASGRUN holds the value of current payroll run, ASGYTD holds the cumulative value for the current financial year and gets reset at the beginning of the next financial year, ASGQTD holds the cumulative value for the current quarter and gets reset at the beginning of the next quarter etc.
    You can see the values of the balances for different dimension after running the payroll.
    View -> Assignment Process Results -> Balances.

Maybe you are looking for