0

I'm using the design view of Netbeans to create a UI for my Java App. For my login window I want the label "Wrong username..." to show up ONLY if the login wasn't successful.

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        if(!tryLogin()) jLabel3.setVisible(true);
} 

So what's a best-practice to hide the label at the beginning?

Where should I put jLabel3.setVisible(false);?

And since this is probably an extremely easy question I got one more problem:

I set the background color of my JFrame to a different one that is displayed in the Netbeans design view. What can I do for it to display all my color changes immediatly? I saw a possible answer here: Netbeans GUI preview is different from Runtime view but I cannot find "%APPDATA%\CompanyName\myApp\mainFrame.session.xml" to test it and not sure if it will solve my problem.

Here are the pics of the UI in design view and when it's actually running:enter image description hereenter image description here

if you need more information just let me know!

any other tips for UI making are greatly appreciated :D

Community
  • 1
  • 1
Cold_Class
  • 3,214
  • 4
  • 39
  • 82

1 Answers1

1
  • Set jLabel3.setVisible(false); in the constructor.

  • set your button opaque, using jbutton.setOpaque(true) or from Netbeans properties tab select the checkbox against the property "Opaque".