Eclipse compile problem
This is a multi-part message in MIME format.
------=_NextPart_000_0006_01CAB55C.C0B66CC0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
The following code compiles and runs properly using BlueJay.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class LayoutBox2
{
private JFrame frame;
public static void main (String[] args)
{
LayoutBox2 guiLayout = new LayoutBox2();
guiLayout.start();
}
public void start()
{
frame = new JFrame("Border Layout");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container contentPane = frame.getContentPane();
contentPane.setLayout(new BoxLayout(contentPane, =
BoxLayout.Y_AXIS));
contentPane.add(new JButton("First Button"));
contentPane.add(new JButton("Second Button - a long one"));
contentPane.add(new JButton("Third Button"));
contentPane.add(new JButton("Fourth Button"));
frame.pack();
frame.setVisible(true);
}
}
However Eclipse gives an error on the following line:
contentPane.setLayout(new BoxLayout(contentPane, =
BoxLayout.Y_AXIS));
The error says that it can't resolve the Y_AXIS...
I know that this is way to easy for most of you, but as someone new to =
Java, it is driving me mad. Does anyone have any idea why it will =
compile in one program and not the other?
Mike
------=_NextPart_000_0006_01CAB55C.C0B66CC0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; =
charset=iso-8859-1">
<META content="MSHTML 6.00.2900.5921" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=Arial size=2>The following code compiles and runs =
properly using
BlueJay. </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>import java.awt.*;<BR>import
java.awt.event.*;<BR>import javax.swing.*;<BR>public class
LayoutBox2<BR>{<BR> private JFrame
frame;<BR> public static void main (String[] args)
<BR> {<BR>
LayoutBox2 guiLayout = new
LayoutBox2();<BR>
guiLayout.start();<BR> }<BR> public =
void
start() <BR> =
{<BR>
frame = new JFrame("Border
Layout");<BR>
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<BR> &nbs=
p;
Container contentPane =
frame.getContentPane();<BR>
contentPane.setLayout(new BoxLayout(contentPane,
BoxLayout.Y_AXIS));<BR>
contentPane.add(new JButton("First
Button"));<BR> =
contentPane.add(new
JButton("Second Button - a long
one"));<BR> =
contentPane.add(new
JButton("Third Button"));<BR>
contentPane.add(new JButton("Fourth
Button"));<BR>
frame.pack();<BR>
frame.setVisible(true);<BR> }<BR>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>However Eclipse gives an error on the =
following
line:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial =
size=2> <FONT
color=#ff0000>contentPane.setLayout(new BoxLayout(contentPane,
BoxLayout.Y_AXIS));<BR></FONT></FONT></DIV>
<DIV><FONT face=Arial size=2>The error says that it can't =
resolve the
Y_AXIS...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I know that this is way to easy for =
most of you,
but as someone new to Java, it is driving me mad. Does anyone have any =
idea why
it will compile in one program and not the other?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Mike</FONT></DIV></BODY></HTML>
------=_NextPart_000_0006_01CAB55C.C0B66CC0--