By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,737 Members | 1,971 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,737 IT Pros & Developers. It's quick & easy.

GridbagLayout and Canvas3D

P: n/a
this short program does not do as it should!!! when you resize the frame,
the weights (3 and 1) would not stay the same. why???

import java.applet.Applet;
import java.awt.event.*;
import java.util.*;
import java.awt.*;
import com.sun.j3d.utils.universe.*;
import javax.swing.*;
import java.applet.*;
import javax.swing.*;
import com.sun.j3d.utils.applet.MainFrame;

public class GridbagLayout1 extends JApplet{
public GridbagLayout1() {
GridBagLayout gbl = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
GraphicsConfiguration config=
Canvas3D c3d=new Canvas3D(config);
c.fill = GridBagConstraints.BOTH;
c.weightx = 1;
c.weighty = 1;
c.insets = new Insets(0,0,0,0);
JPanel pan1 = new JPanel();
JPanel pan2 = new JPanel();
pan2.setBackground(new Color(200,200,0));
c.gridx = 0;
c.gridy = 0;
c.gridwidth = 1;
c.gridheight = 1;
gbl.setConstraints(c3d, c);
c.gridx = 1;
c.weightx = 3;
gbl.setConstraints(pan2, c);

public static void main(String argv[]) {
MainFrame a=new MainFrame(new GridbagLayout1(),1000,1000);
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.