Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

still not getting.....  RSS feed

 
Ravi Bhai
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I am not getting compilation from this file and also not able to figure out the problem....

program........
=======================================================================
// Source File Name: GroupLayout.java

package org.jdesktop.layout;

import java.util.ArrayList;
import java.util.List;

// Referenced classes of package org.jdesktop.layout:
// GroupLayout

public abstract class GroupLayout$Group extends
{
int indexOf( spring)
{
return springs.indexOf(spring);
}

GroupLayout$Group addSpring( spring, int index)
{
springs.add(spring);
spring.setParent(this);
if(!(spring instanceof ddingSpring))
GroupLayout.access$202(GroupLayout.this, true);
return this;
}

GroupLayout$Group addSpring( spring)
{
addSpring(spring, springs.size());
return this;
}

void setParent( parent)
{
super.setParent(parent);
for(int counter = springs.size() - 1; counter >= 0; counter--)
(()springs.get(counter)).setParent(this);

}

void setSize(int axis, int origin, int size)
{
super.setSize(axis, origin, size);
if(size == 0x80000000)
{
for(int counter = springs.size() - 1; counter >= 0; counter--)
getSpring(counter).setSize(axis, origin, size);

} else
{
setSize0(axis, origin, size);
}
}

abstract void setSize0(int i, int j, int k);

int getMinimumSize0(int axis)
{
return calculateSize(axis, 0);
}

int getPreferredSize0(int axis)
{
return calculateSize(axis, 1);
}

int getMaximumSize0(int axis)
{
return calculateSize(axis, 2);
}

abstract int operator(int i, int j);

int calculateSize(int axis, int type)
{
int count = springs.size();
if(count == 0)
return 0;
if(count == 1)
return getSize(getSpring(0), axis, type);
int size = constrain(operator(getSize(getSpring(0), axis, type), getSize(getSpring(1), axis, type)));
for(int counter = 2; counter < count; counter++)
size = constrain(operator(size, getSize(getSpring(counter), axis, type)));

return size;
}

getSpring(int index)
{
return ()springs.get(index);
}

int getSize( spring, int axis, int type)
{
switch(type)
{
case 0: // '\0'
return spring.getMinimumSize(axis);

case 1: // '\001'
return spring.getPreferredSize(axis);

case 2: // '\002'
return spring.getMaximumSize(axis);
}
if(!$assertionsDisabled)
throw new AssertionError();
else
return 0;
}

abstract void insertAutopadding(int i, List list, List list1, List list2, List list3, boolean flag);

void removeAutopadding()
{
for(int counter = springs.size() - 1; counter >= 0; counter--)
{
spring = ()springs.get(counter);
if(spring instanceof ddingSpring)
{
if(((ddingSpring)spring).getUserCreated())
((ddingSpring)spring).reset();
else
springs.remove(counter);
continue;
}
if(spring instanceof GroupLayout$Group)
((GroupLayout$Group)spring).removeAutopadding();
}

}

void resetAutopadding()
{
clear();
for(int counter = springs.size() - 1; counter >= 0; counter--)
{
spring = ()springs.get(counter);
if(spring instanceof ddingSpring)
{
((ddingSpring)spring).clear();
continue;
}
if(spring instanceof GroupLayout$Group)
((GroupLayout$Group)spring).resetAutopadding();
}

}

void calculateAutopadding(int axis)
{
for(int counter = springs.size() - 1; counter >= 0; counter--)
{
spring = ()springs.get(counter);
if(spring instanceof ddingSpring)
{
spring.clear();
((ddingSpring)spring).calculatePadding(axis);
continue;
}
if(spring instanceof GroupLayout$Group)
((GroupLayout$Group)spring).calculateAutopadding(axis);
}

clear();
}

List springs;
static final boolean $assertionsDisabled; /* synthetic field */


GroupLayout$Group()
{
super(GroupLayout.this);
springs = new ArrayList();
}
}

==================================================================

the error when compiled is......

======================
E:\Source\sender>javac GroupLayout$Group.java
GroupLayout$Group.java:12: illegal start of type
{
^
GroupLayout$Group.java:177: '{' expected
}
^
2 errors

E:\Source\sender>
--------------------------------------------------------------------------------
Posts: 1 | Registered: Mar 2008 | IP: Logged

Marco Ehrentreich
best scout
Member # 144924
posted Yesterday 11:36 PM
--------------------------------------------------------------------------------
Hi Ravi,

there's definitely a base class missing after the keyword "extends" at the start of your code:


quote:
--------------------------------------------------------------------------------
// Referenced classes of package org.jdesktop.layout:
// GroupLayout

public abstract class GroupLayout$Group extends
{
int indexOf( spring)
{
return springs.indexOf(spring);
--------------------------------------------------------------------------------



And what are all the dollar signs between GroupLayout and Group? Group is a nested class of GroupLayout and should by separated with a dot, I think?!? Did you write this code yourself or did you just copy it from the internet?

Please try again with correcting the mentioned errors. Maybe there are more, but the code is hard to read without formatting Just try again and let me know in case you don't get it work on your own.



================================================================




I tryed but not getting This is Decomplied source from class file.... I lost its source but when this is recompiled causing error above mentioned...
 
Campbell Ritchie
Sheriff
Posts: 53773
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isn't that the Group class inside GroupLayout? Go into your Java installation folder and find the file called src.zip. Unzip that, navigate into the javax folder, then the swing folder, then look inside the GroupLayout class.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!