コード例 #1
0
  /** Creates new form ConferenceDescShowDialog */
  public ConferenceDescShowDialog(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();
    jScrollPane1.getViewport().setOpaque(false);
    try {

      BufferedImage resultImage =
          Vovo.getMyContext()
              .getDataManager()
              .getValue(Constants.DataKey.BACKGROUND_GAUSSIAN_IMAGE.toString());

      ImagePainter ip = new ImagePainter(resultImage);
      //			ip.setScaleToFit(true);
      ip.setScaleType(ScaleType.Distort);

      backgroundXPanel.setBackgroundPainter(ip);

      BufferedImage whiteimg =
          ImageIO.read(getClass().getResource("/com/lorent/vovo/resource/images/whitealpha.png"));
      ImagePainter imagePainter = new ImagePainter(whiteimg);
      imagePainter.setScaleType(ScaleType.Distort);
      imagePainter.setScaleToFit(true);
      jXPanel1.setBackgroundPainter(imagePainter);

    } catch (Exception e) {
      log.error("ConferenceEditDialog()", e);
      e.printStackTrace();
    }
  }
コード例 #2
0
  public void interactiveTransparentRenderer() throws IOException {
    final JXTree tree = new JXTree(new ComponentTreeTableModel(new JXFrame()));
    tree.setEditable(true);
    StringValue sv =
        new StringValue() {

          public String getString(Object value) {
            if (value instanceof Component) {
              return ((Component) value).getName();
            }
            return " - no component - ";
          }
        };
    DefaultTreeRenderer renderer = new DefaultTreeRenderer(sv);
    tree.setCellRenderer(renderer);
    tree.setForeground(Color.WHITE);
    JXPanel panel = new JXPanel(new BorderLayout());
    ImagePainter imagePainter = new ImagePainter(XTestUtils.loadDefaultImage());
    imagePainter.setFillHorizontal(true);
    imagePainter.setFillVertical(true);
    panel.setBackgroundPainter(imagePainter);
    panel.add(new JScrollPane(tree));

    JXFrame frame = wrapInFrame(panel, "renderer");
    WrappingProvider provider = (WrappingProvider) renderer.getComponentProvider();
    provider.getWrappee().getRendererComponent(null).setOpaque(false);
    tree.setOpaque(false);
    ((JComponent) tree.getParent()).setOpaque(false);
    ((JComponent) tree.getParent().getParent()).setOpaque(false);
    Action edit =
        new AbstractActionExt("edit") {

          public void actionPerformed(ActionEvent e) {
            if (tree.isSelectionEmpty()) return;
            TreePath path = tree.getSelectionPath();
            Component comp = (Component) path.getLastPathComponent();
            String oldName = comp.getName();
            if (oldName == null) {
              oldName = "none";
            }
            String changed =
                oldName.length() > 60
                    ? oldName.substring(0, 20)
                    : oldName + "+++++++++++++++++++++++++++++++++++++++++++++";
            tree.getModel().valueForPathChanged(path, changed);
          }
        };
    addAction(frame, edit);
    show(frame);
  }