I set the background of the form, not just 1 component. I don't have another form at the moment, and only 1 button on my current form, so it's pretty difficult (I believe) for NetBeans to screw this up.
java
private void initComponents()
{
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Login");
setAlwaysOnTop(true);
setBackground(new java.awt.Color(0, 0, 0));
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
setResizable(false);
jButton1.setText("Login");
jButton1.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(142, 142, 142)
.addComponent(jButton1)
.addContainerGap(149, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(167, Short.MAX_VALUE)
.addComponent(jButton1)
.addGap(41, 41, 41))
);
jButton1.getAccessibleContext().setAccessibleName(null);
pack();
}// </editor-fold>
The setBackground(new java.awt.Color(0, 0, 0)) command is correct, since it's just doing this to the form...
EDIT: ARGH, I hate the way NetBeans generates code. (I just switched the brace locations.)
This post has been edited by Locke37: 28 Jun, 2008 - 03:17 PM