netbeans - Any idea I wanted my JFrame to be transparent but not the button and label -
i have java project named javaapplication3 , created jframe named o insert jlabel1 , insert picture in icon property create button message hey
the picture inserted png , transparent background
i wanted make jframe transparent can see background wallpaper in desktop became transparent jlabel1 wanted jframe transparent not picture , button appreciated thank you. output package javaapplication3;
public class o extends javax.swing.jframe { public o() { initcomponents(); com.sun.awt.awtutilities.setwindowopacity(this,0.7f); } @suppresswarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="generated code"> private void initcomponents() { jlabel1 = new javax.swing.jlabel(); jbutton1 = new javax.swing.jbutton(); setdefaultcloseoperation(javax.swing.windowconstants.exit_on_close); jlabel1.seticon(new javax.swing.imageicon(getclass().getresource("/tumblr_nqmzgf3pyc1si30aao1_500.png"))); // noi18n jlabel1.settext("jlabel1"); jbutton1.settext("hey"); javax.swing.grouplayout layout = new javax.swing.grouplayout(getcontentpane()); getcontentpane().setlayout(layout); layout.sethorizontalgroup( layout.createparallelgroup(javax.swing.grouplayout.alignment.leading) .addgroup(layout.createsequentialgroup() .addgroup(layout.createparallelgroup(javax.swing.grouplayout.alignment.leading) .addgroup(layout.createsequentialgroup() .addgap(24, 24, 24) .addcomponent(jlabel1, javax.swing.grouplayout.preferred_size, 427, javax.swing.grouplayout.preferred_size)) .addgroup(layout.createsequentialgroup() .addgap(189, 189, 189) .addcomponent(jbutton1))) .addcontainergap(65, short.max_value)) ); layout.setverticalgroup( layout.createparallelgroup(javax.swing.grouplayout.alignment.leading) .addgroup(layout.createsequentialgroup() .addcontainergap() .addcomponent(jlabel1, javax.swing.grouplayout.preferred_size, 400, javax.swing.grouplayout.preferred_size) .addgap(37, 37, 37) .addcomponent(jbutton1) .addcontainergap(67, short.max_value)) ); pack(); }// </editor-fold> public static void main(string args[]) { java.awt.eventqueue.invokelater(new runnable() { public void run() { new o().setvisible(true); } }); } // variables declaration - not modify private javax.swing.jbutton jbutton1; private javax.swing.jlabel jlabel1; // end of variables declaration
}
Comments
Post a Comment