private void getFilmImage() {
   ImageIcon image = new ImageIcon(imageURL);
   imageLabel.setText("");
   imageLabel.setBorder(null);
   System.out.println(
       "Ancho: "
           + (int) imageLabel.getSize().width
           + ", Alto:"
           + (int) imageLabel.getSize().getHeight());
   imageLabel.setIcon(new UtilTools().getScaledImageIcon(image.getImage(), 129, 166));
   SwingUtilities.invokeLater(
       new Runnable() {
         public void run() {
           infoPanel.revalidate();
         }
       });
 }
Ejemplo n.º 2
0
    @Override
    public void mouseMoved(MouseEvent e) {
      Point p = e.getPoint();
      Point l = node.getLocation();
      Dimension d = node.getSize();

      if (l.x <= p.x && l.y <= p.y && l.x + d.width >= p.x && l.y + d.height >= p.y) {
        tipLabel.setText(tooltip);
      }
      parent.repaint();
    }
Ejemplo n.º 3
0
  private void processDrag(final MouseEvent e) {
    if (myDragCancelled) return;
    if (!isDraggingNow()) {
      if (myPressedPoint == null) return;
      if (isWithinDeadZone(e)) return;

      myDragPane = findLayeredPane(e);
      if (myDragPane == null) return;
      final BufferedImage image =
          new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB);
      paint(image.getGraphics());
      myDragButtonImage =
          new JLabel(new ImageIcon(image)) {

            public String toString() {
              return "Image for: " + StripeButton.this.toString();
            }
          };
      myDragPane.add(myDragButtonImage, JLayeredPane.POPUP_LAYER);
      myDragButtonImage.setSize(myDragButtonImage.getPreferredSize());
      setVisible(false);
      myPane.startDrag();
      myDragKeyEventDispatcher = new DragKeyEventDispatcher();
      KeyboardFocusManager.getCurrentKeyboardFocusManager()
          .addKeyEventDispatcher(myDragKeyEventDispatcher);
    }
    if (!isDraggingNow()) return;

    Point xy = SwingUtilities.convertPoint(e.getComponent(), e.getPoint(), myDragPane);
    if (myPressedPoint != null) {
      xy.x -= myPressedPoint.x;
      xy.y -= myPressedPoint.y;
    }
    myDragButtonImage.setLocation(xy);

    SwingUtilities.convertPointToScreen(xy, myDragPane);

    final Stripe stripe =
        myPane.getStripeFor(new Rectangle(xy, myDragButtonImage.getSize()), (Stripe) getParent());
    if (stripe == null) {
      if (myLastStripe != null) {
        myLastStripe.resetDrop();
      }
    } else {
      if (myLastStripe != null && myLastStripe != stripe) {
        myLastStripe.resetDrop();
      }
      stripe.processDropButton(this, myDragButtonImage, xy);
    }

    myLastStripe = stripe;
  }
Ejemplo n.º 4
0
  private void buildOptionsPanel() {

    JPanel copyPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    copyPanel.add(btnObject);
    copyPanel.add(btnValue);
    // copyPanel.add(cbTake);

    JPanel northPanel = new JPanel(new BorderLayout());
    // northPanel.add(namePanel,BorderLayout.NORTH);
    // northPanel.add(Box.createRigidArea(new Dimension(50,10)),
    // app.borderWest());
    northPanel.add(copyPanel, BorderLayout.CENTER);

    JPanel orderPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    orderPanel.add(cbScanOrder);

    JPanel transposePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    transposePanel.add(ckTranspose);

    JPanel xySwitchPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    xySwitchPanel.add(cbLeftRightOrder);

    JPanel pointListPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    pointListPanel.add(Box.createRigidArea(lblName.getSize()));

    // TODO: this is not a good way to manage visibility of option panels
    // ..fix it if we need more options in the future
    cards = new JPanel(new CardLayout());
    cards.add("c0", orderPanel);
    cards.add("c1", transposePanel);
    cards.add("c2", xySwitchPanel);
    cards.add("c3", transposePanel);

    optionsPanel = new JPanel(new BorderLayout());
    optionsPanel.add(northPanel, BorderLayout.NORTH);
    // optionsPanel.add(Box.createRigidArea(new Dimension(50,10)),
    // app.borderWest());
    optionsPanel.add(cards, BorderLayout.CENTER);

    // lblPreviewHeader = new JLabel();
    // optionsPanel.add(lblPreviewHeader, BorderLayout.SOUTH);

  }
Ejemplo n.º 5
0
  public InfoPanel() {
    super(new BorderLayout());
    Box verticalBox = Box.createVerticalBox();

    Box center = Box.createHorizontalBox();
    center.add(Box.createHorizontalGlue());
    center.add(
        new JLabel(
            new ImageIcon(
                DataStorage.mainLogo
                    .getImage()
                    .getScaledInstance(
                        DataStorage.mainLogo.getIconWidth() / 2,
                        DataStorage.mainLogo.getIconHeight() / 2,
                        Image.SCALE_SMOOTH))));
    center.add(Box.createHorizontalGlue());
    verticalBox.add(center);

    latestButton = new JButton(checkButtonString);

    latestButton.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            if (!checked) {
              busyLabel.setBusy(true);
              DataStorage.executors.submit(checker);
              //          latestButton.setMinimumSize(latestButton.getSize());
              //                 latestButton.setText("Checking...");
            } else if (!latestButton.isEnabled()) {
              // we have newest
            } else {
              if (Desktop.isDesktopSupported()) {
                Desktop d = Desktop.getDesktop();
                if (d != null) {
                  try {
                    d.browse(
                        new URI(
                            "http://www.mylifesucks.de/oss/NCSimulator/NCSimulator-latest.zip"));
                  } catch (Exception ex) {
                  }
                }
              }
            }
          }
        });

    checkText = new JLabel("                      ");
    checkText.setSize(300, checkText.getSize().height);

    busyLabel = new JXBusyLabel();
    center = Box.createHorizontalBox();
    center.add(Box.createHorizontalGlue());
    center.add(latestButton);
    center.add(busyLabel);
    center.add(Box.createHorizontalGlue());
    verticalBox.add(center);

    center = Box.createHorizontalBox();
    center.add(Box.createHorizontalGlue());
    center.add(checkText);
    center.add(Box.createHorizontalGlue());
    verticalBox.add(center);

    checker =
        new Runnable() {

          public void run() {
            try {
              URL url = new URL("http://www.mylifesucks.de/oss/NCSimulator/NCSimulator-latest.txt");
              URLConnection connection = url.openConnection();
              InputStream is = connection.getInputStream();
              String newest = new Scanner(is, "UTF-8").useDelimiter("\\Z").next();

              // System.out.println(newest);
              if (newest.equals("NCSimulator-" + Main.version)) {
                // System.out.println("Current");
                // latestButton.setText(youhavenewest);
                //                        latestButton.setEnabled(false);
                checkText.setText(youhavenewest);
              } else {
                checkText.setText(newest);
              }
              is.close();
              //                    checked = true;
            } catch (Exception ex) {
              // Logger.getLogger(InfoPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            busyLabel.setBusy(false);
          }
        };

    //        checkThread.start();

    JTextArea jta =
        new JTextArea(
            "Some hacked Java GUI to simulate the OSD (and some other) output from the NC\n"
                + "A lot of bugs might be here since it is heavily untested stuff but somehow helpfull for debugging own Applications that require data from an MK.\n"
                + "\n"
                + "Open Source:\n"
                + "\tLicensed under: Creative Commons / Non Commercial / Share Alike\n"
                + "\thttp://creativecommons.org/licenses/by-nc-sa/2.0/de/\n"
                + "\tSources available at: https://github.com/crathje/NCSimulator\n"
                + "\n"
                + "This Software uses:\n"
                + "\tRXTX which is licensed under the LGPL v2.1 and available from http://rxtx.qbang.org/\n"
                + "\tSwingX which is licensed under the LGPL and available from http://www.swinglabs.org/\n"
                + "\n"
                + "Credits to:\n"
                + "\tMarcus -LiGi- Bueschleb for the Encode/Decode java parts I borrowed from DUBWise\n"
                + "\tHolger Buss & Ingo Busker for the MikroKopter-project\n"
                + "\tFrank Blumenberg for adapting the simulator to current FC/NC releases\n"
                + "");
    //        jta.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 14));
    jta.setBackground(this.getBackground());
    // jta.setWrapStyleWord(true);
    // jta.setAutoscrolls(true);
    jta.setBackground(this.getBackground());
    jta.setEditable(false);
    jta.setLineWrap(true);
    // jta.setColumns(20);
    /*jta.setSize(new Dimension(DataStorage.mainLogo.getIconWidth(), DataStorage.mainLogo.getIconHeight()));
    jta.setPreferredSize(jta.getSize());
    jta.setMinimumSize(jta.getSize());
    jta.setMaximumSize(jta.getSize());*/
    center = Box.createHorizontalBox();
    center.add(Box.createHorizontalGlue());
    Box vertical = Box.createVerticalBox();

    JTabbedPane tabbed = new JTabbedPane();
    tabbed.add("General", new JScrollPane(jta));
    // vertical.add(new JScrollPane(jta));

    JTextArea changeLog = new JTextAreaFromFile("/CHANGE.LOG");
    changeLog.setEditable(false);
    changeLog.setBackground(getBackground());
    changeLog.setLineWrap(true);
    tabbed.add("Change Log", new JScrollPane(changeLog));

    vertical.add(tabbed);
    Box links = Box.createHorizontalBox();
    links.add(new LinkLabel("NCSimulator", "http://www.mylifesucks.de/oss/NCSimulator/"));
    links.add(Box.createHorizontalGlue());
    links.add(
        new LinkLabel(
            "NCSimulator latest",
            "http://www.mylifesucks.de/oss/NCSimulator/NCSimulator-latest.zip"));
    links.add(Box.createHorizontalGlue());
    links.add(new LinkLabel("Thread in MK-Forum", "http://forum.mikrokopter.de/topic-20435.html"));
    links.add(Box.createHorizontalGlue());

    links.add(new LinkLabel("MikroKopter", "http://www.mikrokopter.de/"));
    links.add(Box.createHorizontalGlue());
    links.add(new LinkLabel("DUBwise", "http://www.mikrokopter.de/ucwiki/DUBwise"));
    vertical.add(links);
    center.add(vertical);
    center.add(Box.createHorizontalGlue());

    //        center.add(jb);

    center.add(Box.createHorizontalGlue());
    verticalBox.add(center);

    // Desktop.getDesktop().browse(null);

    add(verticalBox, BorderLayout.CENTER);
  }