package Kalkulator;
import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.JButton;
import javax.swing.JPanel;
import java.awt.Color;
import javax.swing.JLabel;
import javax.swing.JTextField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Wyglad {
private static JTextField txtWynik; // Your class name
public static void main(String[] args) {
JFrame frame = new JFrame("kalkulator");
frame.setBounds(350, 120, 556, 647);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
frame.getContentPane().setLayout(null);
JButton button = new JButton("0");
button.setBounds(275, 370, 123, 73);
frame.getContentPane().add(button);
JButton button_1 = new JButton("1");
button_1.setBounds(143, 121, 123, 73);
frame.getContentPane().add(button_1);
JButton button_2 = new JButton("2");
button_2.setBounds(275, 121, 123, 73);
frame.getContentPane().add(button_2);
JButton button_3 = new JButton("3");
button_3.setBounds(407, 121, 123, 73);
frame.getContentPane().add(button_3);
JButton button_4 = new JButton("4");
button_4.setBounds(143, 204, 123, 73);
frame.getContentPane().add(button_4);
JButton button_5 = new JButton("5");
button_5.setBounds(275, 204, 123, 73);
frame.getContentPane().add(button_5);
JButton button_6 = new JButton("6");
button_6.setBounds(407, 204, 123, 73);
frame.getContentPane().add(button_6);
JButton button_7 = new JButton("7");
button_7.setBounds(143, 287, 123, 73);
frame.getContentPane().add(button_7);
JButton button_8 = new JButton("8");
button_8.setBounds(275, 287, 123, 73);
frame.getContentPane().add(button_8);
JButton button_9 = new JButton("9");
button_9.setBounds(407, 287, 123, 73);
frame.getContentPane().add(button_9);
JButton button_10 = new JButton(",");
button_10.setBounds(143, 370, 123, 73);
frame.getContentPane().add(button_10);
JButton button_11 = new JButton("=");
button_11.setBounds(11, 121, 123, 73);
frame.getContentPane().add(button_11);
JButton button_12 = new JButton("+");
button_12.setBounds(11, 204, 123, 73);
frame.getContentPane().add(button_12);
JButton button_13 = new JButton("-");
button_13.setBounds(11, 284, 123, 73);
frame.getContentPane().add(button_13);
JButton btnX = new JButton("x");
btnX.setBounds(11, 367, 123, 73);
frame.getContentPane().add(btnX);
JButton button_14 = new JButton("/");
button_14.setBounds(11, 450, 123, 73);
frame.getContentPane().add(button_14);
JButton button_15 = new JButton("%");
button_15.setBounds(143, 450, 123, 73);
frame.getContentPane().add(button_15);
JButton button_16 = new JButton("\u221a");
button_16.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
button_16.setBounds(275, 450, 123, 73);
frame.getContentPane().add(button_16);
txtWynik = new JTextField();
txtWynik.setBounds(10, 10, 520, 101);
txtWynik.setEditable(false);
frame.getContentPane().add(txtWynik);
txtWynik.setColumns(10);
JButton btnDel = new JButton("Del");
btnDel.setBounds(407, 372, 123, 73);
frame.getContentPane().add(btnDel);
}
}
Cześć, staram się zrobić sam kalkulator jakiś prosty w javie za pomocą pakietu swing.
Umieściłem kafelki (przyciski, txtfield) do mojego okienka i problem pojawia się że niektóre przyciski pojawiają się dopiero wtedy gdy przejadę kursorem po miejscu w którym powinny się znaleść. Screeny poniżej:

A tak powinno być: ( i jest po przejechaniu kursorem) Czy ktoś miał podobny problem ??
