Sunday, 29 November 2009

GUI Transparan

import com.sun.awt.AWTUtilities;

public class NewJFrame extends javax.swing.JFrame {

public NewJFrame() {
initComponents();
/**Untuk Membuat Form Transparan*/
AWTUtilities.setWindowOpacity(this, 0.70F);
}
@SuppressWarnings("unchecked")
//
private void initComponents() {

jLabel1 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Transparan");

jLabel1.setText("Hello world");

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(159, 159, 159)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(173, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(137, 137, 137)
.addComponent(jLabel1)
.addContainerGap(149, Short.MAX_VALUE))
);

pack();
}//



public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NewJFrame().setVisible(true);
}
});
}

// Variables declaration - do not modify
private javax.swing.JLabel jLabel1;
// End of variables declaration

}

Hasilnya :

No comments:

Post a Comment