• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 287
  • Last Modified:

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);
  }
 
}
0
komlaaa
Asked:
komlaaa
  • 6
  • 2
1 Solution
 
zzynxSoftware engineerCommented:
Are WindowUtilities and DrawingPanel classes of your own?
0
 
zzynxSoftware engineerCommented:
And PrintUtilities doesn't give problems?
0
 
komlaaaAuthor Commented:
>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
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
zzynxSoftware engineerCommented:
>> I place them in the same package
Sure? I don't see any

   package .....;

line in the code you posted
0
 
zzynxSoftware engineerCommented:
Forget the above.
Do you place all the java files you downloaded
(PrintExample.java, DrawingPanel.java, WindowsUtilities.java, PrintUtilities.java, ...)
in the same directory?
0
 
zzynxSoftware engineerCommented:
>> I place them in the same package
What did you mean exactly with that statement?
0
 
komlaaaAuthor Commented:
your questions drive me to the solution :)
0
 
zzynxSoftware engineerCommented:
Good :°)
Thanks
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now