Question on Super

J

Joe

package COM.xxxx.psd.cmr;

import java.awt.Toolkit;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.*;
import java.sql.*;
import java.util.*;
import javax.swing.JDialog;


import COM.xxxx.psd.common.*;

/** Printing Parameters Dialog. It will hold the printing parameters
tabs.
*/

public class PrintParameterDlg extends JDialog {
private int HEIGHT = 450;
private int WIDTH = 450;
public JPanel buttonsPanel;
public JButton doneButton;
Object target;

// ------------------
// Define main class.
// ------------------
public PrintParameterDlg(CmrServerObjectInterface handle, String
title) {
super(null, title);
initialize();
makeGUI(handle);
}

I have this error. How could I call the java.awt.Frame if I decided
to? or call java.awt.Dialog?



System\Com\xxxx\psd\cmr\PrintParameterDlg.java:43: reference to
JDialog is ambiguous, both method
JDialog(java.awt.Frame,java.lang.String) in javax.swing.JDialog and
method JDialog(java.awt.Dialog,java.lang.String) in
javax.swing.JDialog match
super(null, title);
 
C

Chris Smith

Joe said:
I have this error. How could I call the java.awt.Frame if I decided
to? or call java.awt.Dialog?



System\Com\xxxx\psd\cmr\PrintParameterDlg.java:43: reference to
JDialog is ambiguous, both method
JDialog(java.awt.Frame,java.lang.String) in javax.swing.JDialog and
method JDialog(java.awt.Dialog,java.lang.String) in
javax.swing.JDialog match
super(null, title);

The problem is that 'null' could be either one, since a null reference
could be of any type, and the null literal is therefore of all types.
To specify with type you meant for null to be this time, use a cast:

super((JDialog) null, title);

Incidentally, you're not calling Frame or Dialog here. You're still
making a call to the superclass constructor in JDialog. All you're
doing is helping the compiler to resolve an overload that was ambiguous,
and determine *which* JDialog constructor to call.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top