• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

setBorder not working in Eclipse

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
//********************************************************************
// 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)
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic