I'm a total beginner in java and I'm coding a JApplet (that also runs outside the browser).
On my main form I want to add a QuickTable when its loaded.
Currently I have a button and when the button is pressed the QuickTable is added successfully. I copied the code behind the button into a void and tried to execute it at the end of init() but the QuickTable is not shown.
DBTable servers = new DBTable();
servers.setConnection(conn);
servers.setSelectSql("SELECT ServerID, Naam, Kost, Opslag, Paswoord from tblServers");
servers.createControlPanel();
jPanel3.add(servers);
servers.refresh();
How do I automatically execute a method after the applet is loaded?
Code behind me button is here (doesn't fit here): http://ompldr.org/vZXkycw/pasta
**GET THIS**: The snippet stops working if I remove "jButton1.setVisible(false);"
I currently use .setVisible(false) at the beginning of the method and .setVisible(true) at the end and that works fine when still working with the button. If I load the code from within init() the table isn't shown. I answered the question, but that will obviously not solve the problem, since you already tried that. To solve the problem, I suggest you post an SSCCE.
以上就是Add a component to JApplet on startup的详细内容,更多请关注web前端其它相关文章!