N
N
nano_e_t_42016-10-23 23:44:25
Java
nano_e_t_4, 2016-10-23 23:44:25

How to indent a button?

Hello everyone
Plz tell me how to indent the button?
similar to paddin? googled a lot of solutions like

setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));

or
JBtn.setMargin(new Insets(5,5,10,10));
but they add an internal margin, but you need an external
one, you don’t want to just resort to the option of creating a JPanel, adding a button to it and setting the indents
thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2016-10-27
@nano_e_t_4

What you need is not an analogue of padding (this is just an internal margin), but an analogue of margin (external indents).
Here stackoverflow.com/questions/9565760/java-jpanel-with-margins-and-jtextarea-inside describes two options for implementing what you need with links to the Oracle documentation. You can easily google examples by name.
PS I will assume that you are familiar with css, maybe you should take a look at javaFX.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question