public boolean setIconStatus(JLabel _jl, ImageIcon ii) {
   if (_jl != null) {
     _jl.setIcon(ii);
     if (ii != yellowLight) _jl.setCursor(thePointyFinger);
     else _jl.setCursor(theNormalMouse);
     _jl.update(_jl.getGraphics());
   }
   return (ii == greenLight);
 }
 /**
  * DOCUMENT ME!
  *
  * @param dokumentUrl DOCUMENT ME!
  */
 private void setDokumentLink(final String dokumentUrl) {
   if (dokumentUrl != null) {
     lblDokumentLink.setText(
         "<html><a href=\"" + dokumentUrl + "\">Dokument im Browser anzeigen</a>");
     lblDokumentLink.setToolTipText(dokumentUrl);
     lblDokumentLink.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
   } else {
     lblDokumentLink.setText("");
     lblDokumentLink.setToolTipText(null);
     lblDokumentLink.setCursor(Cursor.getDefaultCursor());
   }
 }
Esempio n. 3
0
  /**
   * Constructor
   *
   * @param tagValues the initial tag values
   * @param canDelete
   */
  public TagLabelPanel(String tagName, List<String> tagValues, boolean canDelete) {
    setLayout(new BorderLayout(5, 3));

    this.tagName = tagName;

    // add add button
    initImageIcons();

    JLabel lAdd = new JLabel(iiAdd);
    lAdd.setToolTipText(Messages.getString("ML.TagLabelPanel.toolTipAdd"));
    lAdd.setCursor(new Cursor(Cursor.HAND_CURSOR));
    lAdd.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            createNewLabel();
          }
        });

    if (canDelete) {
      JPanel pOptions = new JPanel(new GridLayout(1, 2, 4, 0));
      pOptions.add(lAdd);

      JLabel lDelete = new JLabel(iiDelete);
      lDelete.setToolTipText(Messages.getString("ML.TagLabelPanel.toolTipDelete"));
      lDelete.setCursor(new Cursor(Cursor.HAND_CURSOR));
      lDelete.addMouseListener(
          new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
              fireActionEvent(ACTION_COMMAND_DELETE);
            }
          });
      pOptions.add(lDelete);

      add(pOptions, BorderLayout.LINE_START);
    } else {
      add(lAdd, BorderLayout.LINE_START);
    }

    // add all the tag values
    pTagValues = new JPanel(new WrapLayout(FlowLayout.LEFT, 0, 0));
    for (String tagValue : tagValues) {
      final TagLabel tl = createTagLabel(tagValue);
      pTagValues.add(tl);
    }
    add(pTagValues, BorderLayout.CENTER);
    refreshCommas();
  }
Esempio n. 4
0
 @Override
 public void mouseEntered(MouseEvent e) {
   // TODO Auto-generated method stub
   JLabel now = (JLabel) e.getSource();
   now.setCursor(new Cursor(Cursor.HAND_CURSOR));
   TextLabelStyle.makeUnderLine(now);
 }
 // Renders image from canon DSLR
 private static void canonSLR(final CanonCamera camera) {
   renderCanon = new JLabel();
   if (canon = true) {
     while (canon = true) {
       try {
         Thread.sleep(50);
         BufferedImage canonimage = camera.downloadLiveView();
         if (canonimage != null) {
           renderCanon.setIcon(new ImageIcon(canonimage));
           renderCanon.setBounds((width / 2) - 528, 10, 1056, 704);
           renderCanon.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 3));
           renderCanon.setToolTipText("Live Canon DSLR feed");
           renderCanon.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
           window.add(renderCanon);
           webcam = false;
           nikon = false;
           System.out.println("Battery: " + camera.getProperty(kEdsPropID_BatteryLevel));
           canonimage.flush();
         }
       } catch (InterruptedException ex) {
         Logger.getLogger(Controls.class.getName()).log(Level.SEVERE, null, ex);
       }
     }
   }
 }
Esempio n. 6
0
  private JPanel createScope(
      final Float lScore, final String lScoreId, final Float hScore, final String hScoreId) {
    JPanel scoreScope = new JPanel();
    FlowLayout flowLayout = new FlowLayout();
    flowLayout.setAlignment(FlowLayout.RIGHT);
    scoreScope.setLayout(flowLayout);
    scoreScope.setBackground(new java.awt.Color(255, 255, 255));
    JLabel scopeTitle =
        new JLabel(BundleUtil.getString(BundleUtil.ClientWin_ScorePanel_ExistingScoreScope) + ":");
    scopeTitle.setForeground(new java.awt.Color(204, 204, 204));
    scoreScope.add(scopeTitle);
    JLabel lScoreJLablel = new JLabel(String.valueOf(lScore));
    lScoreJLablel.setForeground(new java.awt.Color(204, 204, 204));
    lScoreJLablel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    scoreScope.add(lScoreJLablel);
    lScoreJLablel.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(java.awt.event.MouseEvent evt) {
            try {
              scoreScopeMouseClicked(lScoreId);
            } catch (JDependException e) {
              frame.getResultPanel().showError(e);
            }
          }
        });
    JLabel interval = new JLabel("~");
    interval.setForeground(new java.awt.Color(204, 204, 204));
    scoreScope.add(interval);
    JLabel hScoreJLablel = new JLabel(String.valueOf(hScore));
    hScoreJLablel.setForeground(new java.awt.Color(204, 204, 204));
    hScoreJLablel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    hScoreJLablel.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(java.awt.event.MouseEvent evt) {
            try {
              scoreScopeMouseClicked(hScoreId);
            } catch (JDependException e) {
              frame.getResultPanel().showError(e);
            }
          }
        });
    scoreScope.add(hScoreJLablel);

    return scoreScope;
  }
Esempio n. 7
0
  @Override
  public void mouseClicked(MouseEvent e) {
    // TODO Auto-generated method stub
    JLabel now = (JLabel) e.getSource();
    try {
      // Check now
      if (now.getName().equals("checknow")) {
        now.setText("Checking ...");
        now.setCursor(new Cursor(Cursor.WAIT_CURSOR));
        ExternalCommandPipe.forceCheckService(
            DIMS.getInstance().getCurrentHostName(), DIMS.getInstance().getCurrentServiceName());
        Thread.sleep(1000);

        DIMS myApp = DIMS.getInstance();
        UpdateWholeSystem updater = new UpdateWholeSystem();
        updater.update(myApp);
      }

      // Reschedule
      else if (now.getName().equals("reschedule")) {
        if (active == 0) {
          reschedule.setVisible(true);
          active = 1;
        } else {
          reschedule.setVisible(false);
          active = 0;
        }
      }

      // History
      else if (now.getName().equals("history")) {
        try {
          ShowServiceHistory shower = new ShowServiceHistory();
          DIMS.getInstance().getDetailContent().reloadContent(shower);
        } catch (SQLException e1) {
          // TODO Auto-generated catch block
          new FrameNotification(
              "Maybe something went wrong when you were trying to open a service<br>"
                  + e1.getMessage());
        }
      }

      // Service group
      else {
        if (IsServiceGroup.check(now.getName())) {
          DIMS.getInstance().setCurrentObjectID(Integer.parseInt(now.getName()));
          ShowServiceInGroup shower = new ShowServiceInGroup();
          DIMS.getInstance().getDetailContent().reloadContent(shower);
        }
      }
    } catch (Exception e1) {
      new FrameNotification(
          "Maybe something went wrong when you were trying to open a service<br>"
              + e1.getMessage());
    }
  }
 private static JLabel createArrow(final ActionLink link) {
   JLabel arrow = new JLabel(AllIcons.General.Combo3);
   arrow.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
   arrow.setVerticalAlignment(SwingConstants.BOTTOM);
   new ClickListener() {
     @Override
     public boolean onClick(@NotNull MouseEvent e, int clickCount) {
       final MouseEvent newEvent = MouseEventAdapter.convert(e, link, e.getX(), e.getY());
       link.doClick(newEvent);
       return true;
     }
   }.installOn(arrow);
   return arrow;
 }
    /**
     * Tries to obtain the image. If an IOException is thrown, we'll assume that no image exists. If
     * everything goes fine, we make the label of that player look like a link and register the
     * ChessclubBoardPanel as a mouse listener.
     */
    public void run() {
      try {
        String playerName = player.isWhite() ? getGame().getWhiteName() : getGame().getBlackName();
        URL url = new URL("http://www.chessclub.com/mugshots/" + playerName + ".jpg");
        InputStream in = url.openStream();
        in.close();

        // openStream() didn't throw an exception, so we'll assume it's ok.
        JLabel label = player.isWhite() ? whiteLabel : blackLabel;
        label.setForeground(Color.blue);
        label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        label.addMouseListener(ChessclubBoardPanel.this);
      } catch (IOException e) {
      }
    }
  /** Initializes the components of the editor panel. */
  private void initialize() {

    titleLabel.setText(getDataConstructor().getAdaptedName(namingPolicy));
    titleLabel.setFont(getFont().deriveFont(Font.BOLD));
    titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 10));
    titleLabel.setForeground(NORMAL_FOREGROUND_COLOR);
    titleLabel.setCursor(Cursor.getDefaultCursor());
    add(titleLabel);

    Dimension prefSize = titleLabel.getPreferredSize();
    titleLabel.setPreferredSize(new Dimension(prefSize.width, ValueEntryPanel.PANEL_HEIGHT));

    List<ValueNode> childValueNodes = valueNode.getChildrenList();
    int size = childValueNodes.size();

    // Add an argument editor panel for each argument.
    editorPanels = new ArgumentEditorPanel[size];

    for (int i = 0; i < size; i++) {

      ValueNode childValueNode = childValueNodes.get(i);

      ValueEntryPanel vep = new ValueEntryPanel(parentEditor.valueEditorHierarchyManager);

      vep.setContext(getValueEntryPanelContext(i));
      vep.setParentValueEditor(parentEditor);
      vep.setOwnerValueNode(childValueNode);

      editorPanels[i] = new ArgumentEditorPanel(vep);

      add(Box.createHorizontalStrut(5));
      add(editorPanels[i]);
    }

    add(Box.createHorizontalGlue());

    // Focus this panel if the user clicks on a component.
    MouseAdapter focusMouseListener =
        new MouseAdapter() {
          @Override
          public void mousePressed(MouseEvent e) {
            requestFocusInWindow();
          }
        };

    addMouseListener(focusMouseListener);
    titleLabel.addMouseListener(focusMouseListener);
  }
Esempio n. 11
0
  private void addThanks() {
    int padding = 5;
    int lineHeight = 20;
    int lineDistance = 4;
    int x;
    int y = padding;
    for (int i = 0; i < THANKS.length; i++) {
      final Thanks thanks = THANKS[i];
      x = padding;
      ImageIcon icon = FileAssets.getImageIcon(thanks.getIconFilePath(), lineHeight, lineHeight);
      JLabel lblIcon = new JLabel(icon);
      lblIcon.setLocation(x, y);
      lblIcon.setSize(lineHeight, lineHeight);
      panThanksList.add(lblIcon);
      x += 30;
      JLabel lblReceiver = new JLabel(thanks.getReceiver());
      lblReceiver.setLocation(x, y);
      lblReceiver.setSize(130, lineHeight);
      lblReceiver.setForeground(Color.WHITE);
      panThanksList.add(lblReceiver);
      x += 135;
      JLabel lblDescription = new JLabel(thanks.getDescription());
      lblDescription.setLocation(x, y);
      lblDescription.setSize(240, lineHeight);
      lblDescription.setForeground(Color.WHITE);
      panThanksList.add(lblDescription);
      x += 245;
      if (thanks.hasURL()) {
        JLabel lblURL = new JLabel("<html><u>" + thanks.getURL() + "</u></html>");
        lblURL.setLocation(x, y);
        lblURL.setSize(300, lineHeight);
        lblURL.setForeground(Color.WHITE);
        lblURL.setCursor(new Cursor(Cursor.HAND_CURSOR));
        lblURL.addMouseListener(
            new MouseAdapter() {

              @Override
              public void mouseClicked(MouseEvent evt) {
                super.mouseClicked(evt);
                Util.browseURL(thanks.getURL());
              }
            });
        panThanksList.add(lblURL);
      }
      y += lineHeight + lineDistance;
    }
    panThanksList.setPreferredSize(new Dimension(573, y));
  }
  /** Show an 'About' dialog */
  public void showAbout(final Component parent) {

    JPanel p = new JPanel(new GridBagLayout());
    p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    GridBagConstraints gBC = new GridBagConstraints();
    gBC.anchor = GridBagConstraints.CENTER;
    gBC.fill = GridBagConstraints.HORIZONTAL;
    gBC.insets = new Insets(1, 1, 1, 1);

    JLabel a = new JLabel(getApplicationName());
    a.setFont(a.getFont().deriveFont(24f));
    UIUtil.jGridBagAdd(p, a, gBC, GridBagConstraints.REMAINDER);

    MultilineLabel v = new MultilineLabel(getApplicationName() + " " + getApplicationVersion());
    v.setFont(v.getFont().deriveFont(10f));
    UIUtil.jGridBagAdd(p, v, gBC, GridBagConstraints.REMAINDER);

    MultilineLabel x = new MultilineLabel(getAboutAuthors());
    x.setBorder(BorderFactory.createEmptyBorder(8, 0, 8, 0));
    x.setFont(x.getFont().deriveFont(12f));
    UIUtil.jGridBagAdd(p, x, gBC, GridBagConstraints.REMAINDER);

    MultilineLabel c = new MultilineLabel(getAboutLicenseDetails());
    c.setFont(c.getFont().deriveFont(10f));
    UIUtil.jGridBagAdd(p, c, gBC, GridBagConstraints.REMAINDER);

    final JLabel h = new JLabel(getAboutURL());
    h.setForeground(Color.blue);
    h.setFont(new Font(h.getFont().getName(), Font.BOLD, 10));
    h.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    h.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent evt) {
            try {
              BrowserLauncher.openURL(getAboutURL());
            } catch (IOException ioe) {
              ioe.printStackTrace();
            }
          }
        });
    UIUtil.jGridBagAdd(p, h, gBC, GridBagConstraints.REMAINDER);

    JOptionPane.showMessageDialog(
        parent, p, "About", JOptionPane.PLAIN_MESSAGE, getApplicationLargeIcon());
  }
  @Override
  public JComponent layoutDialogContent() {
    final JPanel panel = new JPanel(new MigLayout("ins 5,wrap 1", "[fill,grow]"));

    ImageIcon imageIcon = null;

    if (this.imagefile != null && this.imagefile.exists()) {
      imageIcon = new ImageIcon(this.imagefile.getAbsolutePath());
    } else {
      imageIcon = NewTheme.I().getIcon("ocr", 0);
    }

    final int size =
        SubConfiguration.getConfig("JAC").getIntegerProperty(Configuration.PARAM_CAPTCHA_SIZE, 100);
    if (size != 100) {
      imageIcon =
          new ImageIcon(
              imageIcon
                  .getImage()
                  .getScaledInstance(
                      (int) (imageIcon.getIconWidth() * size / 100.0f),
                      (int) (imageIcon.getIconHeight() * size / 100.0f),
                      Image.SCALE_SMOOTH));
    }

    final JLabel captcha = new JLabel(imageIcon);
    captcha.addMouseListener(this);
    captcha.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
    captcha.setToolTipText(this.explain);

    if (this.explain != null) {
      final JTextPane tf = new JTextPane();
      tf.setBorder(null);
      tf.setBackground(null);
      tf.setContentType("text/html");
      tf.setOpaque(false);
      tf.putClientProperty("Synthetica.opaque", Boolean.FALSE);
      tf.setText(this.explain);
      tf.setEditable(false);
      panel.add(tf, "");
    }
    panel.add(captcha, "w pref!, h pref!, alignx center");

    return panel;
  }
Esempio n. 14
0
  /** Creates a new instance of FlaecheRenderer. */
  public FlaecheRenderer() {
    super();
    iconContainer.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    iconContainer.setVerticalAlignment(javax.swing.SwingConstants.TOP);
    iconContainer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
    this.setLayout(new java.awt.BorderLayout());
    this.add(iconContainer, java.awt.BorderLayout.EAST);
    iconContainer.setVisible(true);
    iconContainer.addMouseListener(
        new java.awt.event.MouseAdapter() {

          @Override
          public void mouseClicked(final java.awt.event.MouseEvent evt) {
            iconContainerMouseClicked(evt);
          }
        });
    setHorizontalAlignment(SwingConstants.CENTER);
  }
Esempio n. 15
0
    public MoreItem() {
      setBorder(new ResultItemBorder(Color.decode("#f7f7f7")));
      setBackground(Color.decode("#fafafa"));
      Font font = getFont().deriveFont(10f);

      setLayout(new FormLayout("41px, p, 5px", "2px, p, 2px"));
      CellConstraints cc = new CellConstraints();

      lbMore = new JLabel();
      lbMore.setFont(font);
      lbMore.setForeground(Color.decode("#567fca"));
      lbMore.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      add(lbMore, cc.xy(2, 2));

      setCount(0);

      enableEvents(AWTEvent.MOUSE_EVENT_MASK);
    }
  /**
   * Creates a new instance of Validator.
   *
   * @param comp DOCUMENT ME!
   */
  public Validator(final javax.swing.JComponent comp) {
    this.comp = comp;
    // comp.setBackground(Color.red);
    iconContainer.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    iconContainer.setVerticalAlignment(javax.swing.SwingConstants.TOP);
    iconContainer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
    // iconContainer.setText("LALAL");
    comp.setLayout(new java.awt.BorderLayout());
    comp.add(iconContainer, java.awt.BorderLayout.EAST);
    iconContainer.setVisible(true);
    iconContainer.addMouseListener(
        new java.awt.event.MouseAdapter() {

          @Override
          public void mouseClicked(final java.awt.event.MouseEvent evt) {
            iconContainerMouseClicked(evt);
          }
        });
  }
Esempio n. 17
0
  public void Resetday(int weekLog, int yearLog, int monthLog) {
    // 存储月份的天数
    int monthDayScore;
    int count = 1;
    monthDayScore = 0;

    now = Calendar.getInstance();
    int day = now.get(Calendar.DATE);
    // EmailLogger.info("day: " + day);
    now.set(yearLog + 1900, monthLog, 1);

    // 得到一个月中最后一天
    monthDayScore = now.getActualMaximum(Calendar.DAY_OF_MONTH);
    // 当前天数所在月份的第几天

    // 初始化标签(除去前七个标签的下标值)
    for (int i = 0; i < weekLog; i++) {
      dayJL[i + 7].setText("");
    }
    //
    monthDayScore = monthDayScore + weekLog;
    //
    for (int i = weekLog; i < monthDayScore; i++) {
      // 加上前七个标签的下标值
      dayJL[i + 6].setText("" + count);
      count++;
    }
    //
    for (int i = monthDayScore + 6; i < dayNum; i++) {
      // 加上前七个标签的下标值
      dayJL[i].setText("");
    }

    if (isFirst == false) {
      isFirst = true;
      lastJL = dayJL[day + 6 + weekLog - 1];
      lastJL.setForeground(Color.green);
      lastJL.setFont(lastJL.getFont().deriveFont(Font.BOLD));
      lastJL.setCursor(new Cursor(Cursor.HAND_CURSOR));
      // get day
      mDay = day;
    }
  }
  public OperatorPropertyPanel(final MainFrame mainFrame) {
    super();
    this.mainFrame = mainFrame;
    breakpointButton = new BreakpointButton();
    headerLabel.setHorizontalAlignment(SwingConstants.CENTER);
    expertModeHintLabel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    expertModeHintLabel.setIcon(WARNING_ICON);
    expertModeHintLabel.addMouseListener(
        new MouseListener() {
          public void mouseReleased(MouseEvent e) {
            mainFrame.TOGGLE_EXPERT_MODE_ACTION.actionPerformed(null);
          }

          public void mouseClicked(MouseEvent e) {}

          public void mouseEntered(MouseEvent e) {}

          public void mouseExited(MouseEvent e) {}

          public void mousePressed(MouseEvent e) {}
        });
    expertModeHintLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
    expertModeHintLabel.setHorizontalAlignment(SwingConstants.LEFT);
    setupComponents();

    compatibilityLevelSpinner.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            // compatibility level
            OperatorVersion[] versionChanges = operator.getIncompatibleVersionChanges();
            if (versionChanges.length != 0) {
              OperatorVersion latestChange = versionChanges[versionChanges.length - 1];
              if (latestChange.isAtLeast(operator.getCompatibilityLevel())) {
                compatibilityLabel.setIcon(WARNING_ICON);
              } else {
                compatibilityLabel.setIcon(SwingTools.createIcon("16/ok.png"));
              }
            }
          }
        });
  }
Esempio n. 19
0
  public WalletSumPanel(BigInteger balance) {

    this.setBackground(Color.WHITE);
    double width = this.getSize().getWidth();
    this.setPreferredSize(new Dimension(500, 50));
    Border line = BorderFactory.createLineBorder(Color.LIGHT_GRAY);
    Border empty = new EmptyBorder(5, 8, 5, 8);
    CompoundBorder border = new CompoundBorder(line, empty);

    JLabel addressField = new JLabel();
    addressField.setPreferredSize(new Dimension(300, 35));
    this.add(addressField);

    JTextField amount = new JTextField();
    amount.setBorder(border);
    amount.setEnabled(true);
    amount.setEditable(false);
    amount.setText(Utils.getValueShortString(balance));

    amount.setPreferredSize(new Dimension(100, 35));
    amount.setForeground(new Color(143, 170, 220));
    amount.setHorizontalAlignment(SwingConstants.RIGHT);
    amount.setFont(new Font("Monospaced", 0, 13));
    amount.setBackground(Color.WHITE);
    this.add(amount);

    URL payoutIconURL = ClassLoader.getSystemResource("buttons/wallet-pay.png");
    ImageIcon payOutIcon = new ImageIcon(payoutIconURL);
    JLabel payOutLabel = new JLabel(payOutIcon);
    payOutLabel.setToolTipText("Payout for all address list");
    payOutLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
    payOutLabel.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            JOptionPane.showMessageDialog(null, "Under construction");
          }
        });

    this.add(payOutLabel);
  }
Esempio n. 20
0
  private JLabel makeLabelIcon() {
    ImageIcon i = new ImageIcon(getClass().getResource("duke.gif"));
    Dimension d = new Dimension(i.getIconWidth(), i.getIconHeight());
    final BufferedImage image = new BufferedImage(d.width, d.height, BufferedImage.TYPE_INT_ARGB);
    Graphics g = image.createGraphics();
    i.paintIcon(null, g, 0, 0);
    g.dispose();
    final JLabel icon =
        new JLabel(i) {
          @Override
          public boolean contains(int x, int y) {
            return super.contains(x, y) && ((image.getRGB(x, y) >> 24) & 0xff) != 0;
          }
        };
    icon.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
    MouseAdapter l =
        new MouseAdapter() {
          private final transient Point start = new Point();
          private Point loc;

          @Override
          public void mousePressed(MouseEvent me) {
            start.setLocation(me.getPoint());
          }

          @Override
          public void mouseDragged(MouseEvent me) {
            loc = icon.getLocation(loc);
            int x = loc.x - start.x + me.getX();
            int y = loc.y - start.y + me.getY();
            icon.setLocation(x, y);
          }
        };
    icon.addMouseListener(l);
    icon.addMouseMotionListener(l);
    icon.setBounds(new Rectangle(22, 22, d.width, d.height));
    return icon;
  }
Esempio n. 21
0
  /**
   * Creates the subscribe label.
   *
   * @param linkName the link name
   * @return the newly created subscribe label
   */
  private Component createWebSignupLabel(String linkName, final String linkURL) {
    JLabel subscribeLabel =
        new JLabel("<html><a href=''>" + linkName + "</a></html>", JLabel.RIGHT);

    subscribeLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
    subscribeLabel.setToolTipText(
        DesktopUtilActivator.getResources()
            .getI18NString("plugin.simpleaccregwizz.SPECIAL_SIGNUP"));
    subscribeLabel.addMouseListener(
        new MouseAdapter() {
          public void mousePressed(MouseEvent e) {
            try {
              DesktopUtilActivator.getBrowserLauncher().openURL(linkURL);
            } catch (UnsupportedOperationException ex) {
              // This should not happen, because we check if the
              // operation is supported, before adding the sign
              // up.
              logger.error("The web sign up is not supported.", ex);
            }
          }
        });
    return subscribeLabel;
  }
Esempio n. 22
0
    public SearchKeywordRow addKeyword(
        String displayText, final String insertText, String description, String... examples) {
      JLabel label =
          new JLabel(
              "<html>"
                  + "<style>td{border:1px solid gray; font-weight:normal;}</style>"
                  + "<table><tr><td>"
                  + displayText
                  + "</td></tr></table></html>");
      add(label);
      if (description != null || examples.length > 0) {
        label.setToolTipText(
            "<html>"
                + description
                + (examples.length > 0
                    ? Utils.joinAsHtmlUnorderedList(Arrays.asList(examples))
                    : "")
                + "</html>");
      }
      if (insertText != null) {
        label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        label.addMouseListener(
            new MouseAdapter() {

              @Override
              public void mouseClicked(MouseEvent e) {
                try {
                  JTextComponent tf = hcb.getEditorComponent();
                  tf.getDocument().insertString(tf.getCaretPosition(), ' ' + insertText, null);
                } catch (BadLocationException ex) {
                  throw new JosmRuntimeException(ex.getMessage(), ex);
                }
              }
            });
      }
      return this;
    }
    public ArgumentEditorPanel(ValueEntryPanel valueEntryPanel) {

      if (valueEntryPanel == null) {
        throw new NullPointerException();
      }

      this.valueEntryPanel = valueEntryPanel;

      setLayout(new BorderLayout());
      setCursor(Cursor.getDefaultCursor());
      setOpaque(true);

      // Initially we are in the focused look and the VEP is shown.
      add(valueEntryPanel);

      // Setup the placeholder label.
      placeHolderLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
      placeHolderLabel.setHorizontalAlignment(SwingConstants.CENTER);
      placeHolderLabel.setFont(TYPE_LABEL_FONT);
      placeHolderLabel.setForeground(Color.DARK_GRAY);
      placeHolderLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
      placeHolderLabel.setCursor(Cursor.getDefaultCursor());

      // Activate the value entry panel this label is for is the user clicks on it.
      placeHolderLabel.addMouseListener(
          new MouseAdapter() {
            @Override
            public void mousePressed(MouseEvent e) {
              valueEntryPanelToFocus = ArgumentEditorPanel.this.valueEntryPanel;
              requestFocusInWindow();
            }
          });

      // Finally make sure we only grow as big as the VEP needs to be.
      setPreferredSize(valueEntryPanel.getPreferredSize());
      setMaximumSize(getPreferredSize());
    }
 // renders buffered image from webcam
 private static void webcamRender() {
   renderWebcam = new JLabel();
   if (webcam = true) {
     while (webcam = true) {
       try {
         Thread.sleep(20);
         BufferedImage webcamImage = (frame.frame().getBufferedImage());
         if (webcamImage != null) {
           renderWebcam.setIcon(new ImageIcon(webcamImage));
           renderWebcam.setBounds(
               Frame.grabber.getImageWidth(),
               10,
               Frame.grabber.getImageWidth(),
               Frame.grabber.getImageHeight());
           renderWebcam.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 3));
           renderWebcam.setToolTipText("Live webcam feed");
           renderWebcam.setMaximumSize(new Dimension(1056, 704));
           renderWebcam.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
           canon = false;
           nikon = false;
           window.add(renderWebcam);
           webcamImage.flush();
         }
       } catch (InterruptedException ex) {
         Logger.getLogger(Controls.class.getName()).log(Level.SEVERE, null, ex);
       }
     }
   } else {
     webcam = false;
     try {
       frame.grabber.stop();
     } catch (FrameGrabber.Exception ex) {
       Logger.getLogger(Controls.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
 }
  public SearchPatient(final String type, final int docID) {

    try {
      // "Load" the JDBC driver
      Class.forName("java.sql.Driver");

      // Establish the connection to the database
      String url = "jdbc:mysql://localhost:3306/cse";
      conn = DriverManager.getConnection(url, "root", "admin");
    } catch (Exception e) {
      System.err.println("Got an exception!");
      System.err.println(e.getMessage());
    }

    // Menu
    // MENU ACTIONS

    // Action to view new patient registered
    class NewPatientAction extends AbstractAction {
      private static final long serialVersionUID = 1L;

      public NewPatientAction() {
        putValue(SHORT_DESCRIPTION, "View list of new patients");
      }

      public void actionPerformed(ActionEvent e) {
        ViewRegisteredPatients vp = new ViewRegisteredPatients("new");
        vp.setVisible(true);
        ViewRegisteredPatients.hasNew = false;
      }
    }
    Action newPatientAction = new NewPatientAction();

    // Action to view all patient registered
    class AllPatientAction extends AbstractAction {
      private static final long serialVersionUID = 1L;

      public AllPatientAction() {
        putValue(SHORT_DESCRIPTION, "View list of all patients");
      }

      public void actionPerformed(ActionEvent e) {
        ViewRegisteredPatients vp = new ViewRegisteredPatients("all");
        vp.setVisible(true);
      }
    }
    Action allPatientAction = new AllPatientAction();

    // Action to open Statistical Report
    class StatsReportAction implements MenuListener {
      public void menuSelected(MenuEvent e) {
        StatsReport report = new StatsReport();
        setAlwaysOnTop(false);
        report.setVisible(true);
        report.setAlwaysOnTop(true);
      }

      public void menuDeselected(MenuEvent e) {}

      public void menuCanceled(MenuEvent e) {}
    }

    // Action to open Statistical Report
    class ProfileAction implements MenuListener {
      public void menuSelected(MenuEvent e) {
        Profile profilePage = new Profile("staff", docID, type);
        profilePage.setVisible(true);
        dispose();
      }

      public void menuDeselected(MenuEvent e) {}

      public void menuCanceled(MenuEvent e) {}
    }

    // MENU COMPONENTS
    menu = new JMenuBar();

    menuOp1 = new JMenu();
    menuOp2 = new JMenu();
    menuOp3 = new JMenu();
    menuOp4 = new JMenu();
    menuOp5 = new JMenu();

    menuOp1.setText("Profile");
    menuOp1.addMenuListener(new ProfileAction());

    optionsFrame = new JFrame("Options");

    optionsContainer = new JPanel();
    optionsContainer.setLayout(new BoxLayout(optionsContainer, BoxLayout.Y_AXIS));
    optionsContainer.add(Box.createRigidArea(new Dimension(20, 5)));

    if (type.equals("Doctor")) // if a doctor is logging in
    {
      menuOp2.setText("Patients");
      menuOp3.setText("Appointments Request");
      menuOp4.setText("View Medical Alerts");

      menuItem1 = new JMenuItem("Search Patient");

      menuOp2.add(menuItem1);

      menu.add(menuOp1);
      menu.add(menuOp2);
      menu.add(menuOp3);
      menu.add(menuOp4);

      // optionsFrame
      optionUpdateHCC = new JLabel("Update Healthcare Condition");
      optionUpdateHCC.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      optionUpdateHCC.addMouseListener(new MouseUpdateHCCListener());

      optionPrescription = new JLabel("e-Prescription");
      optionPrescription.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      // optionPrescription.addMouseListener(new MousePrescriptionListener());

      optionLabRecord = new JLabel("View Lab Records");
      optionLabRecord.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      optionLabRecord.addMouseListener(new MouseLabRecordListener());

      optionUpdateHCR = new JLabel("Update Healthcare Records");
      optionUpdateHCR.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      optionUpdateHCR.addMouseListener(new MouseUpdateHCRListener());

      // add option to container
      optionsContainer.add(optionUpdateHCC);
      optionsContainer.add(Box.createRigidArea(new Dimension(20, 5)));
      optionsContainer.add(optionPrescription);
      optionsContainer.add(Box.createRigidArea(new Dimension(20, 5)));
      optionsContainer.add(optionLabRecord);
      optionsContainer.add(Box.createRigidArea(new Dimension(20, 5)));
      optionsContainer.add(optionLabRecord);
      optionsContainer.add(Box.createRigidArea(new Dimension(20, 5)));
      optionsContainer.add(optionUpdateHCR);
    } else if (type.equals("HSP")) // if the HSP is logging in
    {
      menuOp2.setText("Patients");
      menuOp3.setText("Appointment Request");
      menuOp4.setText("View Medical Alerts");
      menuOp5.setText("Generate Statistical Report");
      menuOp5.addMenuListener(new StatsReportAction());

      menuItem1 = new JMenuItem("Search Patient");
      menuOp6 = new JMenu("List of Registered Patient");
      menuOp6.setMnemonic(KeyEvent.VK_S);

      menuItem2 = new JMenuItem(newPatientAction);
      menuItem2.setText("List of New Registered Patient");
      menuItem3 = new JMenuItem(allPatientAction);
      menuItem3.setText("List of All Registered Patient");

      menuOp2.add(menuItem1);
      menuOp2.add(menuOp6);
      menuOp6.add(menuItem2);
      menuOp6.add(menuItem3);

      menu.add(menuOp1);
      menu.add(menuOp2);
      menu.add(menuOp3);
      menu.add(menuOp4);
      menu.add(menuOp5);

      // optionsFrame
      optionUpdateHCC = new JLabel("Update Healthcare Condition");
      optionUpdateHCC.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      optionUpdateHCC.addMouseListener(new MouseUpdateHCCListener());

      optionLabRecord = new JLabel("View Lab Records");
      optionLabRecord.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      optionLabRecord.addMouseListener(new MouseLabRecordListener());

      optionHCR = new JLabel("Upload Healthcare Records");
      optionHCR.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      optionHCR.addMouseListener(new MouseUploadHCRListener());

      optionUpdateHCR = new JLabel("Update Healthcare Records");
      optionUpdateHCR.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      optionUpdateHCR.addMouseListener(new MouseUpdateHCRListener());

      // add option to container
      optionsContainer.add(optionUpdateHCC);
      optionsContainer.add(Box.createRigidArea(new Dimension(20, 5)));
      optionsContainer.add(optionLabRecord);
      optionsContainer.add(Box.createRigidArea(new Dimension(20, 5)));
      optionsContainer.add(optionLabRecord);
      optionsContainer.add(Box.createRigidArea(new Dimension(20, 5)));
      optionsContainer.add(optionHCR);
      optionsContainer.add(Box.createRigidArea(new Dimension(20, 5)));
      optionsContainer.add(optionUpdateHCR);
    } else if (type.equals("Pharmacist")) // if the Pharmacist is logging in
    {
      menuOp2.setText("Patients");

      menuItem1 = new JMenuItem("Search Patients");

      menuOp2.add(menuItem1);

      menu.add(menuOp1);
      menu.add(menuOp2);

      // optionsFrame
      optionViewPrescription = new JLabel("View e-Prescription");
      optionViewPrescription.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      optionViewPrescription.addMouseListener(new MouseViewPrescriptionListener());

      // add option to container
      optionsContainer.add(optionViewPrescription);

    } else if (type.equals("Nurse")) // if the nurse is logging in
    {
      menuOp2.setText("Patients");

      menuItem1 = new JMenuItem("Search Patients");

      menuOp2.add(menuItem1);

      menu.add(menuOp1);
      menu.add(menuOp2);

      // optionsFrame
      optionUpdateHCR = new JLabel("Update Healthcare Records");
      optionUpdateHCR.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      optionUpdateHCR.addMouseListener(new MouseUpdateHCRListener());

      // add option to container
      optionsContainer.add(optionUpdateHCR);
    }

    // Labels
    firstNameLabel = new JLabel(" First name:"); // first name label
    lastNameLabel = new JLabel("Last name:"); // last name label
    patientListLabel = new JLabel("Patient List:"); // patient list label

    // Text Fields
    firstNameField = new JTextField(10); // first name text field
    lastNameField = new JTextField(10); // last name text field

    // Buttons
    searchButton = new JButton("Search"); // search button
    searchButton.addActionListener(new SearchButtonListener()); // add listener

    selectButton = new JButton("Select");
    selectButton.addActionListener(new SelectButtonListener()); // add listener

    cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(new CancelButtonListener()); // add listener

    // JPanels
    firstNamePanel = new JPanel(); // First name panel
    firstNamePanel.add(firstNameLabel);
    firstNamePanel.add(firstNameField);

    lastNamePanel = new JPanel(); // Last name panel
    lastNamePanel.add(lastNameLabel);
    lastNamePanel.add(lastNameField);

    patientInfoPanel = new JPanel();
    patientInfoPanel.setLayout(new BoxLayout(patientInfoPanel, BoxLayout.X_AXIS));
    patientInfoPanel.add(firstNamePanel);
    patientInfoPanel.add(lastNamePanel);
    patientInfoPanel.add(searchButton);

    buttonPanel = new JPanel(); // button panel
    buttonPanel.add(selectButton);
    buttonPanel.add(cancelButton);

    // Patient List
    patientVector = new Vector(); // Vector of Patient objects
    patientList =
        new JList(patientVector); // creates a JList that show the content of the recordVector

    scrollPatientList = new JScrollPane(patientList); // add scroll option to the list
    patientList.setSelectionMode(
        ListSelectionModel.SINGLE_SELECTION); // Allow the selection of only one item at a time

    String[] patients = new String[1000000];

    // Populates the patient list with the patients from the database
    if (type.equals("Doctor")) {
      int i = 0;
      try {
        // checks if the patient is a patient of the doctor logged
        statement = conn.createStatement();
        rs =
            statement.executeQuery(
                "SELECT * FROM appointments WHERE `docID`='" + docID + "' ORDER BY `patientID`");

        while (rs.next()) {
          int patientID = rs.getInt("patientID");
          patients[i] = String.valueOf(patientID);

          i++;
        }

        String[] patientSet =
            (String[]) new HashSet(Arrays.asList(patients)).toArray(new String[0]);

        // gets information from the specific set of patients
        for (int j = 0; j < patientSet.length; j++) {
          statement = conn.createStatement();
          rs =
              statement.executeQuery(
                  "SELECT * FROM patient WHERE `idpatient`='" + patientSet[j] + "';");

          while (rs.next()) {
            Patient obj = new Patient();
            obj.setFirstName(rs.getString("fname"));
            obj.setLastName(rs.getString("lname"));
            obj.setDOB(rs.getString("dob"));
            obj.setPatientId(Integer.parseInt(patientSet[j]));

            patientVector.add(obj);
          }
        }

      } catch (Exception e) {
        System.err.println("Got an exception! ");
        System.err.println(e.getMessage());
        System.err.println(e);
      }
    } else {
      try {
        statement = conn.createStatement();
        rs = statement.executeQuery("SELECT * FROM patient ORDER BY fname");

        while (rs.next()) {
          Patient obj = new Patient();
          obj.setFirstName(rs.getString("fname"));
          obj.setLastName(rs.getString("lname"));
          obj.setDOB(rs.getString("dob"));
          obj.setPatientId(rs.getInt("idpatient"));

          patientVector.add(obj);
        }
      } catch (Exception e) {
        System.err.println("Got an exception! ");
        System.err.println(e.getMessage());
      }
    }

    searchVector = new Vector();

    // set options frame
    optionsFrame.add(optionsContainer);
    optionsFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // close the window on close
    optionsFrame.setSize(300, 150); // set size of window
    optionsFrame.setLocation(600, 280);
    optionsFrame.setVisible(false);

    searchPanel = new JPanel();
    searchPanel.setLayout(new BoxLayout(searchPanel, BoxLayout.Y_AXIS));
    searchPanel.add(patientInfoPanel);
    searchPanel.add(patientListLabel);
    searchPanel.add(scrollPatientList);
    searchPanel.add(buttonPanel);

    Border padding = BorderFactory.createEmptyBorder(20, 20, 10, 10);
    searchPanel.setBorder(padding);

    setJMenuBar(menu);
    add(searchPanel);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(1200, 580);
  }
Esempio n. 26
0
  public EntropyUtilPanel() {
    super();
    setBackground(new Color(208, 228, 254));
    final String url = "http://arxiv.org/ftp/arxiv/papers/1305/1305.0954.pdf";
    JLabel lblFindEntropyOf =
        new JLabel(
            "<html>Compute the binary entropy of the text using <a href='"
                + url
                + "'>Croll's method</a></html>");
    lblFindEntropyOf.setCursor(new Cursor(Cursor.HAND_CURSOR));
    lblFindEntropyOf.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            try {
              Desktop.getDesktop().browse(new URI(url));
            } catch (URISyntaxException | IOException ex) {
              // It looks like there's a problem
            }
          }
        });

    textArea = new JTextArea();
    textArea.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyReleased(KeyEvent e) {
            checkEntropy();
          }
        });

    lblEntropy = new JLabel("...");

    GroupLayout groupLayout = new GroupLayout(this);
    groupLayout.setHorizontalGroup(
        groupLayout
            .createParallelGroup(Alignment.TRAILING)
            .addGroup(
                Alignment.LEADING,
                groupLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        groupLayout
                            .createParallelGroup(Alignment.LEADING)
                            .addComponent(textArea, GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE)
                            .addComponent(
                                lblFindEntropyOf,
                                GroupLayout.PREFERRED_SIZE,
                                392,
                                GroupLayout.PREFERRED_SIZE)
                            .addGroup(
                                groupLayout
                                    .createSequentialGroup()
                                    .addGap(40)
                                    .addComponent(lblEntropy)))
                    .addContainerGap()));
    groupLayout.setVerticalGroup(
        groupLayout
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                groupLayout
                    .createSequentialGroup()
                    .addGap(21)
                    .addComponent(
                        lblFindEntropyOf,
                        GroupLayout.PREFERRED_SIZE,
                        26,
                        GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(
                        textArea, GroupLayout.PREFERRED_SIZE, 164, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addComponent(lblEntropy)
                    .addContainerGap(58, Short.MAX_VALUE)));
    setLayout(groupLayout);
  }
Esempio n. 27
0
  private JComponent createTitleInfo() {

    JPanel content = new JPanel(new BorderLayout());
    content.setBackground(new java.awt.Color(255, 255, 255));

    JLabel executeInfo = new JLabel();

    executeInfo.setFont(new java.awt.Font("宋体", 0, 10));
    executeInfo.setForeground(new java.awt.Color(204, 204, 204));
    executeInfo.setText(
        BundleUtil.getString(BundleUtil.Analysis_Time)
            + ":"
            + this.result.getRunningContext().getAnalyseDate()
            + " V"
            + VersionUtil.getVersion()
            + " BuildDate:"
            + VersionUtil.getBuildDate()
            + " Group:"
            + this.result.getRunningContext().getGroup()
            + " Command:"
            + this.result.getRunningContext().getCommand());

    content.add(BorderLayout.WEST, executeInfo);

    JPanel buttons = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0));
    buttons.setBackground(new java.awt.Color(255, 255, 255));

    JLabel addResultButton = new JLabel();
    addResultButton.setIcon(new ImageIcon(JDependUIUtil.getImage("cart/add.png")));
    addResultButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    addResultButton.setToolTipText("将当前结果加入到购物车");
    addResultButton.addMouseListener(
        new java.awt.event.MouseAdapter() {
          @Override
          public void mouseClicked(java.awt.event.MouseEvent evt) {
            try {
              ShoppingCart.getInstance().addProduct(result);
              frame.getStatusField().refresh();
            } catch (JDependException e) {
              JOptionPane.showMessageDialog(
                  ScorePanel.this, e.getMessage(), "alert", JOptionPane.ERROR_MESSAGE);
            }
          }
        });

    buttons.add(addResultButton);

    JLabel exportResultButton = new JLabel();
    exportResultButton.setIcon(new ImageIcon(JDependUIUtil.getImage("export.png")));
    exportResultButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    exportResultButton.setToolTipText("将当前结果导出");
    exportResultButton.addMouseListener(
        new java.awt.event.MouseAdapter() {
          @Override
          public void mouseClicked(java.awt.event.MouseEvent evt) {
            try {
              AnalysisResultExportUtil.exportResult(frame, result);
            } catch (Exception e) {
              e.printStackTrace();
              JOptionPane.showMessageDialog(frame, "导出失败!", "alert", JOptionPane.ERROR_MESSAGE);
            }
          }
        });

    buttons.add(exportResultButton);

    content.add(BorderLayout.EAST, buttons);

    return content;
  }
Esempio n. 28
0
  public void init() {

    try {

      UIManager.setLookAndFeel("com.jtattoo.plaf.mint.MintLookAndFeel");
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setTitle("EasyLoands - Login");
    getContentPane().setLayout(null);
    setSize(1275, 759);

    getContentPane().add(new PanelClientes());

    JLabel lblNewLabel = new JLabel("");
    lblNewLabel.setIcon(
        new ImageIcon(Principal.class.getResource("/com/easyloands/imagenes/Logo peq.png")));
    lblNewLabel.setBounds(20, 11, 154, 85);
    getContentPane().add(lblNewLabel);

    JSeparator separator = new JSeparator();
    separator.setBounds(20, 108, 1233, 9);
    getContentPane().add(separator);

    JScrollPane sc = new JScrollPane();
    getContentPane().add(sc);

    PanelUsuarios panel_Usuarios = new PanelUsuarios();
    panel_Usuarios.setBounds(290, 120, 930, 600);
    // getContentPane().add(panel_Usuarios);

    JLabel lblAyuda = new JLabel("Ayuda");
    lblAyuda.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    lblAyuda.setForeground(SystemColor.activeCaptionText);
    lblAyuda.setFont(new Font("Arial", Font.BOLD, 18));
    lblAyuda.setIcon(
        new ImageIcon(
            Principal.class.getResource("/com/easyloands/imagenes/Apps-help-browser-icon.png")));
    lblAyuda.setBounds(930, 35, 108, 48);
    getContentPane().add(lblAyuda);

    JLabel lblCerrasSesim = new JLabel("Cerrar sesi\u00F3n");
    lblCerrasSesim.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    lblCerrasSesim.setIcon(
        new ImageIcon(Principal.class.getResource("/com/easyloands/imagenes/Log-Out-icon.png")));
    lblCerrasSesim.setForeground(SystemColor.activeCaptionText);
    lblCerrasSesim.setFont(new Font("Arial", Font.BOLD, 18));
    lblCerrasSesim.setBounds(1083, 35, 170, 48);
    getContentPane().add(lblCerrasSesim);

    JSeparator separator_1 = new JSeparator();
    separator_1.setOrientation(SwingConstants.VERTICAL);
    separator_1.setBounds(1061, 35, 4, 48);
    getContentPane().add(separator_1);

    JTaskPane taskPane = new JTaskPane();
    taskPane.setBounds(20, 118, 253, 603);
    getContentPane().add(taskPane);
    taskPane.setAutoscrolls(true);
    taskPane.setBackground(SystemColor.menu);

    JTaskPaneGroup Config = new JTaskPaneGroup();
    Config.setTitle("Configuraci\u00F3n y par\u00E1metros");
    Config.setBounds(30, 138, 267, 85);
    taskPane.add(Config);

    JTaskPaneGroup Clients = new JTaskPaneGroup();
    Clients.setTitle("Clientes");
    Config.setBounds(30, 138, 267, 85);
    taskPane.add(Clients);

    JLabel lblListadoDeClientes = new JLabel("Listado de clientes");
    lblListadoDeClientes.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            panelControl = new PanelClientes();
            panelControl.setVisible(false);
            lblMensaje.setText("Lista Clientes");
            panelControl.setBounds(321, 150, 932, 593);
            panelControl.setVisible(true);
            getContentPane().add(panelControl);
          }
        });
    lblListadoDeClientes.setIcon(
        new ImageIcon(
            Principal.class.getResource(
                "/com/easyloands/imagenes/Apps-preferences-contact-list-icon.png")));
    lblListadoDeClientes.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    Clients.getContentPane().add(lblListadoDeClientes);

    JLabel lblAgregarClientes = new JLabel("Agregar clientes");
    lblAgregarClientes.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            new PanelNuevoCliente();
          }
        });
    lblAgregarClientes.setIcon(
        new ImageIcon(
            Principal.class.getResource(
                "/com/easyloands/imagenes/Actions-list-add-user-icon.png")));
    lblAgregarClientes.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    Clients.getContentPane().add(lblAgregarClientes);

    JLabel Usr = new JLabel("Usuarios");
    Usr.setIcon(new ImageIcon(Principal.class.getResource("/com/easyloands/imagenes/users.png")));
    Config.getContentPane().add(Usr);

    JLabel Cbr = new JLabel("Cobradores");
    Cbr.setIcon(
        new ImageIcon(
            Principal.class.getResource("/com/easyloands/imagenes/personal-loan-icon.png")));
    Config.getContentPane().add(Cbr);

    JTaskPaneGroup Loands = new JTaskPaneGroup();
    Loands.setTitle("Pr\u00E9stamos");
    Config.setBounds(30, 138, 267, 85);

    JLabel lblUsuarios = new JLabel("Datos de la empresa");
    lblUsuarios.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    lblUsuarios.setIcon(
        new ImageIcon(Principal.class.getResource("/com/easyloands/imagenes/App-home-2-icon.png")));
    Config.getContentPane().add(lblUsuarios);

    JLabel lblNewLabel_1 = new JLabel("Inter\u00E9s por mora");
    lblNewLabel_1.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    lblNewLabel_1.setIcon(
        new ImageIcon(Principal.class.getResource("/com/easyloands/imagenes/money-icon.png")));
    Config.getContentPane().add(lblNewLabel_1);

    taskPane.add(Loands);

    JTaskPaneGroup Charges = new JTaskPaneGroup();
    Charges.setTitle("Cobros");
    Config.setTitle("Configuraci\u00F3n y par\u00E1metros");
    Config.setBounds(30, 138, 267, 85);
    taskPane.add(Charges);

    JLabel lblAplicarPago = new JLabel("Aplicar Pago");
    lblAplicarPago.setIcon(
        new ImageIcon(Principal.class.getResource("/com/easyloands/imagenes/checklist-icon.png")));
    lblAplicarPago.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    Charges.getContentPane().add(lblAplicarPago);

    JTaskPaneGroup Reports = new JTaskPaneGroup();
    Reports.setTitle("Reportes");
    Config.setTitle("Configuraci\u00F3n y par\u00E1metros");
    Config.setBounds(30, 138, 267, 85);
    taskPane.add(Reports);

    JLabel lblIngresos = new JLabel("Balance de Ingresos");
    lblIngresos.setIcon(
        new ImageIcon(
            Principal.class.getResource("/com/easyloands/imagenes/sales-report-icon.png")));
    lblIngresos.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    Reports.getContentPane().add(lblIngresos);

    JLabel lblAgregarPrestamo = new JLabel("Agregar pr\u00E9stamos");
    lblAgregarPrestamo.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {

            new PanelNuevoPrestamo().setVisible(true);
          }
        });
    lblAgregarPrestamo.setIcon(
        new ImageIcon(Principal.class.getResource("/com/easyloands/imagenes/coins-add-icon.png")));
    lblAgregarPrestamo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    Loands.getContentPane().add(lblAgregarPrestamo);
    lblMensaje.setFont(new Font("Tahoma", Font.PLAIN, 20));

    lblMensaje.setBounds(321, 116, 193, 25);
    getContentPane().add(lblMensaje);
  }
  @SuppressWarnings("serial")
  public JTableRenderer(final Object cell, final mxGraphComponent graphContainer) {
    this.cell = cell;
    this.graphContainer = graphContainer;
    this.graph = graphContainer.getGraph();
    setLayout(new BorderLayout());
    setBorder(
        BorderFactory.createCompoundBorder(
            ShadowBorder.getSharedInstance(), BorderFactory.createBevelBorder(BevelBorder.RAISED)));

    JPanel title = new JPanel();
    title.setBackground(new Color(149, 173, 239));
    title.setOpaque(true);
    title.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1));
    title.setLayout(new BorderLayout());

    JLabel icon =
        new JLabel(new ImageIcon(JTableRenderer.class.getResource(IMAGE_PATH + "preferences.gif")));
    icon.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 1));
    title.add(icon, BorderLayout.WEST);

    JLabel label = new JLabel(String.valueOf(graph.getLabel(cell)));
    label.setForeground(Color.WHITE);
    label.setFont(title.getFont().deriveFont(Font.BOLD, 11));
    label.setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 2));
    title.add(label, BorderLayout.CENTER);

    JPanel toolBar2 = new JPanel();
    toolBar2.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 2));
    toolBar2.setOpaque(false);
    JButton button =
        new JButton(
            new AbstractAction(
                "", new ImageIcon(JTableRenderer.class.getResource(IMAGE_PATH + "minimize.gif"))) {

              public void actionPerformed(ActionEvent e) {
                graph.foldCells(graph.isCellCollapsed(cell), false, new Object[] {cell});
                ((JButton) e.getSource())
                    .setIcon(
                        new ImageIcon(
                            JTableRenderer.class.getResource(
                                IMAGE_PATH
                                    + ((graph.isCellCollapsed(cell))
                                        ? "maximize.gif"
                                        : "minimize.gif"))));
              }
            });
    button.setPreferredSize(new Dimension(16, 16));
    button.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    button.setToolTipText("Collapse/Expand");
    button.setOpaque(false);
    toolBar2.add(button);

    title.add(toolBar2, BorderLayout.EAST);
    add(title, BorderLayout.NORTH);

    // CellStyle style =
    // graph.getStylesheet().getCellStyle(graph.getModel(),
    // cell);
    // if (style.getStyleClass() == null) {
    table = new MyTable();
    JScrollPane scrollPane = new JScrollPane(table);
    scrollPane.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));

    if (graph.getModel().getChildCount(cell) == 0) {
      scrollPane.getViewport().setBackground(Color.WHITE);
      setOpaque(true);
      add(scrollPane, BorderLayout.CENTER);
    }

    scrollPane
        .getVerticalScrollBar()
        .addAdjustmentListener(
            new AdjustmentListener() {

              public void adjustmentValueChanged(AdjustmentEvent e) {
                graphContainer.refresh();
              }
            });

    label = new JLabel(new ImageIcon(JTableRenderer.class.getResource(IMAGE_PATH + "resize.gif")));
    label.setCursor(new Cursor(Cursor.NW_RESIZE_CURSOR));

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(label, BorderLayout.EAST);

    add(panel, BorderLayout.SOUTH);

    ResizeHandler resizeHandler = new ResizeHandler();
    label.addMouseListener(resizeHandler);
    label.addMouseMotionListener(resizeHandler);

    setMinimumSize(new Dimension(20, 30));
  }
Esempio n. 30
0
  /** Create the frame. */
  public LaunchFrame(final int tab) {
    setFont(new Font("a_FuturaOrto", Font.PLAIN, 12));
    setResizable(false);
    setTitle("Feed the Beast Launcher v" + version);
    setIconImage(
        Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("/image/logo_ftb.png")));

    panel = new JPanel();

    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    if (OSUtils.getCurrentOS() == OS.WINDOWS) {
      setBounds(100, 100, 842, 480);
    } else {
      setBounds(100, 100, 850, 480);
    }
    panel.setBounds(0, 0, 850, 480);
    panel.setLayout(null);
    footer.setBounds(0, 380, 850, 100);
    footer.setLayout(null);
    footer.setBackground(LauncherStyle.getCurrentStyle().footerColor);
    tabbedPane.setBounds(0, 0, 850, 380);
    panel.add(tabbedPane);
    panel.add(footer);
    setContentPane(panel);

    // Footer
    // footerLogo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    // footerLogo.setBounds(20, 20, 42, 42);
    // footerLogo.addMouseListener(new MouseAdapter() {
    // @Override
    // public void mouseClicked(MouseEvent event) {
    // OSUtils.browse("http://www.feed-the-beast.com");
    // }
    // });

    footerCreeper.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    footerCreeper.setBounds(25, 20, 150, 42);
    footerCreeper.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent event) {
            OSUtils.browse("http://www.mckhaos.net");
          }
        });

    dropdown_[0] = I18N.getLocaleString("PROFILE_SELECT");
    dropdown_[1] = I18N.getLocaleString("PROFILE_CREATE");

    String[] dropdown =
        concatenateArrays(dropdown_, UserManager.getNames().toArray(new String[] {}));
    users = new JComboBox(dropdown);
    if (Settings.getSettings().getLastUser() != null) {
      for (int i = 0; i < dropdown.length; i++) {
        if (dropdown[i].equalsIgnoreCase(Settings.getSettings().getLastUser())) {
          users.setSelectedIndex(i);
        }
      }
    }

    donate = new JButton(I18N.getLocaleString("DONATE_BUTTON"));
    donate.setBounds(390, 20, 80, 30);
    donate.setEnabled(false);
    donate.setToolTipText("Coming Soon...");
    donate.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {}
        });

    users.setBounds(550, 20, 150, 30);
    users.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            if (users.getSelectedIndex() == 1) {
              ProfileAdderDialog p = new ProfileAdderDialog(getInstance(), true);
              users.setSelectedIndex(0);
              p.setVisible(true);
            }
            edit.setEnabled(users.getSelectedIndex() > 1);
          }
        });

    edit = new JButton(I18N.getLocaleString("EDIT_BUTTON"));
    edit.setBounds(480, 20, 60, 30);
    edit.setVisible(true);
    edit.setEnabled(users.getSelectedIndex() > 1);
    edit.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent event) {
            if (users.getSelectedIndex() > 1) {
              ProfileEditorDialog p =
                  new ProfileEditorDialog(getInstance(), (String) users.getSelectedItem(), true);
              users.setSelectedIndex(0);
              p.setVisible(true);
            }
            edit.setEnabled(users.getSelectedIndex() > 1);
          }
        });

    launch.setText(I18N.getLocaleString("LAUNCH_BUTTON"));
    launch.setBounds(711, 20, 100, 30);
    launch.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent arg0) {
            doLaunch();
          }
        });

    serverbutton.setBounds(480, 20, 330, 30);
    serverbutton.setText(I18N.getLocaleString("DOWNLOAD_SERVER_PACK"));
    serverbutton.setVisible(false);
    serverbutton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent event) {
            if (!ModPack.getSelectedPack().getServerUrl().isEmpty()) {
              if (getSelectedModIndex() >= 0) {
                try {
                  String version =
                      (Settings.getSettings().getPackVer().equalsIgnoreCase("recommended version")
                              || Settings.getSettings()
                                  .getPackVer()
                                  .equalsIgnoreCase("newest version"))
                          ? ModPack.getSelectedPack().getVersion().replace(".", "_")
                          : Settings.getSettings().getPackVer().replace(".", "_");
                  if (ModPack.getSelectedPack().isPrivatePack()) {
                    OSUtils.browse(
                        DownloadUtils.getCreeperhostLink(
                            "privatepacks%5E"
                                + ModPack.getSelectedPack().getDir()
                                + "%5E"
                                + version
                                + "%5E"
                                + ModPack.getSelectedPack().getServerUrl()));
                  } else {
                    OSUtils.browse(
                        DownloadUtils.getCreeperhostLink(
                            "modpacks%5E"
                                + ModPack.getSelectedPack().getDir()
                                + "%5E"
                                + version
                                + "%5E"
                                + ModPack.getSelectedPack().getServerUrl()));
                  }
                  TrackerUtils.sendPageView(
                      ModPack.getSelectedPack().getName() + " Server Download",
                      ModPack.getSelectedPack().getName());
                } catch (NoSuchAlgorithmException e) {
                }
              }
            }
          }
        });

    mapInstall.setBounds(650, 20, 160, 30);
    mapInstall.setText(I18N.getLocaleString("INSTALL_MAP"));
    mapInstall.setVisible(false);
    mapInstall.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent arg0) {
            if (getSelectedMapIndex() >= 0) {
              MapManager man = new MapManager(new JFrame(), true);
              man.setVisible(true);
              MapManager.cleanUp();
            }
          }
        });

    mapInstallLocation = new JComboBox();
    mapInstallLocation.setBounds(480, 20, 160, 30);
    mapInstallLocation.setToolTipText("Install to...");
    mapInstallLocation.setVisible(false);

    serverMap.setBounds(480, 20, 330, 30);
    serverMap.setText(I18N.getLocaleString("DOWNLOAD_MAP_SERVER"));
    serverMap.setVisible(false);
    serverMap.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent event) {
            if (getSelectedMapIndex() >= 0) {
              try {
                OSUtils.browse(
                    DownloadUtils.getCreeperhostLink(
                        "maps%5E"
                            + Map.getMap(LaunchFrame.getSelectedMapIndex()).getMapName()
                            + "%5E"
                            + Map.getMap(LaunchFrame.getSelectedMapIndex()).getVersion()
                            + "%5E"
                            + Map.getMap(LaunchFrame.getSelectedMapIndex()).getUrl()));
              } catch (NoSuchAlgorithmException e) {
              }
            }
          }
        });

    tpInstall.setBounds(650, 20, 160, 30);
    tpInstall.setText(I18N.getLocaleString("INSTALL_TEXTUREPACK"));
    tpInstall.setVisible(false);
    tpInstall.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent arg0) {
            if (getSelectedTexturePackIndex() >= 0) {
              TextureManager man = new TextureManager(new JFrame(), true);
              man.setVisible(true);
            }
          }
        });

    tpInstallLocation = new JComboBox();
    tpInstallLocation.setBounds(480, 20, 160, 30);
    tpInstallLocation.setToolTipText("Install to...");
    tpInstallLocation.setVisible(false);

    tpInstallLocLbl.setText("Install to...");
    tpInstallLocLbl.setBounds(480, 20, 80, 30);
    tpInstallLocLbl.setVisible(false);

    footer.add(edit);
    footer.add(users);
    footer.add(footerLogo);
    footer.add(footerCreeper);
    footer.add(launch);
    footer.add(donate);
    footer.add(serverbutton);
    footer.add(mapInstall);
    footer.add(mapInstallLocation);
    footer.add(serverMap);
    footer.add(tpInstall);
    footer.add(tpInstallLocation);

    newsPane = new NewsPane();
    modPacksPane = new ModpacksPane();
    mapsPane = new MapsPane();
    tpPane = new TexturepackPane();
    optionsPane = new OptionsPane(Settings.getSettings());

    getRootPane().setDefaultButton(launch);
    updateLocale();

    tabbedPane.add(newsPane, 0);
    tabbedPane.add(optionsPane, 1);
    tabbedPane.add(modPacksPane, 2);
    tabbedPane.add(mapsPane, 3);
    tabbedPane.add(tpPane, 4);
    setNewsIcon();
    tabbedPane.setIconAt(1, new ImageIcon(this.getClass().getResource("/image/tabs/options.png")));
    tabbedPane.setIconAt(2, new ImageIcon(this.getClass().getResource("/image/tabs/modpacks.png")));
    tabbedPane.setIconAt(3, new ImageIcon(this.getClass().getResource("/image/tabs/maps.png")));
    tabbedPane.setIconAt(
        4, new ImageIcon(this.getClass().getResource("/image/tabs/texturepacks.png")));
    tabbedPane.setSelectedIndex(tab);

    tabbedPane.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent event) {
            if (tabbedPane.getSelectedComponent() instanceof ILauncherPane) {
              ((ILauncherPane) tabbedPane.getSelectedComponent()).onVisible();
              currentPane = Panes.values()[tabbedPane.getSelectedIndex()];
              updateFooter();
            }
          }
        });
  }