java - Issue typing in a JtextField in full Screen Exclusive mode -
i want fullcreen window can type login , password , login , pass textfields. when run code in eclipse, login textfield , pass textfield unable type in. code:
import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; public class mostrarbloqueio extends jframe implements actionlistener { private static graphicsdevice graphicsdevice1; private displaymode mindisplaymode; private jbutton loginbutton = new jbutton( "login"); private jtextfield txtlogin; private jpasswordfield passwordfield; public static void main(string[] args) { //get , display list of graphics devices solely // information purposes. graphicsenvironment graphicsenvironment = graphicsenvironment.getlocalgraphicsenvironment(); graphicsdevice[] devices = graphicsenvironment.getscreendevices(); for(int cnt = 0;cnt < 1;cnt++) { system.out.println(devices[cnt]); }//end loop //construct full-screen object // new mostrarbloqueio(devices[0]); }//end main //constructor public mostrarbloqueio(graphicsdevice graphicsdevice) { //save reference graphics device // instance variable can used later // exit full-screen mode. this.graphicsdevice1 = graphicsdevice; settitle("this title hidden (undecorated)"); //get , save reference original display // mode instance variable can // restored later. mindisplaymode = graphicsdevice.getdisplaymode(); loginbutton.setbounds(633, 518, 103, 23); //register action listener on loginbutton. loginbutton.addactionlistener(this); getcontentpane().setlayout(null); passwordfield = new jpasswordfield(); passwordfield.setbounds(633, 475, 142, 20); getcontentpane().add(passwordfield); passwordfield.setcolumns(10); //place loginbutton in jframe getcontentpane().add(loginbutton); getcontentpane().setbackground(getbackground()); jlabel lblnewlabel = new jlabel("senha:"); lblnewlabel.setbounds(578, 478, 45, 14); getcontentpane().add(lblnewlabel); jlabel lbllogin = new jlabel("login:"); lbllogin.setbounds(578, 456, 45, 14); getcontentpane().add(lbllogin); txtlogin = new jtextfield(); txtlogin.setbounds(633, 453, 142, 20); getcontentpane().add(txtlogin); txtlogin.setcolumns(10); if (graphicsdevice.isfullscreensupported()) { // enter full-screen mode witn undecorated, // non-resizable jframe object. setundecorated(true); setresizable(false); setalwaysontop(true); setdefaultcloseoperation(jframe.do_nothing_on_close); graphicsdevice.setfullscreenwindow(this); alttabstopper @ = new alttabstopper(this); at.create(this); validate(); } else { system.out.println("full-screen mode not supported"); }//end else }//end constructor //the following method invoked when used clicks // loginbutton public void actionperformed(actionevent evt) { //restore original display mode string login = txtlogin.gettext(); system.out.println("1"+login); graphicsdevice1.setdisplaymode(mindisplaymode); //terminate program system.exit(0); } }//end class
call txtlogin.seteditable(true) , passwordfield.seteditable(true)
Comments
Post a Comment