Here is my issue. I have a frame with label, jtextfield, and 2 buttons when you run the program the label and the textfield show but the butttons dont until you mouse over them. i was told i needed to post here from eclipse forum even though this is cut and paist from a you tube video but didnt run using winbuilder. When i try to run the Scientific Caalculator it has the messages the"cannot refer to nonfinal verible in scope.
i am running ubuntu linux and openjdk 8.0
here is my code
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
double first;
double second;
double result;
String operation;
String answer;
//private final ButtonGroup buttonGroup = new ButtonGroup();
public static void main(String[] args) {
// TODO Auto-generated method stub
//private void initialize() {
JFrame frame = new JFrame();
frame.setForeground(Color.WHITE);
frame.getContentPane().setForeground(Color.BLACK);
frame.setBounds(100, 100, 357, 539);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
frame.setVisible(true);
JLabel lblNewLabel = new JLabel("SCIENTFIC CALCULATOR");
lblNewLabel.setBounds(10, 11, 320, 27);
lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 23));
frame.getContentPane().add(lblNewLabel);
JTextField textField = new JTextField();
textField.setFont(new Font("Tahoma", Font.BOLD, 15));
textField.setBounds(10, 39, 320, 63);
frame.getContentPane().add(textField);
textField.setColumns(10);
JButton btn2 = new JButton("2");
btn2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
String number = textField.getText() + btn2.getText();
textField.setText(number);
}
});
btn2.setFont(new Font("Tahoma", Font.BOLD, 23));
btn2.setBounds(139, 398, 64, 50);
frame.getContentPane().add(btn2);
JButton btn5 = new JButton("5");
btn5.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
String number = textField.getText() + btn5.getText();
textField.setText(number);
}
});
btn5.setFont(new Font("Tahoma", Font.BOLD, 23));
btn5.setBounds(139, 347, 64, 50);
frame.getContentPane().add(btn5);
Here is my issue. I have a frame with label, jtextfield, and 2 buttons when you run the program the label and the textfield show but the butttons dont until you mouse over them. i was told i needed to post here from eclipse forum even though this is cut and paist from a you tube video but didnt run using winbuilder. When i try to run the Scientific Caalculator it has the messages the"cannot refer to nonfinal verible in scope.
i am running ubuntu linux and openjdk 8.0
here is my code
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
//import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
public class SC4 {
static JFrame frame;
static JTextField textField;