This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JFRAME ERROR  RSS feed

 
Rico jamz
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • 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
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
its actually sun one studios
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • 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
 
Marie Jeanne Thibault
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • 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
 
Joe Ess
Bartender
Posts: 9425
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!