/**
   * Returns the border used by tool tips in this look and feel.
   *
   * @return The border.
   */
  public static Border getToolTipBorder() {

    Border border = UIManager.getBorder("ToolTip.border");

    if (border == null || isNimbusLookAndFeel()) {
      border = UIManager.getBorder("nimbusBorder");
      if (border == null) {
        border = BorderFactory.createLineBorder(SystemColor.controlDkShadow);
      }
    }

    return border;
  }
 protected void installDefaults() {
   Color defaultGridColor = UIManager.getColor("Table.gridColor");
   Color defaultForegroundColor = UIManager.getColor("Table.foreground");
   Color defaultBackgroundColor = UIManager.getColor("Table.background");
   Border defaultBorder = UIManager.getBorder("Table.scrollPaneBorder");
   Color defaultSelectionForeground = UIManager.getColor("Table.selectionForeground");
   Color defaultSelectionBackground = UIManager.getColor("Table.selectionBackground");
   Color defaultFocusCellForeground = UIManager.getColor("Table.focusCellForeground");
   Color defaultFocusCellBackground = new Color(153, 153, 204);
   Font defaultFont = UIManager.getFont("Table.font");
   Border defaultGridBorder = UIManager.getBorder("Table.border");
   InputMap inputMap = (InputMap) UIManager.get("Table.ancestorInputMap");
   if (!installed) {
     UIManager.getDefaults().put("Grid.gridColor", defaultGridColor);
     UIManager.getDefaults().put("Grid.foreground", defaultForegroundColor);
     UIManager.getDefaults().put("Grid.background", defaultBackgroundColor);
     UIManager.getDefaults().put("Grid.selectionForegroundColor", defaultSelectionForeground);
     UIManager.getDefaults().put("Grid.selectionBackgroundColor", defaultSelectionBackground);
     UIManager.getDefaults().put("Grid.focusForegroundColor", defaultFocusCellForeground);
     UIManager.getDefaults().put("Grid.focusBackgroundColor", defaultFocusCellBackground);
     UIManager.getDefaults().put("Grid.border", defaultGridBorder);
     UIManager.getDefaults().put("Grid.font", defaultFont);
     UIManager.getDefaults().put("Grid.scrollPaneBorder", defaultBorder);
     UIManager.getDefaults().put("Grid.ancestorInputMap", inputMap);
     installed = true;
   }
   Color foregroundColor = grid.getForeground();
   Color backgroundColor = grid.getBackground();
   Font font = grid.getFont();
   Border border = grid.getBorder();
   Color gridColor = grid.getGridColor();
   Color selectionForeground = grid.getSelectionForegroundColor();
   Color selectionBackground = grid.getSelectionBackgroundColor();
   Color focusForeground = grid.getFocusForegroundColor();
   Color focusBackground = grid.getFocusBackgroundColor();
   if (foregroundColor == null || foregroundColor instanceof UIResource)
     grid.setForeground(defaultForegroundColor);
   if (backgroundColor == null || backgroundColor instanceof UIResource)
     grid.setBackground(defaultBackgroundColor);
   if (font == null || font instanceof UIResource) grid.setFont(defaultFont);
   if (gridColor == null || gridColor instanceof UIResource) grid.setGridColor(defaultGridColor);
   if (border == null || border instanceof UIResource) grid.setBorder(defaultGridBorder);
   if (selectionForeground == null || selectionForeground instanceof UIResource)
     grid.setSelectionForegroundColor(defaultSelectionForeground);
   if (selectionBackground == null || selectionBackground instanceof UIResource)
     grid.setSelectionBackgroundColor(defaultSelectionBackground);
   if (focusForeground == null || focusForeground instanceof UIResource)
     grid.setFocusForegroundColor(defaultFocusCellForeground);
   if (focusBackground == null || focusBackground instanceof UIResource)
     grid.setFocusBackgroundColor(defaultFocusCellBackground);
 }
 /** Insere a borda padrão nos campos da janela */
 @Override
 public void inserirBordasPadrao() {
   verificacaoPanel.setBorder(
       new TitledBorder(
           UIManager.getBorder("TitledBorder.border"),
           "N\u00E3o Verificado",
           TitledBorder.LEADING,
           TitledBorder.TOP,
           null,
           new Color(0, 0, 255)));
   loginTextField.setBorder(UIManager.getBorder("TextField.border"));
   passwordField.setBorder(UIManager.getBorder("PasswordField.border"));
   rPasswordField.setBorder(UIManager.getBorder("PasswordField.border"));
 }
 @Override
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   if (isSelected) {
     setForeground(table.getSelectionForeground());
     setBackground(table.getSelectionBackground());
   } else {
     setForeground(table.getForeground());
     setBackground(table.getBackground());
   }
   setFont(table.getFont());
   if (hasFocus) {
     setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
     if (table.isCellEditable(row, column)) {
       setForeground(UIManager.getColor("Table.focusCellForeground"));
       setBackground(UIManager.getColor("Table.focusCellBackground"));
     }
   } else {
     setBorder(new EmptyBorder(1, 2, 1, 2));
   }
   if (value != null) {
     setText(value.toString());
   } else {
     setText("");
   }
   adjustRowHeight(table, row, column);
   return this;
 }
    public Component getTableCellRendererComponent(
        JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
      super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);

      // Inherit the colors and font from the header component
      if (bookTable_ != null) {
        JTableHeader header = bookTable_.getTableHeader();
        if (header != null) {
          setForeground(header.getForeground());
          setBackground(header.getBackground());
          setFont(header.getFont());
        }
      }

      if (value instanceof JLabel) {
        setIcon(((JLabel) value).getIcon());
        setText(((JLabel) value).getText());
      } else {
        setText((value == null) ? "" : value.toString());
        setIcon(null);
      }
      setBorder(UIManager.getBorder("TableHeader.cellBorder"));
      setHorizontalAlignment(JLabel.CENTER);
      return this;
    }
Exemple #6
0
  public void setMatrix(int size) {

    String title = size + "X" + size + " Matrix";
    panel_filter_content.setBorder(
        new TitledBorder(
            UIManager.getBorder("TitledBorder.border"),
            title,
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            new Color(0, 0, 0)));
    panel_matrix.removeAll();
    for (int y = 0; y < size; y++) {
      ArrayList<Matrix_Block> listBlockCol = new ArrayList<Matrix_Block>();

      for (int x = 0; x < size; x++) {
        Matrix_Block mb = new Matrix_Block();
        mb.setKeyListener(this);
        GridBagConstraints gbc_textField = new GridBagConstraints();
        gbc_textField.fill = GridBagConstraints.HORIZONTAL;
        gbc_textField.gridx = x;
        gbc_textField.gridy = y;
        gbc_textField.weightx = 30;
        gbc_textField.weighty = 30;
        listBlockCol.add(mb);
        panel_matrix.add(mb, gbc_textField);
      }
      listBlock.add(listBlockCol);
    }

    this.revalidate();
    this.repaint();
    cmb_image_filters.addActionListener(this);
  }
Exemple #7
0
  public TeamEntry(ITeam team, int relatedTeam) {
    setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
            },
            new RowSpec[] {
              FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
            }));
    setBorder(
        new CompoundBorder(
            UIManager.getBorder("TitledBorder.aquaVariant"), new EmptyBorder(0, 5, 0, 5)));
    {
      JLabel lblTeamname = new JLabel("TeamName");
      if (team != null) {
        this.team = team;
        lblTeamname.setText(team.getName());
      }

      lblTeamname.setFont(new Font("Lucida Grande", Font.PLAIN, 11));
      add(lblTeamname, "2, 2, right, default");
    }
    {
      comboBox = new JComboBox();
      comboBox.setFont(new Font("Lucida Grande", Font.PLAIN, 11));
      comboBox.setModel(new DefaultComboBoxModel(new String[] {"Red", "Yellow", "Green", "Blue"}));
      if (relatedTeam >= 0 && relatedTeam < 4) {
        comboBox.setSelectedIndex(relatedTeam);
      }
      add(comboBox, "4, 2, fill, default");
    }
  }
 public MyRenderComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
   super();
   this.table = table;
   this.col = col;
   if (value != null) {
     setText(value.toString());
   } else {
     setText("");
   }
   setOpaque(false);
   setFont(UIManager.getFont("TableHeader.font"));
   setForeground(UIManager.getColor("TableHeader.foreground"));
   setHorizontalAlignment(JLabel.CENTER);
   setHorizontalTextPosition(SwingConstants.LEADING);
   setBorder(UIManager.getBorder("TableHeader.cellBorder"));
   if ((JTattooUtilities.getJavaVersion() >= 1.6)
       && (UIManager.getLookAndFeel() instanceof AbstractLookAndFeel)) {
     RowSorter rowSorter = table == null ? null : table.getRowSorter();
     List keyList = rowSorter == null ? null : rowSorter.getSortKeys();
     if ((keyList != null) && (keyList.size() > 0)) {
       RowSorter.SortKey sortKey = (RowSorter.SortKey) keyList.get(0);
       if (sortKey.getColumn() == table.convertColumnIndexToModel(col)) {
         AbstractIconFactory iconFactory =
             ((AbstractLookAndFeel) UIManager.getLookAndFeel()).getIconFactory();
         if (sortKey.getSortOrder().equals(SortOrder.ASCENDING)) {
           setIcon(iconFactory.getUpArrowIcon());
         } else if (sortKey.getSortOrder().equals(SortOrder.DESCENDING)) {
           setIcon(iconFactory.getDownArrowIcon());
         }
       }
     }
   }
   gv = ColorHelper.getGrayValue(AbstractLookAndFeel.getTheme().getRolloverColor());
 }
  protected JComponent getPopupComponent() {
    if (entryPanel != null) return entryPanel;

    entryPanel = new JPanel(new GridBagLayout());
    entryPanel.setBorder(UIManager.getBorder("List.border"));
    entryPanel.setBackground(UIManager.getColor("List.background"));
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    c.gridwidth = GridBagConstraints.REMAINDER;

    entryList = new AutoCompleteList();
    JScrollPane entryScrollPane = new JScrollPane(entryList);
    entryScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    entryScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    entryPanel.add(entryScrollPane, c);

    Font origFont = getFont();
    Font newFont = origFont;
    if (OSUtils.isWindows()) {
      newFont = ThemeMediator.DIALOG_FONT.deriveFont(origFont.getSize2D());
    }
    entryList.setFont(newFont);

    return entryPanel;
  }
  public Component getTableCellRendererComponent(
      JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
    int index = -1;
    int direction = 0;

    if (table != null) {
      if (table.getModel() instanceof ISorterFilterTableModel) {
        ISorterFilterTableModel model = (ISorterFilterTableModel) table.getModel();
        index = table.convertColumnIndexToView(model.getSortColumn());
        direction = model.getSortDirection();
      }

      JTableHeader header = table.getTableHeader();
      if (header != null) {
        setForeground(header.getForeground());
        setBackground(header.getBackground());
        setFont(header.getFont());
      }
    }
    setIcon(
        col == index && direction != ISorterFilterTableModel.NONE
            ? new SortArrowIcon(direction)
            : null);
    setText((value == null) ? "" : value.toString());
    setBorder(UIManager.getBorder("TableHeader.cellBorder"));
    return this;
  }
    protected void setBorder(JComponent renderer, boolean hasFocus, boolean isSelected) {

      if (hasFocus) {
        Border border = null;
        if (isSelected) {
          border = UIManager.getBorder("Table.focusSelectedCellHighlightBorder");
        }
        if (border == null) {
          border = UIManager.getBorder("Table.focusCellHighlightBorder");
        }
        renderer.setBorder(border);

      } else {
        renderer.setBorder(noFocusBorder);
      }
    }
  /** TableCellRenderer implementation */
  public Component getTableCellRendererComponent(
      JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    // Try to set default fore- and background colors
    if (table != null) {
      JTableHeader header = table.getTableHeader();
      if (header != null) {
        setForeground(header.getForeground());
        setBackground(header.getBackground());
        setFont(header.getFont());
        AbstractTableModel model = (AbstractTableModel) table.getModel();

        column = table.convertColumnIndexToModel(column);
        setText(model.getColumnName(column));
        // set normal border
        setBorder(javax.swing.UIManager.getBorder("TableHeader.cellBorder"));

        if (m_sortmode == SortMode.ASCENDING) setIcon(m_upimage);
        else if (m_sortmode == SortMode.DESCENDING) setIcon(m_downimage);
        else
          // if NONE
          setIcon(m_emptyheaderimage);
      }
    }
    return this;
  }
  public FileNameRenderer(JTable table) {
    Border b = UIManager.getBorder("Table.noFocusBorder");
    if (Objects.isNull(b)) { // Nimbus???
      Insets i = focusCellHighlightBorder.getBorderInsets(textLabel);
      b = BorderFactory.createEmptyBorder(i.top, i.left, i.bottom, i.right);
    }
    noFocusBorder = b;

    p.setOpaque(false);
    panel.setOpaque(false);

    // http://www.icongalore.com/ XP Style Icons - Windows Application Icon, Software XP Icons
    nicon = new ImageIcon(getClass().getResource("wi0063-16.png"));
    sicon =
        new ImageIcon(
            p.createImage(
                new FilteredImageSource(nicon.getImage().getSource(), new SelectedImageFilter())));

    iconLabel = new JLabel(nicon);
    iconLabel.setBorder(BorderFactory.createEmptyBorder());

    p.add(iconLabel, BorderLayout.WEST);
    p.add(textLabel);
    panel.add(p, BorderLayout.WEST);

    Dimension d = iconLabel.getPreferredSize();
    dim.setSize(d);
    table.setRowHeight(d.height);
  }
Exemple #14
0
  private void init() {
    isExperimentalSheet = UIManager.getBoolean("Sheet.experimentalSheet");

    if (getOwner() != null && isShowAsSheet()) {
      if (isNativeSheetSupported()) {
        // J2SE 7 requires that we set undecorated to true.
        setUndecorated(true);
        getRootPane().putClientProperty("apple.awt.documentModalSheet", Boolean.TRUE);
      } else if (isExperimentalSheet()) {
        setUndecorated(true);
      } else {
        setUndecorated(true);
        getRootPane().setWindowDecorationStyle(JRootPane.NONE);
        getRootPane().setBorder(UIManager.getBorder("Sheet.border"));
      }
      if (isDocumentModalitySupported()) {
        Methods.invokeIfExistsWithEnum(
            this, "setModalityType", "java.awt.Dialog$ModalityType", "DOCUMENT_MODAL");
      }
    }

    // We move the sheet when the user moves the owner, so that it
    // will always stay centered below the title bar of the owner.
    // If the user has moved the owner, we 'forget' the shift back location,
    // and don't shift the owner back to the place it was, when we opened
    // the sheet.
    ownerMovementHandler =
        new ComponentAdapter() {

          @Override
          public void componentMoved(ComponentEvent evt) {
            Window owner = getOwner();
            Point newLocation = owner.getLocation();
            if (!newLocation.equals(oldLocation)) {
              setLocation(
                  newLocation.x + (owner.getWidth() - getWidth()) / 2,
                  newLocation.y + owner.getInsets().top);
              shiftBackLocation = null;
              oldLocation = newLocation;
            }
          }
        };

    // If the sheet is experimental, we need some special handling
    // so that the JSheet is handled correctly
    windowEventHandler =
        new WindowAdapter() {
          // public void windowIconified(WindowEvent e) {
          // TODO The sheet is reshown when the parent window is iconified.
          // setVisible(false) on the sheet only deiconifies the owner window.
          // }

          @Override
          public void windowActivated(WindowEvent e) {
            if (JSheet.this.isVisible() && JSheet.this.getOwner() == e.getWindow())
              JSheet.this.toFront();
          }
        };
  }
 /**
  * Creates the default renderer that will be used in a non-editiable combo box. A default renderer
  * will used only if a renderer has not been explicitly set with <code>setRenderer</code>.
  *
  * <p>This method differs from the superclass implementation in that it uses an empty border with
  * wider left and right margins of 2 pixels instead of 1.
  *
  * @return a <code>ListCellRender</code> used for the combo box
  * @see javax.swing.JComboBox#setRenderer
  */
 protected ListCellRenderer createRenderer() {
   if (tableCellEditor) {
     return super.createRenderer();
   }
   BasicComboBoxRenderer renderer = new BasicComboBoxRenderer.UIResource();
   renderer.setBorder(UIManager.getBorder("ComboBox.rendererBorder"));
   return renderer;
 }
 /**
  * Constructs with the specified initial table
  *
  * @param table the instance of JTable
  */
 public RowHeaderTableCellRenderer(JTable table) {
   header = table.getTableHeader();
   setOpaque(true);
   setBorder(UIManager.getBorder("TableHeader.cellBorder"));
   // setHorizontalAlignment(CENTER);
   setForeground(header.getForeground());
   setBackground(header.getBackground());
   setFont(header.getFont());
 }
  private void initPanelVisualizacion() {
    panelVisualizacion = new JPanel();
    panelVisualizacion.setBorder(
        new TitledBorder(
            UIManager.getBorder("TitledBorder.border"),
            "Visualizacion",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            new Color(0, 0, 0)));
    GridBagConstraints gbc_panelVisualizacion = new GridBagConstraints();
    gbc_panelVisualizacion.fill = GridBagConstraints.BOTH;
    gbc_panelVisualizacion.insets = new Insets(5, 5, 0, 5);
    gbc_panelVisualizacion.gridx = 0;
    gbc_panelVisualizacion.gridy = 3;
    panelOpciones.add(panelVisualizacion, gbc_panelVisualizacion);
    GridBagLayout gbl_panelVisualizacion = new GridBagLayout();
    gbl_panelVisualizacion.columnWidths = new int[] {48, 0};
    gbl_panelVisualizacion.rowHeights = new int[] {29, 0, 0};
    gbl_panelVisualizacion.columnWeights = new double[] {1.0, Double.MIN_VALUE};
    gbl_panelVisualizacion.rowWeights = new double[] {0.0, 0.0, Double.MIN_VALUE};
    panelVisualizacion.setLayout(gbl_panelVisualizacion);

    comboVista = new JComboBox();
    GridBagConstraints gbc_comboVista = new GridBagConstraints();
    gbc_comboVista.fill = GridBagConstraints.HORIZONTAL;
    gbc_comboVista.insets = new Insets(5, 5, 5, 5);
    gbc_comboVista.gridx = 0;
    gbc_comboVista.gridy = 0;
    panelVisualizacion.add(comboVista, gbc_comboVista);
    comboVista.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent item) {
            if (item.getStateChange() == ItemEvent.SELECTED) {
              actualizarVista();
            }
          }
        });
    comboVista.setModel(
        new DefaultComboBoxModel(new String[] {"Puntos", "Triangulacion", "Solido"}));
    comboVista.setSelectedIndex(2);
    comboVista.setToolTipText("Modo de Visualizacion");

    chckbxBackfaceCulling = new JCheckBox("Backface Culling");
    chckbxBackfaceCulling.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent item) {
            panelImagen.setBackfaceCulling(item.getStateChange() == ItemEvent.SELECTED);
          }
        });
    GridBagConstraints gbc_chckbxBackfaceCulling = new GridBagConstraints();
    gbc_chckbxBackfaceCulling.anchor = GridBagConstraints.WEST;
    gbc_chckbxBackfaceCulling.insets = new Insets(0, 10, 0, 0);
    gbc_chckbxBackfaceCulling.gridx = 0;
    gbc_chckbxBackfaceCulling.gridy = 1;
    panelVisualizacion.add(chckbxBackfaceCulling, gbc_chckbxBackfaceCulling);
  }
 /** 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);
 }
 public SortedTableHeaderRenderer(TableSorter sorter) {
   this.m_sorter = sorter;
   setOpaque(true);
   setForeground(UIManager.getColor("TableHeader.foreground"));
   setBackground(UIManager.getColor("TableHeader.background"));
   setBorder(UIManager.getBorder("TableHeader.cellBorder"));
   setFont(UIManager.getFont("TableHeader.font"));
   setHorizontalTextPosition(SwingConstants.LEFT);
   this.setIconTextGap(2);
 }
 public WrappableJLabel(double width) {
   setWrapStyleWord(true);
   setLineWrap(true);
   setOpaque(false);
   setEditable(false);
   setFocusable(false);
   setBackground(UIManager.getColor("Label.background"));
   setFont(UIManager.getFont("Label.font"));
   setBorder(UIManager.getBorder("Label.border"));
 }
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   final Component rendererComponent =
       super.getTableCellRendererComponent(table, value, hasFocus, false, row, column);
   if (hasFocus) {
     setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
   }
   zoom = ((AttributeTable) table).getZoom();
   return rendererComponent;
 }
  public Component getTableCellRendererComponent(
      ScreenView screenView,
      Object value,
      boolean isSelected,
      boolean hasFocus,
      int row,
      int column) {

    /*
     * Since the renderer is reusable, we must reinitialize it each time.
     */
    if (isSelected) {
      setForeground(screenView.getSelectionForeground());
      setBackground(screenView.getSelectionBackground());
    } else {
      setForeground(screenView.getForeground());
      setBackground(screenView.getBackground());
      // setBackground(Color.white);
    }

    setFont(screenView.getFont());

    if (hasFocus) {
      setBorder(UIManager.getBorder("Table.focusCellHighlightBorder")); // NOT
      // LOCALIZABLE
      if (screenView.isCellEditable(row, column)) {
        setForeground(UIManager.getColor("Table.focusCellForeground")); // NOT
        // LOCALIZABLE
        setBackground(UIManager.getColor("Table.focusCellBackground")); // NOT
        // LOCALIZABLE
      }
    } else {
      setBorder(noFocusBorder);
    }

    setIcon(null);
    setText("");
    setToolTipText(null);

    setValue(screenView, row, column, value);

    ScreenModel model = screenView.getModel();
    if (model instanceof DbDescriptionModel) {
      setEnabled(((DbDescriptionModel) model).isEditable(row));
    } else if (model instanceof DbListModel) {
      DbListModel dblm = (DbListModel) model;
      boolean editable = dblm.isCellEditable(row, column);
      boolean enabled = dblm.isCellEnabled(row, column);
      if (!enabled) {
        int i = 0;
      } else if (editable) setEnabled(editable);
    } else setEnabled(true);

    return this;
  }
  private void initPanelPosicion() {
    panelPosicion = new JPanel();
    panelPosicion.setBorder(
        new TitledBorder(
            UIManager.getBorder("TitledBorder.border"),
            "Posicion",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            new Color(0, 0, 0)));
    GridBagConstraints gbc_panelPosicion = new GridBagConstraints();
    gbc_panelPosicion.insets = new Insets(5, 5, 5, 5);
    gbc_panelPosicion.fill = GridBagConstraints.BOTH;
    gbc_panelPosicion.gridx = 0;
    gbc_panelPosicion.gridy = 5;
    panelOpciones.add(panelPosicion, gbc_panelPosicion);
    GridBagLayout gbl_panelPosicion = new GridBagLayout();
    gbl_panelPosicion.columnWidths = new int[] {48, 0, 0};
    gbl_panelPosicion.rowHeights = new int[] {0, 0, 0};
    gbl_panelPosicion.columnWeights = new double[] {1.0, 1.0, Double.MIN_VALUE};
    gbl_panelPosicion.rowWeights = new double[] {0.0, 0.0, Double.MIN_VALUE};
    panelPosicion.setLayout(gbl_panelPosicion);

    lblPosicionX = new JLabel("Posicion X:");
    GridBagConstraints gbc_lblPosicionX = new GridBagConstraints();
    gbc_lblPosicionX.anchor = GridBagConstraints.EAST;
    gbc_lblPosicionX.insets = new Insets(0, 0, 5, 5);
    gbc_lblPosicionX.gridx = 0;
    gbc_lblPosicionX.gridy = 0;
    panelPosicion.add(lblPosicionX, gbc_lblPosicionX);

    labelPosX = new JLabel("");
    GridBagConstraints gbc_labelPosX = new GridBagConstraints();
    gbc_labelPosX.anchor = GridBagConstraints.WEST;
    gbc_labelPosX.insets = new Insets(0, 0, 5, 0);
    gbc_labelPosX.gridx = 1;
    gbc_labelPosX.gridy = 0;
    panelPosicion.add(labelPosX, gbc_labelPosX);

    lblPosicionY = new JLabel("Posicion Y:");
    GridBagConstraints gbc_lblPosicionY = new GridBagConstraints();
    gbc_lblPosicionY.anchor = GridBagConstraints.EAST;
    gbc_lblPosicionY.insets = new Insets(0, 0, 0, 5);
    gbc_lblPosicionY.gridx = 0;
    gbc_lblPosicionY.gridy = 1;
    panelPosicion.add(lblPosicionY, gbc_lblPosicionY);

    lblPosY = new JLabel("");
    GridBagConstraints gbc_lblPosY = new GridBagConstraints();
    gbc_lblPosY.anchor = GridBagConstraints.WEST;
    gbc_lblPosY.gridx = 1;
    gbc_lblPosY.gridy = 1;
    panelPosicion.add(lblPosY, gbc_lblPosY);
  }
  public Component getListCellRendererComponent(
      JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    if (index == -1) {
      Component comp =
          cellRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
      return comp;
    }
    getTableListCellRendererModel().setRow(index);

    setComponentOrientation(list.getComponentOrientation());
    if (isSelected) {
      setBackground(list.getSelectionBackground());
      setForeground(list.getSelectionForeground());
    } else {
      setBackground(list.getBackground());
      setForeground(list.getForeground());
    }

    setEnabled(list.isEnabled());
    setFont(list.getFont());

    Border border = null;
    if (cellHasFocus) {
      if (isSelected) {
        border = UIManager.getBorder("List.focusSelectedCellHighlightBorder");
      }
      if (border == null) {
        border = UIManager.getBorder("List.focusCellHighlightBorder");
      }
    } else {
      border = getNoFocusBorder();
    }
    setBorder(border);

    if (index == 0) {
      headerPanel.add(this);
      return headerPanel;
    }

    return this;
  }
Exemple #25
0
 public TextBox(String text, int rows, int columns) {
   super(rows, columns);
   setBackground(UIManager.getColor("Label.background"));
   setForeground(UIManager.getColor("Label.foreground"));
   setBorder(UIManager.getBorder("Label.border"));
   setFont(UIManager.getFont("TextField.font"));
   setOpaque(false);
   setWrapStyleWord(true);
   setLineWrap(true);
   setEditable(false);
   setText(text);
 }
  private void initPanelLuzAmbiente() {
    panelLuzAmbiente = new JPanel();
    panelLuzAmbiente.setBorder(
        new TitledBorder(
            UIManager.getBorder("TitledBorder.border"),
            "Fuente de Luz",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            new Color(0, 0, 0)));
    GridBagConstraints gbc_panelLuzAmbiente = new GridBagConstraints();
    gbc_panelLuzAmbiente.fill = GridBagConstraints.BOTH;
    gbc_panelLuzAmbiente.insets = new Insets(5, 5, 0, 5);
    gbc_panelLuzAmbiente.gridx = 0;
    gbc_panelLuzAmbiente.gridy = 1;
    panelOpciones.add(panelLuzAmbiente, gbc_panelLuzAmbiente);
    GridBagLayout gbl_panelLuzAmbiente = new GridBagLayout();
    gbl_panelLuzAmbiente.columnWidths = new int[] {48, 0};
    gbl_panelLuzAmbiente.rowHeights = new int[] {0, 0, 0, 0};
    gbl_panelLuzAmbiente.columnWeights = new double[] {1.0, Double.MIN_VALUE};
    gbl_panelLuzAmbiente.rowWeights = new double[] {0.0, 1.0, 1.0, Double.MIN_VALUE};
    panelLuzAmbiente.setLayout(gbl_panelLuzAmbiente);

    comboLuz = new JComboBox();
    comboLuz.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent item) {
            if (item.getStateChange() == ItemEvent.SELECTED) {
              actualizarLuz();
            }
          }
        });
    comboLuz.setModel(
        new DefaultComboBoxModel(
            new String[] {
              "Lateral Izquierda",
              "Lateral Derecha",
              "Cenital",
              "Contrapicado",
              "Frontal",
              "Contraluz",
              "Semi-lateral",
              "Semi-contraluz"
            }));
    comboLuz.setSelectedIndex(0);
    GridBagConstraints gbc_comboLuz = new GridBagConstraints();
    gbc_comboLuz.insets = new Insets(5, 5, 5, 5);
    gbc_comboLuz.fill = GridBagConstraints.HORIZONTAL;
    gbc_comboLuz.gridx = 0;
    gbc_comboLuz.gridy = 0;
    panelLuzAmbiente.add(comboLuz, gbc_comboLuz);
  }
Exemple #27
0
  public Component getListCellRendererComponent(
      JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    setText(value.toString());

    setBackground(isSelected ? list.getSelectionBackground() : list.getBackground());
    setForeground(isSelected ? list.getSelectionForeground() : list.getForeground());

    setFont(list.getFont());
    setBorder(
        (cellHasFocus) ? UIManager.getBorder("List.focusCellHighlightBorder") : m_noFocusBorder);

    return this;
  }
  /**
   * Verifica se os campos da janela foram preenchidos corretamente. Os campos errados recebem uma
   * borda vermelha
   *
   * @return <code>boolean</code> com <code>true</code> caso todos os campos tenham sido preenchidos
   *     corretamente, e <code>false</code> caso contrário
   */
  @Override
  public boolean validarCampos() {
    boolean valido = true;

    if (!validarLogin()) valido = false;

    if (ValidarDados.validarSenhaFunc(passwordField.getPassword())) {
      passwordField.setBorder(UIManager.getBorder("PasswordField.border"));

      if (!ValidarDados.validarSenhasIguais(
          passwordField.getPassword(), rPasswordField.getPassword())) {
        rPasswordField.setBorder(new LineBorder(Color.RED));
        valido = false;
      } else rPasswordField.setBorder(UIManager.getBorder("PasswordField.border"));
    } else {
      passwordField.setBorder(new LineBorder(Color.RED));
      rPasswordField.setBorder(UIManager.getBorder("PasswordField.border"));
      valido = false;
    }

    return valido;
  }
 protected void installDefaults() {
   String string = UIManager.getLookAndFeel().getName();
   Color defaultGridColor = UIManager.getColor("Table.gridColor");
   Color defaultForegroundColor = UIManager.getColor("TableHeader.foreground");
   Color defaultBackgroundColor = UIManager.getColor("TableHeader.background");
   Font defaultGridFont = UIManager.getFont("Table.font");
   Border defaultGridBorder = UIManager.getBorder("TableHeader.border");
   Color defaultSelectionForegroundColor = defaultForegroundColor.brighter();
   Color defaultSelectionBackgroundColor = defaultBackgroundColor;
   Color defaultFocusForegroundColor = defaultForegroundColor.brighter();
   Color defaultFocusBackgroundColor = defaultBackgroundColor.brighter();
   if (!installedHeader) {
     UIManager.getDefaults().put("GridHeader.gridColor", defaultGridColor);
     UIManager.getDefaults().put("GridHeader.foreground", defaultForegroundColor);
     UIManager.getDefaults().put("GridHeader.background", defaultBackgroundColor);
     UIManager.getDefaults()
         .put("GridHeader.selectionForegroundColor", defaultSelectionForegroundColor);
     UIManager.getDefaults()
         .put("GridHeader.selectionBackgroundColor", defaultSelectionBackgroundColor);
     UIManager.getDefaults().put("GridHeader.focusForegroundColor", defaultFocusForegroundColor);
     UIManager.getDefaults().put("GridHeader.focusBackgroundColor", defaultFocusBackgroundColor);
     UIManager.getDefaults().put("GridHeader.border", defaultGridBorder);
     UIManager.getDefaults().put("GridHeader.font", defaultGridFont);
   }
   Color foregroundColor = gridHeader.getForeground();
   Color backgroundColor = gridHeader.getBackground();
   Font gridFont = gridHeader.getFont();
   Border gridBorder = gridHeader.getBorder();
   Color gridColor = gridHeader.getGridColor();
   Color selectionForegroundColor = gridHeader.getSelectionForegroundColor();
   Color selectionBackgroundColor = gridHeader.getSelectionBackgroundColor();
   Color focusForegroundColor = gridHeader.getFocusForegroundColor();
   Color focusBackgroundColor = gridHeader.getFocusBackgroundColor();
   if (foregroundColor == null || foregroundColor instanceof UIResource)
     gridHeader.setForeground(defaultForegroundColor);
   if (backgroundColor == null || backgroundColor instanceof UIResource)
     gridHeader.setBackground(defaultBackgroundColor);
   if (gridColor == null || gridColor instanceof UIResource)
     gridHeader.setGridColor(defaultGridColor);
   if (gridFont == null || gridFont instanceof UIResource) gridHeader.setFont(defaultGridFont);
   if (gridBorder == null || gridBorder instanceof UIResource)
     gridHeader.setBorder(defaultGridBorder);
   if (selectionForegroundColor == null || selectionForegroundColor instanceof UIResource)
     gridHeader.setSelectionForegroundColor(defaultSelectionForegroundColor);
   if (selectionBackgroundColor == null || selectionBackgroundColor instanceof UIResource)
     gridHeader.setSelectionBackgroundColor(defaultSelectionBackgroundColor);
   if (focusForegroundColor == null || focusForegroundColor instanceof UIResource)
     gridHeader.setFocusForegroundColor(defaultFocusForegroundColor);
   if (focusBackgroundColor == null || focusBackgroundColor instanceof UIResource)
     gridHeader.setFocusBackgroundColor(defaultFocusBackgroundColor);
 }
Exemple #30
0
 @Override
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   if (table != null) {
     JTableHeader header = table.getTableHeader();
     if (header != null) {
       setForeground(header.getForeground());
       setBackground(header.getBackground());
       setFont(header.getFont());
       header.addMouseListener(this);
     }
   }
   setColumn(column);
   setBorder(UIManager.getBorder("TableHeader.cellBorder"));
   return this;
 }