A
A
Anton @ Lyalin2017-01-12 15:08:19
Java
Anton @ Lyalin, 2017-01-12 15:08:19

Why are the items not showing?

I have the following code

public add(){
        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        setLocationRelativeTo(null);
        setSize(new Dimension(400, 200));
        setTitle("Add");
        setLayout(new FlowLayout());

        JTextPane jTextPane = new JTextPane();
        jTextPane.setPreferredSize(new Dimension(390, 100));

        JButton jButton = new JButton("добавить");
        jButton.setPreferredSize(new Dimension(200, 30));

        add(jTextPane);
        add(jButton);

        setVisible(true);

    }

But the result is this 537c337f0882451190ce79b7cf9637a9.png
. There are still windows, the code is the same, everything is fine there.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton @ Lyalin, 2017-01-12
@toxa_1995

Issue resolved

setVisible(true);

add(jTextPane);
        add(jButton);

Thus, it is displayed normally, although a little and not logically.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question