Exemplo n.º 1
0
  /**
   * Constructs a titled panel.
   *
   * @param title the title
   * @param content the JComponent that contains the content
   * @param outerBorder the outer border
   */
  public JTitlePanel(String title, Icon icon, JComponent content, Border outerBorder) {
    setLayout(new BorderLayout());

    label = new JLabel(title, icon, JLabel.LEADING);
    label.setForeground(Color.WHITE);

    GradientPanel titlePanel = new GradientPanel(Color.BLACK);
    titlePanel.setLayout(new BorderLayout());
    titlePanel.add(label, BorderLayout.WEST);
    int borderOffset = 2;
    if (icon == null) {
      borderOffset += 1;
    }
    titlePanel.setBorder(BorderFactory.createEmptyBorder(borderOffset, 4, borderOffset, 1));
    add(titlePanel, BorderLayout.NORTH);

    JPanel northPanel = new JPanel();
    northPanel.setLayout(new BorderLayout());
    northPanel.add(content, BorderLayout.NORTH);
    northPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    add(northPanel, BorderLayout.CENTER);

    if (outerBorder == null) {
      setBorder(BorderFactory.createLineBorder(Color.GRAY));
    } else {
      setBorder(
          BorderFactory.createCompoundBorder(
              outerBorder, BorderFactory.createLineBorder(Color.GRAY)));
    }
  }
Exemplo n.º 2
0
 @Override
 public void actionPerformed(ActionEvent arg0) {
   if (!dialog.username.getText().isEmpty() && Utils.validIP(dialog.serverIp.getText())) {
     try {
       serverIP = InetAddress.getByName(dialog.serverIp.getText());
       username = dialog.username.getText();
       LOGIN_RESULT result = Actions.login(serverIP, serverPort);
       if (result == LOGIN_RESULT.SUCCESSFUL) pane.setValue(JOptionPane.OK_OPTION);
       else if (result == LOGIN_RESULT.USERNAME_USED) {
         dialog.usernameLabel.setText("Username already in use.");
         dialog.username.setBorder(BorderFactory.createLineBorder(Color.RED));
       } else if (result == LOGIN_RESULT.INVALID_IP || result == null) {
         dialog.serverIpLabel.setText("Server IP is invalid.");
         dialog.serverIp.setBorder(BorderFactory.createLineBorder(Color.RED));
       }
     } catch (IOException e) {
       e.printStackTrace();
     } catch (InterruptedException e) {
       e.printStackTrace();
     }
   } else {
     if (dialog.username.getText().isEmpty())
       dialog.username.setBorder(BorderFactory.createLineBorder(Color.RED));
     if (!Utils.validIP(dialog.serverIp.getText()))
       dialog.serverIp.setBorder(BorderFactory.createLineBorder(Color.RED));
   }
 }
Exemplo n.º 3
0
  /** {@inheritDoc} */
  @Override
  public Component getListCellRendererComponent(
      JList list,
      final Object value,
      final int index,
      boolean isSelected,
      final boolean cellHasFocus) {

    Component label = getObjectComponent(list, value, index, isSelected, cellHasFocus);
    if (label instanceof JComponent) ((JComponent) label).setOpaque(false);

    panel.removeAll();
    panel.add(label);
    panel.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
    panel.restoreBackground();

    if (cellHasFocus)
      if (panel.isBackgroundRestored())
        panel.setBackground(UIUtils.setAlpha(list.getSelectionBackground(), 100));
      else panel.setBorder(BorderFactory.createLineBorder(list.getSelectionBackground()));

    if (isSelected)
      if (panel.isBackgroundRestored())
        panel.setBackground(UIUtils.setAlpha(list.getSelectionBackground(), 200));
      else panel.setBorder(BorderFactory.createLineBorder(list.getSelectionBackground()));

    if (index == hoveredIndex) panel.mouseEntered(null);

    return panel;
  }
Exemplo n.º 4
0
  private void initWindow() {
    window.setIconImage(fsuicon);
    window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    window.setResizable(false);
    window.setLocation(400, 400);
    window.setSize(400, 600);
    window.setLayout(null);
    window.add(mainPanel);
    mainPanel.setSize(395, 570);
    mainPanel.setLayout(null);
    mainPanel.setBackground(garnet);
    mainPanel.setBorder(BorderFactory.createLineBorder(gold, 10));

    logoLBL = new JLabel(new ImageIcon(fsutitle));
    setJLabel(logoLBL, 372, 35, 10, 30);

    nameLBL = new JLabel(new ImageIcon(nametitle));
    nameLBL.setBorder(BorderFactory.createLineBorder(gold, 5));
    setJLabel(nameLBL, 400, 55, 0, 510);

    p1Stats = new JLabel();
    setJLabel(p1Stats, 150, 50, 20, 470);

    p2Stats = new JLabel();
    setJLabel(p2Stats, 150, 50, 225, 470);

    buildGridPanel();
    buildMenuPanel();
  }
Exemplo n.º 5
0
    public Component getListCellRendererComponent(
        JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {

      Object[] values = (Object[]) list.getModel().getElementAt(index);
      String icoState = (String) (values[0]);

      setIcon(null);
      if (icoState.equals("bad")) { // Error
        setIcon(errIco);
        setBackground(list.getSelectionForeground()); // RED
        setForeground(Color.BLACK);
        setBorder(BorderFactory.createLineBorder(Color.BLUE, 1));
      } else if (icoState.equals("good")) { // Ok
        setIcon(nrmIco);
        setBackground(list.getSelectionBackground()); // GREEN
        setForeground(Color.BLACK);
        setBorder(BorderFactory.createLineBorder(Color.BLUE, 1));
      } else if (icoState.equals("goodcont")) { // Ok
        setIcon(imdIco);
        setBackground(list.getSelectionBackground()); // GREEN
        setForeground(Color.BLACK);
        setBorder(BorderFactory.createLineBorder(list.getSelectionBackground(), 1));
      } else {
        setIcon(ibdIco); // Errorcont
        setBackground(list.getSelectionForeground()); // RED
        setForeground(Color.BLACK);
        setBorder(BorderFactory.createLineBorder(list.getSelectionForeground(), 1));
      }
      setText((String) (values[1]));
      setFont(list.getFont());
      return this;
    }
Exemplo n.º 6
0
  public JCalendarDay(int start_hour, int end_hour, int minutes_by_split) {
    super(new MigLayout("insets 0, gapy 0", "[grow]", "[0:30px:30px][grow]"));

    START_HOUR = start_hour;
    END_HOUR = end_hour;
    MINUTES_BY_SPLIT = minutes_by_split;
    NB_SPLIT = (END_HOUR - START_HOUR) * 60 / MINUTES_BY_SPLIT;

    eventsList = new ArrayList<>();
    checkList = new ArrayList<>();
    JPanel header = new JPanel();
    add(header, "grow, cell 0 0");
    header.setBorder(BorderFactory.createLineBorder(Color.black));
    content =
        new JPanel(
            new MigLayout("insets 4px 0px 5px 5px, gapy 0", "[1px][grow]", "[grow, 0:5px:30px]"));
    add(content, "grow, cell 0 1");
    content.setBorder(BorderFactory.createLineBorder(Color.black));
    title = new JLabel();
    header.add(title);
    // La première colonne de la grille du layout est rempli avec des Panels de taille 1*1 pour
    // fixer la grille
    for (int row = 0; row < NB_SPLIT; row++) {
      content.add(new JPanel(), "width 1px:1px:1px, grow, cell 0 " + row);
    }
  }
Exemplo n.º 7
0
  @Override
  public void onMessage(IMCMessage message) {
    String id = message.getSourceName();
    if (!sidePanels.containsKey(id)) {
      SideVehiclePanel sp = new SideVehiclePanel();
      sp.setVehicle(id);
      sp.setSize((int) (getWidth() * 0.666), getHeight() / (1 + sidePanels.size()));
      sp.setBorder(BorderFactory.createLineBorder(Color.red));
      sidePanels.put(id, sp);
      BackVehiclePanel bp = new BackVehiclePanel();
      bp.setVehicle(id);
      bp.setSize((int) (getWidth() * 0.333), getHeight() / (1 + sidePanels.size()));
      bp.setBorder(BorderFactory.createLineBorder(Color.red));
      backPanels.put(id, bp);
      JPanel p =
          new JPanel(new TableLayout(new double[] {0.666, 0.333}, new double[] {TableLayout.FILL}));
      p.add(sp, "0,0");
      p.add(bp, "1,0");

      add(p);
      invalidate();
      revalidate();
    }
    sidePanels.get(id).setPitch(message.getFloat("theta"));
    sidePanels.get(id).setDepth(message.getFloat("depth"));
    backPanels.get(id).setRoll(message.getFloat("phi"));
    repaint();
  }
Exemplo n.º 8
0
  @Override
  protected void paintComponent(Graphics g) {
    Graphics2D g2 = (Graphics2D) g.create();

    if (activityType == ActivityType.SHOW) {
      if (themeColor == ThemeColors.RED)
        g2.setColor(new Color(0x517800)); // new Color(0x8ff069));//new Color(0xde594c));
      else g2.setColor(new Color(0x43ba71)); // 0x32e632));//0xffff33));
      // Draw rectangle
      g2.fillRect(0, 0, getWidth(), getHeight());
      this.setBorder(BorderFactory.createLineBorder(new Color(0x999999)));

    } else if (activityType == ActivityType.SHARE) {
      // set color
      if (themeColor == ThemeColors.RED)
        g2.setColor(
            new Color(0x7d4374)); // new Color(0xf069bc));//(0xd84837));//(0xc74245));//(0x4268af));
      else g2.setColor(new Color(0x9843ba)); // 0xaa32e6));//0x99ccff));//2fb9f5));

      // Draw rectangle
      g2.fillRect(0, 0, getWidth(), getHeight());
      this.setBorder(BorderFactory.createLineBorder(new Color(0x999999)));
    } else {
      // set color
      if (themeColor == ThemeColors.RED)
        g2.setColor(new Color(0x7474b5)); // (new Color(0x6aa5ef));//(0xf59e13));
      else g2.setColor(new Color(0x4379ba)); // 0x32aae6));//0x99ff33));

      // Draw rectangle
      g2.fillRect(0, 0, getWidth(), getHeight());
      this.setBorder(BorderFactory.createLineBorder(new Color(0x999999)));
    }

    // Draw app icon
    int minDimension = Math.min(getWidth(), getHeight());
    BufferedImage resizedImage = resizeTrick(programIcon, minDimension, minDimension);
    BufferedImage transparentImage = ImageUtils.makeColorTransparent(resizedImage, Color.BLACK);
    g2.drawImage(transparentImage, 0, 0, null);
    // Draw device icon
    if (sharedDevice == SharedDevice.SHAREDDISPLAY) {
      BufferedImage resizedDeviceIcon = resizeTrick(deviceIcon, minDimension, minDimension);
      if (minDimension == getWidth()) {
        g.drawImage(resizedDeviceIcon, 0, getHeight() / 2, null);
      } else {
        g.drawImage(resizedDeviceIcon, getWidth() - 2 * minDimension, 0, null);
      }
    }
    if (activityIcon != null) {
      BufferedImage resizedActivityIcon;
      if (activityType == ActivityType.SHOW || activityType == ActivityType.SHARE)
        resizedActivityIcon = resize(activityIcon, minDimension, minDimension);
      else resizedActivityIcon = resizeTrick(activityIcon, minDimension, minDimension);
      if (minDimension == getWidth()) {
        g.drawImage(resizedActivityIcon, 0, getHeight(), null);
      } else {
        g.drawImage(resizedActivityIcon, getWidth() - minDimension, 0, null);
      }
    }
  }
Exemplo n.º 9
0
 /**
  * Faz tabela e Muda cor do fundo dos Labels
  *
  * @param Label
  * @param Label
  */
 public void Labels(JLabel lUltimoReg, JLabel lUltimoTit) {
   lUltimoReg.setBorder(BorderFactory.createLineBorder(Color.black));
   lUltimoReg.setBackground(Color.cyan);
   lUltimoReg.setOpaque(true);
   lUltimoTit.setBorder(BorderFactory.createLineBorder(Color.black));
   lUltimoTit.setBackground(Color.cyan);
   lUltimoTit.setOpaque(true);
 }
Exemplo n.º 10
0
 @Override
 public void mouseClicked(MouseEvent arg0) {
   if (arg0.getClickCount() > 1) {
     sprite.setBorder(BorderFactory.createLineBorder(Color.blue));
     System.out.println(this.toString());
   } else {
     sprite.setBorder(BorderFactory.createLineBorder(Color.GRAY));
   }
 }
Exemplo n.º 11
0
  public void buildPopulationBox() {
    rebuilding = true;
    populationBox.removeAll();
    peopleList = new ArrayList<Object>();
    famList = new ArrayList<Family>();
    peopleList.addAll(ctxt.individualCensus);
    String plur = (peopleList.size() == 1 ? "" : "s");
    populationBox.setLayout(new BoxLayout(populationBox, BoxLayout.PAGE_AXIS));
    populationBox.setBorder(
        BorderFactory.createTitledBorder(
            BorderFactory.createLineBorder(Color.blue), "Current Population"));
    populationBox.setAlignmentX(0.5f);
    populationBox.add(Box.createRigidArea(new Dimension(8, 0)));
    indivLabel = new JLabel("Contains " + peopleList.size() + " Individual" + plur);
    indivLabel.setAlignmentX(0.5f);
    populationBox.add(indivLabel);
    if (peopleList.size() > 0) {
      JPanel indivBtnBox = new JPanel();
      indivBtnBox.setLayout(new BoxLayout(indivBtnBox, BoxLayout.LINE_AXIS));
      Dimension sizer2 = new Dimension(350, 50);
      String[] indMenu = genIndMenu(peopleList);
      indPick = new JComboBox(indMenu);
      indPick.addActionListener(listener);
      indPick.setActionCommand("view/edit person");
      indPick.setMinimumSize(sizer2);
      indPick.setMaximumSize(sizer2);
      indPick.setBorder(
          BorderFactory.createTitledBorder(
              BorderFactory.createLineBorder(Color.blue), "View/Edit Person"));
      indivBtnBox.add(indPick);
      populationBox.add(indivBtnBox);
    } //  end of if-any-people-exist

    famList.addAll(ctxt.familyCensus); //  end of filtering deleted records
    plur = (famList.size() == 1 ? "y" : "ies");
    famLabel = new JLabel("Contains " + famList.size() + " Famil" + plur);
    famLabel.setAlignmentX(0.5f);
    populationBox.add(Box.createRigidArea(new Dimension(0, 4)));
    populationBox.add(famLabel);
    if (famList.size() > 0) {
      JPanel famBtnBox = new JPanel();
      famBtnBox.setLayout(new BoxLayout(famBtnBox, BoxLayout.LINE_AXIS));
      Dimension sizer2 = new Dimension(350, 50);
      String[] famMenu = genFamMenu(famList);
      famPick = new JComboBox(famMenu);
      famPick.addActionListener(listener);
      famPick.setActionCommand("view/edit family");
      famPick.setMinimumSize(sizer2);
      famPick.setMaximumSize(sizer2);
      famPick.setBorder(
          BorderFactory.createTitledBorder(
              BorderFactory.createLineBorder(Color.blue), "View/Edit Family"));
      famBtnBox.add(famPick);
      populationBox.add(famBtnBox);
    } //  end of if-any-families-exist
    rebuilding = false;
  } //  end of method buildPopulationBox
Exemplo n.º 12
0
 void updateColor() {
   if (gNode.isInitial()) {
     setBackground(Color.yellow);
     setBorder(BorderFactory.createLineBorder(Color.yellow, 1));
     //  two pixels wide
   } else {
     setBackground(Color.white);
     setBorder(BorderFactory.createLineBorder(Color.black, 1));
   }
 }
 /** Return the cell's border. */
 protected Border border(
     JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) {
   if (hasFocus) {
     return UIManager.getBorder("Table.focusCellHighlightBorder");
   }
   if (selected) {
     return BorderFactory.createLineBorder(table.getSelectionBackground(), 1);
   }
   return BorderFactory.createLineBorder(table.getBackground(), 1);
 }
Exemplo n.º 14
0
 public void updateKeyboardUI() {
   if (Skin.VIETNAMESE_KEY.isEnabled()) {
     chkVietnamese.setText(" V ");
     chkVietnamese.setBackground(Color.yellow);
     chkVietnamese.setBorder(BorderFactory.createLineBorder(Color.red, 1));
   } else {
     chkVietnamese.setText(" E ");
     chkVietnamese.setBackground(Color.cyan);
     chkVietnamese.setBorder(BorderFactory.createLineBorder(Color.blue, 1));
   }
 }
Exemplo n.º 15
0
  public DayPanel(ActiveView activeView, WeekDayNames weekDayNames) {
    super(activeView);
    switch (activeView) {
      case DAY_VIEW:
        JPanel pnlUp = new JPanel();
        JPanel pnlUnder = new JPanel();
        GridLayout dayLayout = new GridLayout(4, 6);
        pnlUnder.setLayout(dayLayout);
        this.setLayout(new BorderLayout());
        pnlUp.setBorder(BorderFactory.createLineBorder(Color.GREEN));

        String currentDay = weekDayNames.name();
        JLabel day = new JLabel(currentDay);
        pnlUp.add(day);

        for (int am = 0; am < 4; am++) {
          for (int hi = 0; hi < 6; hi++) {
            JPanel hour = new JPanel();
            hour.add(new JLabel(new Integer(hi + (6 * am)).toString()));
            hour.setBorder(BorderFactory.createLineBorder(Color.BLUE));
            pnlUnder.add(hour);
          }
        }

        this.add(pnlUnder, BorderLayout.CENTER);
        this.add(pnlUp, BorderLayout.PAGE_START);
        break;
      case WEEK_VIEW:
        GridLayout daysLayout;
        switch (weekDayNames) {
          case EMPTYDAY:
            daysLayout = new GridLayout(24, 1);
            this.setLayout(daysLayout);
            break;
          default:
            daysLayout = new GridLayout(25, 1);
            this.setLayout(daysLayout);
            this.add(new JLabel(weekDayNames.toString()));
        }

        for (int hi = 0; hi < 24; hi++) {
          JPanel hour = new JPanel();
          JButton btnAddEvt = new JButton("Add an event");
          // EX;4 : Creer votre propre widget permettant, l'ajout d'un évènement et d'une personne
          hour.add(new JLabel(new Integer(hi).toString()));
          this.add(hour);
        }
        break;
      case MONTH_VIEW:
        JPanel hour = new JPanel();
        hour.add(new JLabel("H"));
        this.add(hour);
    }
  }
Exemplo n.º 16
0
 private void setBack() {
   if (!sel) {
     this.setBackground(normBack);
     this.setForeground(faint ? faintText : normText);
   } else {
     this.setBackground(selBack);
     this.setForeground(faint ? faintText : selText);
   }
   if (pick) this.setBorder(BorderFactory.createLineBorder(Color.red));
   else this.setBorder(BorderFactory.createLineBorder(this.getBackground()));
 }
Exemplo n.º 17
0
 public void SetSelected(boolean Selected) {
   if (this.Selected != Selected) {
     if (Selected) {
       setBorder(BorderFactory.createLineBorder(Color.BLACK));
     } else {
       setBorder(BorderFactory.createLineBorder(Color.WHITE));
     }
     repaint();
   }
   this.Selected = Selected;
 }
Exemplo n.º 18
0
 public void drawItems() {
   itemList.removeAll();
   OrderedItem orders[] = commande.getOrders();
   for (int i = 0; i < orders.length; i++) {
     GridBagConstraints constraintLeft = new GridBagConstraints(),
         constraintRight = new GridBagConstraints();
     constraintLeft.gridx = 0;
     constraintLeft.gridy = GridBagConstraints.RELATIVE;
     constraintLeft.fill = GridBagConstraints.HORIZONTAL;
     constraintRight.gridx = 1;
     constraintRight.gridy = GridBagConstraints.RELATIVE;
     constraintRight.fill = GridBagConstraints.HORIZONTAL;
     String itemText = orders[i].getItem().getNom();
     if (itemText.length() > 15) {
       itemText = itemText.substring(0, 12) + "...";
     }
     JLabel item = new JLabel(itemText);
     JPanel itemTextHolder = new JPanel();
     itemTextHolder.setBorder(BorderFactory.createLineBorder(Color.BLUE));
     itemTextHolder.setBackground(Color.WHITE);
     itemTextHolder.add(item);
     itemList.add(itemTextHolder, constraintLeft);
     Color bg = Color.WHITE;
     String statusIcon = "";
     JLabel itemStatus = new JLabel();
     JPanel statusHolder = new JPanel();
     switch (orders[i].getStatus()) {
       case 0:
         bg = Color.RED;
         statusIcon = "\u2718";
         break;
       case 1:
         bg = Color.YELLOW;
         statusIcon = "\u2718";
         break;
       case 2:
         bg = Color.GREEN;
         statusIcon = "\u2718";
         break;
       case 3:
         bg = Color.GRAY;
         statusIcon = "\u2713";
         break;
     }
     itemStatus.setText(statusIcon);
     statusHolder.setBackground(bg);
     statusHolder.setBorder(BorderFactory.createLineBorder(Color.BLUE));
     statusHolder.add(itemStatus);
     itemList.add(statusHolder, constraintRight);
   }
   validate();
   repaint();
 }
  private void btnAgregarLabActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnAgregarLabActionPerformed
    DefaultTableModel modeloTabla = (DefaultTableModel) tblLaboratorio.getModel();
    GestorHibernate gestorH = new GestorHibernate();
    int campo = gestorE.campoObligatorio(txtRazonSocial, txtCalle);
    if (campo == 0) {
      Object fila[] = {
        txtRazonSocial.getText(), cmbEspecialidad.getSelectedItem(), cmbLocalidad.getSelectedItem()
      };
      modeloTabla.addRow(fila);
      tblLaboratorio.setModel(modeloTabla);

      // Boton nuevo
      if (editar == false) {
        Laboratorio laboratorio = new Laboratorio();
        laboratorio.setRazonSocial(txtRazonSocial.getText());
        laboratorio.setEspecialidad((EspecialidadLaboratorio) cmbEspecialidad.getSelectedItem());
        laboratorio.setTelefono(txtTelefono.getText());
        laboratorio.setTipoTel((TipoTelefono) cmbTipoTel.getSelectedItem());
        Domicilio domicilio = new Domicilio();
        domicilio.setCalle(txtCalle.getText());
        domicilio.setNumero(Integer.parseInt(txtNum.getText()));
        domicilio.setBarrio((Barrio) cmbBarrio.getSelectedItem());
        laboratorio.setDomicilio(domicilio);

        gestorH.guardarObjeto(laboratorio);
      }

      // Boton editar
      else {
        Iterator ite = gestorH.listarClase(Laboratorio.class).iterator();
        while (ite.hasNext()) {
          Laboratorio l = (Laboratorio) ite.next();
          if (l.getRazonSocial().equalsIgnoreCase(txtRazonSocial.getText())) {
            l.setRazonSocial(txtRazonSocial.getText());
            l.setEspecialidad((EspecialidadLaboratorio) cmbEspecialidad.getSelectedItem());
            l.setTelefono(txtTelefono.getText());
            l.setTipoTel((TipoTelefono) cmbTipoTel.getSelectedItem());
            Domicilio domicilio = new Domicilio();
            domicilio.setCalle(txtCalle.getText());
            domicilio.setNumero(Integer.parseInt(txtNum.getText()));
            domicilio.setBarrio((Barrio) cmbBarrio.getSelectedItem());
            l.setDomicilio(domicilio);
            gestorH.actualizarObjeto(l);
          }
        }
      }
      txtRazonSocial.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
      txtCalle.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
    }
    editar = false;
  } // GEN-LAST:event_btnAgregarLabActionPerformed
Exemplo n.º 20
0
  private void updateFromFeature(Feature feature) {
    GridBagConstraints c = new GridBagConstraints();
    JPanel gridPanel = new JPanel(new GridBagLayout());
    gridPanel.setBackground(Color.white);

    //
    // literature & dbxref
    literatureTextArea = new QualifierTextArea();
    literatureTextArea.setBorder(BorderFactory.createLineBorder(Color.gray));
    dbxrefTextArea = new QualifierTextArea();
    dbxrefTextArea.setBorder(BorderFactory.createLineBorder(Color.gray));

    literatureTextArea
        .getDocument()
        .addDocumentListener(new TextAreaDocumentListener(literatureTextArea));

    dbxrefTextArea.getDocument().addDocumentListener(new TextAreaDocumentListener(dbxrefTextArea));

    final QualifierVector qualifiers = feature.getQualifiers().copy();
    final StringBuffer litBuffer = new StringBuffer();
    final StringBuffer dbxrefBuffer = new StringBuffer();

    for (int i = 0; i < qualifiers.size(); ++i) {
      Qualifier this_qualifier = (Qualifier) qualifiers.elementAt(i);
      if (this_qualifier.getName().equals("literature"))
        appendToBuffer(this_qualifier.getValues(), litBuffer);
      else if (this_qualifier.getName().equalsIgnoreCase("Dbxref"))
        appendToBuffer(this_qualifier.getValues(), dbxrefBuffer);
    }

    c.gridx = 0;
    c.gridy = 0;
    c.ipadx = 5;
    c.ipady = 5;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.fill = GridBagConstraints.NONE;
    gridPanel.add(new JLabel("Literature"), c);
    c.gridx = 1;
    gridPanel.add(literatureTextArea, c);

    c.gridx = 0;
    c.gridy = 1;
    gridPanel.add(new JLabel("Dbxref"), c);
    c.gridx = 1;
    gridPanel.add(dbxrefTextArea, c);

    add(gridPanel);

    literatureTextArea.setText(litBuffer.toString() + "\n");
    dbxrefTextArea.setText(dbxrefBuffer.toString() + "\n");
  }
Exemplo n.º 21
0
  /**
   * Sets one of the <code>ReceiverView</code>s in focus. <code>ReceiverView</code> in focus is
   * denoted by black border around itself (<code>ReceiverView</code>s that are not in focus don't
   * have this border). When focused, <code>ReceiverView</code>'s <code>angle</code> property can be
   * changed through <code>ParametersPanel</code>.
   *
   * @param receiverViewInFocus <code>ReceiverView</code> object in focus
   * @see ReceiverView
   * @see ParametersPanel
   */
  public void focusReceiverView(ReceiverView receiverViewInFocus) {

    this.receiverViewInFocus = receiverViewInFocus;

    for (ReceiverView receiverView : receiverViews) {
      // remove border from all receiverViews
      receiverView.setBorder(BorderFactory.createLineBorder(Color.black, 0));
      receiverView.repaint();
      if (receiverView.equals(receiverViewInFocus)) {
        receiverView.setBorder(BorderFactory.createLineBorder(Color.black, 2));
        receiverView.repaint();
      }
    }
  }
Exemplo n.º 22
0
 public void Margins_set(int left, int top, int right, int bot) {
   if (left == 0 && right == 0) {
     txt_box.setBorder(BorderFactory.createLineBorder(Color.BLACK));
     txt_box.setMargin(new Insets(0, 0, 0, 0));
   } else {
     //			txt_box.setBorder(BasicBorders.getTextFieldBorder());
     //			txt_box.setMargin(new Insets(0, l, 0, r));
     txt_box.setFont(new Font("Courier New", FontStyleAdp_.Plain.Val(), 12));
     txt_box.setBorder(
         BorderFactory.createCompoundBorder(
             BorderFactory.createLineBorder(Color.BLACK),
             BorderFactory.createEmptyBorder(top, left, bot, right)));
   }
 }
 public static JTextArea createTextArea(String parTitle, int parRows, int parCols) {
   JTextArea textarea = new JTextArea(parRows, parCols);
   setDefaultScheme(textarea);
   if (parTitle == null || parTitle.isEmpty()) {
     textarea.setBorder(BorderFactory.createLineBorder(Settings.getScheme().BORDER_COLOR));
   } else {
     TitledBorder border = BorderFactory.createTitledBorder(parTitle);
     border.setTitleColor(Color.WHITE);
     border.setTitleFont(Settings.getScheme().FONT);
     border.setBorder(BorderFactory.createLineBorder(Color.WHITE));
     textarea.setBorder(border);
   }
   return textarea;
 }
Exemplo n.º 24
0
    public AccountInfoPanel() {
      setLayout(new MigLayout("gap 0, fill"));

      // setBorder(BorderFactory.createLineBorder(Color.BLACK));
      number2.setBorder(BorderFactory.createLineBorder(Color.BLACK));
      number.setBorder(BorderFactory.createLineBorder(Color.BLACK));
      balance2.setBorder(BorderFactory.createLineBorder(Color.BLACK));
      balance.setBorder(BorderFactory.createLineBorder(Color.BLACK));

      add(number2, "grow, align center");
      add(number, "wrap, grow, align center");
      add(balance2, "grow, align center");
      add(balance, "grow, align center");
    }
Exemplo n.º 25
0
    void drawScreen() {

      teams.add(myTeams);
      teams.add(manageTeams, "growx");
      teams.add(new JSeparator(), "growx");

      for (Team team : Global.Teams) {
        JPanel thisTeam = team.teamPreview();
        JButton startTeam = new JButton("Draft!");
        startTeam.addActionListener(
            (ActionEvent e) -> {
              DraftScreen called = new DraftScreen(team, this);
              called.Switch();
            });
        thisTeam.add(startTeam, "east");
        thisTeam.setBorder(BorderFactory.createLineBorder(Color.black));
        teamsInner.add(thisTeam, "growx");
      }
      teams.add(teamScroll);

      players.add(myPlayers);
      players.add(managePlayers, "growx");
      players.add(new JSeparator());

      for (Player player : Global.Players) {
        JPanel thisPlayer = player.playerPreview();
        JButton modify = new JButton(ResourceRetriever.getImage("edit.png", 16, 16));
        modify.setMargin(new Insets(0, 0, 0, 0));
        modify.addActionListener(
            (ActionEvent e) -> {
              new ModifyPlayerPopup(player, this, null);
            });
        thisPlayer.add(modify, "east");
        thisPlayer.setBorder(BorderFactory.createLineBorder(Color.black));
        playersInner.add(thisPlayer, "growx");
      }
      players.add(playerScroll);

      teamDraft.add(teamDraftL, "span, center");
      teamDraft.add(teams, "grow");
      teamDraft.add(players, "grow");

      Eve.add(quick);
      Eve.add(viewAll);
      Eve.add(teamDraft, "span");

      Adam.add(Eve);
      Adam.setSize(windowSize);
    }
Exemplo n.º 26
0
  public Login() {

    Image titleImage = Toolkit.getDefaultToolkit().getImage("logo.jpg");
    con = getContentPane();
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setTitle("Brain Tumor Segmentation");
    setBounds(125, 50, 800, 600);
    setIconImage(titleImage);
    con.setLayout(null);
    con.add(panel);
    panel.setLayout(null);
    panel.setBounds(15, 10, 760, 540);
    panel.setBorder(new TitledBorder("Login Page"));
    panel.setBackground(Color.lightGray);

    panel.add(index);
    panel.add(userid);
    panel.add(password);
    panel.add(useridTxt);
    panel.add(passwordTxt);
    panel.add(submit);
    panel.add(exit);

    Font font = new Font("Bookman Old Style", 1, 15);

    index.setBounds(260, 50, 350, 30);
    userid.setBounds(250, 125, 125, 30);
    useridTxt.setBounds(400, 125, 125, 30);
    password.setBounds(250, 200, 175, 30);
    passwordTxt.setBounds(400, 200, 125, 30);
    submit.setBounds(275, 300, 125, 50);
    exit.setBounds(425, 300, 125, 50);

    index.setFont(new Font("Bookman Old Style", 1, 18));
    userid.setFont(font);
    useridTxt.setFont(font);
    password.setFont(font);
    passwordTxt.setFont(font);
    submit.setFont(font);
    exit.setFont(font);

    submit.setBorder(BorderFactory.createLineBorder(Color.black, 5));
    exit.setBorder(BorderFactory.createLineBorder(Color.black, 5));
    setVisible(true);

    submit.addActionListener(this);
    exit.addActionListener(this);
  }
Exemplo n.º 27
0
  @Override
  public void mousePressed(MouseEvent e) {
    /* clear all when 1. not meta down
     * 2. popup
     * 3. already selected
     *
     */
    if (!(e.isMetaDown()
        || (e.isPopupTrigger() && this.isSelected())
        || e.isShiftDown()
        || ((MartComponent) e.getSource()).isSelected())) {
      this.clearOthers((Component) e.getSource());
    }
    if (!this.isSelected() && e.getButton() == MouseEvent.BUTTON3) {
      this.clearOthers((Component) e.getSource());
    }

    McViewSourceGroup groupview =
        (McViewSourceGroup) McViews.getInstance().getView(IdwViewType.SOURCEGROUP);
    if (e.isShiftDown() && groupview.getLastpoint() != null) {
      this.clearOthers(this);
      List<MartComponent> mcs = groupview.getComponentsBetween(groupview.getLastpoint(), this);
      for (MartComponent mc : mcs) {
        mc.setSelected(true);
        mc.setBorder(BorderFactory.createLineBorder(Color.RED));
      }
    } else groupview.setLastpoint(this);
    this.setSelected(true);
    this.setBorder(BorderFactory.createLineBorder(Color.RED));

    if (e.isPopupTrigger()) {
      this.handleRightClick(e);
    } else if (e.getClickCount() == 2) {
      List<Mart> martList = new ArrayList<Mart>();
      martList.add(((MartComponent) e.getSource()).getMart());
      // added cols orders to a new PtModel
      ArrayList<Integer> cols = new ArrayList<Integer>();
      cols.add(PartitionUtils.DATASETNAME);
      cols.add(PartitionUtils.DISPLAYNAME);
      cols.add(PartitionUtils.CONNECTION);
      cols.add(PartitionUtils.DATABASE);
      cols.add(PartitionUtils.SCHEMA);
      cols.add(PartitionUtils.HIDE);
      cols.add(PartitionUtils.KEY);
      new DatasourceDialog(martList, cols, !this.getMart().getSourceContainer().isGrouped());
    }
    this.revalidate();
  }
Exemplo n.º 28
0
 // 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);
       }
     }
   }
 }
Exemplo n.º 29
0
  public BoutonCouleur(int i, ChoixCouleur parent) {
    this.parent = parent;
    this.index = i;
    this.setPreferredSize(new Dimension(50, 50));
    this.setMaximumSize(new Dimension(50, 50));

    Color borderColor = (getCouleur().isConflictuel(getPalette()) ? Color.RED : Color.BLACK);

    this.setBorder(BorderFactory.createLineBorder(borderColor));
    ;

    this.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent e) {
            setCouleurActuelle();
            permuterCarte();
          }

          public void mouseEntered(MouseEvent e) {}

          public void mouseExited(MouseEvent e) {}

          public void mousePressed(MouseEvent e) {}

          public void mouseReleased(MouseEvent e) {}
        });
  }
  private JComponent createSettingsPanel() {
    JPanel result = new JPanel(new FlowLayout(FlowLayout.RIGHT, 3, 0));
    result.add(new JLabel(ApplicationBundle.message("label.font.size")));
    myFontSizeSlider = new JSlider(JSlider.HORIZONTAL, 0, FontSize.values().length - 1, 3);
    myFontSizeSlider.setMinorTickSpacing(1);
    myFontSizeSlider.setPaintTicks(true);
    myFontSizeSlider.setPaintTrack(true);
    myFontSizeSlider.setSnapToTicks(true);
    UIUtil.setSliderIsFilled(myFontSizeSlider, true);
    result.add(myFontSizeSlider);
    result.setBorder(BorderFactory.createLineBorder(UIUtil.getBorderColor(), 1));

    myFontSizeSlider.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            if (myIgnoreFontSizeSliderChange) {
              return;
            }
            EditorColorsManager colorsManager = EditorColorsManager.getInstance();
            EditorColorsScheme scheme = colorsManager.getGlobalScheme();
            scheme.setQuickDocFontSize(FontSize.values()[myFontSizeSlider.getValue()]);
            applyFontSize();
          }
        });

    String tooltipText = ApplicationBundle.message("quickdoc.tooltip.font.size.by.wheel");
    result.setToolTipText(tooltipText);
    myFontSizeSlider.setToolTipText(tooltipText);
    result.setVisible(false);
    result.setOpaque(true);
    myFontSizeSlider.setOpaque(true);
    return result;
  }