Why in Java on the panel the rectangle can not be drawn?
public class FinanceMarketFrame extends JFrame { private JPanel toolPanel; FinanceMarketFrame() { super("ΠΡΠ°ΡΠΈΡΠ΅ΡΠΊΠΎΠ΅ ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅"); this.setBackground(Color.WHITE); setBounds(50,50,1000, 450); toolPanel = new JPanel(); toolPanel.setPreferredSize(new Dimension(70, this.getContentPane().getHeight())); add(toolPanel, BorderLayout.EAST); toolPanel.getGraphics().setColor(Color.black); toolPanel.getGraphics().drawRect(5, 40, 5, 20); toolPanel.setOpaque(false); toolPanel.add(new JButton()); this.setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); }