Click to See Complete Forum and Search --> : How do I compile this jar file


peahead
February 10th, 2010, 01:12 PM
New to java but willing to learn.

I discovered an excellent Scrabble game done in java called Jabble (http://domcobley.50megs.com/jabble.html)

It works really well but I would like to make a couple of tweaks to it (i.e. make it 800 x 600 on startup without having to resize and changing some of the colours).

So, I decomplied the jar file, made some changes and used NetBean 6.8 to do a clean and build but I get a lot of errors which I don't understand.

I would really appreciate if somone could tell me if they can rebuild the jar or am I wasting my time as the jar file was built in 2001? If someone can rebuild it can you tell me how it is done?

Much appreciated

keang
February 10th, 2010, 02:08 PM
Unless you tell us what errors you are getting it's hard to help without guessing.

My guess though is the decompiler hasn't correctly decompiled the class files and therefore when you try to recompile the class files there are compile time errors.

peahead
February 10th, 2010, 04:41 PM
I used JD Java Decompiler (http://java.decompiler.free.fr).
The files seemed to have to decompiled ok to me, i.e. there is no corrupted text etc?
Do you want me to upload the decompiled java files so that you can have a go yourself or do you want me to send you a debug log of one of the files - however, the errors vary from file to file? Would it be a case of a missing library?

dlorde
February 10th, 2010, 06:26 PM
Post up the full text of the error messages - they will tell us what the problem(s) is/are.

By viewing the old we learn the new...
Chinese proverb

peahead
February 11th, 2010, 02:17 AM
Here are the errors generated when I compile the main Jabble. I am using NetBeans 6.8

I've also attached the source I am working with.

Would really appreciate if someone could help me. Thanks

dlorde
February 11th, 2010, 06:00 AM
These are syntax errors, suggesting either the decompiler isn't handling certain code correctly, or that compiler optimisations have rendered the compiled code problematic for decompiling.

However, I see you have cross-posted this in other forums, so I won't waste any more time on it.

Any fool can use a computer. Many do...
Ted Nelson

peahead
February 11th, 2010, 07:41 AM
Thanks Dlorde,
Yes, you are right. I had posted this article in two other forums but I never received any real help except for a bum steer about a missing org.apache library which, when installed, removed the errors, but I found out later to be a waste of time...hmmmm.

Your answer is the most definitive and constructive I have received, so thanks for that. Ah well, all I was trying to do was resize the screen on startup which is no big deal.

Cheers

keang
February 11th, 2010, 09:08 AM
Yes, you are right. I had posted this article in two other forums Bad move. Many people (generally myself included) won't answer cross posted questions because we end up wasting our time answering something that has already been answered on another forum. If you want serious help close the posts on the other forums.

but I never received any real help except for a bum steer about a missing org.apache library which, when installed, removed the errors, Adding a library, any library, would not make these errors go away. As dlorde has already pointed out these are predominantly syntax errors and not problems with binding to other classes.

Decompiling code is not as easy as you may think and it looks like, in this case, your decompiler has struggled to understand the p code. You could try using a different decompiler and see if that makes a better job of it.

peahead
February 11th, 2010, 02:47 PM
Ok Keang,
Point taken - I have since closed the other cross posts. In my defence, I gave up on them due to lack of interest, so thought no harm done, but I appreciate the time wasting effort in responding to cross posts, so apologies. I wouldn't appreciate the same if it happended to me.

I will take your advice at trying another decompiler. Any suggestions as to a free decompiler?

Thanks again

dlorde
February 11th, 2010, 05:40 PM
Any suggestions as to a free decompiler?

I've used JAD (http://www.varaneckas.com/jad) in the past - but I've not tried to recompile from it. It seems to have died out of late, so there may be better options out there now.

The trouble with programmers is that you can never tell what a programmer is doing until it’s too late...
Seymour Cray

peahead
February 14th, 2010, 02:48 PM
dlorde: Thanks for the pointer about JAD - it has done a much better job of decompiling the class files when compared to JD java compiler as there are less errors detected by NetBeans, however, I still have 3 class files which contain errors so the build fails but I am making progress as the preference screen kicks in at the start before it falls over.

It falls over as the class file 'DragArea' (see attached screenshot) contains illegible code. You will see that lines 262-272 failed to decompile properly and just my luck these lines see to contain the code need to boot the main panel itself.

Not to be beaten I checked the code decompiled by JD java compiler and it is as follows:

{
DragArea tmp43_42 = this;
if ((localObject = tmp43_42.m12(tmp43_42.f7, (this.f10) ? 1 : 2)) == null)
return;
if (this.f10)
this.f7.x = ((Tile)localObject).getPoint().x;
else
this.f7.y = ((Tile)localObject).getPoint().y;
m9((Tile)localObject);
if (!(this.setupMode))
m2((Tile)localObject);
}

(not sure how to enter code on this site).

I have tried (on & off) for 3 nights to 'patch' this code into the code produced by JAD but without success. Admittedly I am out of my depth. I would appreciate if someone could have a go themselves at patching the code with a view to being able to build and compile it.

I attach a snapshot of the files I am using plus a test dictionary. If I am wasting my time with this project could someone tell me. All I want to do is to change the screen size and a few colours but if the end result is not worth the effort then I will stop while I am ahead.

dlorde
February 15th, 2010, 07:07 AM
(not sure how to enter code on this site).

You didn't see notice my or Keang's sigs then?

If you get errors, please post the full text of the error message and the stack trace, if present. If possible, post the section of code referred to in the error message.

If you want truly to understand something, try to change it...
K. Lewin

keang
February 15th, 2010, 12:15 PM
Without more information this is a guess but from comparing the two code snippets it looks like the code should be:
{
tile = m12(f7, f10 ? 1 : 2);

if ( tile == null )
return;

if ( f10 )
f7.x = tile.getPoint().x;
else
f7.y = tile.getPoint().y;

m9(tile);

if ( !setupMode )
m2(tile);
}
You may also need to declare the variable 'tile' (I can't see from the code you've posted if it is already declared).

peahead
February 15th, 2010, 02:44 PM
Thanks for your help keang.

Your code has removed the errors on the java file 'DragArea' (thanks!) but I am still unable to compile the project as 2 other java files 1) Jabble and 2) Toolbarframe contains errors

1) Jabble.java

NetBean 6.8 stops compiling at line 649 on Jabble.java; this is the relevant error:

Listening on javadebug
User program running
Debugger stopped on uncompilable source code.
Thread main stopped at Jabble.java:649.


The code at line 649 reads as follows:


f2 = new DragArea();


When I hover over the line with the mouse it says cannot find symbol
symbol: constructor DragArea
location: class DragArea

Also, in the Jabble file NetBeans finds errors in the following code (line 2 and 5 respectively) saying variable tmp31_30 might not have been intialized


{
problemField.setText(s);
Jabble tmp31_30 = tmp31_30;
if (tmp31_30 == null)
throw null;
new Jabble.Reminder(tmp31_30, 3);
return;
}


2) Toolbarframe.java

This file contains 42 errors mainly surrounding 'package super does not exist'

Any suggestions?

I attach another screenshot for reference.

Again, thanks for your time and help

keang
February 16th, 2010, 10:58 AM
NetBean 6.8 stops compiling at line 649 on Jabble.java; this is the relevant error:

Listening on javadebug
User program running
Debugger stopped on uncompilable source code.
Thread main stopped at Jabble.java:649.That's not a compiler message, it looks like output from running the program.

You need to look at the DragArea class, see what constructors it has and use the most appropriate one. It probably should be: f2 = new DragArea(this);

Also, in the Jabble file NetBeans finds errors in the following code (line 2 and 5 respectively) saying variable tmp31_30 might not have been intializedCan you show the output from both decompilers.

This file contains 42 errors mainly surrounding 'package super does not exist'This file imports a file (com.symbian.devnet.util.ELocale), do you have this file - it could be in another jar.

Try removing the package declaration and make sure the jar containing the imported file is on the class path.

peahead
February 16th, 2010, 03:25 PM
Thanks - I added the constructor code:


f2 = new DragArea(this);


Here are the 2 sets of deompiled code:



public final void reportProblem(String paramString)
{
if (paramString.equals(""))
{
this.problemField.setText("");
return;
}
this.problemField.setText(paramString);
Jabble tmp31_30 = this;
if (tmp31_30 == null)
throw null;
new Jabble.Reminder(tmp31_30, 3);
}


public final void reportProblem(String s)
{
if(s.equals(""))
{
problemField.setText("");
return;
} else
{
problemField.setText(s);
Jabble tmp31_30 = tmp31_30;
if (tmp31_30 == null)
throw null;
new Jabble.Reminder(tmp31_30, 3);
return;
}
}



I don't have the file com.symbian.devnet.util.ELocale. Not sure what you mean by:


Try removing the package declaration and make sure the jar containing the imported file is on the class path.


I have 'hidden' it by putting 2 // in front of it??

keang
February 17th, 2010, 07:48 AM
Again this is just an educated guess as I haven't studied all of the code but it looks like it should be:

public final void reportProblem(String paramString)
{
problemField.setText(paramString);

if (paramString.equals(""))
{
return;
}

new Jabble.Reminder(3);
}




I don't have the file com.symbian.devnet.util.ELocale.
The class is importing it so unless the import is superfluous the compile will fail without this file. If it is a real import then the file must be on the class path or the original app would have failed when it tried to access it. Try removing this import statement and see if the compiler complains about not finding the class.

Alternatively, Netbeans probably will be able to auto generate import statements (Eclipse can certainly do this) so try running the auto-generate import statements feature and see if it complains about a class it can't resolve.


I have 'hidden' it by putting 2 // in front of it??
Yes, that will work.

peahead
February 18th, 2010, 10:03 AM
Hi keang,

Good news - we are making progress!! The game now works in debug mode!! However, the downside is that it will still not compile properly (as you suspected) because of the errors in the file ToolbarFrame.

Here's an update.

1) Your new code worked great - thanks

2) I couldn't work out how to create an auto-statement in NetBeans so, I took a long cut for a shortcut and downloaded Eclipse. Long story short I created a new java file called ELocale.java with the following code:


package com.symbian.devnet.util;

public class ELocale
{
class startNotifier
{

}
}


3) I then done a build and compile but NetBeans generates 45 errors as follows:


init:
deps-clean:
Updating property file: C:\Users\User1\Desktop\JabbleDev\build\built-clean.properties
Deleting directory C:\Users\User1\Desktop\JabbleDev\build
clean:
init:
deps-jar:
Created dir: C:\Users\User1\Desktop\JabbleDev\build
Updating property file: C:\Users\User1\Desktop\JabbleDev\build\built-jar.properties
Created dir: C:\Users\User1\Desktop\JabbleDev\build\classes
Created dir: C:\Users\User1\Desktop\JabbleDev\build\empty
Compiling 23 source files to C:\Users\User1\Desktop\JabbleDev\build\classes
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:18: cannot find symbol
symbol: class EFrame
public class ToolbarFrame extends EFrame
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:33: cannot find symbol
symbol : method getBounds()
location: class ToolbarFrame
TOOLBAR_HEIGHT = getBounds().height;
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:46: package super does not exist
super.aboutDialog.setTitle("About the Toolbar Frame");
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:47: package super does not exist
super.aboutDialog.text = dialogText;
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:49: addActionListener(java.awt.event.ActionListener) in java.awt.MenuItem cannot be applied to (ToolbarFrame)
showToolbarItem.addActionListener(this);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:51: addItemListener(java.awt.event.ItemListener) in java.awt.CheckboxMenuItem cannot be applied to (ToolbarFrame)
leftToolbarItem.addItemListener(this);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:52: package super does not exist
super.menuBar.add(viewMenu);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:88: cannot find symbol
symbol : method getToolkit()
location: class ToolbarFrame
RIGHT_SHIFT = getToolkit().getScreenSize().width - 68;
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:96: package super does not exist
super.mainPanel.addComponentListener(new _cls2());
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:97: package super does not exist
super.mainPanel.setBounds(0, 0, RIGHT_SHIFT + 1, TOOLBAR_HEIGHT);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:98: package super does not exist
f1 = super.mainPanel.getSize().width;
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:99: cannot find symbol
symbol : method setLayout(<nulltype>)
location: class ToolbarFrame
setLayout(null);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:100: cannot find symbol
symbol : method add(java.awt.Panel,java.lang.String)
location: class ToolbarFrame
add(panel, panel.getName());
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:103: cannot find symbol
symbol : variable ELocale
location: class ToolbarFrame
ELocale.startNotifier();
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:131: package super does not exist
if(!f2 && super.mainPanel.getSize().width == f1)
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:132: cannot find symbol
symbol : variable super
location: class ToolbarFrame
m1(super.mainPanel, 67, 0);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:134: package super does not exist
if(f2 && super.mainPanel.getSize().width == f1)
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:135: package super does not exist
super.mainPanel.setBounds(0, 0, super.mainPanel.getSize().width + 67, super.mainPanel.getSize().height);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:135: operator + cannot be applied to super.mainPanel.getSize.width,int
super.mainPanel.setBounds(0, 0, super.mainPanel.getSize().width + 67, super.mainPanel.getSize().height);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:135: package super does not exist
super.mainPanel.setBounds(0, 0, super.mainPanel.getSize().width + 67, super.mainPanel.getSize().height);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:135: package super does not exist
super.mainPanel.setBounds(0, 0, super.mainPanel.getSize().width + 67, super.mainPanel.getSize().height);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:137: package super does not exist
if(f2 && super.mainPanel.getSize().width > f1)
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:139: cannot find symbol
symbol : variable super
location: class ToolbarFrame
m2(super.mainPanel, 67, 0);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:140: package super does not exist
super.mainPanel.setLocation(0, 0);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:146: package super does not exist
if(!f2 && super.mainPanel.getSize().width > f1)
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:147: cannot find symbol
symbol : variable super
location: class ToolbarFrame
m2(super.mainPanel, 67, 0);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:149: package super does not exist
if(f2 && super.mainPanel.getSize().width == f1)
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:150: package super does not exist
super.mainPanel.setLocation(67, 0);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:152: package super does not exist
if(f2 && super.mainPanel.getSize().width > f1)
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:153: package super does not exist
super.mainPanel.setBounds(67, 0, super.mainPanel.getSize().width - 67, super.mainPanel.getSize().height);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:153: package super does not exist
super.mainPanel.setBounds(67, 0, super.mainPanel.getSize().width - 67, super.mainPanel.getSize().height);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:153: package super does not exist
super.mainPanel.setBounds(67, 0, super.mainPanel.getSize().width - 67, super.mainPanel.getSize().height);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:155: cannot find symbol
symbol : variable super
location: class ToolbarFrame
super.actionPerformed(actionevent);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:169: package super does not exist
super.mainPanel.setLocation(67, 0);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:171: package super does not exist
if(super.mainPanel.getSize().width > f1)
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:172: cannot find symbol
symbol : variable super
location: class ToolbarFrame
m2(super.mainPanel, 67, 0);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:174: cannot find symbol
symbol : method repaint()
location: class ToolbarFrame
repaint();
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:177: package super does not exist
if(super.mainPanel.getSize().width > f1)
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:178: cannot find symbol
symbol : variable super
location: class ToolbarFrame
m2(super.mainPanel, 67, 0);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:179: package super does not exist
super.mainPanel.setLocation(0, 0);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:182: cannot find symbol
symbol : method repaint()
location: class ToolbarFrame
repaint();
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:192: cannot find symbol
symbol : method repaint()
location: class ToolbarFrame
repaint();
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:197: cannot find symbol
symbol : method setVisible(boolean)
location: class ToolbarFrame
(new ToolbarFrame()).setVisible(true);
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:235: cannot find symbol
symbol : variable TaskSwitch
location: class ToolbarFrame._cls1
TaskSwitch.displayTaskList();
C:\Users\User1\Desktop\JabbleDev\Jabble.src\ToolbarFrame.java:249: cannot find symbol
symbol : class EFrame
location: class ToolbarFrame._cls2
((EFrame) (f1)).mainPanel.validate();
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
45 errors
C:\Users\User1\Desktop\JabbleDev\nbproject\build-impl.xml:413: The following error occurred while executing this line:
C:\Users\User1\Desktop\JabbleDev\nbproject\build-impl.xml:199: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 3 seconds)


4) I have attached a screenshot of work in progress.

5) The game is working very well in debug mode and the only thing that doesn't seem to be working is alignment of the letters (they are aligned left rather than centre), other than that it is going great guns.

6) Here is the code from the ToolbarFrame java file for reference



// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)

package com.symbian.devnet.awt;

import com.symbian.devnet.util.ELocale;
import java.awt.*;
import java.awt.event.*;
import java.text.SimpleDateFormat;
import java.util.*;

// Referenced classes of package com.symbian.devnet.awt:
// EFrame

public class ToolbarFrame extends EFrame
implements ItemListener, ActionListener
{

public ToolbarFrame()
{
this("");
}

public ToolbarFrame(String s)
{
super(s);
appName = System.getProperty("com.symbian.appName");
if(appName.length() > 10)
appName = appName.substring(0, 10);
TOOLBAR_HEIGHT = getBounds().height;
TOOLBAR_WIDTH = 68;
BUTTON_HEIGHT = 37;
TITLE_BAR_HEIGHT = 24;
CLOCK_BAR_HEIGHT = TOOLBAR_HEIGHT - 24 - 148;
viewMenu = new Menu("View");
showToolbarItem = new MenuItem("Hide toolbar", new MenuShortcut(84));
leftToolbarItem = new CheckboxMenuItem("Left toolbar", false);
f2 = false;
dummy = new Date();
cal = new GregorianCalendar();
df = new SimpleDateFormat("HH:mm\nEE d");
lastdate = df.format(dummy);
super.aboutDialog.setTitle("About the Toolbar Frame");
super.aboutDialog.text = dialogText;
viewMenu.add(showToolbarItem);
showToolbarItem.addActionListener(this);
viewMenu.add(leftToolbarItem);
leftToolbarItem.addItemListener(this);
super.menuBar.add(viewMenu);
Label1 = new Label();
Label1.setName("Label1");
Label1.setAlignment(1);
Label1.setFont(new Font("dialog", 1, 12));
Label1.setText(appName);
Label1.setBackground(Color.white);
Label1.setBounds(1, 1, 66, 24);
Label1.addMouseListener(new _cls1());
Button1 = new Button();
Button1.setName("Button1");
Button1.setBounds(0, 25, 68, 37);
Button1.setLabel("Cmd1");
Button2 = new Button();
Button2.setName("Button2");
Button2.setBounds(0, 62, 68, 37);
Button2.setLabel("Cmd2");
Button3 = new Button();
Button3.setName("Button3");
Button3.setBounds(0, 99, 68, 37);
Button3.setLabel("Cmd3");
Button4 = new Button();
Button4.setName("Button4");
Button4.setBounds(0, 136, 68, 37);
Button4.setLabel("Cmd4");
Label2 = new Label();
Label2.setName("Label2");
Label2.setAlignment(1);
Label2.setFont(new Font("dialog", 1, 14));
displayTime();
Label2.setBackground(Color.white);
Label2.setBounds(1, 173, 66, CLOCK_BAR_HEIGHT - 2);
panel = new Panel();
panel.setName("panel");
panel.setLayout(null);
panel.setBackground(Color.black);
RIGHT_SHIFT = getToolkit().getScreenSize().width - 68;
panel.setBounds(RIGHT_SHIFT, 0, 68, TOOLBAR_HEIGHT);
panel.add(Label1, Label1.getName());
panel.add(Button1, Button1.getName());
panel.add(Button2, Button2.getName());
panel.add(Button3, Button3.getName());
panel.add(Button4, Button4.getName());
panel.add(Label2, Label2.getName());
super.mainPanel.addComponentListener(new _cls2());
super.mainPanel.setBounds(0, 0, RIGHT_SHIFT + 1, TOOLBAR_HEIGHT);
f1 = super.mainPanel.getSize().width;
setLayout(null);
add(panel, panel.getName());
try
{
ELocale.startNotifier();
}
catch(RuntimeException runtimeexception)
{
System.err.println(runtimeexception.getMessage());
System.exit(0);
}
timer = new _cls3();
timer.start();
}

private void m1(Component component, int i, int j)
{
component.setSize(component.getSize().width + i, component.getSize().height + j);
}

private void m2(Component component, int i, int j)
{
component.setSize(component.getSize().width - i, component.getSize().height - j);
}

public void actionPerformed(ActionEvent actionevent)
{
if(actionevent.getSource() == showToolbarItem)
if(panel.isVisible())
{
panel.setVisible(false);
showToolbarItem.setLabel("Show toolbar");
if(!f2 && super.mainPanel.getSize().width == f1)
m1(super.mainPanel, 67, 0);
else
if(f2 && super.mainPanel.getSize().width == f1)
super.mainPanel.setBounds(0, 0, super.mainPanel.getSize().width + 67, super.mainPanel.getSize().height);
else
if(f2 && super.mainPanel.getSize().width > f1)
{
m2(super.mainPanel, 67, 0);
super.mainPanel.setLocation(0, 0);
}
} else
{
panel.setVisible(true);
showToolbarItem.setLabel("Hide toolbar");
if(!f2 && super.mainPanel.getSize().width > f1)
m2(super.mainPanel, 67, 0);
else
if(f2 && super.mainPanel.getSize().width == f1)
super.mainPanel.setLocation(67, 0);
else
if(f2 && super.mainPanel.getSize().width > f1)
super.mainPanel.setBounds(67, 0, super.mainPanel.getSize().width - 67, super.mainPanel.getSize().height);
}
super.actionPerformed(actionevent);
}

public void itemStateChanged(ItemEvent itemevent)
{
if(itemevent.getSource() == leftToolbarItem)
{
if(!panel.isVisible())
{
panel.setVisible(true);
showToolbarItem.setLabel("Hide toolbar");
}
if(itemevent.getStateChange() == 1)
{
super.mainPanel.setLocation(67, 0);
panel.setLocation(0, 0);
if(super.mainPanel.getSize().width > f1)
m2(super.mainPanel, 67, 0);
f2 = true;
repaint();
return;
}
if(super.mainPanel.getSize().width > f1)
m2(super.mainPanel, 67, 0);
super.mainPanel.setLocation(0, 0);
panel.setLocation(RIGHT_SHIFT, 0);
f2 = false;
repaint();
}
}

public void displayTime()
{
dat = new Date();
cal.setTime(dat);
today = df.format(dat);
Label2.setText(today);
repaint();
}

public static void main(String args[])
{
(new ToolbarFrame()).setVisible(true);
}

String dialogText[] = {
"--" + System.getProperty("com.symbian.appName") + "--", "Version 1.1, 31st January 2000"
};
public String appName;
public Label Label1;
public Label Label2;
public Button Button1;
public Button Button2;
public Button Button3;
public Button Button4;
public Panel panel;
private static int f1;
final int TOOLBAR_HEIGHT;
final int TOOLBAR_WIDTH;
final int BUTTON_HEIGHT;
final int TITLE_BAR_HEIGHT;
final int CLOCK_BAR_HEIGHT;
static int RIGHT_SHIFT;
public Menu viewMenu;
public MenuItem showToolbarItem;
public CheckboxMenuItem leftToolbarItem;
private boolean f2;
Thread timer;
Date dummy;
GregorianCalendar cal;
SimpleDateFormat df;
String lastdate;
Date dat;
String today;

private class _cls1 extends MouseAdapter
{

public void mousePressed(MouseEvent mouseevent)
{
TaskSwitch.displayTaskList();
}

_cls1()
{
}
}


private class _cls2 extends ComponentAdapter
{

public void componentResized(ComponentEvent componentevent)
{
((EFrame) (f1)).mainPanel.validate();
}

private final ToolbarFrame f1;

_cls2()
{
f1 = ToolbarFrame.this;
}
}


private class _cls3 extends Thread
{

public void run()
{
while(f1.timer != null)
{
try
{
Thread.sleep(100L);
}
catch(InterruptedException _ex) { }
f1.displayTime();
}
}

private final ToolbarFrame f1;

_cls3()
{
f1 = ToolbarFrame.this;
}
}

}



Any thoughts on removing the errors from ToolbarFrame?

As always keang, thanks for your time and expertise - much appreciated

keang
February 19th, 2010, 02:51 AM
As I said before you must have the ELocale class in the original distribution or the original program would not work. Are there any other jar files in the distribution?

In the version of the ELocale class you have written startnotifier() should be a method and not an inner class.

The other problems mainly stem from the fact that you don't seem to have the class EFrame either.

Before you go any further you will need to find these class files. If you haven't got them try searching for the full package name and class file name on the internet.

peahead
February 19th, 2010, 10:03 AM
I have checked and double-checked the original distribution - there are definitely no additional class files called ELocale and EFrame and there are no additional jar files included either, yet the program runs fine without them? This would fit in with the decompiled version I am using in NetBeans - it runs fine in debug mode but won't compile because of the broken references?

Is it possible to remove the references to the ELocale and EFrame to allow it to compile without error, as I don't the files are needed?

I don't know what you mean by searching for the full package name?

keang
February 19th, 2010, 01:09 PM
ToolbarFrame extends EFrame and from looking at the code EFrame has functionality that maybe required. You could try changing ToolbarFrame so it extends Frame and lose some of the funtionality such as the about dialog. Such as this:

//Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
//Jad home page: http://www.kpdus.com/jad.html
//Decompiler options: packimports(3)
import java.awt.Button;
import java.awt.CheckboxMenuItem;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Label;
import java.awt.Menu;
import java.awt.MenuItem;
import java.awt.MenuShortcut;
import java.awt.Panel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.GregorianCalendar;

//Referenced classes of package com.symbian.devnet.awt:
// EFrame

public class ToolbarFrame extends Frame
implements ItemListener, ActionListener
{

public ToolbarFrame()
{
this("");
}

public ToolbarFrame(String s)
{
super(s);
appName = System.getProperty("com.symbian.appName");
if(appName.length() > 10)
appName = appName.substring(0, 10);
TOOLBAR_HEIGHT = getBounds().height;
TOOLBAR_WIDTH = 68;
BUTTON_HEIGHT = 37;
TITLE_BAR_HEIGHT = 24;
CLOCK_BAR_HEIGHT = TOOLBAR_HEIGHT - 24 - 148;
viewMenu = new Menu("View");
showToolbarItem = new MenuItem("Hide toolbar", new MenuShortcut(84));
leftToolbarItem = new CheckboxMenuItem("Left toolbar", false);
f2 = false;
dummy = new Date();
cal = new GregorianCalendar();
df = new SimpleDateFormat("HH:mm\nEE d");
lastdate = df.format(dummy);
// super.aboutDialog.setTitle("About the Toolbar Frame");
// super.aboutDialog.text = dialogText;
viewMenu.add(showToolbarItem);
showToolbarItem.addActionListener(this);
viewMenu.add(leftToolbarItem);
leftToolbarItem.addItemListener(this);
getMenuBar().add(viewMenu);
Label1 = new Label();
Label1.setName("Label1");
Label1.setAlignment(1);
Label1.setFont(new Font("dialog", 1, 12));
Label1.setText(appName);
Label1.setBackground(Color.white);
Label1.setBounds(1, 1, 66, 24);
Label1.addMouseListener(new _cls1());
Button1 = new Button();
Button1.setName("Button1");
Button1.setBounds(0, 25, 68, 37);
Button1.setLabel("Cmd1");
Button2 = new Button();
Button2.setName("Button2");
Button2.setBounds(0, 62, 68, 37);
Button2.setLabel("Cmd2");
Button3 = new Button();
Button3.setName("Button3");
Button3.setBounds(0, 99, 68, 37);
Button3.setLabel("Cmd3");
Button4 = new Button();
Button4.setName("Button4");
Button4.setBounds(0, 136, 68, 37);
Button4.setLabel("Cmd4");
Label2 = new Label();
Label2.setName("Label2");
Label2.setAlignment(1);
Label2.setFont(new Font("dialog", 1, 14));
displayTime();
Label2.setBackground(Color.white);
Label2.setBounds(1, 173, 66, CLOCK_BAR_HEIGHT - 2);
panel = new Panel();
panel.setName("panel");
panel.setLayout(null);
panel.setBackground(Color.black);
RIGHT_SHIFT = getToolkit().getScreenSize().width - 68;
panel.setBounds(RIGHT_SHIFT, 0, 68, TOOLBAR_HEIGHT);
panel.add(Label1, Label1.getName());
panel.add(Button1, Button1.getName());
panel.add(Button2, Button2.getName());
panel.add(Button3, Button3.getName());
panel.add(Button4, Button4.getName());
panel.add(Label2, Label2.getName());
addComponentListener(new _cls2());
setBounds(0, 0, RIGHT_SHIFT + 1, TOOLBAR_HEIGHT);
f1 = getSize().width;
setLayout(null);
add(panel, panel.getName());
timer = new _cls3();
timer.start();
}

private void m1(Component component, int i, int j)
{
component.setSize(component.getSize().width + i, component.getSize().height + j);
}

private void m2(Component component, int i, int j)
{
component.setSize(component.getSize().width - i, component.getSize().height - j);
}

public void actionPerformed(ActionEvent actionevent)
{
if(actionevent.getSource() == showToolbarItem)
if(panel.isVisible())
{
panel.setVisible(false);
showToolbarItem.setLabel("Show toolbar");
if(!f2 && getSize().width == f1)
m1(this, 67, 0);
else
if(f2 && getSize().width == f1)
setBounds(0, 0, getSize().width + 67, getSize().height);
else
if(f2 && getSize().width > f1)
{
m2(this, 67, 0);
setLocation(0, 0);
}
} else
{
panel.setVisible(true);
showToolbarItem.setLabel("Hide toolbar");
if(!f2 && getSize().width > f1)
m2(this, 67, 0);
else
if(f2 && getSize().width == f1)
setLocation(67, 0);
else
if(f2 && getSize().width > f1)
setBounds(67, 0, getSize().width - 67, getSize().height);
}
}

public void itemStateChanged(ItemEvent itemevent)
{
if(itemevent.getSource() == leftToolbarItem)
{
if(!panel.isVisible())
{
panel.setVisible(true);
showToolbarItem.setLabel("Hide toolbar");
}
if(itemevent.getStateChange() == 1)
{
setLocation(67, 0);
panel.setLocation(0, 0);
if(getSize().width > f1)
m2(this, 67, 0);
f2 = true;
repaint();
return;
}
if(getSize().width > f1)
m2(this, 67, 0);
setLocation(0, 0);
panel.setLocation(RIGHT_SHIFT, 0);
f2 = false;
repaint();
}
}

public void displayTime()
{
dat = new Date();
cal.setTime(dat);
today = df.format(dat);
Label2.setText(today);
repaint();
}

public static void main(String args[])
{
(new ToolbarFrame()).setVisible(true);
}

String dialogText[] = {
"--" + System.getProperty("com.symbian.appName") + "--", "Version 1.1, 31st January 2000"
};
public String appName;
public Label Label1;
public Label Label2;
public Button Button1;
public Button Button2;
public Button Button3;
public Button Button4;
public Panel panel;
private static int f1;
final int TOOLBAR_HEIGHT;
final int TOOLBAR_WIDTH;
final int BUTTON_HEIGHT;
final int TITLE_BAR_HEIGHT;
final int CLOCK_BAR_HEIGHT;
static int RIGHT_SHIFT;
public Menu viewMenu;
public MenuItem showToolbarItem;
public CheckboxMenuItem leftToolbarItem;
private boolean f2;
Thread timer;
Date dummy;
GregorianCalendar cal;
SimpleDateFormat df;
String lastdate;
Date dat;
String today;

private class _cls1 extends MouseAdapter
{

public void mousePressed(MouseEvent mouseevent)
{
TaskSwitch.displayTaskList();
}

_cls1()
{
}
}


private class _cls2 extends ComponentAdapter
{

public void componentResized(ComponentEvent componentevent)
{
f1.validate();
}

private final ToolbarFrame f1;

_cls2()
{
f1 = ToolbarFrame.this;
}
}


private class _cls3 extends Thread
{

public void run()
{
while(f1.timer != null)
{
try
{
Thread.sleep(100L);
}
catch(InterruptedException _ex) { }
f1.displayTime();
}
}

private final ToolbarFrame f1;

_cls3()
{
f1 = ToolbarFrame.this;
}
}

}
I've no idea if this will run and it still has one error - missing TaskSwitch - but I'm assuming that is in the jar you have decompiled and so will be resolve on your system.

peahead
February 20th, 2010, 11:13 AM
Success!! I am now able to compile a working jar file.
Thanks for all your help keang - much appreciated.
Final compilable source code attached.

keang
February 20th, 2010, 11:24 AM
Excellent news, glad I could help.