-5

What code shall I use to add shadow effects to a panel in Java swing, I know the same is available in javafx but can we do the same in swing?

jyoti proy
  • 138
  • 3
  • 9
  • 1
    This question is too broad – ControlAltDel Dec 27 '16 at 16:11
  • I haven't tried yet and expect the answer to be 'no' but still there might be some way – jyoti proy Dec 27 '16 at 16:19
  • Can anyone point out where my question went wrong? Have I asked something baseless? – jyoti proy Dec 27 '16 at 16:24
  • Regarding why people don't like this question, see a note in my answer. It is not really terrible, but I personally hesitated whether to flag it as too broad or as a duplicate, but decided it deserves an answer (I personally never downvote except really terrible questions but flag is another thing) . – Fedor Losev Dec 27 '16 at 16:28

1 Answers1

5

Swing does not provide built-in capabilities for these.

You can drop shadow either by adding border or draw manually. Here are some examples for dropping shadow from JPanel

Animation is more complex, one approach is to use timer and change properties or draw on appropriate ticks, another is to incorporate some library like Timing Framework.

As a side note, you are asking two different questions in one and probably you need to do some research by yourself before posting and provide the results in the question.

Community
  • 1
  • 1
Fedor Losev
  • 3,244
  • 15
  • 13
  • Thanks that helped a lot, and by the way is my question being down voted for asking two questions in one? – jyoti proy Dec 27 '16 at 16:33
  • More for not stating any efforts of your own and being too broad but this too. What composes a good question is also a thing that is easy to search for on StackOverflow e,g, http://stackoverflow.com/help/how-to-ask http://meta.stackexchange.com/help/how-to-ask. Good question usually ask for one specific thing (not how do I this or that or that), shows what author did before, with what results and what he expects from an answer. Of course "specific" should also be [reasonable](http://stackoverflow.com/help/mcve), not a bunch of unrelated code asking where is the error. – Fedor Losev Dec 27 '16 at 16:42