komlaaa
asked on
WindowUtilities & DrawingPanel
What is still wrong with this piece of code? WindowUtilities & DrawingPanel are detected as unfound symbols
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.print.*;
public class PrintExample extends JFrame
implements ActionListener
{
public static void main(String[] args)
{
new PrintExample();
}
public PrintExample() {
super("Printing Swing Components");
WindowUtilities.setNativeL ookAndFeel (); <<=====
addWindowListener(new ExitListener()); <<=====
Container content = getContentPane();
JButton printButton = new JButton("Print");
printButton.addActionListe ner(this);
JPanel buttonPanel = new JPanel();
buttonPanel.setBackground( Color.whit e);
buttonPanel.add(printButto n);
content.add(buttonPanel, BorderLayout.SOUTH);
DrawingPanel drawingPanel = new DrawingPanel();<<=====
content.add(drawingPanel, BorderLayout.CENTER);
pack();
setVisible(true);
}
public void actionPerformed(ActionEven t event) {
PrintUtilities.printCompon ent(this);
}
}
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.print.*;
public class PrintExample extends JFrame
implements ActionListener
{
public static void main(String[] args)
{
new PrintExample();
}
public PrintExample() {
super("Printing Swing Components");
WindowUtilities.setNativeL
addWindowListener(new ExitListener()); <<=====
Container content = getContentPane();
JButton printButton = new JButton("Print");
printButton.addActionListe
JPanel buttonPanel = new JPanel();
buttonPanel.setBackground(
buttonPanel.add(printButto
content.add(buttonPanel, BorderLayout.SOUTH);
DrawingPanel drawingPanel = new DrawingPanel();<<=====
content.add(drawingPanel, BorderLayout.CENTER);
pack();
setVisible(true);
}
public void actionPerformed(ActionEven
PrintUtilities.printCompon
}
}
Are WindowUtilities and DrawingPanel classes of your own?
And PrintUtilities doesn't give problems?
ASKER
>Are WindowUtilities and DrawingPanel classes of your own?
yes, i am trying to get the code at the link below working. All those packages are provided.
I place them in the same package but still
http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-Printing.html
yes, i am trying to get the code at the link below working. All those packages are provided.
I place them in the same package but still
http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-Printing.html
>> I place them in the same package
Sure? I don't see any
package .....;
line in the code you posted
Sure? I don't see any
package .....;
line in the code you posted
Forget the above.
Do you place all the java files you downloaded
(PrintExample.java, DrawingPanel.java, WindowsUtilities.java, PrintUtilities.java, ...)
in the same directory?
Do you place all the java files you downloaded
(PrintExample.java, DrawingPanel.java, WindowsUtilities.java, PrintUtilities.java, ...)
in the same directory?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
your questions drive me to the solution :)
Good :°)
Thanks
Thanks