Thread View: borland.public.jbuilder.java.swing
2 messages
2 total messages
Started by Sven Goetgeluck
Tue, 24 Feb 2004 16:04
JB 9 designer help
Author: Sven Goetgeluck
Date: Tue, 24 Feb 2004 16:04
Date: Tue, 24 Feb 2004 16:04
115 lines
4014 bytes
4014 bytes
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
Author: Gillmer J. Derge (TeamB)
Date: Tue, 24 Feb 2004 16:14
Date: Tue, 24 Feb 2004 16:14
34 lines
2205 bytes
2205 bytes
Sven Goetgeluck wrote:
> 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)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads