Ejemplo n.º 1
2
  AdminMain() {
    l = new JLabel();
    l.setBounds(10, 20, 1340, 1000);
    l.setBackground(Color.black);
    Font ft = new Font("Arial", Font.BOLD, 30);
    Font ft1 = new Font("Arial", Font.BOLD, 14);
    Font ft2 = new Font("Arial", Font.BOLD, 20);

    f1 = new Frame("Soft Test Management (Beta)");
    f1.setLayout(null);

    l1 = new Label("Test Instructions", l1.CENTER);
    l1.setBounds(10, 20, 1300, 60);
    l1.setForeground(Color.blue);
    l1.setBackground(Color.white);
    l1.setFont(ft);

    l2 = new JLabel("Deletion of Faculty/Students");
    l2.setBounds(20, 30, 1000, 500);
    l2.setBackground(Color.blue);
    l2.setFont(ft2);
    l3 = new JLabel("Test Pattern");
    l3.setBounds(20, 90, 1300, 500);
    l3.setBackground(Color.green);
    l3.setFont(ft2);

    b1 = new JButton("Go !");
    b1.setBounds(300, 220, 120, 30);
    b1.setBackground(Color.white);
    b1.setForeground(Color.blue);
    b1.setFont(ft2);

    b2 = new JButton("Go");
    b2.setBounds(300, 240, 120, 30);
    b2.setBackground(Color.white);
    b2.setForeground(Color.blue);
    b2.setFont(ft2);

    f1.add(l);
    l.add(l1);
    l2.add(b1);
    l.add(l2);
    l3.add(b2);
    l.add(l3);

    b1.addActionListener(this);
    b2.addActionListener(this);

    f1.setVisible(true);
    f1.setSize(1800, 800);
  }
Ejemplo n.º 2
0
 @Override
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   int row1 = shortcutTable.convertRowIndexToModel(row);
   Shortcut sc = (Shortcut) model.getValueAt(row1, -1);
   if (sc == null) return null;
   JLabel label =
       (JLabel)
           super.getTableCellRendererComponent(
               table,
               name ? sc.getLongText() : sc.getKeyText(),
               isSelected,
               hasFocus,
               row,
               column);
   label.setBackground(Main.pref.getUIColor("Table.background"));
   if (isSelected) {
     label.setForeground(Main.pref.getUIColor("Table.foreground"));
   }
   if (sc.getAssignedUser()) {
     label.setBackground(
         Main.pref.getColor(marktr("Shortcut Background: User"), new Color(200, 255, 200)));
   } else if (!sc.getAssignedDefault()) {
     label.setBackground(
         Main.pref.getColor(marktr("Shortcut Background: Modified"), new Color(255, 255, 200)));
   }
   return label;
 }
Ejemplo n.º 3
0
  @Override
  public Component getTableCellRendererComponent(
      JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    textLabel.setFont(table.getFont());
    textLabel.setText(Objects.toString(value, ""));
    textLabel.setBorder(hasFocus ? focusCellHighlightBorder : noFocusBorder);

    FontMetrics fm = table.getFontMetrics(table.getFont());
    Insets i = textLabel.getInsets();
    int swidth =
        iconLabel.getPreferredSize().width + fm.stringWidth(textLabel.getText()) + i.left + i.right;
    int cwidth = table.getColumnModel().getColumn(column).getWidth();
    dim.width = swidth > cwidth ? cwidth : swidth;

    if (isSelected) {
      textLabel.setOpaque(true);
      textLabel.setForeground(table.getSelectionForeground());
      textLabel.setBackground(table.getSelectionBackground());
      iconLabel.setIcon(sicon);
    } else {
      textLabel.setOpaque(false);
      textLabel.setForeground(table.getForeground());
      textLabel.setBackground(table.getBackground());
      iconLabel.setIcon(nicon);
    }
    return panel;
  }
Ejemplo n.º 4
0
  /**
   * Updates the progress bar.
   *
   * @param percent must be between 0 and 100
   */
  private void progress(int percent) {
    // Ensure limits
    percent = Math.max(0, percent);
    percent = Math.min(100, percent);

    double p = percent / 100.;

    int r, g;
    if (p < .5) {
      r = 255;
      g = (int) (255 * 2 * p);
    } else {
      r = 255 - (int) (255 * 2 * (p - .5));
      g = 255;
    }
    Color color = new Color(r, g, 0);
    progLabel.setBackground(color);

    if (this.xmasEgg) {
      splashLabel.setBackground(new Color(r, g, 0));
      try {
        Thread.sleep(400);
      } catch (InterruptedException ex) {
      }
    }
  }
Ejemplo n.º 5
0
 private void sendRequest(BlockPdu pdu) {
   setButton.setEnabled(false);
   getButton.setEnabled(false);
   getNextButton.setEnabled(false);
   lmessage.setText("Sending request ..");
   lmessage.setBackground(Color.white);
   try {
     varbind var = pdu.getResponseVariableBinding();
     AsnObjectId oid = var.getOid();
     AsnObject res = var.getValue();
     if (res != null) {
       toid.setText(oid.toString());
       tvalue.setText(res.toString());
       lmessage.setText("Received aswer ");
       lmessage.setBackground(Color.white);
     } else {
       lmessage.setText("Received no aswer ");
       lmessage.setBackground(Color.red);
     }
   } catch (PduException exc) {
     lmessage.setText("PduException: " + exc.getMessage());
     lmessage.setBackground(Color.red);
     exc.printStackTrace();
   } catch (java.io.IOException exc) {
     lmessage.setText("IOException: " + exc.getMessage());
     lmessage.setBackground(Color.red);
     exc.printStackTrace();
   }
   setButton.setEnabled(true);
   getButton.setEnabled(true);
   getNextButton.setEnabled(true);
 }
Ejemplo n.º 6
0
 @Override
 public Component getListCellRendererComponent(
     final JList list,
     final Object value,
     final int index,
     final boolean isSelected,
     final boolean cellHasFocus) {
   final JLabel comp =
       (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
   if (value instanceof Competitor) {
     final boolean groupSaved =
         MultiCompetitorGroupList.this
             .getCompetitorGroups()
             .get(MultiCompetitorGroupList.this.getListIndexOfCompetitor((Competitor) value))
             .isSavedForAnotherWeighing();
     if (groupSaved) {
       comp.setBackground(Color.LIGHT_GRAY);
       comp.setForeground(Color.GRAY);
       comp.setFont(comp.getFont().deriveFont(Font.ITALIC));
     } else {
       comp.setBackground(
           MultiListUtilities.getBackListColor(
               MultiCompetitorGroupList.this.getListIndexOfCompetitor((Competitor) value)));
       comp.setForeground(Color.BLACK);
       comp.setFont(comp.getFont().deriveFont(Font.PLAIN));
     }
   }
   return comp;
 }
Ejemplo n.º 7
0
  public TestPanel3() {

    super();

    contentPanel = getContentPanel();
    ImageIcon icon = getImageIcon();

    titlePanel = new javax.swing.JPanel();
    textLabel = new javax.swing.JLabel();
    iconLabel = new javax.swing.JLabel();
    separator = new javax.swing.JSeparator();

    setLayout(new java.awt.BorderLayout());

    titlePanel.setLayout(new java.awt.BorderLayout());
    titlePanel.setBackground(Color.gray);

    textLabel.setBackground(Color.gray);
    textLabel.setFont(new Font("MS Sans Serif", Font.BOLD, 14));
    textLabel.setText("Pretending To Connect To Server");
    textLabel.setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
    textLabel.setOpaque(true);

    iconLabel.setBackground(Color.gray);
    if (icon != null) iconLabel.setIcon(icon);

    titlePanel.add(textLabel, BorderLayout.CENTER);
    titlePanel.add(iconLabel, BorderLayout.EAST);
    titlePanel.add(separator, BorderLayout.SOUTH);

    add(titlePanel, BorderLayout.NORTH);
    JPanel secondaryPanel = new JPanel();
    secondaryPanel.add(contentPanel, BorderLayout.NORTH);
    add(secondaryPanel, BorderLayout.WEST);
  }
Ejemplo n.º 8
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);
 }
Ejemplo n.º 9
0
 public void setEnabled(boolean enabled) {
   super.setEnabled(enabled);
   if (myToggleHistoryLabel != null) {
     final Color bg = enabled ? UIUtil.getTextFieldBackground() : UIUtil.getPanelBackground();
     myToggleHistoryLabel.setBackground(bg);
     myClearFieldLabel.setBackground(bg);
   }
 }
Ejemplo n.º 10
0
  public void init() {
    this.setPreferredSize(new Dimension(500, 500));
    this.setMinimumSize(new Dimension(500, 500));

    this.setLocationRelativeTo(null);
    this.setUndecorated(true);

    this.pack();
    this.toFront();
    this.setLayout(new GridLayout(2, 1, 0, 0));

    panelSuperior = new JPanel(new GridLayout(4, 1, 0, 0));

    usuario = new JLabel(accion);
    usuario.setHorizontalAlignment(JLabel.CENTER);
    usuario.setFont(new Font("Arial", 0, 20));
    usuario.setOpaque(true);
    usuario.setBackground(Color.BLACK);
    usuario.setForeground(Color.white);

    this.cargo = new JLabel("SESION " + puesto);
    cargo.setHorizontalAlignment(JLabel.CENTER);
    cargo.setFont(new Font("Arial", 0, 36));
    cargo.setOpaque(true);
    cargo.setBackground(Color.BLACK);
    cargo.setForeground(Color.white);

    this.cargo = new JLabel("CARGO");
    cargo.setHorizontalAlignment(JLabel.CENTER);
    cargo.setFont(new Font("Arial", 0, 36));
    cargo.setOpaque(true);
    cargo.setBackground(Color.BLACK);
    cargo.setForeground(Color.white);

    this.usuarioIn = new JTextField();
    usuarioIn.setEditable(false);
    usuarioIn.setFont(new Font("Arial", 0, 36));
    usuarioIn.setOpaque(true);
    usuarioIn.setBackground(Color.GREEN);
    usuarioIn.setText("");

    String[] puestos = {"Cajero", "Supervisor", "Gerente", "Admin"};
    cargoIn = new JComboBox<>(puestos);
    cargoIn.setFont(new Font("Arial", 0, 20));

    this.teclado = new TecladoPass();

    this.panelSuperior.add(cargo);
    this.panelSuperior.add(usuario);
    this.panelSuperior.add(usuarioIn);
    this.panelSuperior.add(cargo);
    this.panelSuperior.add(cargoIn);
    this.add(panelSuperior);
    this.add(teclado);

    this.setVisible(true);
  }
Ejemplo n.º 11
0
  public Component getTreeCellRendererComponent(
      JTree tree,
      Object value,
      boolean selected,
      boolean expanded,
      boolean leaf,
      int row,
      boolean hasFocus) {
    jl.setFont(tree.getFont());

    /*
     * Icons are *important*; this is (obviously) wholly inadequate ATM.
     * Individual programs should have their own icons, where possible
     * (ideally, favicons from main site pages). Seasons
     * could use Apple-alias-style derived icons, or something.
     */

    if (leaf) {
      jl.setIcon(UIManager.getIcon("Tree.leafIcon"));
    } else if (expanded) {
      jl.setIcon(UIManager.getIcon("Tree.openIcon"));
    } else {
      jl.setIcon(UIManager.getIcon("Tree.closedIcon"));
    }

    //        this.value = value.toString();
    jl.setText(value.toString());
    jl.setForeground(Color.BLACK);

    Checkable c = (Checkable) value;

    this.implicit = c.implicit;
    this.selected = c.isSelected();

    if (c instanceof EpisodeTreeNode) {
      EpisodeTreeNode n = (EpisodeTreeNode) c;
      if (n.icon != null) jl.setIcon(n.icon);
    }

    if (c.isLocal) {
      jl.setFont(jl.getFont().deriveFont(Font.BOLD));
    }

    if (c.isPartiallyLocal) {
      jl.setForeground(Color.BLUE);
    } else if (selected) {
      jl.setForeground(UIManager.getColor("Tree.selectionForeground"));
    }

    if (selected) {
      jl.setBackground(UIManager.getColor("Tree.selectionBackground"));
    } else {
      jl.setBackground(UIManager.getColor("Tree.textBackground"));
    }

    return this;
  }
Ejemplo n.º 12
0
  public AchievementPanel(String t, String desc, String imagePath, String status)
      throws IOException {
    setLayout(new FlowLayout(FlowLayout.LEFT));
    setBackground(new Color(30, 30, 30));
    // imageURL = new URL(imagePath);
    LineBorder border;
    if (status.equalsIgnoreCase("yes")) {
      unlocked = true;
      // (Color color, int thickness, boolean roundedCorner)
      border = new LineBorder(Color.GREEN, 1);
    } else {
      unlocked = false;
      border = new LineBorder(Color.RED, 1);
    }

    ImageIcon icon = new ImageIcon(imagePath);
    img = new JLabel();

    right = new JPanel();
    right.setBackground(new Color(30, 30, 30));

    title = new JLabel();
    title.setBackground(Color.BLACK);
    title.setForeground(Color.WHITE);

    String html1 = "<html><body style='width: ";
    String html2 = "px'>";

    description = new JLabel(html1 + "450" + html2 + desc);
    description.setBackground(Color.BLACK);
    description.setForeground(Color.GRAY);
    //

    //        JTextPane achievementInfo = new JTextPane();
    //        achievementInfo.setText("<html>"+t + "<br>" + desc+"</html>");

    img.setIcon(icon);
    img.setBorder(border);
    title.setText(t);
    //   description.setText(desc);

    //   img.setBounds(5, 5, 64, 64);

    this.add(img);
    //        right.add(achievementInfo);
    right.add(title);
    right.add(description);
    this.add(right);
    right.setLayout(new BoxLayout(right, BoxLayout.Y_AXIS));

    Dimension d = new Dimension(725, 80);
    this.setPreferredSize(d);
    this.setMinimumSize(d);
    this.setMaximumSize(d);
  }
Ejemplo n.º 13
0
  public NouveauPanel() {
    trouve = false;
    nbLettre = 0;
    pendu = 0;
    points = 100;

    panel.setBackground(Color.white);
    panel.setLayout(new BorderLayout());

    // Affichage du titre
    JLabel titre = new JLabel("A vous de jouer\n");
    titre.setHorizontalAlignment(JLabel.CENTER);
    titre.setBackground(Color.white);
    titre.setFont(new Font("Comics Sans MS", Font.BOLD, 20));
    panel.add(titre, BorderLayout.NORTH);

    initMot();

    // Affichage du mot a trouver
    motSecret.setText(mot_masq);
    motSecret.setHorizontalAlignment(JLabel.CENTER);
    motSecret.setBackground(Color.white);
    motSecret.setFont(new Font("Comics Sans MS", Font.BOLD, 20));
    panel.add(motSecret, BorderLayout.EAST);

    // Affichage image
    // Le "/" car à la racine du jar
    imagePanel.add(new JLabel(new ImageIcon(getClass().getResource("/pendu0.jpg"))));
    imagePanel.setBackground(Color.white);
    panel.add(imagePanel, BorderLayout.CENTER);

    // Affichage des boutons
    JPanel boutonsPanel = new JPanel();
    boutonsPanel.setBackground(Color.white);
    boutonsPanel.setLayout(new GridLayout(7, 3, 10, 10));
    boutonsPanel.setSize(150, 200);
    boutonsPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    for (int i = 0; i < lettres.length; i++) {
      tab_button[i] = new JButton(lettres[i].toUpperCase());
      boutonsPanel.add(tab_button[i]);
      tab_button[i].addActionListener(new LettreListener());
      tab_button[i].setPreferredSize(new Dimension(50, 30));
    }
    panel.add(boutonsPanel, BorderLayout.WEST);

    // Affichage du score
    score.setText("Vous avez 7 tentatives");
    score.setBackground(Color.white);
    score.setFont(new Font("Comics Sans MS", Font.BOLD, 20));
    panel.add(score, BorderLayout.SOUTH);
  }
Ejemplo n.º 14
0
 @Override
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean selected, boolean focused, int row, int column) {
   JLabel lbl = new JLabel();
   lbl.setText(value.toString());
   lbl.setOpaque(true);
   lbl.setBackground(Color.white);
   if (selected) {
     lbl.setBackground(new java.awt.Color(237, 234, 234));
     lbl.setForeground(new java.awt.Color(255, 255, 255));
   }
   return lbl;
 }
  public Semaforo() {

    setTitle("Tela Exemplo");
    setBounds(200, 120, 700, 600);

    setLayout(null);
    Container cnt = getContentPane();

    // Color fundoPagina = new Color ( 0x15984117 );
    cnt.setBackground(Color.WHITE);

    // --[ Adicionando elementos: JLabel ]---------------------------------\\
    // Passo 1: criar o elemento
    JLabel l = new JLabel("FEEVALE - Prog Para Internet II");
    // Passo 2: estabelecer posição e tamanho (sómente se não for utilizado um gerenciador de
    // layout)
    l.setBounds(0, 0, 700, 55);
    // Passo 3: adicionar o elemento ao container.
    cnt.add(l);

    JLabel l2 = new JLabel("Semáforo");
    // Passo 2: estabelecer posição e tamanho (sómente se não for utilizado um gerenciador de
    // layout)
    l2.setBounds(0, 55, 700, 20);
    // Passo 3: adicionar o elemento ao container.
    cnt.add(l2);

    // --[ Alterando cores e fontes ]--------------------------------------\\
    // Color cor = new Color( 0x1677721 );			Cor da letra.
    Color corFundo = new Color(0x6323595); // Cor da caixa ao redor das palavras.
    Color corFundo2 = new Color(0x15527921);

    l.setForeground(Color.WHITE);
    l.setBackground(corFundo);
    l.setOpaque(true);
    l.setHorizontalAlignment(JLabel.CENTER);

    l2.setForeground(Color.WHITE);
    l2.setBackground(corFundo);
    l2.setOpaque(true);
    l2.setHorizontalAlignment(JLabel.CENTER);

    Font fonte = new Font("Tahoma", Font.PLAIN, 20);

    l.setFont(fonte);

    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setVisible(true);
    criaGauge();
    criaExibicaoImagens();
  }
Ejemplo n.º 16
0
    @Override
    public Component getListCellRendererComponent(
        JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
      String s = (String) value;
      if (!s.startsWith("All")) value = driver.curDiag.filterOptions[0];

      JLabel c =
          (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

      if (isSelected) c.setBackground(lightBlue);
      else c.setBackground(vLightBlue);

      return c;
    }
 @Override
 public Component getListCellRendererComponent(
     JList<? extends Pilote> list,
     Pilote value,
     int index,
     boolean isSelected,
     boolean cellHasFocus) {
   if (value != null) {
     JLabel lab = new JLabel(value.getNom() + " " + value.getPrenom());
     lab.setOpaque(true);
     if (index % 2 == 0) lab.setBackground(Color.MAGENTA);
     else lab.setBackground(Color.YELLOW);
     return lab;
   } else return new JLabel("");
 }
Ejemplo n.º 18
0
 /** Update Display with Connection info */
 public void setDisplay() {
   m_text.setText(getDisplay());
   if (m_value == null) return;
   //  Text
   if (m_value.isAppsServerOK(false) || m_value.isDatabaseOK()) {
     m_text.setForeground(AdempierePLAF.getTextColor_OK());
     setBackground(false);
     if (!m_value.isAppsServerOK(false))
       m_server.setBackground(AdempierePLAF.getFieldBackground_Error());
     if (!m_value.isDatabaseOK()) m_db.setBackground(AdempierePLAF.getFieldBackground_Error());
   } else {
     m_text.setForeground(AdempierePLAF.getTextColor_Issue());
     setBackground(true);
   }
 } //  setDisplay
  private void colorir(JPanel jpanel) {

    for (int i = 0; i < jpanel.getComponentCount(); i++) {
      if (jpanel.getComponent(i) instanceof JLabel) {
        JLabel label = ((JLabel) jpanel.getComponent(i));
        if (label.getText().equals("Concluido") || label.getText().equals("Finalizado")) {
          label.setBackground(Color.GREEN);
          label.setForeground(Color.WHITE);
        } else {
          label.setBackground(Color.RED);
          label.setForeground(Color.WHITE);
        }
      }
    }
  }
Ejemplo n.º 20
0
  private JPanel initComponents() {
    // pane with null layout
    JPanel contentPane = new JPanel(null);
    contentPane.setBackground(new Color(200, 200, 200));

    initButton1();
    initButton2();
    initButton3();
    initButton4();
    initButton5();
    initButton6();
    initButton7();
    initButton8();
    // initButton9();

    JLabel label1 = new JLabel();
    label1.setBounds(115, 45, 200, 50);
    label1.setBackground(new Color(214, 217, 223));
    label1.setForeground(new Color(0, 0, 0));
    label1.setEnabled(true);
    label1.setFont(new Font("SansSerif", 1, 20));
    label1.setText("MENU");
    label1.setVisible(true);

    JLabel label2 = new JLabel();
    label2.setBounds(125, 10, 50, 50);
    label2.setBackground(new Color(214, 217, 223));
    label2.setForeground(new Color(0, 0, 0));
    label2.setEnabled(true);
    label2.setFont(new Font("SansSerif", 1, 14));
    label2.setText("PT_SP");
    label2.setVisible(true);

    // adding components to contentPane panel
    contentPane.add(button1);
    contentPane.add(button2);
    contentPane.add(button3);
    contentPane.add(button4);
    contentPane.add(button5);
    contentPane.add(button6);
    contentPane.add(button7);
    contentPane.add(button8);
    // contentPane.add(button9);
    contentPane.add(label1);
    contentPane.add(label2);

    return contentPane;
  }
Ejemplo n.º 21
0
  private void createComponents() {
    SpringLayout springLayout = new SpringLayout();
    setLayout(springLayout);

    JLabel label = new JLabel();
    springLayout.putConstraint(SpringLayout.NORTH, label, 47, SpringLayout.NORTH, this);
    springLayout.putConstraint(SpringLayout.WEST, label, 10, SpringLayout.WEST, this);
    springLayout.putConstraint(SpringLayout.EAST, label, -10, SpringLayout.EAST, this);
    label.setText(Main.APP_NAME);
    label.setHorizontalAlignment(SwingConstants.CENTER);
    label.setFont(new Font("Tahoma", Font.PLAIN, 30));
    label.setBackground(Color.WHITE);
    add(label);

    JScrollPane scrollPane = new JScrollPane();
    springLayout.putConstraint(SpringLayout.NORTH, scrollPane, 6, SpringLayout.SOUTH, label);
    springLayout.putConstraint(SpringLayout.WEST, scrollPane, 10, SpringLayout.WEST, this);
    springLayout.putConstraint(SpringLayout.SOUTH, scrollPane, 206, SpringLayout.SOUTH, label);
    springLayout.putConstraint(SpringLayout.EAST, scrollPane, -10, SpringLayout.EAST, this);
    add(scrollPane);

    textArea = new JTextArea();
    textArea.setEditable(false);
    scrollPane.setViewportView(textArea);
  }
Ejemplo n.º 22
0
  private void initialize() {
    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    fileLabel = new JLabel(I18n.text("(no log loaded)"));
    fileLabel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
    fileLabel.setBackground(Color.white);
    fileLabel.setOpaque(true);
    filePanel.add(fileLabel, BorderLayout.CENTER);
    fileSelection = new JButton("...");
    fileSelection.setMargin(new Insets(1, 1, 1, 1));
    fileSelection.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            selectFile();
          }
        });
    filePanel.add(fileSelection, BorderLayout.EAST);
    filePanel.setMaximumSize(new Dimension(200, 25));
    add(filePanel);
    overlaysPanel = new JPanel();
    overlaysPanel.setLayout(new BoxLayout(overlaysPanel, BoxLayout.PAGE_AXIS));
    add(new JScrollPane(overlaysPanel));
  }
Ejemplo n.º 23
0
  public void setPrequelImage(int n) {

    switch (n) {
      case 0:
        removeComponents();
        removeAll();
        // labelImage.setIcon(null);
        // labelImage.setFont(new Font("Serif", Font.BOLD, 48));
        // labelImage.setForeground(Color.RED);
        // labelImage.setText(REPRODUCE);
        for (int i = 0; i < init.length; i++) add(init[i]);
        break;
      case 1:
        for (int i = 0; i < init.length; i++) init[i].removeAll();
        removeComponents();
        removeAll();
        setLayout(new GridBagLayout());
        labelImage.setBackground(this.getBackground());
        add(labelImage);
        break;
    }

    revalidate();
    repaint();
  }
Ejemplo n.º 24
0
 /** called by ImageRunnable */
 void onImageProcessing() {
   canvas = new JLabel();
   canvas.setBackground(Color.GREEN);
   canvas.repaint();
   removeAll();
   add(canvas);
 }
Ejemplo n.º 25
0
 @Override
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   label.setText("");
   label.setBorder(PropertyEditorTable.BORDER_RENDER);
   label.setForeground(table.getForeground());
   label.setBackground(table.getBackground());
   label.setFont(table.getFont().deriveFont(Font.PLAIN));
   if (isActivated() && (value instanceof SignalData)) {
     SignalData st = (SignalData) value;
     switch (column) {
       case COLUMN_SIGNAL:
         label.setText(st.name);
         label.setForeground(getTypeColor(st.type));
         break;
       case COLUMN_STATE:
         label.setText(st.value.toString());
         if (st.excited) {
           label.setFont(table.getFont().deriveFont(Font.BOLD));
         }
         break;
       default:
         break;
     }
   }
   return label;
 }
Ejemplo n.º 26
0
 private void fundoMouseClicked(java.awt.event.MouseEvent evt) {
   if (paletaDeCores.isPinturaAtivada()) {
     fundo.setBackground(paletaDeCores.getCorSelecionada());
     getContentPane().setComponentZOrder(fundo, getContentPane().getComponentCount() - 1);
     getContentPane().repaint();
   }
 }
  public LayeredPaneDemo2() {
    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));

    // Create and load the duke icon.
    final ImageIcon icon = createImageIcon("images/dukeWaveRed.gif");

    // Create and set up the layered pane.
    layeredPane = new JLayeredPane();
    layeredPane.setPreferredSize(new Dimension(300, 310));
    layeredPane.setBorder(BorderFactory.createTitledBorder("Move the Mouse to Move Duke"));
    layeredPane.addMouseMotionListener(this);

    // Add several labels to the layered pane.
    layeredPane.setLayout(new GridLayout(2, 3));
    for (int i = 0; i < layerStrings.length; i++) {
      JLabel label = createColoredLabel(layerStrings[i], layerColors[i]);
      layeredPane.add(label, new Integer(i));
    }

    // Create and add the Duke label to the layered pane.
    dukeLabel = new JLabel(icon);
    if (icon == null) {
      System.err.println("Duke icon not found; using black rectangle instead.");
      dukeLabel.setOpaque(true);
      dukeLabel.setBackground(Color.BLACK);
    }
    layeredPane.add(dukeLabel, new Integer(2), 0);

    // Add control pane and layered pane to this JPanel.
    add(Box.createRigidArea(new Dimension(0, 10)));
    add(createControlPanel());
    add(Box.createRigidArea(new Dimension(0, 10)));
    add(layeredPane);
  }
Ejemplo n.º 28
0
    @Override
    public Component getTableCellRendererComponent(
        JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
      //        //System.out.println(table.getModel().getClass().getSimpleName());
      Object tmp = table.getModel().getValueAt(row, 0);
      //        //System.out.println(Visualizer.findNode(tmp).getClass().getSimpleName());
      LabelSniffer ls = Visualizer.findNode(tmp).getLookup().lookup(LabelSniffer.class);
      try {
        if (ls != null) {
          //                    //System.out.println(actualCols[(column-1) * 2]);
          LabelProvider label;
          if ((label = ls.findLabelProvider(actualCols[(column - 1) * 2])) != null) {
            JLabel lab = label.getLabel();
            lab.setOpaque(isSelected);
            if (isSelected) {
              lab.setBackground(table.getSelectionBackground());
            }
            return label.getLabel();
          }
        }
      } catch (Exception ex) {
        ex.printStackTrace();
      }

      return new JLabel("tmp");
      //            //System.out.println("bez labela dla "+actualCols[(column-1) * 2]);
      //            Component comp = rend.getTableCellRendererComponent(table, value, isSelected,
      // hasFocus, row, column);
      //            return comp;
    }
Ejemplo n.º 29
0
  public void doIt() {
    mJFrame = new JFrame(mWindowName);
    mJFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Create the menu bar.
    mJMenuBarMain = new JMenuBar();
    mJMenuBarMain.setOpaque(true);
    mJMenuBarMain.setBackground(mMenuColor);
    mJMenuBarMain.setPreferredSize(new Dimension(X_WINDOW_SIZE, Y_MENU_SIZE));

    // Create main component
    mJMain = new JLabel();
    mJMain.setOpaque(true);
    mJMain.setBackground(mMainColor);
    mJMain.setPreferredSize(new Dimension(X_WINDOW_SIZE * 5, Y_WINDOW_SIZE * 150));

    JScrollPane scrollPane = new JScrollPane(mJMain);
    scrollPane.setPreferredSize(new Dimension(X_WINDOW_SIZE + 20, Y_WINDOW_SIZE + 20));

    // Set the menu bar and add the label to the content pane.
    mJFrame.setJMenuBar(mJMenuBarMain);
    mJFrame.getContentPane().add(scrollPane, BorderLayout.CENTER);
    mJFrame.setLocation(10, 10);

    // Display the window.
    mJFrame.pack();
    mJFrame.setVisible(true);
  }
Ejemplo n.º 30
0
 /** To highlight a message, call #warnUser. */
 private void setStatusBarTextHighlighted(boolean highlighted, Color color) {
   // Use #coordinateLabel rather than (unattached) dummy label because
   // dummy label's background does not change when L&F changes. [Jon
   // Aquino]
   messageLabel.setForeground(highlighted ? Color.black : coordinateLabel.getForeground());
   messageLabel.setBackground(highlighted ? color : coordinateLabel.getBackground());
 }