Note that there are some explanatory texts on larger screens.

plurals
  1. POApplet works, but swing components won't appear!
    primarykey
    data
    text
    <p>So I am creating this applet which I want to have full on swing components in it. I have looked at all the docs, I have made the applet, and I can get something to show up in it if I override the <code>update(Graphics g)</code> method, but simply adding components to the <code>contentPane</code> doesn't seem to be doing it! What am I doing wrong?</p> <pre><code>import javax.swing.JApplet; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import org.steephill.kindlab.LabApp; import com.jgoodies.forms.layout.CellConstraints; import com.jgoodies.forms.layout.FormLayout; public class ClientApplet extends JApplet { ClientTreePanel treePanel; public void destroy() { // Put your code here } public String getAppletInfo() { return "KindLab Client Applet"; } public void init() { try { LabApp.initializeHibernate(); if (!LabApp.authenticate("user", "pass")) { JOptionPane.showMessageDialog(this, "authentication failed"); } else { try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { createGUI(); } }); } catch (Exception e) { System.err.println("createGUI didn't successfully complete"); } } } catch (Exception ex) { JOptionPane.showMessageDialog(this, "error intitializing applet\r\n" + ex.getMessage()); } } protected void createGUI() { treePanel = new ClientTreePanel(); treePanel.setVisible(true); getContentPane().add(new JLabel("TESTING!")); getContentPane().add(treePanel); System.out.println("THIS DOES RUN"); } public void start() { // Put your code here } public void stop() { // Put your code here } /* if I uncomment this method, it WORKS and I get "Hello World!" public void paint(Graphics g) { super.paint(g); g.drawString("Hello World!",25,25); } */ } </code></pre> <p>Please, help! And thank you! Joshua</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload