File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes setBorder not working in Eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "setBorder not working in Eclipse" Watch "setBorder not working in Eclipse" New topic
Author

setBorder not working in Eclipse

John Zelek
Greenhorn

Joined: Nov 10, 2012
Posts: 2
//********************************************************************
// P1DisplayPanel.java Author: Zelek
//
// Panel for calculator output
//********************************************************************

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


public class P1CalculatorInterface extends JPanel
{
double tempValue1 = 0, tempValue2 = 0, tempValue3 = 0, memStorage = 0;

// State constants
final int OFF = 0;
final int ON = 1;

// Display panel
JPanel P1Display = new JPanel();
Border loweredBorder = new EtchedBorder(EtchedBorder.LOWERED);
P1Display.setBorder(loweredBorder);

I get the following error on the last line of code above. Looks fine to me. Thoughts?

Multiple markers at this line
- Syntax error on token "loweredBorder", VariableDeclaratorId expected after this
token
- Syntax error on token(s), misplaced construct(s)
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19557
    
  16

Your statement P1Display.setBorder(loweredBorder); does not occur within a constructor, initializer block or method. Outside those you can only have declarations (with or without initialization).


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
jQuery in Action, 2nd edition
 
subject: setBorder not working in Eclipse
 
Similar Threads
Switching between the frames
How can I get the users input?
Problem in drawing a rectangle .....
[newbie] Syntax error on token(s), misplaced construct(s)
How can I add rows in a Jtable