Link to home
Start Free TrialLog in
Avatar of komlaaa
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.setNativeLookAndFeel(); <<=====
    addWindowListener(new ExitListener()); <<=====
    Container content = getContentPane();
    JButton printButton = new JButton("Print");
    printButton.addActionListener(this);
    JPanel buttonPanel = new JPanel();
    buttonPanel.setBackground(Color.white);
    buttonPanel.add(printButton);
    content.add(buttonPanel, BorderLayout.SOUTH);
    DrawingPanel drawingPanel = new DrawingPanel();<<=====
    content.add(drawingPanel, BorderLayout.CENTER);
    pack();
    setVisible(true);
  }

  public void actionPerformed(ActionEvent event) {
    PrintUtilities.printComponent(this);
  }
 
}
Avatar of zzynx
zzynx
Flag of Belgium image

Are WindowUtilities and DrawingPanel classes of your own?
And PrintUtilities doesn't give problems?
Avatar of komlaaa
komlaaa

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
>> I place them in the same package
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?
ASKER CERTIFIED SOLUTION
Avatar of zzynx
zzynx
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of komlaaa

ASKER

your questions drive me to the solution :)
Good :°)
Thanks