javame problem z połączeniem dwóch plików w netbeans

0

Witam
mam mały problem mam mały programik, który przerabiam i jest podzielony na dwa pliki
i chce połączyć dwa pliki w taki sposób, żeby główny plik odczytywał drugi plik
java w netbeams a kod odnosi się do java ME (j2me)

po kompilacji wyskakuje mi błąd


C:\Users\komp_k\Documents\NetBeansProjects\3\src\hello\HelloMIDlet.java:15: error: '.' expected
import a;
C:\Users\komp_k\Documents\NetBeansProjects\3\src\hello\HelloMIDlet.java:15: error: ';' expected
import a;

nie wiem co zrobić proszę o pomoc dziękuje

0

Co jest podzielone? Kod źródłowy? I jak łączysz? Przez kopiuj+wklej+nic nie rób dalej?

Pokaż ten kod najlepiej.

0

podaje kod
przykładowy

HelloMIDlet.java

package hello;


import java.io.*;
import java.io.IOException;
import java.io.PrintStream;
import java.util.*;

import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import a;


public class HelloMIDlet extends MIDlet
    implements ItemStateListener, CommandListener
{

    public HelloMIDlet()
    {
        a_javax_microedition_lcdui_Displayable_fld = null;
        c = new Hashtable();
        d = new Hashtable();
        a_boolean_fld = true;
        a_java_util_Stack_fld = new Stack();
        a_javax_microedition_lcdui_Command_fld = new Command("Wstecz", 2, 2);
        b_javax_microedition_lcdui_Command_fld = new Command("Dalej", 1, 4);
        a_java_util_Hashtable_fld = new Hashtable();
        b_java_util_Hashtable_fld = new Hashtable();
        e = new Hashtable();
        b_java_util_Hashtable_fld.put("/form0.txt", new Integer(0x5e0a0b03));
    }

    public final void startApp()
        throws MIDletStateChangeException
    {
        if(a_javax_microedition_lcdui_Displayable_fld == null)
        {
            a(a("form0"));
            return;
        } else
        {
            Display.getDisplay(this).setCurrent(a_javax_microedition_lcdui_Displayable_fld);
            return;
        }
    }

    public final void pauseApp()
    {
        a_javax_microedition_lcdui_Displayable_fld = Display.getDisplay(this).getCurrent();
    }

    public final void destroyApp(boolean flag)
        throws MIDletStateChangeException
    {
    }

    public final void a(Displayable displayable)
    {
        displayable.setCommandListener(this);
        displayable.addCommand(a_javax_microedition_lcdui_Command_fld);
        Displayable displayable1;
        if((displayable1 = Display.getDisplay(this).getCurrent()) != null)
            a_java_util_Stack_fld.push(displayable1);
        Display.getDisplay(this).setCurrent(displayable);
    }

    public final void a()
    {
        Displayable displayable = null;
        try
        {
            displayable = (Displayable)a_java_util_Stack_fld.pop();
        }
        catch(Exception _ex) { }
        if(displayable == null)
        {
            notifyDestroyed();
            return;
        } else
        {
            Display.getDisplay(this).setCurrent(displayable);
            return;
        }
    }

    private int a(String s)
    {
        int i = -1;
        a a1 = new a(getClass().getResourceAsStream(s));
        Object obj = null;
        try
        {
            String s1;
            do
                if((s1 = a1.a()) != null)
                    if(i != -1)
                        i = Math.abs(i ^ s1.hashCode());
                    else
                        i = s1.hashCode();
            while(s1 != null);
            a1.close();
        }
        catch(IOException _ex)
        {
            i = -1;
        }
        System.out.println("Checksum: " + i);
        return i;
    }

    public final Displayable HelloMIDlet(String s)
    {
        Object obj;
        if(!s.startsWith("/"))
            s = "/" + s;
        if(!s.endsWith(".txt"))
            s = s + ".txt";
        if(a_boolean_fld && d.containsKey(s))
            return (Displayable)d.get(s);
        if(b_java_util_Hashtable_fld != null && b_java_util_Hashtable_fld.containsKey(s))
        {
            int i = ((Integer)b_java_util_Hashtable_fld.get(s)).intValue();
            if(a(s) != i)
                notifyDestroyed();
        }
        obj = null;
        a a1;
        String s1;
        if((s1 = (a1 = new a(getClass().getResourceAsStream(s))).a()).startsWith("LIST:"))
        {
            List list = null;
            (list = new List(s1.substring("LIST:".length()), 3)).setCommandListener(this);
            String s2 = null;
            do
                if((s2 = a1.a()) != null && s2.startsWith("LINK:"))
                {
                    String s4;
                    int j = (s4 = s2.substring("LINK:".length())).indexOf(';');
                    int k = s4.indexOf(';', j + 1);
                    String s8 = s4.substring(0, j);
                    String s9 = s4.substring(j + 1, k);
                    String s11 = s4.substring(k + 1);
                    Image image = null;
                    if(s8 != null && s8.trim().length() > 0)
                        try
                        {
                            image = Image.createImage("/" + s8);
                        }
                        catch(Exception _ex) { }
                    int j1 = list.append(s9, image);
                    Hashtable hashtable = null;
                    if(e.containsKey(list))
                    {
                        hashtable = (Hashtable)e.get(list);
                    } else
                    {
                        hashtable = new Hashtable();
                        e.put(list, hashtable);
                    }
                    hashtable.put(new Integer(j1), s11);
                }
            while(s2 != null);
            obj = list;
        } else
        {
            Form form = null;
            (form = new Form(s1)).setItemStateListener(this);
            String s3 = null;
            ChoiceGroup choicegroup = null;
            do
                if((s3 = a1.a()) != null)
                    if(s3.startsWith("LINK:"))
                    {
                        if(choicegroup == null)
                            choicegroup = new ChoiceGroup("Wybierz: ", 1);
                        String s5;
                        int l = (s5 = s3.substring("LINK:".length())).indexOf(';');
                        int i1 = s5.indexOf(';', l + 1);
                        String s10 = s5.substring(0, l);
                        String s12 = s5.substring(l + 1, i1);
                        String s13 = s5.substring(i1 + 1);
                        Image image1 = null;
                        try
                        {
                            image1 = Image.createImage("/" + s10);
                        }
                        catch(Exception _ex) { }
                        int k1 = choicegroup.append(s12, image1);
                        c.put(((Object) (new Object[] {
                            choicegroup, new Integer(k1)
                        })), s13);
                    } else
                    {
                        if(choicegroup != null)
                        {
                            form.addCommand(b_javax_microedition_lcdui_Command_fld);
                            form.setCommandListener(this);
                            form.append(choicegroup);
                            choicegroup = null;
                        }
                        if(s3.startsWith("TEXT:"))
                        {
                            String s6;
                            if((s6 = s3.substring("TEXT:".length())).charAt(0) == '-')
                                a(form, 1);
                            form.append(s3.substring("TEXT:".length()));
                            if(s6.charAt(0) == '-')
                                a(form, 3);
                        } else
                        if(s3.startsWith("IMAGE:"))
                            form.append(new ImageItem(null, Image.createImage("/" + s3.substring("IMAGE:".length())), 515, null));
                        else
                        if(s3.startsWith("FURTHER:"))
                        {
                            String s7 = s3.substring("FURTHER:".length()).trim();
                            a_java_util_Hashtable_fld.put(form, s7);
                            form.addCommand(b_javax_microedition_lcdui_Command_fld);
                            form.setCommandListener(this);
                        } else
                        if(s3.startsWith("SEPARATOR"))
                            a(form, 4);
                    }
            while(s3 != null);
            if(choicegroup != null)
            {
                form.addCommand(b_javax_microedition_lcdui_Command_fld);
                form.setCommandListener(this);
                form.append(choicegroup);
            }
            obj = form;
        }
        a1.close();
         
 
    }

    private void a(Form form, int i)
    {
        Image image = Image.createImage(Image.createImage(1, i));
        ImageItem imageitem = new ImageItem(null, image, 512, null);
        form.append(imageitem);
    }

    public final void itemStateChanged(Item item)
    {
        Enumeration enumeration = c.keys();
        do
        {
            if(!enumeration.hasMoreElements())
                break;
            Object aobj[] = (Object[])enumeration.nextElement();
            if(item == aobj[0])
            {
                ChoiceGroup choicegroup = (ChoiceGroup)item;
                int i = ((Integer)aobj[1]).intValue();
                if(choicegroup.getSelectedIndex() == i)
                {
                    String s = (String)c.get(((Object) (aobj)));
                    a(a(s));
                }
            }
        } while(true);
        return;
    
    }

    public final void commandAction(Command command, Displayable displayable)
    {
        if(command == a_javax_microedition_lcdui_Command_fld)
        {
            a();
            return;
        }
        Hashtable hashtable;
        if(command == b_javax_microedition_lcdui_Command_fld)
        {
            if(displayable instanceof Form)
            {
                Form form = (Form)displayable;
                boolean flag = false;
                int i = 0;
                do
                {
                    if(i >= form.size())
                        break;
                    Item item;
                    if((item = form.get(i)) instanceof ChoiceGroup)
                    {
                        itemStateChanged(item);
                        flag = true;
                        break;
                    }
                    i++;
                } while(true);
                if(!flag && a_java_util_Hashtable_fld.containsKey(displayable))
                {
                    String s = (String)a_java_util_Hashtable_fld.get(displayable);
                    a(a(s));
                }
                return;
            }
        } else
        if(command == List.SELECT_COMMAND && (hashtable = (Hashtable)e.get(displayable)) != null)
        {
            Integer integer = new Integer(((List)displayable).getSelectedIndex());
            String s1;
            if((s1 = (String)hashtable.get(integer)) != null)
                a(a(s1));
        }
    }

    private Displayable a_javax_microedition_lcdui_Displayable_fld;
    private Hashtable c;
    private Hashtable d;
    private boolean a_boolean_fld;
    private Stack a_java_util_Stack_fld;
    public Command a_javax_microedition_lcdui_Command_fld;
    public Command b_javax_microedition_lcdui_Command_fld;
    public Hashtable a_java_util_Hashtable_fld;
    public Hashtable b_java_util_Hashtable_fld;
    private Hashtable e;
}

a.java


import java.io.*;

public final class a extends Reader
{

    public a(InputStream inputstream)
    {
        a_boolean_fld = false;
        a_java_io_InputStream_fld = inputstream;
    }

    public final void close()
        throws IOException
    {
        a_java_io_InputStream_fld.close();
    }

    public final String a()
        throws IOException
    {
        char ac[] = new char[256];
        StringBuffer stringbuffer = new StringBuffer();
        int i = 0;
        do
            if((i = a(ac, 0, ac.length, true)) > 0)
                stringbuffer.append(ac, 0, i);
        while(i == ac.length);
        if(i == -1)
            return null;
        if(stringbuffer.length() > 0)
            return stringbuffer.toString();
        else
            return "";
    }

    private int a(char ac[], int i, int j, boolean flag)
        throws IOException
    {
        int k = 0;
label0:
        for(int l = i; k < j; l++)
        {
label1:
            {
                int i1;
                if((i1 = a_java_io_InputStream_fld.read()) == -1)
                {
                    if(k == 0)
                        k = -1;
                    break label0;
                }
                char c = '\0';
                switch(i1)
                {
                case 10: // '\n'
                case 13: // '\r'
                    a_boolean_fld = !a_boolean_fld;
                    if(!a_boolean_fld)
                    {
                        k--;
                        l--;
                    } else
                    {
                        c = '\n';
                        break;
                    }
                    break label1;

                case 165: 
                    c = '\u0104';
                    break;

                case 198: 
                    c = '\u0106';
                    break;

                case 202: 
                    c = '\u0118';
                    break;

                case 163: 
                    c = '\u0141';
                    break;

                case 209: 
                    c = '\u0143';
                    break;

                case 211: 
                    c = '\323';
                    break;

                case 140: 
                    c = '\u015A';
                    break;

                case 143: 
                    c = '\u0179';
                    break;

                case 175: 
                    c = '\u017B';
                    break;

                case 185: 
                    c = '\u0105';
                    break;

                case 230: 
                    c = '\u0107';
                    break;

                case 234: 
                    c = '\u0119';
                    break;

                case 179: 
                    c = '\u0142';
                    break;

                case 241: 
                    c = '\u0144';
                    break;

                case 243: 
                    c = '\363';
                    break;

                case 156: 
                    c = '\u015B';
                    break;

                case 159: 
                    c = '\u017A';
                    break;

                case 191: 
                    c = '\u017C';
                    break;

                default:
                    c = (char)i1;
                    break;
                }
                ac[l] = c;
                if(flag && c == '\n')
                    break label0;
            }
            k++;
        }

        return k;
    }

    public final int read(char ac[], int i, int j)
        throws IOException
    {
        return a(ac, i, j, false);
    }

    private InputStream a_java_io_InputStream_fld;
    private boolean a_boolean_fld;
}


0

Zalecane rozwiązanie: przenieś klasę a do jakiejś paczki i nadaj jej nazwę zaczynającą się od wielkiej litery.

1 użytkowników online, w tym zalogowanych: 0, gości: 1