/** Creates an image of the checkbox and puts it in a label. */
 private JLabel createIconLabel(JCheckBox checkBox) {
   checkBox.setOpaque(false);
   checkBox.setSize(checkBox.getMinimumSize());
   Image image =
       new BufferedImage(checkBox.getWidth(), checkBox.getHeight(), Transparency.TRANSLUCENT);
   Graphics g = image.getGraphics();
   checkBox.paint(g);
   g.dispose();
   return new JLabel(new ImageIcon(image));
 }
 private boolean isInCheckBox(Point where) {
   Insets insets = tree.getInsets();
   int right = checkBox.getWidth();
   int left = 0;
   if (insets != null) {
     left += insets.left;
     right += insets.left;
   }
   return where.x >= left && where.x < right;
 }
Example #3
0
  private void setMainLayout() {

    setPreferredSize(new Dimension(280, 340 + 285));
    setSize(getPreferredSize());
    setBorder(
        BorderFactory.createTitledBorder(
            null,
            "ACTION LOG",
            TitledBorder.CENTER,
            TitledBorder.DEFAULT_POSITION,
            null,
            Color.GREEN));
    setOpaque(false);
    setLayout(null);

    this.add(sc);
    sc.setBounds(2, 20, 276, 170 + 285);
    this.add(ckWrap);
    ckWrap.setBounds(sc.getX() + 2, sc.getY() + sc.getHeight() + 10, 140, 30);
    this.add(btnExport);
    btnExport.setBounds(ckWrap.getX() + ckWrap.getWidth() + 5, ckWrap.getY(), 120, 30);
  }