Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

JPanel/ContentPane Applet

$
0
0
Hello :online2long:/>/>

thanks for reading!!


import java.awt.*;
import javax.swing.*;

public class abcxyz extends java.applet.Applet {
    
    public void init() {
    }

    public void paint(Graphics g) {
    g.drawLine(120, 0, 120, 600);

    }
       
    public static void main(String[] args)
    {
    }
}


I've been unable to find information that will enable me to set a location of two new jpanels/contentpanes before and after the vertically drawn line at 120px.

More clearly, I would like to implement a menu panel, and a content panel. An actionlistener would replace contentpanel1 with contentpanel2.

I have read that one way to do this would be to code a jframe and call the frame from the applet, but I'd rather implement the jpanel with a layout directly.. Is there a way to do this?

cheers and thanks,

A.

Viewing all articles
Browse latest Browse all 51036

Trending Articles