Results 1 to 3 of 3
- 05-30-2009, 03:37 PM #1
[SOLVED] method not applicable for the arguments
I have a littel problem with the code, since the arguments I am passing to a stub do not seem to be valid:
NOTE 1: The code does not compile and might have other problems, but I have uploaded it as an attachment.Java Code:chooser.setFileView(new FileIconView(filter, new ImageIcon("C:\\icons\\exit.png"))); //FIX ... [B]which calls[/B] ... public void setFileView (FileIconView fileIconView) { //FIX //TODO stub } ... FileIconView is a class whose constructor requires: public FileIconView(FileFilter aFilter, Icon anIcon) { filter = aFilter; icon = anIcon; } ...
:confused:
- 05-31-2009, 01:49 AM #2
Error 1:Java Code:C:\jexp\jon\src\homenetwork\bkr\training>javac *.java ImagePreviewer.java:35: cannot find symbol symbol : method getScaledInstance(int,int,int) location: class javax.swing.ImageIcon if (icon.getIconWidth() > getWidth()) icon = new ImageIcon(icon.getIma ge()).getScaledInstance(getWidth(),-1, Image.SCALE_DEFAULT); ^ ImageViewerFrame.java:59: setFileView(javax.swing.filechooser.FileView) in javax.swing.JFi leChooser cannot be applied to (FileIconView) chooser.setFileView(new FileIconView(filter, new ImageIcon("icons/exit.png"))); // FIX ^ ImageViewerFrame.java:72: cannot find symbol symbol : class ImageViewFrame location: class ImageViewerFrame.FileOpenListener int result = chooser.showOpenFileDialog(ImageViewFrame.this); ^ 3 errors
You've misplaced a right parenthesis ")". The getScaledInstance method is being called on the ImageIcon instance instead of on its image argument.Java Code:icon = new ImageIcon(icon.getImage()[b])[/b] .getScaledInstance(getWidth(),-1,Image.SCALE_DEFAULT);
Error 2:Java Code:icon = new ImageIcon(icon.getImage() .getScaledInstance(getWidth(),-1,Image.SCALE_DEFAULT)); setIcon(icon);
The argument for the setFileView method is/must be a FileView object.Java Code:chooser.setFileView(new FileIconView(filter, new ImageIcon("icons/exit.png")));
You are supplying something unrelated. You might consider having the FileIconView class extend the FileView abstract class.
Error 3:
Typos.
Change
toJava Code:int result = chooser.showOpen[b]File[/b]Dialog(ImageViewFrame.this);
Java Code:int result = chooser.showOpenDialog(ImageView[b]er[/b]Frame.this);
- 05-31-2009, 04:13 PM #3
Similar Threads
-
method that return 2 arguments
By itaipee in forum New To JavaReplies: 19Last Post: 01-12-2009, 05:36 PM -
Using final with method arguments
By Java Tip in forum java.langReplies: 0Last Post: 04-17-2008, 07:48 PM -
Arguments in Main
By CyberFrog in forum New To JavaReplies: 2Last Post: 03-30-2008, 09:37 PM -
repetition of 'arguments'(?)
By Igor in forum New To JavaReplies: 3Last Post: 12-13-2007, 10:08 AM -
Variable No. of Arguments
By Gajesh Tripathi in forum New To JavaReplies: 2Last Post: 10-31-2007, 02:50 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks