Results 1 to 7 of 7
- 12-09-2011, 10:30 AM #1
Member
- Join Date
- Dec 2011
- Posts
- 11
- Rep Power
- 0
Have Problems Implementing Grid View
Hello all i have a problem implementing a code into my code.
I need some guidance where i am doing it wrong?
The code i am trying to implement is;
setLayout(new GridLayout(2, 2));
ScrollingImagePanel panel = new ScrollingImagePanel(image1, width, height);
add(new ScrollingImagePanel(im1, width, height));
add(new ScrollingImagePanel(im2, width, height));
add(new ScrollingImagePanel(im3, width, height));
add(new ScrollingImagePanel(im4, width, height));
pack();
show();
The code that i am trying to implement in is;
Interpolation interp = Interpolation.getInstance(Interpolation.INTERP_BIL INEAR);
ParameterBlock params = new ParameterBlock();
//System.out.println(ImPath[i]);
RenderedImage image = (RenderedImage)JAI.create("fileload",ImPath[i]);
params.addSource(image);
params.add(0.5F); // x scale factor
params.add(0.5F); // y scale factor
params.add(0.0F); // x translate
params.add(0.0F); // y translate
params.add(interp); // interpolation method
RenderedOp image1 = JAI.create("scale", params);
int width = image1.getWidth();
int height = image1.getHeight();
Frame window = new Frame("Scrolling Image Panel Example");
window.add(panel);
window.pack();
window.show();
I need to show the images in a grid view.
Does anyone has a clue?
Kind Regards
ömer kaya
METU
- 12-09-2011, 01:27 PM #2
Member
- Join Date
- Dec 2011
- Posts
- 11
- Rep Power
- 0
Re: Have Problems Implementing Grid View
RenderedImage image = (RenderedImage)JAI.create("fileload",ImPath[i]);
params.addSource(image);
params.add(0.5F); // x scale factor
params.add(0.5F); // y scale factor
params.add(0.0F); // x translate
params.add(0.0F); // y translate
params.add(interp); // interpolation method
RenderedOp image1 = JAI.create("scale", params);
int width = image1.getWidth();
int height = image1.getHeight();
ScrollingImagePanel panel = new ScrollingImagePanel(image1, width, height);
int ImCount = list.getItemCount();
int DGridW = 0;
int DGridH = 0;
if ((ImCount % 2) == 0)
{
DGridW = ImCount / 2; //Display Grid Assignment Width
DGridH = ImCount / 2; //Display Grid Assignment Height
}
else
{
int ImCountEven = (ImCount+1);
DGridW = ImCountEven / 2; //Display Grid Assignment Width
DGridH = ImCountEven / 2; //Display Grid Assignment Height
}
panel.setLayout(new GridLayout(DGridW,DGridH));
panel.add(new ScrollingImagePanel(image1, width, height));
Frame window = new Frame(" " + ImPath[i]);
//window.add(panel);
window.pack();
window.show();
This is what i can do so far but i get the exception of;
Exception in thread "AWT-EventQueue-0" java.awt.AWTError: ScrollPane controls layout
at java.awt.ScrollPane.setLayout(Unknown Source)
at CamCalib$3.actionPerformed(CamCalib.java:143)
143 = panel.setLayout(new GridLayout(DGridW,DGridH));
Any clues?
- 12-09-2011, 02:24 PM #3
Re: Have Problems Implementing Grid View
What is the definition of the ScrollingImagePanel class?
- 12-09-2011, 02:29 PM #4
Member
- Join Date
- Dec 2011
- Posts
- 11
- Rep Power
- 0
Re: Have Problems Implementing Grid View
Thank you for the reply.
Definition;
Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.
thanks.
ökaya
- 12-09-2011, 02:32 PM #5
Re: Have Problems Implementing Grid View
If you can't say how the ScrollingImagePanel class is defined, then not much can be done
- 12-09-2011, 03:18 PM #6
Member
- Join Date
- Dec 2011
- Posts
- 11
- Rep Power
- 0
Re: Have Problems Implementing Grid View
hmmm...
I have searched the web..
setLayout
public final void setLayout(LayoutManager mgr)
Sets the layout manager for this container. This method is overridden to prevent the layout mgr from being set.
Overrides:
setLayout in class Container
Parameters:
mgr - the specified layout manager
information came out but as i am a Newbie... I can not understand what it means.
regards
ömer kaya
metu
- 12-09-2011, 03:42 PM #7
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Have Problems Implementing Grid View
Presuming (from the error message) ScrollingImagePanel extends JScrollPane then, from the API for setLayout:
"
This method overrides setLayout in java.awt.Container to ensure that only LayoutManagers which are subclasses of ScrollPaneLayout can be used in a JScrollPane.
"
Similar Threads
-
How enter this mode-gui/design-view/code-view
By lse123 in forum NetBeansReplies: 0Last Post: 02-28-2010, 09:09 PM -
Problems implementing Java string methods
By everlast88az in forum New To JavaReplies: 8Last Post: 11-06-2008, 04:17 AM -
Problems with JFrame losing the Design view
By chris@gaiag.net in forum NetBeansReplies: 7Last Post: 07-23-2008, 07:35 AM -
problems trying to view the contents of a text file in JTextArea
By warship in forum New To JavaReplies: 1Last Post: 07-18-2007, 11:20 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks