A
aggreen
Hi,
I'm fairly new to java, so I don't even know if what I'm trying to do is
possible, but I keep getting this "illegal start of expression" error
whenever I try to compile this segment of code.
public void actionPerformed(ActionEvent a) {
Object source = a.getSource();
if (source == okayButton) {
public control2_3a() {
blah = new JLabel("blah..");
}
private static void quantitySelector() {
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame("Select How Many Products Were
Purchased On...");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JComponent ContentPane2 = new control2_3a();
ContentPane2.setOpaque(true);
frame.setContentPane(ContentPane2);
frame.pack();
frame.setVisible(true);
}
public void run() {
quantitySelector();
}
}
}
The error message is referencing the line: public control2_3a() { ... My
best guess right now is that I can't do what I'm trying to do inside of an
if statement? (Theres more code... thats just the section that has problems
at the moment. I have a button that I'm listening to and everything, but
the program would be way too long to put on here.) Any help would be
appreciated... Oh and also a little side note. It is also giving me an
error message that says it is expecting a semicolon on the very last line
of the section that I posted. If I put a semicolon there it appeases the
compiler... but I'm not really sure why it seems to be necessary.
Thanks,
Alex Green
I'm fairly new to java, so I don't even know if what I'm trying to do is
possible, but I keep getting this "illegal start of expression" error
whenever I try to compile this segment of code.
public void actionPerformed(ActionEvent a) {
Object source = a.getSource();
if (source == okayButton) {
public control2_3a() {
blah = new JLabel("blah..");
}
private static void quantitySelector() {
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame("Select How Many Products Were
Purchased On...");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JComponent ContentPane2 = new control2_3a();
ContentPane2.setOpaque(true);
frame.setContentPane(ContentPane2);
frame.pack();
frame.setVisible(true);
}
public void run() {
quantitySelector();
}
}
}
The error message is referencing the line: public control2_3a() { ... My
best guess right now is that I can't do what I'm trying to do inside of an
if statement? (Theres more code... thats just the section that has problems
at the moment. I have a button that I'm listening to and everything, but
the program would be way too long to put on here.) Any help would be
appreciated... Oh and also a little side note. It is also giving me an
error message that says it is expecting a semicolon on the very last line
of the section that I posted. If I put a semicolon there it appeases the
compiler... but I'm not really sure why it seems to be necessary.
Thanks,
Alex Green