public void actionPerformed(ActionEvent ev) {
    if (collapsed) {
      if (label != null) {
        remove(label);
      }
      add(comp);
      moreOrLessButton.setIcon(collapseIcon);
    } else {
      remove(comp);
      if (valueLabelStr != null) {
        if (label == null) {
          label = new JLabel(Resources.format(Messages.CURRENT_VALUE, valueLabelStr));
        }
        add(label);
      }
      moreOrLessButton.setIcon(expandIcon);
    }
    collapsed = !collapsed;

    JComponent container = (JComponent) getParent();
    if (container != null && container.getLayout() instanceof VariableGridLayout) {

      ((VariableGridLayout) container.getLayout()).setFillRow(this, !collapsed);
      container.revalidate();
    }
  }
 public void testCardLayout() throws Exception {
   JComponent rootComponent = getInstrumentedRootComponent("TestCardLayout.form", "BindingTest");
   assertTrue(rootComponent.getLayout() instanceof CardLayout);
   CardLayout cardLayout = (CardLayout) rootComponent.getLayout();
   assertEquals(10, cardLayout.getHgap());
   assertEquals(20, cardLayout.getVgap());
 }
 private static void jGridBagAdd(
     JComponent parent, JComponent componentToAdd, GridBagConstraints constraints, int pos) {
   if (!(parent.getLayout() instanceof GridBagLayout))
     throw new IllegalArgumentException("parent must have a GridBagLayout");
   GridBagLayout layout = (GridBagLayout) parent.getLayout();
   constraints.gridwidth = pos;
   layout.setConstraints(componentToAdd, constraints);
   parent.add(componentToAdd);
 }
Exemple #4
0
  public void testLayout() throws Exception {

    SwingMetawidget metawidget = new SwingMetawidget();
    JComponent container = new JPanel();

    // startLayout

    BoxLayout boxLayout = new BoxLayout();
    boxLayout.startContainerLayout(container, metawidget);

    assertTrue(container.getLayout() instanceof javax.swing.BoxLayout);
    assertFalse((metawidget.getLayout() instanceof javax.swing.BoxLayout));

    // layoutWidget

    assertEquals(0, container.getComponentCount());

    Stub stub = new Stub();
    boxLayout.layoutWidget(stub, PROPERTY, null, container, metawidget);
    assertEquals(0, container.getComponentCount());

    stub.add(new JSpinner());
    boxLayout.layoutWidget(stub, PROPERTY, null, container, metawidget);
    assertEquals(stub, container.getComponent(0));
    assertEquals(1, container.getComponentCount());

    boxLayout.layoutWidget(new JTextField(), PROPERTY, null, container, metawidget);
    assertTrue(container.getComponent(1) instanceof JTextField);
    assertEquals(2, container.getComponentCount());
  }
Exemple #5
0
  /** {@inheritDoc} */
  @Override
  public Dimension getMaximumSize(JComponent c) {
    if (c.getComponentCount() > 0 && c.getLayout() != null) {
      return null;
    }

    AbstractButton b = (AbstractButton) c;
    SynthContext ss = getContext(c);
    Dimension size =
        ss.getStyle()
            .getGraphicsUtils(ss)
            .getMaximumSize(
                ss,
                ss.getStyle().getFont(ss),
                b.getText(),
                getSizingIcon(b),
                b.getHorizontalAlignment(),
                b.getVerticalAlignment(),
                b.getHorizontalTextPosition(),
                b.getVerticalTextPosition(),
                b.getIconTextGap(),
                b.getDisplayedMnemonicIndex());

    return size;
  }
 public void testCardLayoutShow() throws Exception {
   JComponent rootComponent =
       getInstrumentedRootComponent("TestCardLayoutShow.form", "BindingTest");
   assertTrue(rootComponent.getLayout() instanceof CardLayout);
   assertEquals(rootComponent.getComponentCount(), 2);
   assertFalse(rootComponent.getComponent(0).isVisible());
   assertTrue(rootComponent.getComponent(1).isVisible());
 }
  public void testGridLayout() throws Exception {
    JComponent rootComponent =
        getInstrumentedRootComponent("TestGridConstraints.form", "BindingTest");
    final LayoutManager layout = rootComponent.getLayout();
    assertTrue(isInstanceOf(layout, GridLayoutManager.class.getName()));

    assertEquals(1, invokeMethod(layout, "getRowCount"));
    assertEquals(1, invokeMethod(layout, "getColumnCount"));
  }
Exemple #8
0
 public void setVisible(boolean bShow, String title) {
   if (bShow) {
     String strDir = "";
     String strFreq = "";
     String strTraynum = "";
     m_strHelpFile = getHelpFile(title);
     String strSampleName = getSampleName(title);
     String frameBounds = getFrameBounds(title);
     StringTokenizer tok = new QuotedStringTokenizer(title);
     if (tok.hasMoreTokens()) strDir = tok.nextToken();
     if (tok.hasMoreTokens()) strFreq = tok.nextToken();
     if (tok.hasMoreTokens()) strTraynum = tok.nextToken();
     else {
       try {
         Integer.parseInt(strDir);
         // if strdir is number, then strdir is empty, and the
         // strfreq is the number
         strTraynum = strFreq;
         strFreq = strDir;
         strDir = "";
       } catch (Exception e) {
       }
     }
     try {
       setTitle(gettitle(strFreq));
       m_lblSampleName.setText("3");
       boolean bVast = isVast(strTraynum);
       CardLayout layout = (CardLayout) m_pnlSampleName.getLayout();
       if (!bVast) {
         if (strSampleName == null) {
           strSampleName = getSampleName(strDir, strTraynum);
         }
         m_lblSampleName.setText(strSampleName);
         layout.show(m_pnlSampleName, OTHER);
       } else {
         m_strDir = strDir;
         setTrays();
         layout.show(m_pnlSampleName, VAST);
         m_trayTimer.start();
       }
       boolean bSample = bVast || !strSampleName.trim().equals("");
       m_pnlSampleName.setVisible(bSample);
       m_lblLogin.setForeground(getBackground());
       m_lblLogin.setVisible(false);
       m_passwordField.setText("");
       m_passwordField.setCaretPosition(0);
     } catch (Exception e) {
       Messages.writeStackTrace(e);
     }
     setBounds(frameBounds);
     ExpPanel exp = Util.getActiveView();
     if (exp != null) exp.waitLogin(true);
   }
   writePersistence();
   setVisible(bShow);
 }
 private void checkConstraint(JComponent parent, String constraint) {
   BorderLayout layout = (BorderLayout) parent.getLayout();
   if (StringUtils.isNotEmpty(constraint)
       && layout.getLayoutComponent(parent, constraint) != null) {
     logger.warn(
         "Component already has a child in '"
             + constraint
             + "' align position. It will be overplaced with a new child.");
   }
 }
 public Dimension getPreferredSize(JComponent c) {
   Dimension prefSize =
       (getFileChooser().getAccessory() != null) ? WITH_ACCELERATOR_PREF_SIZE : PREF_SIZE;
   Dimension d = c.getLayout().preferredLayoutSize(c);
   if (d != null) {
     return new Dimension(
         d.width < prefSize.width ? prefSize.width : d.width,
         d.height < prefSize.height ? prefSize.height : d.height);
   } else {
     return prefSize;
   }
 }
  public void testGridConstraints() throws Exception {
    JComponent rootComponent =
        getInstrumentedRootComponent("TestGridConstraints.form", "BindingTest");
    assertEquals(1, rootComponent.getComponentCount());
    final LayoutManager layout = rootComponent.getLayout();
    assertTrue(isInstanceOf(layout, GridLayoutManager.class.getName()));

    final Object constraints =
        invokeMethod(layout, "getConstraints", new Class[] {int.class}, new Object[] {0});
    assertTrue(isInstanceOf(constraints, GridConstraints.class.getName()));

    assertEquals(1, invokeMethod(constraints, "getColSpan"));
    assertEquals(1, invokeMethod(constraints, "getRowSpan"));
  }
  /**
   * If <code>c</code> is the <code>JOptionPane</code> the receiver is contained in, the preferred
   * size that is returned is the maximum of the preferred size of the <code>LayoutManager</code>
   * for the <code>JOptionPane</code>, and <code>getMinimumOptionPaneSize</code>.
   */
  public Dimension getPreferredSize(JComponent c) {
    if (c == optionPane) {
      Dimension ourMin = getMinimumOptionPaneSize();
      LayoutManager lm = c.getLayout();

      if (lm != null) {
        Dimension lmSize = lm.preferredLayoutSize(c);

        if (ourMin != null)
          return new Dimension(
              Math.max(lmSize.width, ourMin.width), Math.max(lmSize.height, ourMin.height));
        return lmSize;
      }
      return ourMin;
    }
    return null;
  }
 private DirectionLayout getDirectionLayout() {
   return (DirectionLayout) componentBox.getLayout();
 }
Exemple #14
0
  public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();

    if (cmd.equals("new")) {
      icons = new Hashtable[0];
      fields = new Hashtable[0];

      tabPane.removeAll();
      repaint();
    } else if (cmd.equals("open")) {
      JFileChooser chooser = new JFileChooser();
      FileFilter filter =
          new FileFilter() {
            public boolean accept(File f) {
              return f.getAbsolutePath().endsWith(".template") || f.isDirectory();
            }

            public String getDescription() {
              return "OME Notes Templates";
            }
          };

      chooser.setFileFilter(filter);

      int status = chooser.showOpenDialog(this);
      if (status == JFileChooser.APPROVE_OPTION) {
        String file = chooser.getSelectedFile().getAbsolutePath();
        try {
          Template t = new Template(file);

          TemplateTab[] tabs = t.getTabs();
          for (int i = 0; i < tabs.length; i++) {
            int rows = tabs[i].getRows();
            int cols = tabs[i].getColumns();
            if (cols == 0) cols = 1;
            if (rows == 0) rows = 1;

            addTab(tabs[i].getName(), rows, cols);
            tabPane.setSelectedIndex(i);

            for (int j = 0; j < tabs[i].getNumFields(); j++) {
              TemplateField f = tabs[i].getField(j);

              int x = f.getRow();
              int y = f.getColumn();
              if (x == -1) x = 1;
              if (y == -1) y = j + 1;

              Point p = new Point(x, y);
              DraggableIcon icon = (DraggableIcon) icons[i].get(p);

              icon.label = new JLabel(f.getName());

              JPanel panel = new JPanel();
              panel.add(f.getComponent());

              icon.setPanel(panel);
            }
          }
        } catch (Exception exc) {
          error("Failed to parse template", exc);
        }

        tabPane.setSelectedIndex(0);
      }
    } else if (cmd.equals("save")) {
      // build up the template from the components

      TemplateTab[] tabs = new TemplateTab[tabPane.getTabCount()];

      for (int i = 0; i < tabs.length; i++) {
        tabs[i] = new TemplateTab();
        tabs[i].setName(tabPane.getTitleAt(i));
        JComponent c = (JComponent) tabPane.getComponentAt(i);
        FormLayout layout = (FormLayout) c.getLayout();

        tabs[i].setRows(layout.getRowCount());
        tabs[i].setColumns(layout.getColumnCount());

        Object[] keys = icons[i].keySet().toArray();

        for (int j = 0; j < keys.length; j++) {
          Point p = (Point) keys[j];
          DraggableIcon icon = (DraggableIcon) icons[i].get(p);
          TemplateField f = (TemplateField) fields[i].get(p);

          if (icon.image != null) {
            Component[] components = icon.image.getComponents();
            JLabel label = icon.label;
            JComponent component = (JComponent) components[0];

            f.setComponent(component);

            for (int k = 0; k < COMPONENTS.length; k++) {
              if (component.getClass().equals(COMPONENTS[k])) {
                f.setType(COMPONENT_TYPES[k]);
                break;
              }
            }

            f.setRow(p.y);
            f.setColumn(p.x);
            f.setDefaultValue(TemplateTools.getComponentValue(component));

            tabs[i].addField(f);
          }
        }
      }

      Template t = new Template(tabs, null);

      // prompt for filename to save to
      if (currentFile == null) {
        JFileChooser chooser = new JFileChooser();

        FileFilter filter =
            new FileFilter() {
              public boolean accept(File f) {
                return true;
              }

              public String getDescription() {
                return "All files";
              }
            };

        chooser.setFileFilter(filter);

        int status = chooser.showSaveDialog(this);
        if (status == JFileChooser.APPROVE_OPTION) {
          currentFile = chooser.getSelectedFile().getAbsolutePath();
          if (currentFile == null) return;
        }
      }

      try {
        t.save(currentFile);
      } catch (IOException io) {
        error("Failed to save template", io);
      }
    } else if (cmd.equals("quit")) dispose();
    else if (cmd.equals("add row")) addRow();
    else if (cmd.equals("add col")) addColumn();
    else if (cmd.equals("prompt tab")) {
      // prompt for tab name
      JPopupMenu menu = new JPopupMenu();
      newTabName = new JTextField();
      newTabName.setPreferredSize(new Dimension(200, 25));
      menu.add(newTabName);
      JButton b = new JButton("OK");
      b.addActionListener(this);
      b.setActionCommand("new tab");
      menu.add(b);

      JComponent s = (JComponent) e.getSource();
      menu.show(s, s.getX(), s.getY());
      newTabName.grabFocus();
    } else if (cmd.equals("new tab")) {
      newTabName.getParent().setVisible(false);
      addTab(newTabName.getText(), 2, 2);
    } else if (cmd.equals("setName")) {
      JPopupMenu menu = (JPopupMenu) ((JComponent) e.getSource()).getParent();
      DraggableIcon icon = (DraggableIcon) menu.getInvoker();
      menu.setVisible(false);

      String text = ((JTextField) menu.getComponents()[0]).getText();

      Point p = new Point(icon.gridx, icon.gridy);
      int ndx = tabPane.getSelectedIndex();
      TemplateField f = (TemplateField) fields[ndx].get(p);
      f.setName(text);
      f.setNameMap(null);

      // set the name
      if (icon.label != null) icon.remove(icon.label);
      icon.remove(icon.image);
      icon.label = new JLabel(text);
      icon.add(icon.label);
      icon.add(icon.image);
      icon.getParent().repaint();
    } else if (cmd.equals("changeName")) {
      // prompt for new field name
      JPopupMenu menu = new JPopupMenu();
      JTextField field = new JTextField();
      field.setPreferredSize(new Dimension(200, 25));
      menu.add(field);
      JButton b = new JButton("OK");
      b.addActionListener(this);
      b.setActionCommand("setName");
      menu.add(b);
      menu.show(lastMenuComponent, lastMenuX, lastMenuY);
      field.grabFocus();
    } else if (cmd.equals("nameMap")) {
      JPopupMenu menu = (JPopupMenu) ((JComponent) e.getSource()).getParent();
      DraggableIcon icon = (DraggableIcon) menu.getInvoker();
      menu.setVisible(false);

      MappingWindow w = new MappingWindow(this, true);
      w.show(lastMenuComponent, lastMenuX, lastMenuY);
    } else if (cmd.equals("map")) {
      JPopupMenu menu = (JPopupMenu) ((JComponent) e.getSource()).getParent();
      DraggableIcon icon = (DraggableIcon) menu.getInvoker();
      menu.setVisible(false);

      MappingWindow w = new MappingWindow(this, false);
      w.show(lastMenuComponent, lastMenuX, lastMenuY);
    } else if (cmd.equals("repeat")) {
      JMenuItem item = (JMenuItem) e.getSource();
      DraggableIcon icon = (DraggableIcon) ((JPopupMenu) item.getParent()).getInvoker();
      TemplateField f = getField(icon);

      if (item.getText().equals("Repeat this field")) {
        item.setText("Don't repeat this field");
        f.setRepeated(true);
      } else {
        item.setText("Repeat this field");
        f.setRepeated(false);
      }
    } else if (cmd.equals("removeField")) {
      JPopupMenu menu = (JPopupMenu) ((JComponent) e.getSource()).getParent();
      DraggableIcon icon = (DraggableIcon) menu.getInvoker();
      menu.setVisible(false);

      int idx = tabPane.getSelectedIndex();
      Object[] keys = icons[idx].keySet().toArray();
      for (int i = 0; i < keys.length; i++) {
        if (icons[idx].get(keys[i]).equals(icon)) {
          icons[idx].remove(keys[i]);
          fields[idx].remove(keys[i]);
          break;
        }
      }

      icon.remove(icon.label);
      icon.remove(icon.image);
      tabPane.repaint();
    } else if (cmd.startsWith("removeRow")) {
      int row = Integer.parseInt(cmd.substring(cmd.indexOf(":") + 1));
      JPopupMenu menu = (JPopupMenu) ((JComponent) e.getSource()).getParent();
      menu.setVisible(false);

      JPanel pane = (JPanel) tabPane.getSelectedComponent();
      FormLayout layout = (FormLayout) pane.getLayout();

      int rows = layout.getRowCount();
      int cols = layout.getColumnCount();

      int idx = tabPane.getSelectedIndex();

      for (int i = 0; i < cols; i++) {
        pane.remove((JComponent) icons[idx].get(new Point(i + 1, row + 1)));
      }

      rekey(row, -1);
      layout.removeRow(row + 1);
      tabPane.repaint();
    } else if (cmd.startsWith("removeColumn")) {
      int col = Integer.parseInt(cmd.substring(cmd.indexOf(":") + 1));
      JPopupMenu menu = (JPopupMenu) ((JComponent) e.getSource()).getParent();
      menu.setVisible(false);

      JPanel pane = (JPanel) tabPane.getSelectedComponent();
      FormLayout layout = (FormLayout) pane.getLayout();

      int rows = layout.getRowCount();
      int cols = layout.getColumnCount();
      int idx = tabPane.getSelectedIndex();

      for (int i = 0; i < rows; i++) {
        pane.remove((JComponent) icons[idx].get(new Point(col + 1, i + 1)));
      }

      rekey(-1, col);
      layout.removeColumn(col + 1);
      tabPane.repaint();
    } else if (cmd.equals("removeTab")) {
      int ndx = tabPane.getSelectedIndex();
      tabPane.remove(ndx);

      Hashtable[] h = new Hashtable[icons.length - 1];
      Hashtable[] f = new Hashtable[fields.length - 1];

      System.arraycopy(icons, 0, h, 0, ndx);
      System.arraycopy(icons, ndx + 1, h, ndx, h.length - ndx);
      System.arraycopy(fields, 0, f, 0, ndx);
      System.arraycopy(fields, ndx + 1, f, ndx, f.length - ndx);

      icons = h;
      fields = f;
    } else if (cmd.equals("specifyChoices")) {
      JMenuItem item = (JMenuItem) e.getSource();
      DraggableIcon icon = (DraggableIcon) ((JPopupMenu) item.getParent()).getInvoker();
      TemplateField f = getField(icon);

      EnumWindow w = new EnumWindow(this, f.getEnums());
      w.show(lastMenuComponent, lastMenuX, lastMenuY);
    } else if (cmd.equals("setThumbSource")) {
      JPopupMenu menu = new JPopupMenu();
      ButtonGroup g = new ButtonGroup();

      JRadioButton dataset = new JRadioButton("Use thumbnail from dataset");
      dataset.setSelected(true);
      g.add(dataset);

      JRadioButton file = new JRadioButton("Use thumbnail from file:");
      g.add(file);

      menu.add(dataset);
      menu.add(file);

      JTextField field = new JTextField();
      field.setPreferredSize(new Dimension(200, 25));
      menu.add(field);

      JButton b = new JButton("OK");
      b.addActionListener(this);
      b.setActionCommand("applyThumbSource");
      menu.add(b);
      menu.show(lastMenuComponent, lastMenuX, lastMenuY);
    } else if (cmd.equals("applyThumbSource")) {
      JPopupMenu menu = (JPopupMenu) ((JComponent) e.getSource()).getParent();
      DraggableIcon icon = (DraggableIcon) menu.getInvoker();

      Component[] c = menu.getComponents();
      JRadioButton dataset = (JRadioButton) c[0];

      String text = null;

      if (!dataset.isSelected()) {
        JTextField t = (JTextField) c[2];
        text = t.getText();
        getField(icon).setValueMap(text);
      }

      menu.setVisible(false);

      if (text != null) {
        try {
          BufferedImageReader reader = new BufferedImageReader();
          reader.setId(text);
          BufferedImage thumb = reader.openThumbImage(0);
          JLabel label = (JLabel) icon.image.getComponents()[0];
          label.setIcon(new ImageIcon(thumb));
          reader.close();
        } catch (FormatException exc) {
          error("Failed to open thumbnail (" + text + ")", exc);
        } catch (IOException exc) {
          error("Failed to open thumbnail (" + text + ")", exc);
        }
      }
    } else if (cmd.equals("ok")) {
      // this event came from an instance of EnumWindow
      JPanel parent = (JPanel) ((JButton) e.getSource()).getParent();
      EnumWindow menu = (EnumWindow) parent.getParent();
      DraggableIcon icon = (DraggableIcon) menu.getInvoker();
      TemplateField f = getField(icon);
      menu.setVisible(false);

      String[] options = menu.getOptions();
      f.setEnums(options);

      JComboBox box = (JComboBox) icon.image.getComponents()[0];
      for (int i = 0; i < options.length; i++) box.addItem(options[i]);
      repaint();
    } else if (cmd.equals("chooseMapping")) {
      // this event came from an instance of MappingWindow
      JTabbedPane parent = (JTabbedPane) ((JButton) e.getSource()).getParent();
      MappingWindow menu = (MappingWindow) parent.getParent();
      DraggableIcon icon = (DraggableIcon) menu.getInvoker();
      TemplateField f = getField(icon);

      String omexmlMap = null;

      if (menu.nameMap) f.setNameMap(omexmlMap);
      else f.setValueMap(omexmlMap);
      menu.setVisible(false);
    }
  }
  public static void main(String args[]) {
    JComponent ch = new JComponent() {};
    ch.getAccessibleContext();
    ch.isFocusTraversable();
    ch.setEnabled(false);
    ch.setEnabled(true);
    ch.requestFocus();
    ch.requestFocusInWindow();
    ch.getPreferredSize();
    ch.getMaximumSize();
    ch.getMinimumSize();
    ch.contains(1, 2);
    Component c1 = ch.add(new Component() {});
    Component c2 = ch.add(new Component() {});
    Component c3 = ch.add(new Component() {});
    Insets ins = ch.getInsets();
    ch.getAlignmentY();
    ch.getAlignmentX();
    ch.getGraphics();
    ch.setVisible(false);
    ch.setVisible(true);
    ch.setForeground(Color.red);
    ch.setBackground(Color.red);
    for (String font : Toolkit.getDefaultToolkit().getFontList()) {
      for (int j = 8; j < 17; j++) {
        Font f1 = new Font(font, Font.PLAIN, j);
        Font f2 = new Font(font, Font.BOLD, j);
        Font f3 = new Font(font, Font.ITALIC, j);
        Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);

        ch.setFont(f1);
        ch.setFont(f2);
        ch.setFont(f3);
        ch.setFont(f4);

        ch.getFontMetrics(f1);
        ch.getFontMetrics(f2);
        ch.getFontMetrics(f3);
        ch.getFontMetrics(f4);
      }
    }
    ch.enable();
    ch.disable();
    ch.reshape(10, 10, 10, 10);
    ch.getBounds(new Rectangle(1, 1, 1, 1));
    ch.getSize(new Dimension(1, 2));
    ch.getLocation(new Point(1, 2));
    ch.getX();
    ch.getY();
    ch.getWidth();
    ch.getHeight();
    ch.isOpaque();
    ch.isValidateRoot();
    ch.isOptimizedDrawingEnabled();
    ch.isDoubleBuffered();
    ch.getComponentCount();
    ch.countComponents();
    ch.getComponent(1);
    ch.getComponent(2);
    Component[] cs = ch.getComponents();
    ch.getLayout();
    ch.setLayout(new FlowLayout());
    ch.doLayout();
    ch.layout();
    ch.invalidate();
    ch.validate();
    ch.remove(0);
    ch.remove(c2);
    ch.removeAll();
    ch.preferredSize();
    ch.minimumSize();
    ch.getComponentAt(1, 2);
    ch.locate(1, 2);
    ch.getComponentAt(new Point(1, 2));
    ch.isFocusCycleRoot(new Container());
    ch.transferFocusBackward();
    ch.setName("goober");
    ch.getName();
    ch.getParent();
    ch.getGraphicsConfiguration();
    ch.getTreeLock();
    ch.getToolkit();
    ch.isValid();
    ch.isDisplayable();
    ch.isVisible();
    ch.isShowing();
    ch.isEnabled();
    ch.enable(false);
    ch.enable(true);
    ch.enableInputMethods(false);
    ch.enableInputMethods(true);
    ch.show();
    ch.show(false);
    ch.show(true);
    ch.hide();
    ch.getForeground();
    ch.isForegroundSet();
    ch.getBackground();
    ch.isBackgroundSet();
    ch.getFont();
    ch.isFontSet();
    Container c = new Container();
    c.add(ch);
    ch.getLocale();
    for (Locale locale : Locale.getAvailableLocales()) ch.setLocale(locale);

    ch.getColorModel();
    ch.getLocation();

    boolean exceptions = false;
    try {
      ch.getLocationOnScreen();
    } catch (IllegalComponentStateException e) {
      exceptions = true;
    }
    if (!exceptions)
      throw new RuntimeException("IllegalComponentStateException did not occur when expected");

    ch.location();
    ch.setLocation(1, 2);
    ch.move(1, 2);
    ch.setLocation(new Point(1, 2));
    ch.getSize();
    ch.size();
    ch.setSize(1, 32);
    ch.resize(1, 32);
    ch.setSize(new Dimension(1, 32));
    ch.resize(new Dimension(1, 32));
    ch.getBounds();
    ch.bounds();
    ch.setBounds(10, 10, 10, 10);
    ch.setBounds(new Rectangle(10, 10, 10, 10));
    ch.isLightweight();
    ch.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
    ch.getCursor();
    ch.isCursorSet();
    ch.inside(1, 2);
    ch.contains(new Point(1, 2));
    ch.isFocusable();
    ch.setFocusable(true);
    ch.setFocusable(false);
    ch.transferFocus();
    ch.getFocusCycleRootAncestor();
    ch.nextFocus();
    ch.transferFocusUpCycle();
    ch.hasFocus();
    ch.isFocusOwner();
    ch.toString();
    ch.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
    ch.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    ch.setComponentOrientation(ComponentOrientation.UNKNOWN);
    ch.getComponentOrientation();
  }