Board index » jbuilder » JB 9 designer help

JB 9 designer help


2004-02-25 12:04:40 AM
jbuilder9
hi ,
when opening my dialog in designer i'll get following error
java.lang.IllegalAccessException: Class com.borland.jbuilder.cmt.jb.JbValue
can not access a member of class vrex4.MyScrollPane with modifiers "public"
new MyScrollPane()
anybody has an idea what it means??
thanks Sven
this is the code for the scrollpane
class MyScrollPane
extends JScrollPane {
private static boolean doReset = true;
public MyScrollPane(Component view, int vsbPolicy, int hsbPolicy) {
super(view, vsbPolicy, hsbPolicy);
// Set the component to transparent
if (view instanceof JComponent) {
( (JComponent) view).setOpaque(false);
}
this.getHorizontalScrollBar().addAdjustmentListener(
new AdjustmentListener() {
public void adjustmentValueChanged(AdjustmentEvent ae) {
if (ae.getSource()instanceof JScrollBar) {
// ( (JScrollBar) ae.getSource()).setValue(0);
if (doReset) {
doReset = false;
((JScrollBar)
ae.getSource()).setValue(0);
doReset = false;
}
}
}
});
this.getVerticalScrollBar().addAdjustmentListener(
new AdjustmentListener() {
public void adjustmentValueChanged(AdjustmentEvent ae) {
if (ae.getSource()instanceof JScrollBar) {
if (doReset) {
doReset = false;
((JScrollBar) ae.getSource()).setValue(0);
doReset = false;
}
}
}
}
);
}
public void setReset(boolean sw) {
doReset = sw;
this.getVerticalScrollBar().setValue(0);
this.getHorizontalScrollBar().setValue(0);
}
public MyScrollPane(Component view) {
this(view, VERTICAL_SCROLLBAR_AS_NEEDED,
HORIZONTAL_SCROLLBAR_AS_NEEDED);
}
public MyScrollPane(int vsbPolicy, int hsbPolicy) {
this(null, vsbPolicy, hsbPolicy);
}
public MyScrollPane() {
this(null, VERTICAL_SCROLLBAR_AS_NEEDED,
HORIZONTAL_SCROLLBAR_AS_NEEDED);
}
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
if (image != null) {
// Draw the background image
Rectangle d = getViewport().getViewRect();
for (int x = 0; x < d.width; x += image.getIconWidth()) {
for (int y = 0; y < d.height; y += image.getIconHeight()) {
g2.drawImage(image.getImage(), x, y, null, null);
// Do not use cached image for scrolling
}
}
getViewport().setScrollMode(JViewport.BACKINGSTORE_SCROLL_MODE);
}
super.paint(g2);
setOpaque(false);
System.gc();
}
public void setBackgroundImage(ImageIcon image) {
this.image = image;
}
ImageIcon image = null;
}
 
 

Re:JB 9 designer help

Sven Goetgeluck wrote:
Quote
when opening my dialog in designer i'll get following error
java.lang.IllegalAccessException: Class com.borland.jbuilder.cmt.jb.JbValue
can not access a member of class vrex4.MyScrollPane with modifiers "public"
new MyScrollPane()

anybody has an idea what it means??
I suspect that your dialog contains a member of type vrex4.MyScrollPane.
Something like:
public class MyDialog extends JDialog {
private vrex4.MyScrollPane myScrollPane;
// ...
}
In order to let you manipulate the "myScrollPane" member, the designer
is trying to create an instance of vrex4.MyScrollPane. It does that
using the no-argument constructor as in "new MyScrollPane()." Since
your class doesn't have a no-argument constructor, that's failing.
If you want this class to work in the designer you need to implement a
no-argument constructor. If you want to make sure it's never used in an
actual program, you can do something like this:
public MyScrollPane() {
if (!Beans.isDesignTime()) {
throw new UnsupportedOperationException();
}
// ...
}
--
Gillmer J. Derge (TeamB)