GridBagLayout layOut = new GridBagLayout();
getContentPane().setLayout(layOut);
GridBagConstraints c = new GridBagConstraints();
c.weightx = 1.0;
c.fill = GridBagConstraints.BOTH;
primLabel = new JLabel();
primLabel.setText("Primitive");
Font newFont = getFont().deriveFont(1);
primLabel.setFont(newFont);
primLabel.setHorizontalAlignment(JLabel.CENTER);
layOut.setConstraints(primLabel, c);
getContentPane().add(primLabel);
lineLabel = new JLabel();
lineLabel.setText("Lines");
lineLabel.setFont(newFont);
lineLabel.setHorizontalAlignment(JLabel.CENTER);
layOut.setConstraints(lineLabel, c);
getContentPane().add(lineLabel);
paintLabel = new JLabel();
paintLabel.setText("Paints");
paintLabel.setFont(newFont);
paintLabel.setHorizontalAlignment(JLabel.CENTER);
layOut.setConstraints(paintLabel, c);
getContentPane().add(paintLabel);
c.gridwidth = GridBagConstraints.RELATIVE;
transLabel = new JLabel();
transLabel.setText("Transforms");
transLabel.setFont(newFont);
transLabel.setHorizontalAlignment(JLabel.CENTER);
layOut.setConstraints(transLabel, c);
getContentPane().add(transLabel);
c.gridwidth = GridBagConstraints.REMAINDER;
strokeLabel = new JLabel();
strokeLabel.setText("Rendering");
strokeLabel.setFont(newFont);
strokeLabel.setHorizontalAlignment(JLabel.CENTER);
layOut.setConstraints(strokeLabel, c);
getContentPane().add(strokeLabel);
GridBagConstraints ls = new GridBagConstraints();
ls.weightx = 1.0;
ls.fill = GridBagConstraints.BOTH;
primitive = new JComboBox( new Object []{
"rectangle",
"ellipse",
"text"});
primitive.addItemListener(this);
newFont = newFont.deriveFont(0, 14.0f);
primitive.setFont(newFont);
layOut.setConstraints(primitive, ls);
getContentPane().add(primitive);
line = new JComboBox( new Object []{
"thin",
"thick",
"dashed"});
line.addItemListener(this);
line.setFont(newFont);
layOut.setConstraints(line, ls);
getContentPane().add(line);
paint = new JComboBox( new Object[]{
"solid",
"gradient",
"polka"});
paint.addItemListener(this);
paint.setFont(newFont);
layOut.setConstraints(paint, ls);
getContentPane().add(paint);
ls.gridwidth = GridBagConstraints.RELATIVE;
trans = new JComboBox( new Object[]{
"Identity",
"rotate",
"scale",
"shear"});
trans.addItemListener(this);
trans.setFont(newFont);
layOut.setConstraints(trans, ls);
getContentPane().add(trans);
ls.gridwidth = GridBagConstraints.REMAINDER;
stroke = new JComboBox( new Object[]{
"Stroke",
"Fill",
"Stroke & Fill"});
stroke.addItemListener(this);
stroke.setFont(newFont);
layOut.setConstraints(stroke, ls);
getContentPane().add(stroke);
GridBagConstraints button = new GridBagConstraints();
button.gridwidth = GridBagConstraints.REMAINDER;
redraw = new JButton("Redraw");
redraw.addActionListener(this);
redraw.setFont(newFont);
layOut.setConstraints(redraw, button);
getContentPane().add(redraw);
GridBagConstraints tP = new GridBagConstraints();
tP.fill = GridBagConstraints.BOTH;
tP.weightx = 1.0;
tP.weighty = 1.0;
tP.gridwidth = GridBagConstraints.REMAINDER;
display = new TransPanel();
layOut.setConstraints(display, tP);
display.setBackground(Color.white);
getContentPane().add(display);
validate();