Archive for the 'swing' Category

How to set hand cursor to all buttons

In nowadays web oriented world users expectations are that desktop application behave like web application. And part of this that cursor must be changed when moving over button and checkbox controls. Next code snippet satisfied needs:

How to create hyperlink in desktop application

Suppose, we need link (hyperlink) in our desktop swing application, and clicking it should open specified page in default browser. Try this code:

How to create underlined label

Suppose, we need underlined label in our swing application. java.awt.Font doesn’t have this option. But next code solves the problem: JLabel clickItLabel = new JLabel(“<html><u>Click It</u></html>”)

How to start desktop application with Netbeans

Netbeans is great software. But sometimes very confusing. Netbeans have great java swing GUI editor with drag and drop palette. Use it. It is very helpful. Netbeans have also Java Desktop Application option: File -> New Project -> Java -> Java Desktop Application – don’t use it. It seems to be helpful but creates more [...]

How to make multilined label

I want text on my JLabel object displayed in two lines. Next code does do the work: label.setText(” <html> first line <br> second line </html>”);

How to remove component from container

Suppose we have JPanel with name panel and JButton with name button on it. Try this code:


wordpress seo