Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: newbie stuck, line 28 won't compile...

  1. #1
    Junior Member
    Join Date
    Sep 2014
    My Mood
    Thanked 0 Times in 0 Posts

    Default newbie stuck, line 28 won't compile...

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;

    public class Project1_JaneShteyn
    public static void main (String[] args)
    // creates and presents the program frame
    JFrame frame = new JFrame ("Today's Available Delta Flights From ATL to JFK");
    frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);

    FlightOptionsPanel panel = new FlightOptionsPanel();
    frame.getContentPane().add (panel);


    public class Project1_JaneShteyn extends JPanel
    private JLabel flights;
    private JRadioButton flight123, flight456, flight789;
    private String flight123Seats, flight456Seats, flight789Seats;

       public FlightOptionsPanel()

    flight123Seats = "Departing at 3pm, 6 available seats";
    flight456Seats = "Departing at 4pm, 6 available seats";
    flight789Seats = "Departing at 5pm, 6 available seats";

    flight = new JLabel (flight123Seats);
    flight.setFont (new Font ("Helvetica", Font.BOLD, 24));

    flight123 = new JRadioButton ("Flight 123, true");
    flight123.setBackground (Color.magenta);

    flight456 = new JRadioButton ("Flight 456");
    flight456.setBackground (Color.magenta);

    flight789 = new JRadioButton ("Flight 789");
    flight789.setBackground (Color.magenta);

    ButtonGroup group = new ButtonGroup();
    group.add (flight123);
    group.add (flight456);
    group.add (flight789);

    FlightListener listener = new FlightListener();
    flight123.addActionListener (listener);
    flight456.addActionListener (listener);
    flight789.addActionListener (listener);

    add (flight123);
    add (flight456);
    add (flight789);

    setBackground (Color.green);
    setPreferredSize (new Dimension(300,100));
    private class FlightListener implements ActionListener
    public void actionPerformed (ActionEvent event)
    Object source = event.getSource();

    if (sourse == flights)
    flights.setText (flight123Seats);
    if (source == flights)
    flights.setText (flight456Seats);
    flights.setText (flight789);

  2. #2
    Super Moderator
    Join Date
    Jun 2013
    So. Maryland, USA
    My Mood
    Thanked 698 Times in 680 Posts

    Default Re: newbie stuck, line 28 won't compile...

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

    Please post your code correctly using code or highlight tags per the above link.

    Also post the entire error message.

Similar Threads

  1. Why won't my program compile?
    By Techstudent in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 14th, 2014, 05:48 AM
  2. Java won't compile
    By headhenchmanhollywood in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 31st, 2013, 09:25 PM
  3. Code won't compile
    By JavaChallenged in forum What's Wrong With My Code?
    Replies: 6
    Last Post: February 12th, 2012, 08:18 PM
  4. file won't compile
    By bclark in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 8th, 2011, 12:13 AM
  5. *why won't this compile?*
    By dcshoecousa in forum What's Wrong With My Code?
    Replies: 6
    Last Post: November 2nd, 2010, 07:18 PM