• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JFRAME ERROR

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey guys, i need help
this is the part of code that i am getting an error for
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class maxandmin implements ActionListener {
private static final int winwidth = 350;
private static final int winheight = 350;
private static final int field = 20;
private static final int area = 20;
private static FlowLayout layoutstyle = new FlowLayout();
private static JFrame window = new JFrame("Maximum and Minimum");
private static final String legend = "This program find the MAX and MIN of 4 numbers.";
private JTextArea legendarea = new JTextArea (legend, 2, area);

the error says
maxandmin.java [24:1] cannot resolve symbol
symbol : constructor JFrame (java.lang.String)
location: class JFrame
private static JFrame window = new JFrame("Maximum and Minimum");
^
1 error
Errors compiling maxandmin.
could someone help me with this please
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps you're using a very old Java development environment that doesn't include Swing? I don't recognize the format of the error message, but I can tell it's not from Sun's javac nor from Jikes. Maybe it's from something like Microsoft's old (horribly outdated, buggy, unsupported) J++?
 
Rico jamz
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
its actually sun one studios
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could there be another class called "JFrame" in the same directory as this class? Because javax.swing.JFrame certainly does have a contructor that takes a String
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm real new to this so I may be out to lunch but I've noticed that you've left out JFrame in your constructor.
Try: public class MaxAndMin extends JFrame implements ActionListener
Marie
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Marie Jeanne Thibault:
Hi,
I'm real new to this so I may be out to lunch but I've noticed that you've left out JFrame in your constructor.
Try: public class MaxAndMin extends JFrame implements ActionListener
Marie


Only if he were extending JFrame. It appears in this case that his class has a member variable of type JFrame.
 
reply
    Bookmark Topic Watch Topic
  • New Topic